From 99c8e7a48d0ee6eadc4df6859f212076802c9fa6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Jan 2020 16:34:37 +0100 Subject: Simplify flake tests --- tests/flakes.sh | 131 ++++++++++++++++++++++++++++---------------------------- tests/init.sh | 1 + 2 files changed, 66 insertions(+), 66 deletions(-) (limited to 'tests') diff --git a/tests/flakes.sh b/tests/flakes.sh index 41f123883..283c2e397 100644 --- a/tests/flakes.sh +++ b/tests/flakes.sh @@ -114,52 +114,52 @@ cat > $registry <&1 | grep 'unsupported edition' +nix build -o $TEST_ROOT/result $flake3Dir#sth 2>&1 | grep 'unsupported edition' # Test whether registry caching works. nix flake list --flake-registry file://$registry | grep -q flake3 @@ -224,12 +223,12 @@ mv $registry.tmp $registry # Test whether flakes are registered as GC roots for offline use. # FIXME: use tarballs rather than git. rm -rf $TEST_HOME/.cache -_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result --flake-registry file://$registry git+file://$flake2Dir#bar +_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result git+file://$flake2Dir#bar mv $flake1Dir $flake1Dir.tmp mv $flake2Dir $flake2Dir.tmp nix-store --gc -_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result --flake-registry file://$registry git+file://$flake2Dir#bar -_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result --flake-registry file://$registry git+file://$flake2Dir#bar --tarball-ttl 0 +_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result git+file://$flake2Dir#bar +_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result git+file://$flake2Dir#bar --tarball-ttl 0 mv $flake1Dir.tmp $flake1Dir mv $flake2Dir.tmp $flake2Dir @@ -274,13 +273,13 @@ git -C $flake3Dir commit -m 'Add nonFlakeInputs' # Check whether `nix build` works with a lockfile which is missing a # nonFlakeInputs. -nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir#sth +nix build -o $TEST_ROOT/result $flake3Dir#sth git -C $flake3Dir add flake.lock git -C $flake3Dir commit -m 'Update nonFlakeInputs' -nix build -o $TEST_ROOT/result --flake-registry $registry flake3#fnord +nix build -o $TEST_ROOT/result flake3#fnord [[ $(cat $TEST_ROOT/result) = FNORD ]] # Check whether flake input fetching is lazy: flake3#sth does not @@ -289,21 +288,21 @@ rm -rf $TEST_HOME/.cache clearStore mv $flake2Dir $flake2Dir.tmp mv $nonFlakeDir $nonFlakeDir.tmp -nix build -o $TEST_ROOT/result --flake-registry $registry flake3#sth -(! nix build -o $TEST_ROOT/result --flake-registry $registry flake3#xyzzy) -(! nix build -o $TEST_ROOT/result --flake-registry $registry flake3#fnord) +nix build -o $TEST_ROOT/result flake3#sth +(! nix build -o $TEST_ROOT/result flake3#xyzzy) +(! nix build -o $TEST_ROOT/result flake3#fnord) mv $flake2Dir.tmp $flake2Dir mv $nonFlakeDir.tmp $nonFlakeDir -nix build -o $TEST_ROOT/result --flake-registry $registry flake3#xyzzy flake3#fnord +nix build -o $TEST_ROOT/result flake3#xyzzy flake3#fnord # Test doing multiple `lookupFlake`s -nix build -o $TEST_ROOT/result --flake-registry $registry flake4#xyzzy +nix build -o $TEST_ROOT/result flake4#xyzzy # Test 'nix flake update' and --override-flake. -nix flake update --flake-registry $registry $flake3Dir +nix flake update $flake3Dir [[ -z $(git -C $flake3Dir diff master) ]] -nix flake update --flake-registry $registry $flake3Dir --recreate-lock-file --override-flake flake2 nixpkgs +nix flake update $flake3Dir --recreate-lock-file --override-flake flake2 nixpkgs [[ ! -z $(git -C $flake3Dir diff master) ]] # Make branch "removeXyzzy" where flake3 doesn't have xyzzy anymore @@ -342,29 +341,29 @@ git -C $flake3Dir commit -m 'Remove packages.xyzzy' git -C $flake3Dir checkout master # Test whether fuzzy-matching works for IsAlias -(! nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy#xyzzy) +(! nix build -o $TEST_ROOT/result flake4/removeXyzzy#xyzzy) # Test whether fuzzy-matching works for IsGit -(! nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy#xyzzy) -nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy#sth +(! nix build -o $TEST_ROOT/result flake4/removeXyzzy#xyzzy) +nix build -o $TEST_ROOT/result flake4/removeXyzzy#sth # Testing the nix CLI -nix flake add --flake-registry $registry flake1 flake3 -(( $(nix flake list --flake-registry $registry | wc -l) == 7 )) -nix flake pin --flake-registry $registry flake1 -(( $(nix flake list --flake-registry $registry | wc -l) == 7 )) -nix flake remove --flake-registry $registry flake1 -(( $(nix flake list --flake-registry $registry | wc -l) == 6 )) +nix flake add flake1 flake3 +(( $(nix flake list | wc -l) == 7 )) +nix flake pin flake1 +(( $(nix flake list | wc -l) == 7 )) +nix flake remove flake1 +(( $(nix flake list | wc -l) == 6 )) # Test 'nix flake init'. (cd $flake7Dir && nix flake init) git -C $flake7Dir add flake.nix -nix flake --flake-registry $registry check $flake7Dir +nix flake check $flake7Dir git -C $flake7Dir commit -m 'Initial' # Test 'nix flake clone'. rm -rf $TEST_ROOT/flake1-v2 -nix flake clone --flake-registry $registry flake1 --dest $TEST_ROOT/flake1-v2 +nix flake clone flake1 --dest $TEST_ROOT/flake1-v2 [ -e $TEST_ROOT/flake1-v2/flake.nix ] # More 'nix flake check' tests. @@ -379,7 +378,7 @@ cat > $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix <