From a05de58ebd581c47f4f985efab7236574aa0f842 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 8 Jun 2024 04:20:00 +0000 Subject: tests: fix daemon version in isDaemonNewer function Since ad8a4b380e, the version printer returns "nix (Lix, like Nix) 2.x", hence the `daemonVersion` was being set to the string "like". Using `compareVersions` with a letter compares them lexicographically: builtins.compareVersions "like" "2.12pre20230103" // => -1 builtins.compareVersions "like" "2.16.0" // => -1 This caused that `isDaemonNewer` always returned 1, falsy in Bash terms. Therefore, the test suite skipped those tests where they use it. Fixes https://git.lix.systems/lix-project/lix/issues/324 Change-Id: If6682515bf0bf8b8add641af9a4e98b50a9acb51 --- tests/functional/common/vars-and-functions.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/functional/common/vars-and-functions.sh.in') diff --git a/tests/functional/common/vars-and-functions.sh.in b/tests/functional/common/vars-and-functions.sh.in index 3b343b720..bd1990973 100644 --- a/tests/functional/common/vars-and-functions.sh.in +++ b/tests/functional/common/vars-and-functions.sh.in @@ -146,7 +146,8 @@ fi isDaemonNewer () { [[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0 local requiredVersion="$1" - local daemonVersion=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version | cut -d' ' -f3) + local versionOutput=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version) + local daemonVersion=${versionOutput##* } [[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]] } -- cgit v1.2.3