From 042d7c5f02470e945cda4acca18e9ab072dfcc63 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 18:43:30 +0000 Subject: [PATCH 1/9] alembic: remove custom checkPhase and use enableParallelChecking instead This is supported by stdenv already. --- pkgs/by-name/al/alembic/package.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/by-name/al/alembic/package.nix b/pkgs/by-name/al/alembic/package.nix index 091edf349412..08a804fa1514 100644 --- a/pkgs/by-name/al/alembic/package.nix +++ b/pkgs/by-name/al/alembic/package.nix @@ -60,11 +60,7 @@ stdenv.mkDerivation rec { ''; doCheck = true; - checkPhase = '' - runHook preCheck - ctest -j 1 - runHook postCheck - ''; + enableParallelChecking = false; meta = with lib; { description = "Open framework for storing and sharing scene data"; From 5e9102e8d1b0bf9b0b5932ecf90c0f522b01f422 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 18:50:53 +0000 Subject: [PATCH 2/9] ccache: use ctestCheckHook, writableTmpDirAsHomeHook --- pkgs/by-name/cc/ccache/package.nix | 33 +++++++++++++----------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/cc/ccache/package.nix b/pkgs/by-name/cc/ccache/package.nix index 29a286570bae..ac4cea89bc5b 100644 --- a/pkgs/by-name/cc/ccache/package.nix +++ b/pkgs/by-name/cc/ccache/package.nix @@ -15,6 +15,8 @@ doctest, xcodebuild, makeWrapper, + ctestCheckHook, + writableTmpDirAsHomeHook, nix-update-script, }: @@ -82,31 +84,24 @@ stdenv.mkDerivation (finalAttrs: { # test/run requires the compgen function which is available in # bashInteractive, but not bash. bashInteractive + ctestCheckHook + writableTmpDirAsHomeHook ] ++ lib.optional stdenv.hostPlatform.isDarwin xcodebuild; checkInputs = [ doctest ]; - checkPhase = - let - badTests = - [ - "test.trim_dir" # flaky on hydra (possibly filesystem-specific?) - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "test.basedir" - "test.fileclone" # flaky on hydra (possibly filesystem-specific?) - "test.multi_arch" - "test.nocpp2" - ]; - in - '' - runHook preCheck - export HOME=$(mktemp -d) - ctest --output-on-failure -E '^(${lib.concatStringsSep "|" badTests})$' - runHook postCheck - ''; + disabledTests = + [ + "test.trim_dir" # flaky on hydra (possibly filesystem-specific?) + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "test.basedir" + "test.fileclone" # flaky on hydra (possibly filesystem-specific?) + "test.multi_arch" + "test.nocpp2" + ]; passthru = { # A derivation that provides gcc and g++ commands, but that From e8e3913fa856132c370b5f8eb5d6c3a1bec86b26 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 18:51:24 +0000 Subject: [PATCH 3/9] ccache: disable test.fileclone unconditionally Seems to fail consistently on zfs. This aligns with the comment that the failure might depend on the filesystem. --- pkgs/by-name/cc/ccache/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/cc/ccache/package.nix b/pkgs/by-name/cc/ccache/package.nix index ac4cea89bc5b..00162a46eb58 100644 --- a/pkgs/by-name/cc/ccache/package.nix +++ b/pkgs/by-name/cc/ccache/package.nix @@ -95,10 +95,10 @@ stdenv.mkDerivation (finalAttrs: { disabledTests = [ "test.trim_dir" # flaky on hydra (possibly filesystem-specific?) + "test.fileclone" # flaky on hydra, also seems to fail on zfs ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "test.basedir" - "test.fileclone" # flaky on hydra (possibly filesystem-specific?) "test.multi_arch" "test.nocpp2" ]; From c1c6481a72f4d53fd8d8748be09c8ef779c095d8 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 19:08:40 +0000 Subject: [PATCH 4/9] openscad-unstable: use ctestCheckHook --- pkgs/by-name/op/openscad-unstable/package.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/op/openscad-unstable/package.nix b/pkgs/by-name/op/openscad-unstable/package.nix index 7ee708b69605..280f4035a5ce 100644 --- a/pkgs/by-name/op/openscad-unstable/package.nix +++ b/pkgs/by-name/op/openscad-unstable/package.nix @@ -41,6 +41,7 @@ xorg, mimalloc, opencsg, + ctestCheckHook, }: # clang consume much less RAM than GCC clangStdenv.mkDerivation rec { @@ -142,12 +143,16 @@ clangStdenv.mkDerivation rec { nativeCheckInputs = [ mesa.llvmpipeHook + ctestCheckHook ]; - checkPhase = '' + dontUseNinjaCheck = true; + checkFlags = [ + "-E" # some fontconfig issues cause pdf output to have wrong font - ctest -j$NIX_BUILD_CORES -E pdfexporttest.\* - ''; + "pdfexporttest" + ]; + meta = with lib; { description = "3D parametric model compiler (unstable)"; longDescription = '' From be772126ca5d67b99c76ffb719e5c4b66cc37577 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 19:19:30 +0000 Subject: [PATCH 5/9] halide: use ctestCheckHook --- pkgs/development/compilers/halide/default.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/halide/default.nix b/pkgs/development/compilers/halide/default.nix index 3ce25abaf53c..821459bacdae 100644 --- a/pkgs/development/compilers/halide/default.nix +++ b/pkgs/development/compilers/halide/default.nix @@ -22,6 +22,7 @@ wasmSupport ? false, wabt, doCheck ? true, + ctestCheckHook, }: assert blas.implementation == "openblas" && lapack.implementation == "openblas"; @@ -102,15 +103,9 @@ stdenv.mkDerivation (finalAttrs: { "correctness_cross_compilation" "correctness_simd_op_check_hvx" ]; - # ninja's setup-hook doesn't let us specify custom flags for the checkPhase, see - # https://discourse.nixos.org/t/building-only-specific-targets-with-cmake/31545/4 - # so we resort to overriding the whole checkPhase + dontUseNinjaCheck = true; - checkPhase = '' - runHook preCheck - ctest --exclude-regex '^(${lib.strings.concatStringsSep "|" finalAttrs.disabledTests})$' - runHook postCheck - ''; + nativeCheckInputs = [ ctestCheckHook ]; postInstall = lib.optionalString pythonSupport '' From 0a42a464be671142deb47a6df3ea09466f9a6133 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 19:38:48 +0000 Subject: [PATCH 6/9] prusa-slicer: use ctestCheckHook --- pkgs/applications/misc/prusa-slicer/default.nix | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/misc/prusa-slicer/default.nix b/pkgs/applications/misc/prusa-slicer/default.nix index de0e544b8054..8430f97901cd 100644 --- a/pkgs/applications/misc/prusa-slicer/default.nix +++ b/pkgs/applications/misc/prusa-slicer/default.nix @@ -35,6 +35,7 @@ heatshrink, catch2, webkitgtk_4_0, + ctestCheckHook, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd, wxGTK-override ? null, @@ -205,16 +206,12 @@ stdenv.mkDerivation (finalAttrs: { ''; doCheck = true; - - checkPhase = '' - runHook preCheck - - ctest \ - --force-new-ctest-process \ - -E 'libslic3r_tests|sla_print_tests' - - runHook postCheck - ''; + nativeCheckInputs = [ ctestCheckHook ]; + checkFlags = [ + "--force-new-ctest-process" + "-E" + "libslic3r_tests|sla_print_tests" + ]; meta = with lib; From a429add28053200b1970dbc34f8d837d9f67cfa0 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 19:48:58 +0000 Subject: [PATCH 7/9] sirius: use ctestCheckHook --- pkgs/by-name/si/sirius/package.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/si/sirius/package.nix b/pkgs/by-name/si/sirius/package.nix index df4a5a6af8a8..a913e2e9c864 100644 --- a/pkgs/by-name/si/sirius/package.nix +++ b/pkgs/by-name/si/sirius/package.nix @@ -6,6 +6,7 @@ pkg-config, mpi, mpiCheckPhaseHook, + ctestCheckHook, gfortran, blas, lapack, @@ -152,16 +153,14 @@ stdenv.mkDerivation rec { # Can not run parallel checks generally as it requires exactly multiples of 4 MPI ranks # Even cpu_serial tests had to be disabled as they require scalapack routines in the sandbox # and run into the same problem as MPI tests - checkPhase = '' - runHook preCheck - - ctest --output-on-failure --label-exclude integration_test - - runHook postCheck - ''; + checkFlags = [ + "--label-exclude" + "integration_test" + ]; nativeCheckInputs = [ mpiCheckPhaseHook + ctestCheckHook ]; meta = with lib; { From 5eb77369fbf571d4a3379bfc86493c24b5780633 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 20:01:40 +0000 Subject: [PATCH 8/9] eztrace: use ctestCheckHook --- pkgs/by-name/ez/eztrace/package.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ez/eztrace/package.nix b/pkgs/by-name/ez/eztrace/package.nix index a55d917bfde2..6c5a82dde4a1 100644 --- a/pkgs/by-name/ez/eztrace/package.nix +++ b/pkgs/by-name/ez/eztrace/package.nix @@ -9,6 +9,7 @@ libbfd, libopcodes, otf2, + ctestCheckHook, versionCheckHook, }: @@ -54,8 +55,6 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ (lib.cmakeBool "EZTRACE_ENABLE_MEMORY" true) - # This test is somewhat flaky and fails once per several rebuilds. - (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;memory_tests") ]; nativeBuildInputs = [ @@ -72,8 +71,13 @@ stdenv.mkDerivation (finalAttrs: { ]; doCheck = true; + disabledTests = [ + # This test is somewhat flaky and fails once per several rebuilds. + "memory_tests" + ]; nativeCheckInputs = [ otf2 # `otf2-print` needed by compiler_instrumentation_tests,pthread_tests,posixio_tests + ctestCheckHook ]; postInstall = '' From 98968dae5cafb8f1047985411e12fbd4df13686a Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 10 May 2025 20:13:43 +0000 Subject: [PATCH 9/9] eccodes: use ctestCheckHook --- pkgs/development/libraries/eccodes/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/eccodes/default.nix b/pkgs/development/libraries/eccodes/default.nix index 73e55f8f2979..6ca3c51412c8 100644 --- a/pkgs/development/libraries/eccodes/default.nix +++ b/pkgs/development/libraries/eccodes/default.nix @@ -9,6 +9,7 @@ libpng, gfortran, perl, + ctestCheckHook, enablePython ? false, pythonPackages, enablePosixThreads ? false, @@ -65,11 +66,12 @@ stdenv.mkDerivation rec { ]; doCheck = true; - - # Only do tests that don't require downloading 120MB of testdata - checkPhase = '' - ctest -R "eccodes_t_(definitions|calendar|unit_tests|md5|uerra|grib_2nd_order_numValues|julian)" -VV - ''; + nativeCheckInputs = [ ctestCheckHook ]; + checkFlags = [ + "-R" + # Only do tests that don't require downloading 120MB of testdata + "eccodes_t_(definitions|calendar|unit_tests|md5|uerra|grib_2nd_order_numValues|julian)" + ]; meta = with lib; { homepage = "https://confluence.ecmwf.int/display/ECC/";