From 75c2925c57e7c33c769a2d28758d3ef20aafb46f Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 3 Aug 2023 09:47:40 +0100 Subject: [PATCH 1/2] release: give test derivations meaningful names --- release.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 489c6a05b..d2edd8a81 100644 --- a/release.nix +++ b/release.nix @@ -19,6 +19,10 @@ let makeTest = test: let + testName = + builtins.replaceStrings [ ".nix" ] [ "" ] + (builtins.baseNameOf test); + configuration = { config, lib, pkgs, ... }: with lib; @@ -36,7 +40,7 @@ let }; config = { - system.build.run-test = pkgs.runCommand "darwin-test" + system.build.run-test = pkgs.runCommand "darwin-test-${testName}" { allowSubstitutes = false; preferLocalBuild = true; } '' #! ${pkgs.stdenv.shell} From 9d53926782b6c857ebdf9682137068f9cbcdb5d5 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 3 Aug 2023 09:47:58 +0100 Subject: [PATCH 2/2] tests: fix uses of `!` `set -e` does not trigger on negations, so none of these were actually being tested (and one appears to have been incorrectly negated all along). --- tests/checks-nix-gc.nix | 2 +- tests/nixpkgs-overlays.nix | 2 +- tests/services-nix-daemon.nix | 2 +- tests/services-nix-gc.nix | 6 +++--- tests/sockets-nix-daemon.nix | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/checks-nix-gc.nix b/tests/checks-nix-gc.nix index 75700ccbf..e3dccd7f6 100644 --- a/tests/checks-nix-gc.nix +++ b/tests/checks-nix-gc.nix @@ -14,6 +14,6 @@ in echo checking nix-gc service in /Library/LaunchDaemons >&2 grep "org.nixos.nix-gc" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist - ! grep "UserName" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + (! grep "UserName" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist) ''; } diff --git a/tests/nixpkgs-overlays.nix b/tests/nixpkgs-overlays.nix index aa03bf117..59540ac35 100644 --- a/tests/nixpkgs-overlays.nix +++ b/tests/nixpkgs-overlays.nix @@ -10,7 +10,7 @@ test = '' echo checking /bin/hello >&2 - ! ${pkgs.hello}/bin/hello + (! ${pkgs.hello}/bin/hello) ''; } diff --git a/tests/services-nix-daemon.nix b/tests/services-nix-daemon.nix index 5405d01f7..3a217cbb3 100644 --- a/tests/services-nix-daemon.nix +++ b/tests/services-nix-daemon.nix @@ -19,7 +19,7 @@ in grep "&&" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist grep "exec ${nix}/bin/nix-daemon" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist grep "KeepAlive" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist - ! grep "Sockets" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist + (! grep "Sockets" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist) echo checking NIX_SSL_CERT_FILE in nix-daemon service >&2 grep "NIX_SSL_CERT_FILE" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist diff --git a/tests/services-nix-gc.nix b/tests/services-nix-gc.nix index e28c3df2c..4ef26b5ee 100644 --- a/tests/services-nix-gc.nix +++ b/tests/services-nix-gc.nix @@ -15,11 +15,11 @@ in grep "org.nixos.nix-gc" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist grep "exec ${nix}/bin/nix-collect-garbage --delete-older-than 30d" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist grep "UserName" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist - ! grep "nixuser" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + grep "nixuser" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist - ! grep "KeepAlive" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + (! grep "KeepAlive" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist) echo checking nix-gc validation >&2 - ! grep "nix.gc.user = " ${config.out}/activate-user + (! grep "nix.gc.user = " ${config.out}/activate-user) ''; } diff --git a/tests/sockets-nix-daemon.nix b/tests/sockets-nix-daemon.nix index 0eb09a771..606b7b6fd 100644 --- a/tests/sockets-nix-daemon.nix +++ b/tests/sockets-nix-daemon.nix @@ -16,7 +16,7 @@ in grep "/bin/wait4path" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist grep "&&" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist grep "exec ${nix}/bin/nix-daemon" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist - ! grep "KeepAlive" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist + (! grep "KeepAlive" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist) grep "Sockets" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist grep "/nix/var/nix/daemon-socket/socket" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist '';