Add a test for multiple outputs
This currently fails. Yay test-driven development!
This commit is contained in:
parent
c172d16b00
commit
8f28a3ba25
|
@ -8,7 +8,7 @@ TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \
|
|||
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 @@ EXTRA_DIST = $(TESTS) \
|
|||
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
|
||||
|
||||
|
|
6
tests/multiple-outputs.a.builder.sh
Normal file
6
tests/multiple-outputs.a.builder.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
mkdir $first
|
||||
mkdir $second
|
||||
test -z $all
|
||||
|
||||
echo "second" > $first/file
|
||||
echo "first" > $second/file
|
7
tests/multiple-outputs.b.builder.sh
Normal file
7
tests/multiple-outputs.b.builder.sh
Normal file
|
@ -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
|
23
tests/multiple-outputs.nix
Normal file
23
tests/multiple-outputs.nix
Normal file
|
@ -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;
|
||||
}
|
15
tests/multiple-outputs.sh
Normal file
15
tests/multiple-outputs.sh
Normal file
|
@ -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
|
||||
|
Loading…
Reference in a new issue