2010-01-05 12:18:43 +01:00
|
|
|
{ pkgs, ... }:
|
2009-09-03 01:16:33 +02:00
|
|
|
|
2011-01-09 23:21:22 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
# Build Quake with coverage instrumentation.
|
|
|
|
overrides = pkgs:
|
|
|
|
rec {
|
|
|
|
quake3game = pkgs.quake3game.override (args: {
|
|
|
|
stdenv = pkgs.stdenvAdapters.addCoverageInstrumentation args.stdenv;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2009-09-03 01:16:33 +02:00
|
|
|
rec {
|
|
|
|
|
2009-09-03 02:04:43 +02:00
|
|
|
client =
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
2010-01-05 18:08:57 +01:00
|
|
|
{ require = [ ./common/x11.nix ];
|
2009-09-03 02:04:43 +02:00
|
|
|
services.xserver.driSupport = true;
|
2010-10-13 00:04:10 +02:00
|
|
|
services.xserver.defaultDepth = pkgs.lib.mkOverride 0 16;
|
|
|
|
environment.systemPackages = [ pkgs.quake3demo ];
|
2011-01-09 23:21:22 +01:00
|
|
|
nixpkgs.config.packageOverrides = overrides;
|
2009-09-03 02:04:43 +02:00
|
|
|
};
|
|
|
|
|
2009-09-03 01:16:33 +02:00
|
|
|
nodes =
|
2009-09-03 02:04:43 +02:00
|
|
|
{ server =
|
2009-09-03 01:16:33 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
2009-11-05 19:21:09 +01:00
|
|
|
{ jobs.quake3Server =
|
2009-09-03 02:04:43 +02:00
|
|
|
{ name = "quake3-server";
|
|
|
|
startOn = "startup";
|
|
|
|
exec =
|
2011-01-10 13:25:13 +01:00
|
|
|
"${pkgs.quake3demo}/bin/quake3-server '+set g_gametype 0' " +
|
2009-09-03 02:04:43 +02:00
|
|
|
"'+map q3dm7' '+addbot grunt' '+addbot daemia' 2> /tmp/log";
|
|
|
|
};
|
2011-01-09 23:21:22 +01:00
|
|
|
nixpkgs.config.packageOverrides = overrides;
|
2009-09-03 01:16:33 +02:00
|
|
|
};
|
2009-09-03 02:04:43 +02:00
|
|
|
|
|
|
|
client1 = client;
|
|
|
|
client2 = client;
|
2009-09-03 01:16:33 +02:00
|
|
|
};
|
|
|
|
|
2010-01-05 12:18:43 +01:00
|
|
|
testScript =
|
2009-09-03 01:16:33 +02:00
|
|
|
''
|
|
|
|
startAll;
|
|
|
|
|
2009-09-03 02:04:43 +02:00
|
|
|
$server->waitForJob("quake3-server");
|
2010-01-06 00:59:29 +01:00
|
|
|
$client1->waitForX;
|
|
|
|
$client2->waitForX;
|
2009-09-03 01:16:33 +02:00
|
|
|
|
2010-01-06 00:59:29 +01:00
|
|
|
$client1->execute("quake3 '+set r_fullscreen 0' '+set name Foo' '+connect server' &");
|
|
|
|
$client2->execute("quake3 '+set r_fullscreen 0' '+set name Bar' '+connect server' &");
|
2009-09-03 02:04:43 +02:00
|
|
|
|
2010-02-04 14:59:31 +01:00
|
|
|
$server->waitUntilSucceeds("grep -q 'Foo.*entered the game' /tmp/log");
|
|
|
|
$server->waitUntilSucceeds("grep -q 'Bar.*entered the game' /tmp/log");
|
2009-09-03 02:04:43 +02:00
|
|
|
|
2011-01-10 15:41:16 +01:00
|
|
|
$server->sleep(10); # wait for a while to get a nice screenshot
|
2011-01-09 19:17:17 +01:00
|
|
|
|
|
|
|
$client1->block();
|
|
|
|
|
2011-01-10 15:41:16 +01:00
|
|
|
$server->sleep(20);
|
2010-01-05 12:35:59 +01:00
|
|
|
|
|
|
|
$client1->screenshot("screen1");
|
|
|
|
$client2->screenshot("screen2");
|
2011-01-09 19:17:17 +01:00
|
|
|
|
|
|
|
$client1->unblock();
|
|
|
|
|
2011-01-10 15:41:16 +01:00
|
|
|
$server->sleep(10);
|
2011-01-09 19:17:17 +01:00
|
|
|
|
|
|
|
$client1->screenshot("screen3");
|
|
|
|
$client2->screenshot("screen4");
|
2011-01-09 23:33:21 +01:00
|
|
|
|
|
|
|
$client1->shutdown();
|
|
|
|
$client2->shutdown();
|
2011-01-10 13:25:13 +01:00
|
|
|
$server->succeed("stop quake3-server");
|
2009-09-03 01:16:33 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
}
|