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; 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"; diff --git a/pkgs/by-name/cc/ccache/package.nix b/pkgs/by-name/cc/ccache/package.nix index 29a286570bae..00162a46eb58 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?) + "test.fileclone" # flaky on hydra, also seems to fail on zfs + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "test.basedir" + "test.multi_arch" + "test.nocpp2" + ]; passthru = { # A derivation that provides gcc and g++ commands, but that 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 = '' 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 = '' 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; { 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 '' 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/";