aboutsummaryrefslogtreecommitdiff
path: root/package.nix
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-03-25 12:12:56 -0600
committerQyriad <qyriad@qyriad.me>2024-03-27 18:37:50 -0600
commit038daad2182a22c81861ee7cbb5f0c85f6bb16ba (patch)
tree653f303e26bd99106a4d39d5cb9f880d4ba0a0a3 /package.nix
parentedba570664b952facde43fd0414e60f0a42851da (diff)
meson: implement functional tests
Functional tests can be run with `meson test -C build --suite installcheck`. Notably, functional tests must be run *after* running `meson install` (Lix's derivation runs the installcheck suite in installCheckPhase so it does this correctly), due to some quirks between Meson and the testing system. As far as I can tell the functional tests are meant to be run after installing anyway, but unfortunately I can't transparently make `meson test --suite installcheck` depend on the install targets. The script that runs the functional tests, meson/run-test.py, checks that `meson install` has happened and fails fast with a (hopefully) helpful error message if any of the functional tests are run before installing. TODO: this change needs reflection in developer documentation Change-Id: I8dcb5fdfc0b6cb17580973d24ad930abd57018f6
Diffstat (limited to 'package.nix')
-rw-r--r--package.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/package.nix b/package.nix
index 3c4971605..14451a969 100644
--- a/package.nix
+++ b/package.nix
@@ -101,7 +101,8 @@
] ++ lib.optionals buildWithMeson [
./meson.build
./meson.options
- ./meson/cleanup-install.bash
+ ./meson
+ ./scripts/meson.build
]);
functionalTestFiles = fileset.unions [
@@ -279,10 +280,21 @@ in stdenv.mkDerivation (finalAttrs: {
installCheckFlags = "sysconfdir=$(out)/etc";
installCheckTarget = "installcheck"; # work around buggy detection in stdenv
+ mesonInstallCheckFlags = [
+ "--suite=installcheck"
+ ];
+
preInstallCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
'';
+ installCheckPhase = lib.optionalString buildWithMeson ''
+ runHook preInstallCheck
+ flagsArray=($mesonInstallCheckFlags "''${mesonInstallCheckFlagsArray[@]}")
+ meson test --no-rebuild "''${flagsArray[@]}"
+ runHook postInstallCheck
+ '';
+
separateDebugInfo = !stdenv.hostPlatform.isStatic && !finalAttrs.dontBuild;
strictDeps = true;