From aecb34b42c8bfea097c3269b2b673e839ad8edd3 Mon Sep 17 00:00:00 2001 From: Lin Yinfeng Date: Sat, 6 Dec 2025 02:39:43 +0800 Subject: [PATCH] nixosTests.angrr: fix test 1. Starting from v0.1.4, the tool only monitors `result.*` and `.direnv/.*` GC roots. Modify paths to reflect this change. 2. `test ! -f /path/to/symlink` always succeed because symbol links are not regular file. Replace all `test ! -f` with `test ! -e`. --- nixos/tests/angrr.nix | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/nixos/tests/angrr.nix b/nixos/tests/angrr.nix index e4bca782a1ac..2c2baefd8e86 100644 --- a/nixos/tests/angrr.nix +++ b/nixos/tests/angrr.nix @@ -32,38 +32,38 @@ # Creates some auto gc roots # Use /run/current-system so that we do not need to build anything new - machine.succeed("nix build /run/current-system --out-link /tmp/root-auto-gc-root-1") - machine.succeed("nix build /run/current-system --out-link /tmp/root-auto-gc-root-2") - machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/user-auto-gc-root-1'") - machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/user-auto-gc-root-2'") + machine.succeed("nix build /run/current-system --out-link /tmp/result-root-auto-gc-root-1") + machine.succeed("nix build /run/current-system --out-link /tmp/result-root-auto-gc-root-2") + machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/result-user-auto-gc-root-1'") + machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/result-user-auto-gc-root-2'") machine.systemctl("start nix-gc.service") # Not auto gc root will be removed - machine.succeed("readlink /tmp/root-auto-gc-root-1") - machine.succeed("readlink /tmp/root-auto-gc-root-2") - machine.succeed("readlink /tmp/user-auto-gc-root-1") - machine.succeed("readlink /tmp/user-auto-gc-root-2") + machine.succeed("readlink /tmp/result-root-auto-gc-root-1") + machine.succeed("readlink /tmp/result-root-auto-gc-root-2") + machine.succeed("readlink /tmp/result-user-auto-gc-root-1") + machine.succeed("readlink /tmp/result-user-auto-gc-root-2") # Change time to 8 days after (greater than 7d) machine.succeed("date -s '8 days'") # Touch GC roots `-2` - machine.succeed("touch /tmp/root-auto-gc-root-2 --no-dereference") - machine.succeed("touch /tmp/user-auto-gc-root-2 --no-dereference") + machine.succeed("touch /tmp/result-root-auto-gc-root-2 --no-dereference") + machine.succeed("touch /tmp/result-user-auto-gc-root-2 --no-dereference") machine.systemctl("start nix-gc.service") # Only GC roots `-1` are removed - machine.succeed("test ! -f /tmp/root-auto-gc-root-1") - machine.succeed("readlink /tmp/root-auto-gc-root-2") - machine.succeed("test ! -f /tmp/user-auto-gc-root-1") - machine.succeed("readlink /tmp/user-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-root-auto-gc-root-1") + machine.succeed("readlink /tmp/result-root-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-user-auto-gc-root-1") + machine.succeed("readlink /tmp/result-user-auto-gc-root-2") # Change time again machine.succeed("date -s '8 days'") machine.systemctl("start nix-gc.service") # All auto GC roots are removed - machine.succeed("test ! -f /tmp/root-auto-gc-root-2") - machine.succeed("test ! -f /tmp/user-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-root-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-user-auto-gc-root-2") # Direnv integration test machine.succeed("mkdir /tmp/test-direnv") @@ -74,7 +74,7 @@ # The root will be removed if we does not use the direnv recently machine.succeed("date -s '8 days'") machine.systemctl("start nix-gc.service") - machine.succeed("test ! -f /tmp/test-direnv/.direnv/gc-root") + machine.succeed("test ! -e /tmp/test-direnv/.direnv/gc-root") # Recreate the root machine.succeed("nix build /run/current-system --out-link /tmp/test-direnv/.direnv/gc-root")