1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 13:41:26 +00:00

* Provide a function for taking a screenshot.

svn path=/nixos/trunk/; revision=19225
This commit is contained in:
Eelco Dolstra 2010-01-05 11:35:59 +00:00
parent fbda972090
commit 5af12b6afe
4 changed files with 15 additions and 8 deletions

View file

@ -279,4 +279,12 @@ sub unblock {
}
# Take a screenshot of the X server on :0.0.
sub screenshot {
my ($self, $filename) = @_;
my $scrot = $ENV{'scrot'} or die;
$self->mustSucceed("DISPLAY=:0.0 $scrot /hostfs/$ENV{out}/${filename}.png");
}
1;

View file

@ -14,6 +14,7 @@ rec {
stdenv.mkDerivation {
name = "vm-test-run";
inherit tests;
scrot = "${pkgs.scrot}/bin/scrot";
buildCommand =
''
mkdir $out

View file

@ -32,8 +32,6 @@
useDefaultShell = true;
password = "foobar";
};
environment.systemPackages = [ pkgs.scrot ];
};
testScript =
@ -49,8 +47,8 @@
print STDERR $machine->execute("su - alice -c 'DISPLAY=:0.0 konqueror http://localhost/ &'");
sleep 10;
print STDERR $machine->mustSucceed("DISPLAY=:0.0 scrot /hostfs/$ENV{out}/screen.png");
$machine->screenshot("screen");
'';
}

View file

@ -8,7 +8,7 @@ rec {
{ services.xserver.enable = true;
services.xserver.driSupport = true;
services.xserver.defaultDepth = pkgs.lib.mkOverride 0 {} 16;
environment.systemPackages = [ pkgs.scrot pkgs.icewm pkgs.quake3demo ];
environment.systemPackages = [ pkgs.icewm pkgs.quake3demo ];
};
nodes =
@ -48,9 +48,9 @@ rec {
$server->mustSucceed("grep -q 'Foo.*entered the game' /tmp/log");
$server->mustSucceed("grep -q 'Bar.*entered the game' /tmp/log");
print STDERR $client1->mustSucceed("DISPLAY=:0.0 scrot /hostfs/$ENV{out}/screen1.png");
print STDERR $client2->mustSucceed("DISPLAY=:0.0 scrot /hostfs/$ENV{out}/screen2.png");
$client1->screenshot("screen1");
$client2->screenshot("screen2");
'';
}