Author: shlevy Date: Wed Sep 14 05:59:29 2011 New Revision: 29266 URL: https://ssl.nixos.org/websvn/nix/?rev=29266&sc=1
Log: Add a test for multiple outputs This currently fails. Yay test-driven development! Added: nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.a.builder.sh nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.b.builder.sh nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.nix nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.sh Modified: nix/branches/multiple-outputs-sandbox/tests/Makefile.am Modified: nix/branches/multiple-outputs-sandbox/tests/Makefile.am ============================================================================== --- nix/branches/multiple-outputs-sandbox/tests/Makefile.am Wed Sep 14 05:59:17 2011 (r29265) +++ nix/branches/multiple-outputs-sandbox/tests/Makefile.am Wed Sep 14 05:59:29 2011 (r29266) @@ -8,7 +8,7 @@ referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \ gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \ remote-store.sh export.sh export-graph.sh negative-caching.sh \ - binary-patching.sh timeout.sh secure-drv-outputs.sh + binary-patching.sh timeout.sh secure-drv-outputs.sh multiple-outputs.sh XFAIL_TESTS = @@ -35,6 +35,8 @@ binary-patching.nix \ timeout.nix timeout.builder.sh \ secure-drv-outputs.nix \ + multiple-outputs.nix \ + multiple-outputs.a.builder.sh multiple-outputs.b.builder.sh \ $(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) $(wildcard lang/dir*/*.nix) \ common.sh.in Added: nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.a.builder.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.a.builder.sh Wed Sep 14 05:59:29 2011 (r29266) @@ -0,0 +1,6 @@ +mkdir $first +mkdir $second +test -z $all + +echo "second" > $first/file +echo "first" > $second/file Added: nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.b.builder.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.b.builder.sh Wed Sep 14 05:59:29 2011 (r29266) @@ -0,0 +1,7 @@ +mkdir $out +test "$firstOutput $secondOutput" = "$allOutputs" +test "$defaultOutput" = "$firstOutput" +test "$(cat $first/file)" = "second" +test "$(cat $second/file)" = "first" + +echo "success" > $out/file Added: nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.nix ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.nix Wed Sep 14 05:59:29 2011 (r29266) @@ -0,0 +1,23 @@ +with import ./config.nix; + +let + + a = mkDerivation { + name = "multiple-outputs-a"; + outputs = [ "first" "second" ]; + builder = ./multiple-outputs.a.builder.sh; + helloString = "Hello, world!"; + }; + +in + +assert a.second.helloString == "Hello, world!"; + +mkDerivation { + defaultOutput = a; + firstOutput = a.first.first; + secondOutput = a.second.first.first.second.second.first.second; + allOutputs = a.all; + name = "multiple-outputs-b"; + builder = ./multiple-outputs.b.builder.sh; +} Added: nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ nix/branches/multiple-outputs-sandbox/tests/multiple-outputs.sh Wed Sep 14 05:59:29 2011 (r29266) @@ -0,0 +1,15 @@ +source common.sh + +echo "Testing multiple outputs..." + +drvPath=$($nixinstantiate multiple-outputs.nix) + +echo "derivation is $drvPath" + +outPath=$($nixstore -rvv "$drvPath") + +echo "output path is $outPath" + +text=$(cat "$outPath"/file) +if test "$text" != "success"; then exit 1; fi + _______________________________________________ nix-commits mailing list nix-comm...@cs.uu.nl http://mail.cs.uu.nl/mailman/listinfo/nix-commits