From e44f5a37cff768682b2c9114fdaf9f52c55822b6 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Fri, 14 Mar 2025 19:11:10 +0100 Subject: [PATCH] nixosTests.php: migrate to runTest --- nixos/tests/all-tests.nix | 25 ++++++-- nixos/tests/php/default.nix | 24 ++++---- nixos/tests/php/fpm.nix | 101 +++++++++++++++++---------------- nixos/tests/php/httpd.nix | 88 ++++++++++++++--------------- nixos/tests/php/pcre.nix | 110 ++++++++++++++++++------------------ 5 files changed, 180 insertions(+), 168 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 52d7e8fb618f..031b105a2b0b 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -914,11 +914,26 @@ in { phosh = handleTest ./phosh.nix {}; photonvision = handleTest ./photonvision.nix {}; photoprism = handleTest ./photoprism.nix {}; - php = handleTest ./php {}; - php81 = handleTest ./php { php = pkgs.php81; }; - php82 = handleTest ./php { php = pkgs.php82; }; - php83 = handleTest ./php { php = pkgs.php83; }; - php84 = handleTest ./php { php = pkgs.php84; }; + php = import ./php/default.nix { + inherit runTest; + php = pkgs.php; + }; + php81 = import ./php/default.nix { + inherit runTest; + php = pkgs.php81; + }; + php82 = import ./php/default.nix { + inherit runTest; + php = pkgs.php82; + }; + php83 = import ./php/default.nix { + inherit runTest; + php = pkgs.php83; + }; + php84 = import ./php/default.nix { + inherit runTest; + php = pkgs.php84; + }; phylactery = handleTest ./web-apps/phylactery.nix {}; pict-rs = handleTest ./pict-rs.nix {}; pingvin-share = handleTest ./pingvin-share.nix {} ; diff --git a/nixos/tests/php/default.nix b/nixos/tests/php/default.nix index 9d9f23d6f051..71b2c823a6de 100644 --- a/nixos/tests/php/default.nix +++ b/nixos/tests/php/default.nix @@ -1,8 +1,6 @@ { - system ? builtins.currentSystem, - config ? { }, - pkgs ? import ../../.. { inherit system config; }, - php ? pkgs.php, + runTest, + php, }: let @@ -11,16 +9,16 @@ let }; in { - fpm = import ./fpm.nix { - inherit system pkgs; - php = php'; + fpm = runTest { + imports = [ ./fpm.nix ]; + _module.args.php = php'; }; - httpd = import ./httpd.nix { - inherit system pkgs; - php = php'; + httpd = runTest { + imports = [ ./httpd.nix ]; + _module.args.php = php'; }; - pcre = import ./pcre.nix { - inherit system pkgs; - php = php'; + pcre = runTest { + imports = [ ./pcre.nix ]; + _module.args.php = php'; }; } diff --git a/nixos/tests/php/fpm.nix b/nixos/tests/php/fpm.nix index 64b61a377e28..21336ade042b 100644 --- a/nixos/tests/php/fpm.nix +++ b/nixos/tests/php/fpm.nix @@ -1,59 +1,64 @@ -import ../make-test-python.nix ({ pkgs, lib, php, ... }: { +{ lib, php, ... }: +{ name = "php-${php.version}-fpm-nginx-test"; meta.maintainers = lib.teams.php.members; - nodes.machine = { config, lib, pkgs, ... }: { - environment.systemPackages = [ php ]; + nodes.machine = + { config, pkgs, ... }: + { + environment.systemPackages = [ php ]; - services.nginx = { - enable = true; + services.nginx = { + enable = true; - virtualHosts."phpfpm" = - let - testdir = pkgs.writeTextDir "web/index.php" " - Require all granted - + nodes.machine = + { pkgs, ... }: + { + time.timeZone = "UTC"; + services.httpd = { + enable = true; + adminAddr = "please@dont.contact"; + phpPackage = php; + enablePHP = true; + phpOptions = "pcre.jit = true"; + extraConfig = + let + testRoot = pkgs.writeText "index.php" '' + + Require all granted + + ''; }; - testScript = - let - # PCRE JIT SEAlloc feature does not play well with fork() - # The feature needs to either be disabled or PHP configured correctly - # More information in https://bugs.php.net/bug.php?id=78927 and https://bugs.php.net/bug.php?id=78630 - pcreJitSeallocForkIssue = pkgs.writeText "pcre-jit-sealloc-issue.php" '' -