From cdc46010d9fc51ac4816c68f0af380b97fa9eaed Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Fri, 20 May 2016 23:49:20 +0200 Subject: lvc: combined patch - featuring waitAny and try_for() \o/ The XF86_Switch_VT bit doesn't quite work, but I'll leave it in the kernel command line for now. Signed-off-by: Holger Levsen --- cucumber/features/images/d-i_gui_BadMirror.png | Bin 0 -> 18795 bytes .../images/d-i_gui_InstallingGRUBprogress.png | Bin 8928 -> 0 bytes .../images/d-i_text_InstallingGRUBprogress.png | Bin 10406 -> 0 bytes cucumber/features/install.feature | 10 ++-- cucumber/features/step_definitions/common_steps.rb | 61 ++++++++++++++------- cucumber/features/step_definitions/snapshots.rb | 8 +-- 6 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 cucumber/features/images/d-i_gui_BadMirror.png delete mode 100644 cucumber/features/images/d-i_gui_InstallingGRUBprogress.png delete mode 100644 cucumber/features/images/d-i_text_InstallingGRUBprogress.png diff --git a/cucumber/features/images/d-i_gui_BadMirror.png b/cucumber/features/images/d-i_gui_BadMirror.png new file mode 100644 index 00000000..d8a09a14 Binary files /dev/null and b/cucumber/features/images/d-i_gui_BadMirror.png differ diff --git a/cucumber/features/images/d-i_gui_InstallingGRUBprogress.png b/cucumber/features/images/d-i_gui_InstallingGRUBprogress.png deleted file mode 100644 index 4bbec3c6..00000000 Binary files a/cucumber/features/images/d-i_gui_InstallingGRUBprogress.png and /dev/null differ diff --git a/cucumber/features/images/d-i_text_InstallingGRUBprogress.png b/cucumber/features/images/d-i_text_InstallingGRUBprogress.png deleted file mode 100644 index 4cae1548..00000000 Binary files a/cucumber/features/images/d-i_text_InstallingGRUBprogress.png and /dev/null differ diff --git a/cucumber/features/install.feature b/cucumber/features/install.feature index 57269c8f..cf9a68a0 100644 --- a/cucumber/features/install.feature +++ b/cucumber/features/install.feature @@ -10,16 +10,16 @@ Feature: Doing variations on d-i installs Examples: | install_ui | target_ui | login | - | gui | Minimal | VT | - | gui | non-GUI | VT | - | gui | XFCE Desktop | XFCE | -# | gui | Gnome Desktop | Gnome | | text | Minimal | VT | | text | non-GUI | VT | | text | XFCE Desktop | XFCE | # | text | Gnome Desktop | Gnome | + | gui | Minimal | VT | + | gui | non-GUI | VT | + | gui | XFCE Desktop | XFCE | +# | gui | Gnome Desktop | Gnome | # Scenario: Get a useful error from a bogus HTTP proxy # Given I get d-i to the HTTP proxy prompt -# When I set the proxy to "172.23.23.23" +# When I set the proxy to "127.23.23.23" # Then I should get an error message that mentions the proxy diff --git a/cucumber/features/step_definitions/common_steps.rb b/cucumber/features/step_definitions/common_steps.rb index 86ad60f5..1cb49687 100644 --- a/cucumber/features/step_definitions/common_steps.rb +++ b/cucumber/features/step_definitions/common_steps.rb @@ -277,7 +277,7 @@ Given /^I select ([a-z]*) mode and wait for the remote shell$/ do |ui_mode| end @screen.type(Sikuli::Key.TAB) - @screen.type(' preseed/early_command="echo DPMS=-s\\\\ 0 > /lib/debian-installer.d/S61Xnoblank ; echo ttyS0::askfirst:-/bin/sh>>/etc/inittab;kill -HUP 1"' + " blacklist=psmouse #{@boot_options}" + + @screen.type(' preseed/early_command="echo DPMS=-s\\\\ 0 > /lib/debian-installer.d/S61Xnoblank ; sed -i \'/XF86_Switch_VT_/s/ F\([0-9]\)/ XF86_Switch_VT_\1/\' /usr/share/X11/xkb/symbols/srvr_ctrl ; echo ttyS0::askfirst:-/bin/sh>>/etc/inittab;kill -HUP 1"' + " blacklist=psmouse #{@boot_options}" + Sikuli::Key.ENTER) $vm.wait_until_remote_shell_is_up end @@ -386,7 +386,17 @@ Given /^in ([a-z]*) mode I neglect to scan more CDs$/ do |ui_mode| end Given /^in ([a-z]*) mode I ignore Popcon$/ do |ui_mode| - @screen.wait(diui_png("popcon",ui_mode), 10 * 60) + bad_mirror = diui_png("BadMirror",ui_mode) + on_screen, _ = @screen.waitAny([diui_png("popcon",ui_mode), bad_mirror], 10 * 60) + if on_screen == bad_mirror + if "gui" == ui_mode + @screen.type(Sikuli::Key.F4) # for this to work, we need to remap the keyboard -- CtrlAltF4 is apparently untypable :-( + else + @screen.type(Sikuli::Key.F4, Sikuli::KeyModifier.ALT) + end + sleep(10) + raise "Failed to access the mirror (perhaps a duff proxy?)" + end @screen.type(Sikuli::Key.ENTER) @screen.waitVanish(diui_png("popcon",ui_mode), 10) end @@ -460,33 +470,44 @@ Given /^in ([a-z]*) mode I select the ([a-zA-Z]*) Desktop task$/ do |ui_mode,des @screen.waitVanish(diui_png("Desktop+Gnome",ui_mode), 10) end -Given /^in ([a-z]*) mode I wait while the ([a-z]* |)bulk of the packages are installed$/ do |ui_mode,vast| +Given /^in ([a-z]*) mode I wait while the bulk of the packages are installed$/ do |ui_mode| @screen.wait(diui_png("InstallSoftware",ui_mode), 10) - if "vast " == vast - debug_log("debug: lots of packages, so sod about with AltF4/1 to keep things alive, hopefully", :color => :blue) - 20.times do - sleep(50) - @screen.type(Sikuli::Key.F4, Sikuli::KeyModifier.ALT) + debug_log("debug: we see InstallSoftware", :color => :blue) + try_for(120*60, :msg => "it seems that the install stalled (timing-out after 2 hours)") do + found = false + debug_log("debug: check for Installing Software/GRUBprogress", :color => :blue) + hit, _ = @screen.waitAny([diui_png("InstallSoftware",ui_mode),diui_png("InstallGRUB",ui_mode)], 2*60) + if diui_png("InstallSoftware",ui_mode) == hit + debug_log("debug: still there, so let's glance at tty4", :color => :blue) + if "gui" == ui_mode + @screen.type(Sikuli::Key.F4) # for this to work, we need to remap the keyboard -- CtrlAltF4 is apparently untypable :-( + else + @screen.type(Sikuli::Key.F4, Sikuli::KeyModifier.ALT) + end + debug_log("debug: typed F4, pausing...", :color => :blue) sleep(10) - @screen.type(Sikuli::Key.F1, Sikuli::KeyModifier.ALT) + debug_log("debug: slept 10", :color => :blue) + if "gui" == ui_mode + @screen.type(Sikuli::Key.F5, Sikuli::KeyModifier.ALT) + else + @screen.type(Sikuli::Key.F1, Sikuli::KeyModifier.ALT) + end + debug_log("debug: pressed F1", :color => :blue) + sleep(20) end - debug_log("debug: 20 mins in...", :color => :blue) + if diui_png("InstallGRUB",ui_mode) == hit + debug_log("debug: found InstallGRUB", :color => :blue) + found = true + end + + found end - @screen.wait(diui_png("InstallSoftware",ui_mode), 10) - @screen.waitVanish(diui_png("InstallSoftware",ui_mode), 40 * 60) end Given /^in ([a-z]*) mode I install GRUB$/ do |ui_mode| - #@screen.wait("Install the GRUB", 80 * 60) - debug_log("debug: Look for InstallingGRUBprogress", :color => :blue) - @screen.wait(diui_png("InstallingGRUBprogress",ui_mode), 2 * 60) - debug_log("debug: Found InstallingGRUBprogress", :color => :blue) - @screen.waitVanish(diui_png("InstallingGRUBprogress",ui_mode), 2 * 60) - debug_log("debug: InstallingGRUBprogress gone again", :color => :blue) - debug_log("debug: Look for InstallGRUB", :color => :blue) @screen.wait(diui_png("InstallGRUB",ui_mode), 2 * 60) debug_log("debug: Found InstallGRUB", :color => :blue) - sleep(10) + sleep(10) # FIXME -- this is a kludge to deal with the snapshot coming back -- should be done via the remote shell check instead @screen.wait(diui_png("InstallGRUB",ui_mode), 10) debug_log("debug: Found InstallGRUB (again)", :color => :blue) if "gui" == ui_mode diff --git a/cucumber/features/step_definitions/snapshots.rb b/cucumber/features/step_definitions/snapshots.rb index 66c89747..1604ddae 100644 --- a/cucumber/features/step_definitions/snapshots.rb +++ b/cucumber/features/step_definitions/snapshots.rb @@ -106,7 +106,7 @@ def checkpoints :parent_checkpoint => 'boot-d-i-to-tasksel', :steps => [ 'in text mode I select the Gnome Desktop task', - 'in text mode I wait while the vast bulk of the packages are installed', + 'in text mode I wait while the bulk of the packages are installed', 'in text mode I install GRUB', 'in text mode I allow reboot after the install is complete', 'I wait for the reboot', @@ -120,7 +120,7 @@ def checkpoints :parent_checkpoint => 'boot-g-i-to-tasksel', :steps => [ 'in gui mode I select the Gnome Desktop task', - 'in gui mode I wait while the vast bulk of the packages are installed', + 'in gui mode I wait while the bulk of the packages are installed', 'in gui mode I install GRUB', 'in gui mode I allow reboot after the install is complete', 'I wait for the reboot', @@ -134,7 +134,7 @@ def checkpoints :parent_checkpoint => 'boot-d-i-to-tasksel', :steps => [ 'in text mode I select the XFCE Desktop task', - 'in text mode I wait while the vast bulk of the packages are installed', + 'in text mode I wait while the bulk of the packages are installed', 'in text mode I install GRUB', 'in text mode I allow reboot after the install is complete', 'I wait for the reboot', @@ -148,7 +148,7 @@ def checkpoints :parent_checkpoint => 'boot-g-i-to-tasksel', :steps => [ 'in gui mode I select the XFCE Desktop task', - 'in gui mode I wait while the vast bulk of the packages are installed', + 'in gui mode I wait while the bulk of the packages are installed', 'in gui mode I install GRUB', 'in gui mode I allow reboot after the install is complete', 'I wait for the reboot', -- cgit v1.2.3-54-g00ecf