commit
f6900b842a
17 changed files with 344 additions and 124 deletions
@ -0,0 +1,51 @@ |
||||
use 5.014; |
||||
use strict; |
||||
use warnings; |
||||
|
||||
# Verify that --ignore-modules works for modules that would be included with |
||||
# --include-dependencies in effect. |
||||
# See bug 394497 -- https://bugs.kde.org/show_bug.cgi?id=394497 |
||||
|
||||
use Test::More; |
||||
|
||||
use ksb::Application; |
||||
use ksb::Module; |
||||
|
||||
# Redefine ksb::Application::_resolveModuleDependencies to avoid requiring metadata |
||||
# module. |
||||
package ksb::Application { |
||||
no warnings 'redefine'; |
||||
|
||||
sub _resolveModuleDependencies { |
||||
my ($self, @modules) = @_; |
||||
# simulate effect of --include-dependencies, using ksb::Application's |
||||
# built-in module-name to ksb::Module resolver. |
||||
my $newModule = $self->{module_factory}->('setmod2'); |
||||
splice @modules, 1, 0, $newModule; |
||||
return @modules; |
||||
} |
||||
}; |
||||
|
||||
my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc --include-dependencies setmod1 setmod3); |
||||
|
||||
{ |
||||
my $app = ksb::Application->new(@args); |
||||
my @moduleList = @{$app->{modules}}; |
||||
|
||||
is (scalar @moduleList, 3, 'Right number of modules (include-dependencies)'); |
||||
is ($moduleList[0]->name(), 'setmod1', 'mod list[0] == setmod1'); |
||||
is ($moduleList[1]->name(), 'setmod2', 'mod list[1] == setmod2'); |
||||
is ($moduleList[2]->name(), 'setmod3', 'mod list[2] == setmod3'); |
||||
} |
||||
|
||||
{ |
||||
push @args, '--ignore-modules', 'setmod2'; |
||||
my $app = ksb::Application->new(@args); |
||||
my @moduleList = @{$app->{modules}}; |
||||
|
||||
is (scalar @moduleList, 2, 'Right number of modules (include-dependencies+ignore-modules)'); |
||||
is ($moduleList[0]->name(), 'setmod1', 'mod list[0] == setmod1'); |
||||
is ($moduleList[1]->name(), 'setmod3', 'mod list[1] == setmod3'); |
||||
} |
||||
|
||||
done_testing(); |
||||
@ -0,0 +1,78 @@ |
||||
use 5.014; |
||||
use strict; |
||||
use warnings; |
||||
|
||||
# Verify that a user-set CMAKE_PREFIX_PATH is not removed, even if we supply |
||||
# "magic" of our own |
||||
# See bug 395627 -- https://bugs.kde.org/show_bug.cgi?id=395627 |
||||
|
||||
my @savedCommand; |
||||
my $log_called = 0; |
||||
|
||||
# Redefine log_command to capture whether it was properly called. This is all |
||||
# very order-dependent, we need to load ksb::Util before kdesrc-build itself |
||||
# does to install the new subroutine before it's copied over into the other |
||||
# package symbol tables. |
||||
BEGIN { |
||||
use ksb::Util; |
||||
|
||||
no strict 'refs'; |
||||
no warnings 'redefine'; |
||||
|
||||
*ksb::Util::log_command = sub { |
||||
$log_called = 1; |
||||
|
||||
my ($module, $filename, $argRef, $optionsRef) = @_; |
||||
my @command = @{$argRef}; |
||||
@savedCommand = @command; |
||||
return 0; # success |
||||
}; |
||||
} |
||||
|
||||
use Test::More; |
||||
|
||||
use ksb::Application; |
||||
use ksb::Module; |
||||
|
||||
my @args = qw(--pretend --rc-file t/data/bug-395627/kdesrc-buildrc); |
||||
|
||||
{ |
||||
my $app = ksb::Application->new(@args); |
||||
my @moduleList = @{$app->{modules}}; |
||||
|
||||
is (scalar @moduleList, 6, 'Right number of modules'); |
||||
isa_ok ($moduleList[0]->buildSystem(), 'ksb::BuildSystem::KDE4'); |
||||
|
||||
my $result; |
||||
my @prefixes; |
||||
my $prefix; |
||||
|
||||
# This requires log_command to be overridden above |
||||
$result = $moduleList[0]->setupBuildSystem(); |
||||
is ($log_called, 1, 'Overridden log_command was called'); |
||||
ok ($result, 'Setup build system for auto-set prefix path'); |
||||
|
||||
# We should expect an auto-set -DCMAKE_PREFIX_PATH passed to cmake somewhere |
||||
($prefix) = grep { /-DCMAKE_PREFIX_PATH/ } @savedCommand; |
||||
is ($prefix, '-DCMAKE_PREFIX_PATH=/tmp/qt5', 'Prefix path set to custom Qt prefix'); |
||||
|
||||
$result = $moduleList[2]->setupBuildSystem(); |
||||
ok ($result, 'Setup build system for manual-set prefix path'); |
||||
|
||||
(@prefixes) = grep { /-DCMAKE_PREFIX_PATH/ } @savedCommand; |
||||
is (scalar @prefixes, 1, 'Only one set prefix path in manual mode'); |
||||
if (@prefixes) { |
||||
is ($prefixes[0], '-DCMAKE_PREFIX_PATH=FOO', 'Manual-set prefix path is as set by user'); |
||||
} |
||||
|
||||
$result = $moduleList[4]->setupBuildSystem(); |
||||
ok ($result, 'Setup build system for manual-set prefix path'); |
||||
|
||||
(@prefixes) = grep { /-DCMAKE_PREFIX_PATH/ } @savedCommand; |
||||
is (scalar @prefixes, 1, 'Only one set prefix path in manual mode'); |
||||
if (@prefixes) { |
||||
is ($prefixes[0], '-DCMAKE_PREFIX_PATH:PATH=BAR', 'Manual-set prefix path is as set by user'); |
||||
} |
||||
} |
||||
|
||||
done_testing(); |
||||
@ -0,0 +1,26 @@ |
||||
global |
||||
source-dir /tmp |
||||
qtdir /tmp/qt5 |
||||
git-repository-base fake git://localhost/git-set/ |
||||
override-build-system KDE # Use CMake everywhere w/out source probing |
||||
end global |
||||
|
||||
module-set test |
||||
repository fake |
||||
use-modules sample1 sample2 |
||||
# Should have auto-set CMAKE_PREFIX_PATH |
||||
end module-set |
||||
|
||||
module-set test2-set |
||||
repository fake |
||||
use-modules sample3 sample4 |
||||
cmake-options -DCMAKE_PREFIX_PATH=FOO |
||||
# Should not auto-set CMAKE_PREFIX_PATH since it's already set |
||||
end module-set |
||||
|
||||
module-set test3-set |
||||
repository fake |
||||
use-modules sample5 sample6 |
||||
cmake-options -DCMAKE_PREFIX_PATH:PATH=BAR |
||||
# Uses a slightly different syntax, should still be retained |
||||
end module-set |
||||
Loading…
Reference in new issue