diff --git a/VARIABLES.md b/VARIABLES.md index b8caccb5..f1051f08 100644 --- a/VARIABLES.md +++ b/VARIABLES.md @@ -73,6 +73,7 @@ it also means that `B` conflicts `A` even if not shown in the table). | `TEST_UPDATES` | boolean | `false`/not set | set to indicate that this test checks updates.img loading, so we should check for the expected effect of the updates image used for this testing | | `POSTINSTALL` | string | not set | nothing | If set, `tests/(value)_postinstall.pm` will be loaded after install, boot, login, and other postinstall tests | `UEFI` | boolean | `false`/not set | nothing | whether to use UEFI, this variable isn't usually set in test suites but in machine definition | +| `ANACONDA_TEXT` | boolean | `false`/not set | all | when specified, anaconda will run in text mode | Run variables ------------- diff --git a/lib/anacondatest.pm b/lib/anacondatest.pm index 54d7519f..663e29e4 100644 --- a/lib/anacondatest.pm +++ b/lib/anacondatest.pm @@ -16,6 +16,9 @@ sub post_fail_hook { if (check_screen "anaconda_error", 10) { assert_and_click "anaconda_error_report"; $has_traceback = 1; + } elsif (check_screen "anaconda_text_error", 10) { # also for text install + type_string "1\n"; + $has_traceback = 1; } $self->root_console(check=>0); diff --git a/lib/main_common.pm b/lib/main_common.pm new file mode 100644 index 00000000..4f93dcd6 --- /dev/null +++ b/lib/main_common.pm @@ -0,0 +1,17 @@ +package main_common; + +use strict; + +use base 'Exporter'; +use Exporter; + +use testapi; + +our @EXPORT = qw/run_with_error_check/; + +sub run_with_error_check { + my ($func, $error_screen) = @_; + die "Error screen appeared" if (check_screen $error_screen, 5); + $func->(); + die "Error screen appeared" if (check_screen $error_screen, 5); +} diff --git a/main.pm b/main.pm index c5371c20..5219119d 100644 --- a/main.pm +++ b/main.pm @@ -119,6 +119,12 @@ sub load_install_tests() { # if this is a kickstart install, that's all folks return if (get_var("KICKSTART")); + if (get_var('ANACONDA_TEXT')) { + # since it differs much, handle text installation separately + autotest::loadtest "tests/install_text.pm"; + return; + } + ## Networking if (get_var('ANACONDA_STATIC')) { autotest::loadtest "tests/_network_static.pm"; diff --git a/needles/console/anaconda_install_text_done.json b/needles/console/anaconda_install_text_done.json new file mode 100644 index 00000000..87c02fc5 --- /dev/null +++ b/needles/console/anaconda_install_text_done.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 255, + "ypos": 738, + "width": 152, + "height": 12, + "type": "match" + } + ], + "properties": [], + "tags": [ + "anaconda_install_text_done" + ] +} \ No newline at end of file diff --git a/needles/console/anaconda_install_text_done.png b/needles/console/anaconda_install_text_done.png new file mode 100644 index 00000000..bf10eb95 Binary files /dev/null and b/needles/console/anaconda_install_text_done.png differ diff --git a/needles/console/anaconda_main_hub_text.json b/needles/console/anaconda_main_hub_text.json new file mode 100644 index 00000000..d958f648 --- /dev/null +++ b/needles/console/anaconda_main_hub_text.json @@ -0,0 +1,29 @@ +{ + "tags": [ + "anaconda_main_hub_text" + ], + "area": [ + { + "type": "match", + "ypos": 338, + "height": 12, + "width": 96, + "xpos": 1 + }, + { + "type": "match", + "ypos": 498, + "height": 13, + "width": 127, + "xpos": 71 + }, + { + "xpos": 8, + "ypos": 369, + "width": 119, + "height": 13, + "type": "match" + } + ], + "properties": [] +} \ No newline at end of file diff --git a/needles/console/anaconda_main_hub_text.png b/needles/console/anaconda_main_hub_text.png new file mode 100644 index 00000000..414ccc20 Binary files /dev/null and b/needles/console/anaconda_main_hub_text.png differ diff --git a/needles/console/anaconda_main_hub_text_unfinished.json b/needles/console/anaconda_main_hub_text_unfinished.json new file mode 100644 index 00000000..cf19751f --- /dev/null +++ b/needles/console/anaconda_main_hub_text_unfinished.json @@ -0,0 +1,15 @@ +{ + "tags": [ + "anaconda_main_hub_text_unfinished" + ], + "properties": [], + "area": [ + { + "xpos": 361, + "ypos": 369, + "width": 22, + "height": 14, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/console/anaconda_main_hub_text_unfinished.png b/needles/console/anaconda_main_hub_text_unfinished.png new file mode 100644 index 00000000..414ccc20 Binary files /dev/null and b/needles/console/anaconda_main_hub_text_unfinished.png differ diff --git a/needles/console/anaconda_text_error.json b/needles/console/anaconda_text_error.json new file mode 100644 index 00000000..a883687b --- /dev/null +++ b/needles/console/anaconda_text_error.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 1, + "ypos": 319, + "width": 230, + "height": 16, + "type": "match" + } + ], + "tags": [ + "anaconda_text_error" + ], + "properties": [] +} \ No newline at end of file diff --git a/needles/console/anaconda_text_error.png b/needles/console/anaconda_text_error.png new file mode 100644 index 00000000..58b2a28a Binary files /dev/null and b/needles/console/anaconda_text_error.png differ diff --git a/needles/console/anaconda_use_text_mode.json b/needles/console/anaconda_use_text_mode.json new file mode 100644 index 00000000..cd67c585 --- /dev/null +++ b/needles/console/anaconda_use_text_mode.json @@ -0,0 +1,15 @@ +{ + "tags": [ + "anaconda_use_text_mode" + ], + "properties": [], + "area": [ + { + "xpos": 9, + "ypos": 241, + "width": 125, + "height": 14, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/console/anaconda_use_text_mode.png b/needles/console/anaconda_use_text_mode.png new file mode 100644 index 00000000..659c787e Binary files /dev/null and b/needles/console/anaconda_use_text_mode.png differ diff --git a/templates b/templates index 5efe9e38..e27cdbea 100755 --- a/templates +++ b/templates @@ -325,6 +325,17 @@ }, test_suite => { name => "install_package_set_minimal" }, }, + { + machine => { name => "64bit" }, + prio => 30, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "install_anaconda_text" }, + }, { machine => { name => "64bit" }, prio => 10, @@ -1430,6 +1441,12 @@ { key => "STORE_HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, ], }, + { + name => "install_anaconda_text", + settings => [ + { key => "ANACONDA_TEXT", value => "1" }, + ], + }, { name => "install_package_set_minimal", settings => [ diff --git a/tests/_boot_to_anaconda.pm b/tests/_boot_to_anaconda.pm index afd2c3c8..12f5e967 100644 --- a/tests/_boot_to_anaconda.pm +++ b/tests/_boot_to_anaconda.pm @@ -14,8 +14,9 @@ sub run { # Construct inst.repo arg for REPOSITORY_VARIATION my $repourl = get_var("REPOSITORY_VARIATION"); if ($repourl) { - $params .= "inst.repo=" . $self->get_full_repo($repourl); + $params .= "inst.repo=" . $self->get_full_repo($repourl) . " "; } + $params .= "inst.text" if get_var("ANACONDA_TEXT"); # ternary: set $params to "" if it contains only spaces $params = $params =~ /^\s+$/ ? "" : $params; @@ -28,28 +29,37 @@ sub run { # proceed to installer unless (get_var("KICKSTART")) { - # on lives, we have to explicitly launch anaconda - if (get_var('LIVE')) { - assert_and_click "live_start_anaconda_icon", '', 300; - } - my $language = get_var('LANGUAGE') || 'english'; - # wait for anaconda to appear - assert_screen "anaconda_select_install_lang", 300; - # Select install language - assert_and_click "anaconda_select_install_lang_input"; - type_string "${language}"; - # Needle filtering in main.pm ensures we will only look for the - # appropriate language, here - assert_and_click "anaconda_select_install_lang_filtered"; - assert_screen "anaconda_select_install_lang_selected", 3; - assert_and_click "anaconda_select_install_lang_continue"; + if (get_var("ANACONDA_TEXT")) { + # select that we don't want to start VNC; we want to run in text mode + assert_screen "anaconda_use_text_mode", 300; + type_string "2\n"; - if ( check_screen "anaconda_rawhide_accept_fate" ) { - assert_and_click "anaconda_rawhide_accept_fate"; - } + # wait for text version of Anaconda main hub + assert_screen "anaconda_main_hub_text", 300; + } else { + # on lives, we have to explicitly launch anaconda + if (get_var('LIVE')) { + assert_and_click "live_start_anaconda_icon", '', 300; + } + my $language = get_var('LANGUAGE') || 'english'; + # wait for anaconda to appear + assert_screen "anaconda_select_install_lang", 300; + # Select install language + assert_and_click "anaconda_select_install_lang_input"; + type_string "${language}"; + # Needle filtering in main.pm ensures we will only look for the + # appropriate language, here + assert_and_click "anaconda_select_install_lang_filtered"; + assert_screen "anaconda_select_install_lang_selected", 3; + assert_and_click "anaconda_select_install_lang_continue"; - # wait for Anaconda hub to appear - assert_screen "anaconda_main_hub", 900; # + if ( check_screen "anaconda_rawhide_accept_fate" ) { + assert_and_click "anaconda_rawhide_accept_fate"; + } + + # wait for Anaconda hub to appear + assert_screen "anaconda_main_hub", 900; # + } } } diff --git a/tests/install_text.pm b/tests/install_text.pm new file mode 100644 index 00000000..2dc232ec --- /dev/null +++ b/tests/install_text.pm @@ -0,0 +1,112 @@ +use base "anacondatest"; +use strict; +use testapi; +use main_common; + +sub run { + my $self = shift; + assert_screen "anaconda_main_hub_text"; + # IMHO it's better to use sleeps than to have needle for every text screen + wait_still_screen 5; + + # prepare for different number of spokes (e. g. as in Atomic DVD) + my %spoke_number = ( + "language" => 1, + "timezone" => 2, + "source" => 3, + "swselection" => 4, + "destination" => 5, + "network" => 6, + "rootpwd" => 7, + "user" => 8 + ); + + # Set timezone + run_with_error_check(sub {type_string $spoke_number{"timezone"} . "\n"}, "anaconda_text_error"); + wait_still_screen 5; + type_string "1\n"; # Europe + wait_still_screen 5; + type_string "37\n"; # Prague + wait_still_screen 7; + + # Select disk + run_with_error_check(sub {type_string $spoke_number{"destination"} . "\n"}, "anaconda_text_error"); + wait_still_screen 5; + type_string "c\n"; # first disk selected, continue + wait_still_screen 5; + type_string "c\n"; # use all space selected, continue + wait_still_screen 5; + type_string "c\n"; # LVM selected, continue + wait_still_screen 7; + + # Set root password + run_with_error_check(sub {type_string $spoke_number{"rootpwd"} . "\n"}, "anaconda_text_error"); + wait_still_screen 5; + type_string get_var("ROOT_PASSWORD", "weakpassword"); + send_key "ret"; + wait_still_screen 5; + type_string get_var("ROOT_PASSWORD", "weakpassword"); + send_key "ret"; + wait_still_screen 7; + + # Create user + run_with_error_check(sub {type_string $spoke_number{"user"} . "\n"}, "anaconda_text_error"); + wait_still_screen 5; + type_string "1\n"; # create new + wait_still_screen 5; + type_string "3\n"; # set username + wait_still_screen 5; + type_string get_var("USER_LOGIN", "test"); + send_key "ret"; + wait_still_screen 5; + # typing "4\n" on abrt screen causes system to reboot, so be careful + run_with_error_check(sub {type_string "4\n"}, "anaconda_text_error"); # use password + wait_still_screen 5; + type_string "5\n"; # set password + wait_still_screen 5; + type_string get_var("USER_PASSWORD", "weakpassword"); + send_key "ret"; + wait_still_screen 5; + type_string get_var("USER_PASSWORD", "weakpassword"); + send_key "ret"; + wait_still_screen 5; + type_string "6\n"; # make him an administrator + wait_still_screen 5; + type_string "c\n"; + wait_still_screen 7; + + my $counter = 0; + while (check_screen "anaconda_main_hub_text_unfinished", 2) { + if ($counter > 10) { + die "There are unfinished spokes in Anaconda"; + } + sleep 10; + $counter++; + type_string "r\n"; # refresh + } + + # begin installation + type_string "b\n"; + + # Wait for install to end. Give Rawhide a bit longer, in case + # we're on a debug kernel, debug kernel installs are really slow. + my $timeout = 1800; + if (lc(get_var('VERSION')) eq "rawhide") { + $timeout = 2400; + } + assert_screen "anaconda_install_text_done", $timeout; + type_string "\n"; +} + + +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: