From 23bae35d823e9f3e42e9dbf72df9ddefd89923de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Fri, 10 Jan 2020 15:39:02 +0100 Subject: [PATCH] Create a test to test unmount errors during reboot (aka Reboot Testcase) --- templates | 103 +++++++++++++++++++++++++++++++++++ tests/base_reboot_unmount.pm | 42 ++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 tests/base_reboot_unmount.pm diff --git a/templates b/templates index d0cc58fb..a67cf182 100755 --- a/templates +++ b/templates @@ -249,6 +249,50 @@ }, test_suite => { name => "base_selinux" }, }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "KDE-live-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Workstation-live-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Silverblue-dvd_ostree-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, { machine => { name => "64bit" }, prio => 40, @@ -1892,6 +1936,18 @@ }, test_suite => { name => "base_services_start" }, }, + { + group_name => "Fedora PowerPC", + machine => { name => "ppc64le" }, + prio => 20, + product => { + arch => "ppc64le", + distri => "fedora", + flavor => "Workstation-live-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, { group_name => "Fedora PowerPC", machine => { name => "ppc64le" }, @@ -2084,6 +2140,18 @@ }, test_suite => { name => "base_services_start" }, }, + { + group_name => "Fedora PowerPC", + machine => { name => "ppc64le" }, + prio => 20, + product => { + arch => "ppc64le", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, { group_name => "Fedora PowerPC", machine => { name => "ppc64le" }, @@ -3080,6 +3148,18 @@ }, test_suite => { name => "base_services_start" }, }, + { + group_name => "Fedora PowerPC", + machine => { name => "ppc64le" }, + prio => 20, + product => { + arch => "ppc64le", + distri => "fedora", + flavor => "Silverblue-dvd_ostree-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, { group_name => "Fedora PowerPC", machine => { name => "ppc64le" }, @@ -3200,6 +3280,18 @@ }, test_suite => { name => "base_services_start" }, }, + { + group_name => "Fedora AArch64", + machine => { name => "aarch64" }, + prio => 40, + product => { + arch => "aarch64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "base_reboot_unmount" }, + }, { group_name => "Fedora AArch64", machine => { name => "aarch64" }, @@ -5079,6 +5171,17 @@ { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, ], }, + { + name => "base_reboot_unmount", + settings => [ + { key => "POSTINSTALL", value => "base_reboot_unmount" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, + { key => "START_AFTER_TEST", value => "install_default_upload" }, + { key => "BOOTFROM", value => "c" }, + { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, + ], + }, { name => "modularity_tests", settings => [ diff --git a/tests/base_reboot_unmount.pm b/tests/base_reboot_unmount.pm new file mode 100644 index 00000000..e4af2b9a --- /dev/null +++ b/tests/base_reboot_unmount.pm @@ -0,0 +1,42 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + + +sub test_routine { + my $self = shift; + # Save the result of the error tracking grep operation on journalctl output. + script_run 'journalctl -b | grep -E "dirty bit|data may be corrupt|recovery|unmounted|recovering" > errors.txt'; + # Count the number of errors. + my $errors_count = script_run "cat errors.txt | wc -l"; + # Die, if errors have been found. + if ($errors_count != 0) { + die "Unmount errors have been found in journalctl."; + } + +} + +sub run { + # Seems that the first login is handled by the _console_wait_login(), so + # we can start with testing right away. + + # Run test for the first time + test_routine(); + # Reboot the system. + type_safely "reboot\n"; + # This time, we will need to login manually. + boot_to_login_screen; + console_login; + + # Run the tests for the second time. + test_routine(); +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: