1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-25 15:23:08 +00:00

Simplify the services test fix

I forgot `script_run` actually returns the exit code. That makes
it easier.
This commit is contained in:
Adam Williamson 2017-01-11 16:03:09 -08:00
parent 641b30ac09
commit 460a6e5439

View File

@ -9,14 +9,15 @@ sub run {
# dump the systemctl output # dump the systemctl output
assert_script_run "systemctl --failed | tee /tmp/failed.txt"; assert_script_run "systemctl --failed | tee /tmp/failed.txt";
# if we have 0 failed services, we're good # if we have 0 failed services, we're good
eval "assert_script_run 'grep \"0 loaded units\" /tmp/failed.txt';"; my $ret = script_run "grep '0 loaded units' /tmp/failed.txt";
return unless $@; return if $ret == 0;
# if only mcelog failed, that's a soft fail # if only mcelog failed, that's a soft fail
eval "assert_script_run 'grep \"1 loaded units\" /tmp/failed.txt';"; $ret = script_run "grep '1 loaded units' /tmp/failed.txt";
if ($@) { if ($ret != 0) {
die "More than one services failed to start"; die "More than one services failed to start";
} }
else { else {
# fail if it's something other than mcelog
assert_script_run "systemctl is-failed mcelog.service"; assert_script_run "systemctl is-failed mcelog.service";
record_soft_failure; record_soft_failure;
} }