diff --git a/t/branch-time-based.t b/t/smoke/branch-time-based.t similarity index 100% rename from t/branch-time-based.t rename to t/smoke/branch-time-based.t diff --git a/t/bug-394497-ignore-dep-module.t b/t/smoke/bug-394497-ignore-dep-module.t similarity index 64% rename from t/bug-394497-ignore-dep-module.t rename to t/smoke/bug-394497-ignore-dep-module.t index f67d7f5..c55c019 100644 --- a/t/bug-394497-ignore-dep-module.t +++ b/t/smoke/bug-394497-ignore-dep-module.t @@ -1,51 +1,78 @@ 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. + sub _resolveModuleDependencyGraph { + my $self = shift; + my @modules = @_; + my $newModule = $self->{module_factory}->('setmod2'); - splice @modules, 1, 0, $newModule; - return @modules; + + my $graph = { + 'setmod1' => { + votes => { + 'setmod2' => 1, + 'setmod3' => 1 + }, + build => 1, + module => $modules[0] + }, + 'setmod2' => { + votes => { + 'setmod3' => 1 + }, + build => 1, + module => $newModule + }, + 'setmod3' => { + votes => {}, + build => 1, + module => $modules[1] + } + }; + + my $result = { + graph => $graph + }; + + return $result; } }; 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(); diff --git a/t/bug-395627-keep-cmake-prefix.t b/t/smoke/bug-395627-keep-cmake-prefix.t similarity index 100% rename from t/bug-395627-keep-cmake-prefix.t rename to t/smoke/bug-395627-keep-cmake-prefix.t diff --git a/t/bug-402509-masked-cmdline-opts.t b/t/smoke/bug-402509-masked-cmdline-opts.t similarity index 100% rename from t/bug-402509-masked-cmdline-opts.t rename to t/smoke/bug-402509-masked-cmdline-opts.t diff --git a/t/install-and-run.t b/t/smoke/install-and-run.t similarity index 100% rename from t/install-and-run.t rename to t/smoke/install-and-run.t diff --git a/t/os-release-basics.t b/t/smoke/os-release-basics.t similarity index 100% rename from t/os-release-basics.t rename to t/smoke/os-release-basics.t diff --git a/t/read-module-options.t b/t/smoke/read-module-options.t similarity index 85% rename from t/read-module-options.t rename to t/smoke/read-module-options.t index 60670c0..b821f25 100644 --- a/t/read-module-options.t +++ b/t/smoke/read-module-options.t @@ -1,82 +1,82 @@ use 5.014; use strict; use warnings; # Test basic option reading from rc-files use Test::More; package ksb::test { use Carp qw(confess cluck); use Test::More; my %inspectors = ( log_command => \&_inspect_log_command, ); our @CMD; our %OPTS; sub inspect { my $mod = shift; my $sub = $inspectors{$mod} or return; goto $sub; }; sub _inspect_log_command { my ($module, $filename, $argRef, $optionsRef) = @_; confess "No arg to module" unless $argRef; my @command = @{$argRef}; if (grep { $_ eq 'cmake' } @command) { @CMD = @command; %OPTS = %{$optionsRef}; } }; 1; }; use ksb::Application; use ksb::Util qw(trimmed); my $app = ksb::Application->new(qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc)); my @moduleList = @{$app->{modules}}; is(scalar @moduleList, 4, 'Right number of modules'); -is($moduleList[3]->name(), 'module2', 'Right module name'); +is($moduleList[0]->name(), 'module2', 'Right module name'); -my $scm = $moduleList[3]->scm(); +my $scm = $moduleList[0]->scm(); isa_ok($scm, 'ksb::Updater::Git'); my ($branch, $type) = $scm->_determinePreferredCheckoutSource(); is($branch, 'refs/tags/fake-tag5', 'Right tag name'); is($type, 'tag', 'Result came back as a tag'); -is($moduleList[1]->name(), 'setmod2', 'Right module name from module-set'); -($branch, $type) = $moduleList[1]->scm()->_determinePreferredCheckoutSource(); +is($moduleList[2]->name(), 'setmod2', 'Right module name from module-set'); +($branch, $type) = $moduleList[2]->scm()->_determinePreferredCheckoutSource(); is($branch, 'refs/tags/tag-setmod2', 'Right tag name (options block)'); is($type, 'tag', 'options block came back as tag'); # # Test some of the option parsing indirectly by seeing how the value is input # into build system. # # Override auto-detection since no source is downloaded -$moduleList[1]->setOption('override-build-system', 'kde'); +$moduleList[2]->setOption('override-build-system', 'kde'); # Should do nothing in --pretend -ok($moduleList[1]->setupBuildSystem(), 'setup fake build system'); +ok($moduleList[2]->setupBuildSystem(), 'setup fake build system'); ok(@ksb::test::CMD, 'log_command cmake was called'); is($ksb::test::CMD[2], '-DCMAKE_BUILD_TYPE=a b', 'CMake options can be quoted'); is($ksb::test::CMD[3], 'bar=c', 'CMake option quoting does not eat all options'); is($ksb::test::CMD[-1], "-DCMAKE_INSTALL_PREFIX=$ENV{HOME}/kde", 'Prefix is passed to cmake'); # See https://phabricator.kde.org/D18165 is($moduleList[1]->getOption('cxxflags'), '', 'empty cxxflags renders with no whitespace in module'); done_testing(); diff --git a/t/set-module-option-value.t b/t/smoke/set-module-option-value.t similarity index 78% rename from t/set-module-option-value.t rename to t/smoke/set-module-option-value.t index 36c837a..3bc5bf6 100644 --- a/t/set-module-option-value.t +++ b/t/smoke/set-module-option-value.t @@ -1,33 +1,33 @@ use 5.014; use strict; use warnings; # Test use of --set-module-option-value use Test::More; use ksb::Application; my $app = ksb::Application->new(qw( --pretend --rc-file t/data/sample-rc/kdesrc-buildrc --set-module-option-value), 'module2,tag,fake-tag10', '--set-module-option-value', 'setmod2,tag,tag-setmod10'); my @moduleList = @{$app->{modules}}; is(scalar @moduleList, 4, 'Right number of modules'); -my $scm = $moduleList[3]->scm(); +my $scm = $moduleList[0]->scm(); my ($branch, $type) = $scm->_determinePreferredCheckoutSource(); is($branch, 'refs/tags/fake-tag10', 'Right tag name'); is($type, 'tag', 'Result came back as a tag'); -($branch, $type) = $moduleList[1]->scm()->_determinePreferredCheckoutSource(); +($branch, $type) = $moduleList[2]->scm()->_determinePreferredCheckoutSource(); is($branch, 'refs/tags/tag-setmod10', 'Right tag name (options block from cmdline)'); is($type, 'tag', 'cmdline options block came back as tag'); -ok(!$moduleList[1]->isKDEProject(), 'setmod2 is *not* a "KDE" project'); -is($moduleList[1]->fullProjectPath(), 'setmod2', 'fullProjectPath on non-KDE modules returns name'); +ok(!$moduleList[2]->isKDEProject(), 'setmod2 is *not* a "KDE" project'); +is($moduleList[2]->fullProjectPath(), 'setmod2', 'fullProjectPath on non-KDE modules returns name'); done_testing(); diff --git a/t/submodule-functions.t b/t/smoke/submodule-functions.t similarity index 100% rename from t/submodule-functions.t rename to t/smoke/submodule-functions.t