Commit 4a6d82fe authored by Michael Pyne's avatar Michael Pyne

mojo: Fix testcases again.

The backend/client split this is all leading towards now makes it more
complicated to bring up the application. But then, that also should make
it possible to do better unit testing on each phase of start (reading
cmdline options, setting build context, creating the build plan, etc.).
parent 14286bf3
Pipeline #7301 passed with stage
in 1 minute and 33 seconds
......@@ -86,6 +86,8 @@ sub new
sub setModulesToProcess
{
my ($self, $workLoad) = @_;
croak_internal("Expecting workload object!")
unless ref $workLoad eq 'HASH';
$self->{modules} = $workLoad->{selectedModules};
$self->{workLoad} = $workLoad;
......
......@@ -10,8 +10,10 @@ use ksb::Application;
my @args = qw(--pretend --rc-file t/data/branch-time-based/kdesrc-buildrc);
my $app = ksb::Application->new;
my $workload = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors($workload);
my @selectors = $app->establishContext(@args);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is(scalar @moduleList, 3, 'Right number of modules');
......
......@@ -59,7 +59,9 @@ my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc --include-depe
{
my $app = ksb::Application->new;
my @selectors = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors(@selectors);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is (scalar @moduleList, 3, 'Right number of modules (include-dependencies)');
is ($moduleList[0]->name(), 'setmod1', 'mod list[0] == setmod1');
......@@ -73,7 +75,9 @@ my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc --include-depe
my $app = ksb::Application->new;
$ksb::Application::IGNORE_MOD2 = 1;
my @selectors = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors(@selectors);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
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');
......
......@@ -39,7 +39,9 @@ my @args = qw(--pretend --rc-file t/data/bug-395627/kdesrc-buildrc);
{
my $app = ksb::Application->new(@args);
my @selectors = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors(@selectors);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is (scalar @moduleList, 6, 'Right number of modules');
isa_ok ($moduleList[0]->buildSystem(), 'ksb::BuildSystem::KDE4');
......
......@@ -21,7 +21,9 @@ my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc --stop-on-fail
{
my $app = ksb::Application->new(@args)->setHeadless;
my @selectors = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors(@selectors);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is (scalar @moduleList, 1, 'Right number of modules (just one)');
is ($moduleList[0]->name(), 'setmod3', 'mod list[0] == setmod3');
......@@ -32,7 +34,9 @@ $args[-2] = '--disable-snapshots';
{
my $app = ksb::Application->new(@args)->setHeadless;
my @selectors = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors(@selectors);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is (scalar @moduleList, 1, 'Right number of modules (just one)');
is ($moduleList[0]->name(), 'setmod3', 'mod list[0] == setmod3');
......
......@@ -19,7 +19,7 @@ package ksb::Application {
my $self = shift;
my @modules = @_;
my $newModule = $self->{module_factory}->('setmod2');
my $newModule = ksb::Module->new($self->{context}, 'setmod2');
my $graph = {
'setmod1' => {
......@@ -55,8 +55,11 @@ package ksb::Application {
my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc-with-deps --no-include-dependencies setmod1 setmod3);
{
my $app = ksb::Application->new(@args);
my @moduleList = @{$app->{modules}};
my $app = ksb::Application->new;
my @selectors = $app->establishContext(@args);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is (scalar @moduleList, 2, 'Right number of modules (include-dependencies)');
is ($moduleList[0]->name(), 'setmod1', 'mod list[0] == setmod1');
......@@ -65,8 +68,12 @@ my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc-with-deps --no
{
push @args, '--ignore-modules', 'setmod2';
my $app = ksb::Application->new(@args);
my @moduleList = @{$app->{modules}};
my $app = ksb::Application->new;
my @selectors = $app->establishContext(@args);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
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');
......
......@@ -43,7 +43,9 @@ use ksb::Util qw(trimmed);
my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc);
my $app = ksb::Application->new;
my @selectors = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors(@selectors);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is(scalar @moduleList, 4, 'Right number of modules');
is($moduleList[0]->name(), 'module2', 'Right module name');
......
......@@ -13,7 +13,9 @@ my @args = (qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc
'--set-module-option-value', 'setmod2,tag,tag-setmod10');
my $app = ksb::Application->new;
my @selectors = $app->establishContext(@args);
my @moduleList = $app->modulesFromSelectors(@selectors);
my $workload = $app->modulesFromSelectors(@selectors);
$app->setModulesToProcess($workload);
my @moduleList = $app->modules();
is(scalar @moduleList, 4, 'Right number of modules');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment