diff --git a/tests/yam/agama/agama.pm b/tests/yam/agama/agama.pm index 64586205c2b0..61605a3a83db 100644 --- a/tests/yam/agama/agama.pm +++ b/tests/yam/agama/agama.pm @@ -8,12 +8,17 @@ 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 { @@ -21,12 +26,23 @@ sub run { 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(); }