From 1165a243f857b070dd935870e1244e3f3e25dcdb Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 4 Apr 2015 07:51:46 +0200 Subject: [PATCH] nixos/tests/vbox: Make GUI startup more robust. Sometimes, keys aren't properly recognized the first time, so in order to make sure they get through, always resend the key again on retry. In this case the worst that could happen is that the VM is started over and over again, but never in parallel, so that's fine because we're checking for successful startup 10 seconds after the keypress. Signed-off-by: aszlig --- nixos/tests/virtualbox.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix index febe0923ba2..827481879a3 100644 --- a/nixos/tests/virtualbox.nix +++ b/nixos/tests/virtualbox.nix @@ -244,6 +244,7 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let for (my $i = 0; $i <= 120; $i += 10) { $machine->sleep(10); return if checkRunning_${name}; + eval { $_[0]->() } if defined $_[0]; } die "VirtualBox VM didn't start up within 2 minutes"; } @@ -335,7 +336,9 @@ in { $machine->screenshot("gui_manager_started"); $machine->sendKeys("ret"); $machine->screenshot("gui_manager_sent_startup"); - waitForStartup_simple; + waitForStartup_simple (sub { + $machine->sendKeys("ret"); + }); $machine->screenshot("gui_started"); waitForVMBoot_simple; $machine->screenshot("gui_booted");