tests: verify that NIX_DAEMON_PACKAGE's version looks like a version
Followup to https://gerrit.lix.systems/c/lix/+/1417 to ensure that this
parser will never take something that doesn't look like a version.
It turns out this problem is less alarming than initially thought
because it only applies to the testsuite in a non-default mode.
Change-Id: I26aba24aaf0215f2b782966314b94784db766266
This commit is contained in:
parent
6939ffc9f9
commit
d9345d8836
|
@ -144,11 +144,15 @@ if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
isDaemonNewer () {
|
isDaemonNewer () {
|
||||||
[[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0
|
[[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0
|
||||||
local requiredVersion="$1"
|
local requiredVersion="$1"
|
||||||
local versionOutput=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version)
|
local versionOutput
|
||||||
local daemonVersion=${versionOutput##* }
|
versionOutput=$("$NIX_DAEMON_PACKAGE/bin/nix" daemon --version)
|
||||||
[[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]]
|
local daemonVersion=${versionOutput##* }
|
||||||
|
if [[ ! $daemonVersion =~ [[:digit:]]+\.[[:digit:]]+\..* ]]; then
|
||||||
|
fail "Daemon version '$daemonVersion' does not look plausible, this is a testsuite bug!"
|
||||||
|
fi
|
||||||
|
[[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
skipTest () {
|
skipTest () {
|
||||||
|
|
Loading…
Reference in a new issue