diff --git a/lib/fedoralog.pm b/lib/fedoralog.pm new file mode 100644 index 00000000..b586b356 --- /dev/null +++ b/lib/fedoralog.pm @@ -0,0 +1,33 @@ +package fedoralog; +use base 'basetest'; + +use testapi; + +sub post_fail_hook() { + my $self = shift; + my $password = get_var("ROOT_PASSWORD", "weakpassword"); + + send_key "ctrl-alt-f2"; + assert_screen "text_console_login", 20; + type_string "root"; + send_key "ret"; + assert_screen "console_password_required", 10; + type_string $password; + send_key "ret"; + + assert_screen "root_logged_in", 10; + + # Upload all ABRT logs + type_string "cd /var/tmp/abrt && tar czvf abrt.tar.gz *"; + send_key "ret"; + upload_logs "/var/tmp/abrt/abrt.tar.gz"; + + # Upload /var/log + type_string "tar czvf /tmp/var_log.tar.gz /var/log"; + send_key "ret"; + upload_logs "/tmp/var_log.tar.gz"; +} + +1; + +# vim: set sw=4 et: diff --git a/main.pm b/main.pm index 7ed4f9ec..112ceaed 100644 --- a/main.pm +++ b/main.pm @@ -55,6 +55,12 @@ if (get_var("ENTRYPOINT")) { autotest::loadtest get_var('CASEDIR')."/tests/".get_var("ENTRYPOINT").".pm"; } +elsif (get_var("UPGRADE")) +{ + autotest::loadtest get_var('CASEDIR')."/tests/upgrade_preinstall_".get_var("UPGRADE").".pm"; + autotest::loadtest get_var('CASEDIR')."/tests/upgrade_run_".get_var("UPGRADE").".pm"; + autotest::loadtest get_var('CASEDIR')."/tests/upgrade_postinstall_".get_var("UPGRADE").".pm"; +} else { autotest::loadtest get_var('CASEDIR')."/tests/_boot_to_anaconda.pm"; diff --git a/needles/console_command_success.json b/needles/console_command_success.json index 99976f01..b6681779 100644 --- a/needles/console_command_success.json +++ b/needles/console_command_success.json @@ -7,11 +7,12 @@ ], "area": [ { + "width": 1018, + "height": 13, "xpos": 0, "ypos": 0, - "width": 204, - "height": 13, "type": "match" } - ] + ], + "properties": [] } \ No newline at end of file diff --git a/needles/console_command_success2.json b/needles/console_command_success2.json index 2c3f7960..2584a77a 100644 --- a/needles/console_command_success2.json +++ b/needles/console_command_success2.json @@ -1,18 +1,18 @@ { - "area": [ - { - "height": 13, - "width": 204, - "ypos": 16, - "type": "match", - "xpos": 0 - } - ], "tags": [ "console_command_success", "ENV-DISTRI-fedora", "ENV-INSTLANG-en_US", "ENV-FLAVOR-server" ], + "area": [ + { + "type": "match", + "width": 1012, + "height": 13, + "xpos": 0, + "ypos": 16 + } + ], "properties": [] } \ No newline at end of file diff --git a/needles/console_f22_installed.json b/needles/console_f22_installed.json new file mode 100644 index 00000000..c42b9ba5 --- /dev/null +++ b/needles/console_f22_installed.json @@ -0,0 +1,18 @@ +{ + "properties": [], + "area": [ + { + "xpos": 0, + "ypos": 129, + "width": 238, + "height": 12, + "type": "match" + } + ], + "tags": [ + "console_f22_installed", + "ENV-DISTRI-fedora", + "ENV-INSTLANG-en_US", + "ENV-FLAVOR-develop" + ] +} \ No newline at end of file diff --git a/needles/console_f22_installed.png b/needles/console_f22_installed.png new file mode 100644 index 00000000..2442ad01 Binary files /dev/null and b/needles/console_f22_installed.png differ diff --git a/needles/console_password_required2.json b/needles/console_password_required2.json new file mode 100644 index 00000000..322a8875 --- /dev/null +++ b/needles/console_password_required2.json @@ -0,0 +1,18 @@ +{ + "properties": [], + "area": [ + { + "xpos": 1, + "height": 17, + "width": 77, + "ypos": 79, + "type": "match" + } + ], + "tags": [ + "console_password_required", + "ENV-DISTRI-fedora", + "ENV-INSTLANG-en_US", + "ENV-FLAVOR-server" + ] +} \ No newline at end of file diff --git a/needles/console_password_required2.png b/needles/console_password_required2.png new file mode 100644 index 00000000..496918b1 Binary files /dev/null and b/needles/console_password_required2.png differ diff --git a/needles/grub_fedup.json b/needles/grub_fedup.json new file mode 100644 index 00000000..ba85f34a --- /dev/null +++ b/needles/grub_fedup.json @@ -0,0 +1,18 @@ +{ + "properties": [], + "area": [ + { + "xpos": 119, + "ypos": 51, + "width": 61, + "height": 10, + "type": "match" + } + ], + "tags": [ + "grub_fedup", + "ENV-DISTRI-fedora", + "ENV-INSTLANG-en_US", + "ENV-FLAVOR-server" + ] +} \ No newline at end of file diff --git a/needles/grub_fedup.png b/needles/grub_fedup.png new file mode 100644 index 00000000..e5d87a2a Binary files /dev/null and b/needles/grub_fedup.png differ diff --git a/needles/root_logged_in.json b/needles/root_logged_in.json index 901d58a5..ba1e828b 100644 --- a/needles/root_logged_in.json +++ b/needles/root_logged_in.json @@ -1,17 +1,18 @@ { + "properties": [], + "area": [ + { + "width": 156, + "xpos": 0, + "height": 19, + "ypos": 113, + "type": "match" + } + ], "tags": [ "root_logged_in", "ENV-DISTRI-fedora", "ENV-INSTLANG-en_US", "ENV-FLAVOR-server" - ], - "area": [ - { - "xpos": 0, - "ypos": 126, - "width": 156, - "height": 22, - "type": "match" - } ] } \ No newline at end of file diff --git a/needles/root_logged_in.png b/needles/root_logged_in.png index b26ce344..c848bdc7 100644 Binary files a/needles/root_logged_in.png and b/needles/root_logged_in.png differ diff --git a/needles/tmp_failed_proc.json b/needles/tmp_failed_proc.json new file mode 100644 index 00000000..d2c0b79a --- /dev/null +++ b/needles/tmp_failed_proc.json @@ -0,0 +1,18 @@ +{ + "tags": [ + "tmp_failed_proc", + "ENV-DISTRI-fedora", + "ENV-INSTLANG-en_US", + "ENV-FLAVOR-develop" + ], + "properties": [], + "area": [ + { + "xpos": 71, + "ypos": 338, + "width": 251, + "height": 11, + "type": "match" + } + ] +} diff --git a/needles/tmp_failed_proc.png b/needles/tmp_failed_proc.png new file mode 100644 index 00000000..662a5bd2 Binary files /dev/null and b/needles/tmp_failed_proc.png differ diff --git a/templates b/templates index d717028c..e3812e79 100755 --- a/templates +++ b/templates @@ -176,6 +176,16 @@ }, test_suite => { name => "server_kickstart_hdd" }, }, + { + machine => { name => "64bit" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "fedup_minimal" }, + }, ], Machines => [ { @@ -369,7 +379,7 @@ }, { name => "server_kickstart_hdd", - prio => 13, + prio => 14, settings => [ { key => "KICKSTART", value => "1" }, { key => "GRUB", value => "inst.ks=hd:vdb1:/root-user-crypted-net.ks" }, @@ -381,5 +391,16 @@ ], variables => "", }, + { + name => "fedup_minimal", + prio => 15, + settings => [ + { key => "ROOT_PASSWORD", value => "weakpassword" }, + { key => "BOOTFROM", value => "c" }, + { key => "HDD_1", value => "disk_f21.img" }, + { key => "UPGRADE", value => "minimal" }, + ], + variables => "", + }, ], } diff --git a/tests/upgrade_postinstall_minimal.pm b/tests/upgrade_postinstall_minimal.pm new file mode 100644 index 00000000..1f1b480d --- /dev/null +++ b/tests/upgrade_postinstall_minimal.pm @@ -0,0 +1,37 @@ +use base "fedoralog"; +use strict; +use testapi; + +sub boot_and_login { + wait_still_screen 10; + + my $password = get_var("ROOT_PASSWORD", "weakpassword"); + + send_key "ctrl-alt-f3"; + assert_screen "text_console_login", 20; + type_string "root"; + send_key "ret"; + assert_screen "console_password_required", 10; + type_string $password; + send_key "ret"; + assert_screen "root_logged_in", 10; +} + +sub run { + boot_and_login(); + + assert_screen "console_f22_installed"; +} + + +sub test_flags { + # without anything - rollback to 'lastgood' snapshot if failed + # 'fatal' - whole test suite is in danger if this fails + # 'milestone' - after this test succeeds, update 'lastgood' + # 'important' - if this fails, set the overall state to 'fail' + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/upgrade_preinstall_minimal.pm b/tests/upgrade_preinstall_minimal.pm new file mode 100644 index 00000000..d5a961e9 --- /dev/null +++ b/tests/upgrade_preinstall_minimal.pm @@ -0,0 +1,50 @@ +use base "fedoralog"; +use strict; +use testapi; + +sub boot_and_login { + wait_still_screen 10; + + my $password = get_var("ROOT_PASSWORD", "weakpassword"); + + send_key "ctrl-alt-f3"; + assert_screen "text_console_login", 20; + type_string "root"; + send_key "ret"; + assert_screen "console_password_required", 10; + type_string $password; + send_key "ret"; + assert_screen "root_logged_in", 10; +} + +sub run { + boot_and_login(); + + type_string 'yum -y update; echo $?'; + send_key "ret"; + + assert_screen "console_command_success", 1800; + + type_string "reboot"; + send_key "ret"; + + boot_and_login(); + + type_string 'yum -y install fedup; echo $?'; + send_key "ret"; + + assert_screen "console_command_success", 1800; +} + + +sub test_flags { + # without anything - rollback to 'lastgood' snapshot if failed + # 'fatal' - whole test suite is in danger if this fails + # 'milestone' - after this test succeeds, update 'lastgood' + # 'important' - if this fails, set the overall state to 'fail' + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/upgrade_run_minimal.pm b/tests/upgrade_run_minimal.pm new file mode 100644 index 00000000..5913c73d --- /dev/null +++ b/tests/upgrade_run_minimal.pm @@ -0,0 +1,53 @@ +use base "fedoralog"; +use strict; +use testapi; + +sub run { + my $fedup_url; + my $to_version; + # FIXME: this is just a workaround, see https://phab.qadevel.cloud.fedoraproject.org/T478 + if (get_var("BUILD") =~ /^(\d+)_Final_(.*)$/) { + $fedup_url = "https://dl.fedoraproject.org/pub/alt/stage/".$1."_".$2."/Server/".get_var("ARCH")."/os"; + $to_version = $1; + } else { + $fedup_url = "https://dl.fedoraproject.org/pub/alt/stage/".get_var("BUILD")."/Server/".get_var("ARCH")."/os"; + get_var("BUILD") =~ /^(\d+)/; + $to_version = $1; + } + + type_string "fedup --network ".$to_version." --instrepo ".$fedup_url; + send_key "ret"; + + wait_still_screen 30, 6000; # TODO: shorter timeout, longer stillscreen? + + upload_logs "/var/log/fedup.log"; + + type_string "reboot"; + send_key "ret"; + + assert_screen "grub_fedup", 30; + send_key "ret"; + + my $counter = 0; + + while (!check_screen ("text_console_login", 10) && $counter < 180) { + if (check_screen "tmp_failed_proc", 1) { + send_key "ctrl-alt-delete"; + } + $counter++; + } + assert_screen "text_console_login", 10; +} + + +sub test_flags { + # without anything - rollback to 'lastgood' snapshot if failed + # 'fatal' - whole test suite is in danger if this fails + # 'milestone' - after this test succeeds, update 'lastgood' + # 'important' - if this fails, set the overall state to 'fail' + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: