Skip to content

Commit

Permalink
use null backend 4real
Browse files Browse the repository at this point in the history
  • Loading branch information
josegomezr committed Dec 22, 2023
1 parent a3847c7 commit 5fb18aa
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions t/14-isotovideo.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ use OpenQA::Isotovideo::Utils qw(checkout_wheels handle_generated_assets load_te
use OpenQA::Isotovideo::CommandHandler;

# Each full isotovideo invocation (not using _exit_after_schedule=1)
# is expected to take maximum ~6 seconds per run.
# is expected to take maximum ~6.67 seconds per run.
#
# There are 5 invocations, that approxs to 30 seconds.
# There are 3 invocations, that approxs to ~20 seconds.
#
# Update this number if a new test involving a full isotovideo invocation is
# added.
use OpenQA::Test::TimeLimit '30';
use OpenQA::Test::TimeLimit '20';

my $dir = tempdir("/tmp/$FindBin::Script-XXXX");
my $toplevel_dir = abs_path(dirname(__FILE__) . '/..');
Expand Down Expand Up @@ -247,48 +247,61 @@ subtest 'productdir variable relative/absolute' => sub {
};

subtest 'exit status from test results: no test scheduled' => sub {
# full isotovideo invocation
# dummy isotovideo invocation
chdir($pool_dir);
path(bmwqemu::STATE_FILE)->remove if -e bmwqemu::STATE_FILE;
path('vars.json')->remove if -e 'vars.json';
my $module = 'tests/failing_module';
# TODO: backend/baseclass.pm does not respect backend when reading
# the serial console.
path('serial0')->touch();
my $module_basename = 'failing_module';
my $module = "tests/$module_basename";
my $log = combined_from { isotovideo(
default_opts => '--exit-status-from-test-results backend=null',
opts => "casedir=$data_dir/empty_test_distribution qemu_no_kvm=1 arch=i386 backend=qemu qemu=i386 novideo=1", exit_code => 100) };
opts => "casedir=$data_dir/tests schedule=$module", exit_code => 101) };

like $log, qr/scheduling $module_basename $module\.pm/, 'module scheduled';
like $log, qr/Test result \[testresults\/result\-$module_basename\.json\] fail/, 'module test result parsed';
};

subtest 'exit status from test results: tests scheduled' => sub {
# full isotovideo invocation
# dummy isotovideo invocation
chdir($pool_dir);
path(bmwqemu::STATE_FILE)->remove if -e bmwqemu::STATE_FILE;
path('vars.json')->remove if -e 'vars.json';
# TODO: backend/baseclass.pm does not respect backend when reading
# the serial console.
path('serial0')->touch();
my $module_basename = 'failing_module';
my $module = "tests/$module_basename";
my $log = combined_from { isotovideo(
default_opts => '--exit-status-from-test-results backend=null',
opts => "casedir=$data_dir/tests schedule=$module qemu_no_kvm=1 arch=i386 backend=qemu qemu=i386 novideo=1", exit_code => 101) };
opts => "casedir=$data_dir/tests schedule=$module", exit_code => 101) };

like $log, qr/scheduling $module_basename $module\.pm/, 'module scheduled';
like $log, qr/Test result \[testresults\/result\-$module_basename\.json\] fail/, 'module test result parsed';
};

subtest 'exit status from test results: softfailed test' => sub {
# full isotovideo invocation
# dummy isotovideo invocation
chdir($pool_dir);
path(bmwqemu::STATE_FILE)->remove if -e bmwqemu::STATE_FILE;
path('vars.json')->remove if -e 'vars.json';
# TODO: backend/baseclass.pm does not respect backend when reading
# the serial console.
path('serial0')->touch();
my $module_basename = 'soft_failed_test';
my $module = "tests/$module_basename";
my $log = combined_from { isotovideo(
default_opts => '--exit-status-from-test-results backend=null',
opts => "casedir=$data_dir/tests schedule=$module qemu_no_kvm=1 arch=i386 backend=qemu qemu=i386 novideo=1", exit_code => 0) };
opts => "casedir=$data_dir/tests schedule=$module", exit_code => 0) };

like $log, qr/scheduling $module_basename $module\.pm/, 'module scheduled';
like $log, qr/Test result \[testresults\/result\-$module_basename\.json\] softfail/, 'module test result parsed';
};

subtest 'upload assets on demand even in failed jobs' => sub {
# full isotovideo invocation
# qemu isotovideo invocation
chdir($pool_dir);
path(bmwqemu::STATE_FILE)->remove if -e bmwqemu::STATE_FILE;
path('vars.json')->remove if -e 'vars.json';
Expand All @@ -302,7 +315,7 @@ subtest 'upload assets on demand even in failed jobs' => sub {
};

subtest 'load test success when casedir and productdir are relative path' => sub {
# full isotovideo invocation
# qemu isotovideo invocation
chdir($pool_dir);
path(bmwqemu::STATE_FILE)->remove if -e bmwqemu::STATE_FILE;
path('vars.json')->remove if -e 'vars.json';
Expand Down Expand Up @@ -407,6 +420,7 @@ subtest 'publish assets' => sub {
done_testing();

END {
rmtree "./serial0";
rmtree "$Bin/data/tests/product";
rmtree "$data_dir/wheels_dir/writer";
rmtree "$pool_dir/writer";
Expand Down

0 comments on commit 5fb18aa

Please sign in to comment.