1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-25 03:33:08 +00:00

Post fail: handle landing in dracut shell, upload rdsosreport

If a test fails to the dracut shell, we currently don't do
anything useful. This should recognize when that happens, and
upload rdsosreport.txt.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-01-16 11:24:06 -08:00
parent e718f76c19
commit 536f699013
4 changed files with 53 additions and 0 deletions

View File

@ -25,10 +25,21 @@ sub post_fail_hook {
save_screenshot;
$self->root_console();
# if we're in dracut, do things different
my $dracut = 0;
if (check_screen "root_console_dracut", 0) {
$dracut = 1;
script_run "dhclient";
}
# 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}") {
if ($dracut) {
script_run 'printf "\n** RDSOSREPORT **\n" > /dev/' . $serialdev;
script_run "cat /run/initramfs/rdsosreport.txt > /dev/${serialdev}";
return;
}
script_run 'printf "\n** X.LOG **\n" > /dev/' . $serialdev;
script_run "cat /tmp/X.log > /dev/${serialdev}";
script_run 'printf "\n** ANACONDA.LOG **\n" > /dev/' . $serialdev;
@ -52,6 +63,12 @@ sub post_fail_hook {
return;
}
if ($dracut) {
upload_logs "/run/initramfs/rdsosreport.txt", failok=>1;
# that's all that's really useful, so...
return;
}
upload_logs "/tmp/X.log", failok=>1;
upload_logs "/tmp/anaconda.log", failok=>1;
upload_logs "/tmp/packaging.log", failok=>1;

View File

@ -37,6 +37,13 @@ sub post_fail_hook {
console_loadkeys_us;
}
# if we're in dracut, do things different
my $dracut = 0;
if (check_screen "root_console_dracut", 0) {
$dracut = 1;
script_run "dhclient";
}
# We can't rely on tar being in minimal installs, but we also can't
# rely on dnf always working (it fails in emergency mode, not sure
# why), so try it, then check if we have tar
@ -46,6 +53,11 @@ sub post_fail_hook {
# 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}")) {
if ($dracut) {
script_run 'printf "\n** RDSOSREPORT **\n" > /dev/' . $serialdev;
script_run "cat /run/initramfs/rdsosreport.txt > /dev/${serialdev}";
return;
}
script_run 'printf "\n** IP ADDR **\n" > /dev/' . $serialdev;
script_run "ip addr > /dev/${serialdev} 2>&1";
script_run 'printf "\n** IP ROUTE **\n" > /dev/' . $serialdev;
@ -57,6 +69,12 @@ sub post_fail_hook {
return;
}
if ($dracut) {
upload_logs "/run/initramfs/rdsosreport.txt", failok=>1;
# that's all that's really useful, so...
return;
}
# Note: script_run returns the exit code, so the logic looks weird.
# We're testing that the directory exists and contains something.
unless (script_run 'test -n "$(ls -A /var/tmp/abrt)" && cd /var/tmp/abrt && tar czvf tmpabrt.tar.gz *') {

View File

@ -0,0 +1,18 @@
{
"area": [
{
"type": "match",
"xpos": 1,
"height": 14,
"width": 72,
"ypos": 753
}
],
"properties": [],
"tags": [
"root_logged_in",
"root_console",
"root_console_dracut",
"ENV-DISTRI-fedora"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB