In post_fail_hooks, try using serial line if no network
Sometimes we get a test failing because the SUT isn't connecting to the network for some reason. In this case we never get any logs, because `upload_logs` relies on being able to reacht at least the worker host system via the network. This attempts to detect when we can't ping the worker host, and in that case, send some info out over the serial line instead. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
2f2f0973ec
commit
0f5281f389
2 changed files with 40 additions and 1 deletions
|
@ -25,6 +25,31 @@ sub post_fail_hook {
|
|||
|
||||
save_screenshot;
|
||||
$self->root_console();
|
||||
# if we don't have tar or a network connection, we'll try and at
|
||||
# least send out *some* kinda info via the serial line
|
||||
my $hostip = $testapi::host_ip();
|
||||
if (script_run "ping -c 2 ${hostip}") {
|
||||
script_run 'printf "\n** X.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/X.log > /dev/ttyS0";
|
||||
script_run 'printf "\n** ANACONDA.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/anaconda.log > /dev/ttyS0";
|
||||
script_run 'printf "\n** PACKAGING.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/packaging.log > /dev/ttyS0";
|
||||
script_run 'printf "\n** STORAGE.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/storage.log > /dev/ttyS0";
|
||||
script_run 'printf "\n** SYSLOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/syslog > /dev/ttyS0";
|
||||
script_run 'printf "\n** PROGRAM.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/program.log > /dev/ttyS0";
|
||||
script_run 'printf "\n** DNF.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/dnf.log > /dev/ttyS0";
|
||||
script_run 'printf "\n** DNF.LIBREPO.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/dnf.librepo.log > /dev/ttyS0";
|
||||
script_run 'printf "\n** DNF.RPM.LOG **\n" > /dev/ttyS0';
|
||||
script_run "cat /tmp/dnf.rpm.log > /dev/ttyS0";
|
||||
return;
|
||||
}
|
||||
|
||||
upload_logs "/tmp/X.log", failok=>1;
|
||||
upload_logs "/tmp/anaconda.log", failok=>1;
|
||||
upload_logs "/tmp/packaging.log", failok=>1;
|
||||
|
|
|
@ -37,7 +37,21 @@ sub post_fail_hook {
|
|||
# rely on dnf always working (it fails in emergency mode, not sure
|
||||
# why), so try it, then check if we have tar
|
||||
script_run "dnf -y install tar", 180;
|
||||
assert_script_run "rpm -q tar";
|
||||
|
||||
# if we don't have tar or a network connection, we'll try and at
|
||||
# least send out *some* kinda info via the serial line
|
||||
my $hostip = $testapi::host_ip();
|
||||
if (script_run "rpm -q tar" || script_run "ping -c 2 ${hostip}") {
|
||||
script_run 'printf "\n** IP ADDR **\n" > /dev/ttyS0';
|
||||
script_run "ip addr > /dev/ttyS0 2>&1";
|
||||
script_run 'printf "\n** IP ROUTE **\n" > /dev/ttyS0';
|
||||
script_run "ip route > /dev/ttyS0 2>&1";
|
||||
script_run 'printf "\n** NETWORKMANAGER.SERVICE STATUS **\n" > /dev/ttyS0';
|
||||
script_run "systemctl --no-pager status NetworkManager.service > /dev/ttyS0 2>&1";
|
||||
script_run 'printf "\n** JOURNAL **\n" > /dev/ttyS0';
|
||||
script_run "journalctl -b --no-pager > /dev/ttyS0";
|
||||
return;
|
||||
}
|
||||
|
||||
# Note: script_run returns the exit code, so the logic looks weird.
|
||||
# We're testing that the directory exists and contains something.
|
||||
|
|
Loading…
Reference in a new issue