* Refactoring: renamed *.nix.in to *.nix.

This commit is contained in:
Eelco Dolstra 2009-03-17 17:11:55 +00:00
parent 2d5114452d
commit 51e7e32c3b
22 changed files with 209 additions and 264 deletions

View file

@ -2,18 +2,6 @@ TESTS_ENVIRONMENT = $(SHELL) -e
extra1 = $(shell pwd)/test-tmp/shared
simple.sh substitutes.sh substitutes2.sh fallback.sh: simple.nix
dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh nix-build.sh install-package.sh check-refs.sh export-graph.sh: config.nix
locking.sh: locking.nix
parallel.sh: parallel.nix
build-hook.sh: build-hook.nix
gc-concurrent.sh: gc-concurrent.nix gc-concurrent2.nix simple.nix
user-envs.sh: user-envs.nix
fixed.sh: fixed.nix
gc-runtime.sh: gc-runtime.nix
check-refs.sh: check-refs.nix
filter-source.sh: filter-source.nix
TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \
locking.sh parallel.sh build-hook.sh substitutes.sh substitutes2.sh \
fallback.sh nix-push.sh gc.sh gc-concurrent.sh verify.sh nix-pull.sh \
@ -25,22 +13,22 @@ XFAIL_TESTS =
include ../substitute.mk
$(TESTS): common.sh
$(TESTS): common.sh config.nix
EXTRA_DIST = $(TESTS) \
simple.nix.in simple.builder.sh \
simple.nix simple.builder.sh \
hash-check.nix \
dependencies.nix dependencies.builder*.sh \
locking.nix.in locking.builder.sh \
parallel.nix.in parallel.builder.sh \
build-hook.nix.in build-hook.hook.sh \
locking.nix locking.builder.sh \
parallel.nix parallel.builder.sh \
build-hook.nix build-hook.hook.sh \
substituter.sh substituter2.sh \
gc-concurrent.nix.in gc-concurrent.builder.sh \
gc-concurrent2.nix.in gc-concurrent2.builder.sh \
user-envs.nix.in user-envs.builder.sh \
fixed.nix.in fixed.builder1.sh fixed.builder2.sh \
gc-runtime.nix.in \
check-refs.nix.in \
filter-source.nix.in \
gc-concurrent.nix gc-concurrent.builder.sh gc-concurrent2.builder.sh \
user-envs.nix user-envs.builder.sh \
fixed.nix fixed.builder1.sh fixed.builder2.sh \
gc-runtime.nix \
check-refs.nix \
filter-source.nix \
export-graph.nix \
$(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) \
common.sh.in

21
tests/build-hook.nix Normal file
View file

@ -0,0 +1,21 @@
with import ./config.nix;
let
input1 = mkDerivation {
name = "build-hook-input-1";
builder = ./dependencies.builder1.sh;
};
input2 = mkDerivation {
name = "build-hook-input-2";
builder = ./dependencies.builder2.sh;
};
in
mkDerivation {
name = "build-hook";
builder = ./dependencies.builder0.sh;
inherit input1 input2;
}

View file

@ -1,28 +0,0 @@
let {
input1 = derivation {
name = "build-hook-input-1";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./dependencies.builder1.sh];
PATH = "@testPath@";
};
input2 = derivation {
name = "build-hook-input-2";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./dependencies.builder2.sh];
PATH = "@testPath@";
};
body = derivation {
name = "build-hook";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./dependencies.builder0.sh];
PATH = "@testPath@";
inherit input1 input2;
};
}

58
tests/check-refs.nix Normal file
View file

@ -0,0 +1,58 @@
with import ./config.nix;
rec {
dep = import ./dependencies.nix;
makeTest = nr: args: mkDerivation ({
name = "check-refs-" + toString nr;
} // args);
src = builtins.toFile "aux-ref" "bla bla";
test1 = makeTest 1 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
inherit dep;
};
test2 = makeTest 2 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s ${src} $out/link";
inherit dep;
};
test3 = makeTest 3 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
allowedReferences = [];
inherit dep;
};
test4 = makeTest 4 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
allowedReferences = [dep];
inherit dep;
};
test5 = makeTest 5 {
builder = builtins.toFile "builder.sh" "mkdir $out";
allowedReferences = [];
inherit dep;
};
test6 = makeTest 6 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link";
allowedReferences = [];
inherit dep;
};
test7 = makeTest 7 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link";
allowedReferences = ["out"];
inherit dep;
};
test8 = makeTest 8 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s ${test1} $out/link";
inherit dep;
};
}

View file

@ -1,59 +0,0 @@
rec {
dep = import ./dependencies.nix;
makeTest = nr: args: derivation ({
name = "check-refs-" + toString nr;
system = "@system@";
builder = "@shell@";
PATH = "@testPath@";
} // args);
src = builtins.toFile "aux-ref" "bla bla";
test1 = makeTest 1 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link")];
inherit dep;
};
test2 = makeTest 2 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s ${src} $out/link")];
inherit dep;
};
test3 = makeTest 3 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link")];
allowedReferences = [];
inherit dep;
};
test4 = makeTest 4 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link")];
allowedReferences = [dep];
inherit dep;
};
test5 = makeTest 5 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out")];
allowedReferences = [];
inherit dep;
};
test6 = makeTest 6 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link")];
allowedReferences = [];
inherit dep;
};
test7 = makeTest 7 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link")];
allowedReferences = ["out"];
inherit dep;
};
test8 = makeTest 8 {
args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s ${test1} $out/link")];
inherit dep;
};
}

View file

@ -1,9 +1,17 @@
{
rec {
shell = "@shell@";
path = "@testPath@";
system = "@system@";
shared = "@extra1@";
mkDerivation = args:
derivation ({
system = "@system@";
builder = "@shell@";
inherit system;
builder = shell;
args = ["-e" args.builder];
PATH = "@testPath@";
PATH = path;
} // removeAttrs args ["builder"]);
}

View file

@ -4,7 +4,6 @@ rec {
buildGraphBuilder = builtins.toFile "build-graph-builder"
''
#cat refs
while read path; do
read drv
read nrRefs

View file

@ -1,8 +1,8 @@
derivation {
with import ./config.nix;
mkDerivation {
name = "filter";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" (builtins.toFile "builder" "PATH=@testPath@; ln -s $input $out")];
builder = builtins.toFile "builder" "ln -s $input $out";
input =
let filter = path: type:
type != "symlink"

View file

@ -1,14 +1,13 @@
with import ./config.nix;
rec {
f2 = dummy: builder: mode: algo: hash: derivation {
f2 = dummy: builder: mode: algo: hash: mkDerivation {
name = "fixed";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" builder];
inherit builder;
outputHashMode = mode;
outputHashAlgo = algo;
outputHash = hash;
PATH = "@testPath@";
inherit dummy;
impureEnvVars = ["IMPURE_VAR1" "IMPURE_VAR2"];
};

27
tests/gc-concurrent.nix Normal file
View file

@ -0,0 +1,27 @@
with import ./config.nix;
rec {
input1 = mkDerivation {
name = "dependencies-input-1";
builder = ./dependencies.builder1.sh;
};
input2 = mkDerivation {
name = "dependencies-input-2";
builder = ./dependencies.builder2.sh;
};
test1 = mkDerivation {
name = "gc-concurrent";
builder = ./gc-concurrent.builder.sh;
inherit input1 input2;
};
test2 = mkDerivation {
name = "gc-concurrent2";
builder = ./gc-concurrent2.builder.sh;
inherit input1 input2;
};
}

View file

@ -1,28 +0,0 @@
let {
input1 = derivation {
name = "dependencies-input-1";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./dependencies.builder1.sh];
PATH = "@testPath@";
};
input2 = derivation {
name = "dependencies-input-2";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./dependencies.builder2.sh];
PATH = "@testPath@";
};
body = derivation {
name = "gc-concurrent";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./gc-concurrent.builder.sh];
PATH = "@testPath@";
inherit input1 input2;
};
}

View file

@ -2,10 +2,10 @@ source common.sh
$NIX_BIN_DIR/nix-collect-garbage -vvvvv
drvPath1=$($nixinstantiate gc-concurrent.nix)
drvPath1=$($nixinstantiate gc-concurrent.nix -A test1)
outPath1=$($nixstore -q $drvPath1)
drvPath2=$($nixinstantiate gc-concurrent2.nix)
drvPath2=$($nixinstantiate gc-concurrent.nix -A test2)
outPath2=$($nixstore -q $drvPath2)
drvPath3=$($nixinstantiate simple.nix)

View file

@ -1,28 +0,0 @@
let {
input1 = derivation {
name = "dependencies-input-1";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./dependencies.builder1.sh];
PATH = "@testPath@";
};
input2 = derivation {
name = "dependencies-input-2";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./dependencies.builder2.sh];
PATH = "@testPath@";
};
body = derivation {
name = "gc-concurrent2";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./gc-concurrent2.builder.sh];
PATH = "@testPath@";
inherit input1 input2;
};
}

17
tests/gc-runtime.nix Normal file
View file

@ -0,0 +1,17 @@
with import ./config.nix;
mkDerivation {
name = "gc-runtime";
builder =
# Test inline source file definitions.
builtins.toFile "builder.sh" ''
mkdir $out
cat > $out/program <<EOF
#! ${shell}
sleep 10000
EOF
chmod +x $out/program
'';
}

View file

@ -1,23 +0,0 @@
let {
# Test inline source file definitions.
builder = builtins.toFile "builder.sh" "
mkdir $out
cat > $out/program <<EOF
#! @shell@
sleep 10000
EOF
chmod +x $out/program
";
body = derivation {
name = "gc-runtime";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" builder];
PATH = "@testPath@";
};
}

17
tests/locking.nix Normal file
View file

@ -0,0 +1,17 @@
with import ./config.nix;
let
mkDrv = text: inputs: mkDerivation {
name = "locking";
builder = ./locking.builder.sh;
inherit text inputs;
};
a = mkDrv "a" [];
b = mkDrv "b" [a];
c = mkDrv "c" [a b];
d = mkDrv "d" [a];
e = mkDrv "e" [c d];
in e

View file

@ -1,19 +0,0 @@
let {
mkDrv = text: inputs: derivation {
name = "locking";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./locking.builder.sh];
PATH = "@testPath@";
inherit text inputs;
};
a = mkDrv "a" [];
b = mkDrv "b" [a];
c = mkDrv "c" [a b];
d = mkDrv "d" [a];
e = mkDrv "e" [c d];
body = e;
}

17
tests/parallel.nix Normal file
View file

@ -0,0 +1,17 @@
with import ./config.nix;
let
mkDrv = text: inputs: mkDerivation {
name = "parallel";
builder = ./parallel.builder.sh;
inherit text inputs shared;
};
a = mkDrv "a" [];
b = mkDrv "b" [a];
c = mkDrv "c" [a];
d = mkDrv "d" [a];
e = mkDrv "e" [b c d];
in e

View file

@ -1,20 +0,0 @@
let {
mkDrv = text: inputs: derivation {
name = "parallel";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./parallel.builder.sh];
PATH = "@testPath@";
shared = "@extra1@";
inherit text inputs;
};
a = mkDrv "a" [];
b = mkDrv "b" [a];
c = mkDrv "c" [a];
d = mkDrv "d" [a];
e = mkDrv "e" [b c d];
body = e;
}

8
tests/simple.nix Normal file
View file

@ -0,0 +1,8 @@
with import ./config.nix;
mkDerivation {
name = "simple";
builder = ./simple.builder.sh;
PATH = "";
goodPath = path;
}

View file

@ -1,7 +0,0 @@
derivation {
name = "simple";
system = "@system@";
builder = "@shell@";
args = ["-e" "-x" ./simple.builder.sh];
goodPath = "@testPath@";
}

View file

@ -1,30 +1,28 @@
# Some dummy arguments...
{ system ? "@system@"
, foo ? "foo"
{ foo ? "foo"
}:
with import ./config.nix;
assert foo == "foo";
let {
let
makeDrv = name: progName: (derivation {
makeDrv = name: progName: (mkDerivation {
inherit name progName system;
builder = "@shell@";
shell = "@shell@";
args = ["-e" "-x" ./user-envs.builder.sh];
PATH = "@testPath@";
builder = ./user-envs.builder.sh;
} // {
meta = {
description = "A silly test package";
};
});
body = [
in
[
(makeDrv "foo-1.0" "foo")
(makeDrv "foo-2.0pre1" "foo")
(makeDrv "bar-0.1" "bar")
(makeDrv "foo-2.0" "foo")
(makeDrv "bar-0.1.1" "bar")
];
}
]