Skip to content

Commit

Permalink
Enable TAP for agama testing results
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredi committed Jan 16, 2025
1 parent 2568d56 commit 6aa4935
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/yam/agama/agama.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,41 @@
use base Yam::Agama::agama_base;
use strict;
use warnings;

use Carp qw(croak);
use testapi qw(
diag
get_required_var
script_run
script_output
assert_script_run
record_info
record_soft_failure
parse_extra_log
upload_logs
);

sub run {
my $self = shift;
my $test = get_required_var('AGAMA_TEST');
my $test_options = get_required_var('AGAMA_TEST_OPTIONS');
my $reboot_page = $testapi::distri->get_reboot();
my $spec = "$test.spec.txt";
my $tap = "$test.tap.txt";
my $reporters = "--test-reporter=spec --test-reporter=tap --test-reporter-destination=/tmp/$spec --test-reporter-destination=/tmp/$tap";
my $node_cmd = "node --enable-source-maps $reporters /usr/share/agama/system-tests/${test}.js $test_options";
record_info("node command", $node_cmd);

script_run("dmesg --console-off");
assert_script_run("node --enable-source-maps /usr/share/agama/system-tests/" . $test . ".js " .
$test_options, timeout => 2400);
my $ret = script_run($node_cmd, timeout => 2400);
script_run("dmesg --console-on");

# see https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/Parser/Format/TAP.pm#L36
assert_script_run("sed -i 's/TAP version 13/$tap ../' /tmp/$tap");
parse_extra_log(TAP => "/tmp/$tap");
upload_logs("/tmp/$spec", failok => 1);
my $content = script_output("cat /tmp/$spec /tmp/$tap");
diag($content);
croak("command \n'$node_cmd'\n failed") unless $ret == 0;
$self->upload_agama_logs();
$reboot_page->reboot();
}
Expand Down

0 comments on commit 6aa4935

Please sign in to comment.