1let
2 testString = "can-use-subgroups";
3in import ../make-test-python.nix ({lib, php, ...}: {
4 name = "php-${php.version}-httpd-pcre-jit-test";
5 meta.maintainers = lib.teams.php.members;
6
7 machine = { lib, pkgs, ... }: {
8 time.timeZone = "UTC";
9 services.httpd = {
10 enable = true;
11 adminAddr = "please@dont.contact";
12 phpPackage = php;
13 enablePHP = true;
14 phpOptions = "pcre.jit = true";
15 extraConfig = let
16 testRoot = pkgs.writeText "index.php"
17 ''
18 <?php
19 preg_match('/(${testString})/', '${testString}', $result);
20 var_dump($result);
21 '';
22 in
23 ''
24 Alias / ${testRoot}/
25
26 <Directory ${testRoot}>
27 Require all granted
28 </Directory>
29 '';
30 };
31 };
32 testScript = { ... }:
33 ''
34 machine.wait_for_unit("httpd.service")
35 # Ensure php evaluation by matching on the var_dump syntax
36 response = machine.succeed("curl -fvvv -s http://127.0.0.1:80/index.php")
37 expected = 'string(${toString (builtins.stringLength testString)}) "${testString}"'
38 assert expected in response, "Does not appear to be able to use subgroups."
39 '';
40})