diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2011-01-10 14:41:16 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2011-01-10 14:41:16 +0000 |
commit | 60b6eb757922d7d755c2bfaa629362ff36c42556 (patch) | |
tree | d6e4c9fbe0b88a5aa1581e74593231b324eba32c /lib | |
parent | 8db3bdc4fc1d48f3ea441ef2e1a2639d586e1bf0 (diff) | |
download | nixlib-60b6eb757922d7d755c2bfaa629362ff36c42556.tar nixlib-60b6eb757922d7d755c2bfaa629362ff36c42556.tar.gz nixlib-60b6eb757922d7d755c2bfaa629362ff36c42556.tar.bz2 nixlib-60b6eb757922d7d755c2bfaa629362ff36c42556.tar.lz nixlib-60b6eb757922d7d755c2bfaa629362ff36c42556.tar.xz nixlib-60b6eb757922d7d755c2bfaa629362ff36c42556.tar.zst nixlib-60b6eb757922d7d755c2bfaa629362ff36c42556.zip |
* Add a method Machine::sleep to sleep N seconds in virtual (guest)
time rather than host real time. svn path=/nixos/trunk/; revision=25491
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test-driver/Machine.pm | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm index 5d8d967431c4..81d96ee81e1a 100644 --- a/lib/test-driver/Machine.pm +++ b/lib/test-driver/Machine.pm @@ -467,10 +467,12 @@ sub screenshot { # testing the existence of /tmp/.X11-unix/X0 is insufficient. sub waitForX { my ($self, $regexp) = @_; - retry sub { - my ($status, $out) = $self->execute("xwininfo -root > /dev/null 2>&1"); - return 1 if $status == 0; - } + $self->nest("waiting for the X11 server", sub { + retry sub { + my ($status, $out) = $self->execute("xwininfo -root > /dev/null 2>&1"); + return 1 if $status == 0; + } + }); } @@ -484,12 +486,14 @@ sub getWindowNames { sub waitForWindow { my ($self, $regexp) = @_; - retry sub { - my @names = $self->getWindowNames; - foreach my $n (@names) { - return 1 if $n =~ /$regexp/; + $self->nest("waiting for a window to appear", sub { + retry sub { + my @names = $self->getWindowNames; + foreach my $n (@names) { + return 1 if $n =~ /$regexp/; + } } - } + }); } @@ -518,4 +522,11 @@ sub sendChars { } +# Sleep N seconds (in virtual guest time, not real time). +sub sleep { + my ($self, $time) = @_; + $self->succeed("sleep $time"); +} + + 1; |