diff options
author | Elis Hirwing <elis@hirwing.se> | 2020-03-31 19:06:04 +0200 |
---|---|---|
committer | talyz <kim.lindberger@gmail.com> | 2020-04-05 16:44:59 +0200 |
commit | 0dc95728bac36c3711009e0611b7b31c402a959e (patch) | |
tree | 9e7bcb8270b40aca70370efe2becdebd461731a3 /nixos/tests/php | |
parent | 29e1f0d1691ee1b02dc9dd2af24a6f1b169a1f21 (diff) |
nixos/php: Move the pcre tests to the php test attribute
Diffstat (limited to 'nixos/tests/php')
-rw-r--r-- | nixos/tests/php/default.nix | 1 | ||||
-rw-r--r-- | nixos/tests/php/pcre.nix | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/nixos/tests/php/default.nix b/nixos/tests/php/default.nix index c5735bd664d79..9ab14f722d087 100644 --- a/nixos/tests/php/default.nix +++ b/nixos/tests/php/default.nix @@ -3,4 +3,5 @@ pkgs ? import ../../.. { inherit system config; } }: { fpm = import ./fpm.nix { inherit system pkgs; }; + pcre = import ./pcre.nix { inherit system pkgs; }; } diff --git a/nixos/tests/php/pcre.nix b/nixos/tests/php/pcre.nix new file mode 100644 index 0000000000000..56a87778579f0 --- /dev/null +++ b/nixos/tests/php/pcre.nix @@ -0,0 +1,37 @@ +let + testString = "can-use-subgroups"; +in import ../make-test-python.nix ({ ...}: { + name = "php-httpd-pcre-jit-test"; + machine = { lib, pkgs, ... }: { + time.timeZone = "UTC"; + services.httpd = { + enable = true; + adminAddr = "please@dont.contact"; + enablePHP = true; + phpOptions = "pcre.jit = true"; + extraConfig = let + testRoot = pkgs.writeText "index.php" + '' + <?php + preg_match('/(${testString})/', '${testString}', $result); + var_dump($result); + ''; + in + '' + Alias / ${testRoot}/ + + <Directory ${testRoot}> + Require all granted + </Directory> + ''; + }; + }; + testScript = { ... }: + '' + machine.wait_for_unit("httpd.service") + # Ensure php evaluation by matching on the var_dump syntax + assert 'string(${toString (builtins.stringLength testString)}) "${testString}"' in machine.succeed( + "curl -vvv -s http://127.0.0.1:80/index.php" + ) + ''; +}) |