mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 15:11:25 +00:00
* Provide a function for taking a screenshot.
svn path=/nixos/trunk/; revision=19225
This commit is contained in:
parent
fbda972090
commit
5af12b6afe
@ -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;
|
||||
|
@ -14,6 +14,7 @@ rec {
|
||||
stdenv.mkDerivation {
|
||||
name = "vm-test-run";
|
||||
inherit tests;
|
||||
scrot = "${pkgs.scrot}/bin/scrot";
|
||||
buildCommand =
|
||||
''
|
||||
mkdir $out
|
||||
|
@ -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");
|
||||
'';
|
||||
|
||||
}
|
||||
|
@ -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");
|
||||
'';
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user