diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-12-04T13·47+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-12-04T13·47+0100 |
commit | b215b23e9ee481dff55f8f0acf1232f608e5babb (patch) | |
tree | 3f1e861f508a57a2be8512423e988cc4a69832f0 | |
parent | 56d29dcd62ff5ff65b24da335a5119179c191806 (diff) |
Test priorities
-rw-r--r-- | tests/user-envs.builder.sh | 1 | ||||
-rw-r--r-- | tests/user-envs.nix | 1 | ||||
-rw-r--r-- | tests/user-envs.sh | 15 |
3 files changed, 13 insertions, 4 deletions
diff --git a/tests/user-envs.builder.sh b/tests/user-envs.builder.sh index c5af9ed8dd92..5fafa797f11e 100644 --- a/tests/user-envs.builder.sh +++ b/tests/user-envs.builder.sh @@ -3,4 +3,3 @@ mkdir $out/bin echo "#! $shell" > $out/bin/$progName echo "echo $name" >> $out/bin/$progName chmod +x $out/bin/$progName - diff --git a/tests/user-envs.nix b/tests/user-envs.nix index e2afd92f00ff..1aa410cc9680 100644 --- a/tests/user-envs.nix +++ b/tests/user-envs.nix @@ -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; }) ] diff --git a/tests/user-envs.sh b/tests/user-envs.sh index 465d2fc55d99..fa24d49df9c0 100644 --- a/tests/user-envs.sh +++ b/tests/user-envs.sh @@ -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" ] |