treewide: use ctestCheckHook (part 1) (#406011)

This commit is contained in:
Ben Siraphob
2025-05-13 15:22:29 -04:00
committed by GitHub
8 changed files with 52 additions and 59 deletions

View File

@@ -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;

View File

@@ -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";

View File

@@ -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

View File

@@ -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 = ''

View File

@@ -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 = ''

View File

@@ -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; {

View File

@@ -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 ''

View File

@@ -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/";