blob: 2d8c5207001cbd6fa11d9fc7ea40065e265aae6a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
import ./make-test-python.nix ({ pkgs, lib, ...} :
let
# Build Quake with coverage instrumentation.
overrides = pkgs:
{
quake3game = pkgs.quake3game.override (args: {
stdenv = pkgs.stdenvAdapters.addCoverageInstrumentation args.stdenv;
});
};
# Only allow the demo data to be used (only if it's unfreeRedistributable).
unfreePredicate = pkg: let
allowPackageNames = [ "quake3-demodata" "quake3-pointrelease" ];
allowLicenses = [ lib.licenses.unfreeRedistributable ];
in lib.elem pkg.pname allowPackageNames &&
lib.elem (pkg.meta.license or null) allowLicenses;
client =
{ pkgs, ... }:
{ imports = [ ./common/x11.nix ];
hardware.opengl.driSupport = true;
environment.systemPackages = [ pkgs.quake3demo ];
nixpkgs.config.packageOverrides = overrides;
nixpkgs.config.allowUnfreePredicate = unfreePredicate;
};
in
rec {
name = "quake3";
meta = with lib.maintainers; {
maintainers = [ domenkozar eelco ];
};
# TODO: lcov doesn't work atm
#makeCoverageReport = true;
nodes =
{ server =
{ pkgs, ... }:
{ systemd.services.quake3-server =
{ wantedBy = [ "multi-user.target" ];
script =
"${pkgs.quake3demo}/bin/quake3-server +set g_gametype 0 " +
"+map q3dm7 +addbot grunt +addbot daemia 2> /tmp/log";
};
nixpkgs.config.packageOverrides = overrides;
nixpkgs.config.allowUnfreePredicate = unfreePredicate;
networking.firewall.allowedUDPPorts = [ 27960 ];
};
client1 = client;
client2 = client;
};
testScript =
''
start_all()
server.wait_for_unit("quake3-server")
client1.wait_for_x()
client2.wait_for_x()
client1.execute("quake3 +set r_fullscreen 0 +set name Foo +connect server &")
client2.execute("quake3 +set r_fullscreen 0 +set name Bar +connect server &")
server.wait_until_succeeds("grep -q 'Foo.*entered the game' /tmp/log")
server.wait_until_succeeds("grep -q 'Bar.*entered the game' /tmp/log")
server.sleep(10) # wait for a while to get a nice screenshot
client1.block()
server.sleep(20)
client1.screenshot("screen1")
client2.screenshot("screen2")
client1.unblock()
server.sleep(10)
client1.screenshot("screen3")
client2.screenshot("screen4")
client1.shutdown()
client2.shutdown()
server.stop_job("quake3-server")
'';
})
|