lol

php: Add nixos test to ensure php-pcre works in httpd

+47
+1
nixos/release-combined.nix
··· 109 109 (all nixos.tests.nfs3) 110 110 (all nixos.tests.nfs4) 111 111 (all nixos.tests.openssh) 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 + 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 + 2 + let testString = "can-use-subgroups"; in 3 + 4 + import ./make-test.nix ({ pkgs, ...}: { 5 + name = "php-httpd-pcre-jit-test"; 6 + machine = { config, lib, pkgs, ... }: { 7 + time.timeZone = "UTC"; 8 + services.httpd = { 9 + enable = true; 10 + adminAddr = "please@dont.contact"; 11 + extraSubservices = lib.singleton { 12 + function = f: { 13 + enablePHP = true; 14 + phpOptions = "pcre.jit = true"; 15 + 16 + extraConfig = 17 + let 18 + testRoot = pkgs.writeText "index.php" 19 + '' 20 + <?php 21 + preg_match('/(${testString})/', '${testString}', $result); 22 + var_dump($result); 23 + ?> 24 + ''; 25 + in 26 + '' 27 + Alias / ${testRoot}/ 28 + 29 + <Directory ${testRoot}> 30 + Require all granted 31 + </Directory> 32 + ''; 33 + }; 34 + }; 35 + }; 36 + }; 37 + testScript = { nodes, ... }: 38 + '' 39 + $machine->waitForUnit('httpd.service'); 40 + # Ensure php evaluation by matching on the var_dump syntax 41 + $machine->succeed('curl -vvv -s http://127.0.0.1:80/index.php \ 42 + | grep "string(${toString (builtins.stringLength testString)}) \"${testString}\""'); 43 + ''; 44 + })
+1
pkgs/development/interpreters/php/default.nix
··· 91 91 configureFlags = [ "--enable-pcntl" ]; 92 92 }; 93 93 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 ];