tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
php: Add nixos test to ensure php-pcre works in httpd
Sarah Brofeldt
8 years ago
58d07e2d
c7891595
+47
4 changed files
expand all
collapse all
unified
split
nixos
release-combined.nix
release.nix
tests
php-pcre.nix
pkgs
development
interpreters
php
default.nix
+1
nixos/release-combined.nix
···
109
109
(all nixos.tests.nfs3)
110
110
(all nixos.tests.nfs4)
111
111
(all nixos.tests.openssh)
112
112
+
(all nixos.tests.php-pcre)
112
113
(all nixos.tests.printing)
113
114
(all nixos.tests.proxy)
114
115
(all nixos.tests.sddm.default)
+1
nixos/release.nix
···
309
309
tests.pam-oath-login = callTest tests/pam-oath-login.nix {};
310
310
#tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; });
311
311
tests.peerflix = callTest tests/peerflix.nix {};
312
312
+
tests.php-pcre = callTest tests/php-pcre.nix {};
312
313
tests.postgresql = callSubTests tests/postgresql.nix {};
313
314
tests.pgmanage = callTest tests/pgmanage.nix {};
314
315
tests.postgis = callTest tests/postgis.nix {};
+44
nixos/tests/php-pcre.nix
···
1
1
+
2
2
+
let testString = "can-use-subgroups"; in
3
3
+
4
4
+
import ./make-test.nix ({ pkgs, ...}: {
5
5
+
name = "php-httpd-pcre-jit-test";
6
6
+
machine = { config, lib, pkgs, ... }: {
7
7
+
time.timeZone = "UTC";
8
8
+
services.httpd = {
9
9
+
enable = true;
10
10
+
adminAddr = "please@dont.contact";
11
11
+
extraSubservices = lib.singleton {
12
12
+
function = f: {
13
13
+
enablePHP = true;
14
14
+
phpOptions = "pcre.jit = true";
15
15
+
16
16
+
extraConfig =
17
17
+
let
18
18
+
testRoot = pkgs.writeText "index.php"
19
19
+
''
20
20
+
<?php
21
21
+
preg_match('/(${testString})/', '${testString}', $result);
22
22
+
var_dump($result);
23
23
+
?>
24
24
+
'';
25
25
+
in
26
26
+
''
27
27
+
Alias / ${testRoot}/
28
28
+
29
29
+
<Directory ${testRoot}>
30
30
+
Require all granted
31
31
+
</Directory>
32
32
+
'';
33
33
+
};
34
34
+
};
35
35
+
};
36
36
+
};
37
37
+
testScript = { nodes, ... }:
38
38
+
''
39
39
+
$machine->waitForUnit('httpd.service');
40
40
+
# Ensure php evaluation by matching on the var_dump syntax
41
41
+
$machine->succeed('curl -vvv -s http://127.0.0.1:80/index.php \
42
42
+
| grep "string(${toString (builtins.stringLength testString)}) \"${testString}\""');
43
43
+
'';
44
44
+
})
+1
pkgs/development/interpreters/php/default.nix
···
91
91
configureFlags = [ "--enable-pcntl" ];
92
92
};
93
93
94
94
+
# pcre functionality is tested in nixos/tests/php-pcre.nix
94
95
pcre = {
95
96
configureFlags = ["--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}"];
96
97
buildInputs = [ pcre ];