Test priorities

This commit is contained in:
Eelco Dolstra 2012-12-04 14:47:50 +01:00
parent 56d29dcd62
commit b215b23e9e
3 changed files with 13 additions and 4 deletions

View file

@ -3,4 +3,3 @@ mkdir $out/bin
echo "#! $shell" > $out/bin/$progName
echo "echo $name" >> $out/bin/$progName
chmod +x $out/bin/$progName

View file

@ -25,4 +25,5 @@ in
(makeDrv "bar-0.1" "bar")
(makeDrv "foo-2.0" "foo")
(makeDrv "bar-0.1.1" "bar")
(makeDrv "foo-0.1" "foo" // { meta.priority = 10; })
]

View file

@ -8,7 +8,7 @@ set -x
test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 0
# Query available: should contain several.
test "$(nix-env -p $profiles/test -f ./user-envs.nix -qa '*' | wc -l)" -eq 5
test "$(nix-env -p $profiles/test -f ./user-envs.nix -qa '*' | wc -l)" -eq 6
# Query descriptions.
nix-env -p $profiles/test -f ./user-envs.nix -qa '*' --description | grep silly
@ -98,7 +98,7 @@ nix-env -p $profiles/test --delete-generations old
# foo-1.0.
nix-collect-garbage
test -e "$outPath10"
if test -e "$outPath20"; then false; fi
! [ -e "$outPath20" ]
# Uninstall everything
nix-env -p $profiles/test -f ./user-envs.nix -e '*'
@ -112,7 +112,7 @@ nix-env -p $profiles/test -q '*' | grep -q foo-2.0
# On the other hand, this should install both (and should fail due to
# a collision).
nix-env -p $profiles/test -f ./user-envs.nix -e '*'
if nix-env -p $profiles/test -f ./user-envs.nix -i foo-1.0 foo-2.0; then false; fi
! nix-env -p $profiles/test -f ./user-envs.nix -i foo-1.0 foo-2.0
# Installing "*" should install one foo and one bar.
nix-env -p $profiles/test -f ./user-envs.nix -e '*'
@ -120,3 +120,12 @@ nix-env -p $profiles/test -f ./user-envs.nix -i '*'
test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 2
nix-env -p $profiles/test -q '*' | grep -q foo-2.0
nix-env -p $profiles/test -q '*' | grep -q bar-0.1.1
# Test priorities: foo-0.1 has a lower priority than foo-1.0, so it
# should be possible to install both without a collision. Also test
# --set-flag priority to manually override the declared priorities.
nix-env -p $profiles/test -f ./user-envs.nix -e '*'
nix-env -p $profiles/test -f ./user-envs.nix -i foo-0.1 foo-1.0
[ "$($profiles/test/bin/foo)" = "foo-1.0" ]
nix-env -p $profiles/test -f ./user-envs.nix --set-flag priority 1 foo-0.1
[ "$($profiles/test/bin/foo)" = "foo-0.1" ]