forked from lix-project/lix
* Remove ancient Fix tests.
* Add automated Nix expression language tests.
This commit is contained in:
parent
f09618b63a
commit
463e2817c5
|
@ -1,11 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
|
|
||||||
IFS=
|
|
||||||
|
|
||||||
echo "printing list of args"
|
|
||||||
|
|
||||||
for i in $@; do
|
|
||||||
echo "arg: $i"
|
|
||||||
done
|
|
||||||
|
|
||||||
touch $out
|
|
|
@ -1,7 +0,0 @@
|
||||||
Package(
|
|
||||||
[ ("name", "args")
|
|
||||||
, ("build", Relative("args/args-build.sh"))
|
|
||||||
|
|
||||||
, ("args", ["1", "2", "3", IncludeFix("slow2/slow.fix")])
|
|
||||||
]
|
|
||||||
)
|
|
|
@ -1,9 +0,0 @@
|
||||||
Call(
|
|
||||||
Function(["x"],
|
|
||||||
Call(
|
|
||||||
Function(["x"], Var("x")),
|
|
||||||
[ ("x", Var("x")) ]
|
|
||||||
)
|
|
||||||
),
|
|
||||||
[ ("x", True) ]
|
|
||||||
)
|
|
|
@ -1,9 +0,0 @@
|
||||||
Call(
|
|
||||||
Function(["x"],
|
|
||||||
Call(
|
|
||||||
Function(["y", "z"], Var("y")),
|
|
||||||
[ ("y", Var("x")) ]
|
|
||||||
)
|
|
||||||
),
|
|
||||||
[ ("x", True) ]
|
|
||||||
)
|
|
|
@ -1,9 +0,0 @@
|
||||||
Call(
|
|
||||||
Function(["x"],
|
|
||||||
Call(
|
|
||||||
Function(["x"], Var("x")),
|
|
||||||
[ ("x", False) ]
|
|
||||||
)
|
|
||||||
),
|
|
||||||
[ ("x", True) ]
|
|
||||||
)
|
|
|
@ -1 +0,0 @@
|
||||||
IncludeFix("infrec/infrec.fix")
|
|
|
@ -1,14 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
|
|
||||||
echo "builder started..."
|
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
|
|
||||||
for i in $(seq 1 30); do
|
|
||||||
echo $i
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "done" > $out/bla
|
|
||||||
|
|
||||||
echo "builder finished"
|
|
|
@ -1,5 +0,0 @@
|
||||||
Package(
|
|
||||||
[ ("name", "slow")
|
|
||||||
, ("build", Relative("slow/slow-build.sh"))
|
|
||||||
]
|
|
||||||
)
|
|
|
@ -1,14 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
|
|
||||||
echo "builder started..."
|
|
||||||
|
|
||||||
for i in $(seq 1 10); do
|
|
||||||
echo $i
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
|
|
||||||
echo "done" >> $out/bla
|
|
||||||
|
|
||||||
echo "builder finished"
|
|
|
@ -1,5 +0,0 @@
|
||||||
Package(
|
|
||||||
[ ("name", "slow")
|
|
||||||
, ("build", Relative("slow2/slow-build.sh"))
|
|
||||||
]
|
|
||||||
)
|
|
|
@ -11,7 +11,7 @@ TESTS_ENVIRONMENT = TEST_ROOT=$(TEST_ROOT) \
|
||||||
NIX_BUILD_HOOK= \
|
NIX_BUILD_HOOK= \
|
||||||
TOP=$(shell pwd)/.. \
|
TOP=$(shell pwd)/.. \
|
||||||
SHARED=$(extra1) \
|
SHARED=$(extra1) \
|
||||||
$(SHELL) -e -x
|
$(SHELL) -e
|
||||||
|
|
||||||
simple.sh: simple.nix
|
simple.sh: simple.nix
|
||||||
dependencies.sh: dependencies.nix
|
dependencies.sh: dependencies.nix
|
||||||
|
@ -22,11 +22,14 @@ substitutes.sh: substitutes.nix substituter.nix
|
||||||
substitutes2.sh: substitutes2.nix substituter.nix substituter2.nix
|
substitutes2.sh: substitutes2.nix substituter.nix substituter2.nix
|
||||||
fallback.sh: fallback.nix
|
fallback.sh: fallback.nix
|
||||||
|
|
||||||
TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \
|
TESTS = init.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \
|
||||||
build-hook.sh substitutes.sh substitutes2.sh fallback.sh verify.sh
|
build-hook.sh substitutes.sh substitutes2.sh fallback.sh verify.sh
|
||||||
|
|
||||||
XFAIL_TESTS =
|
XFAIL_TESTS =
|
||||||
|
|
||||||
|
foo:
|
||||||
|
$(TESTS_ENVIRONMENT) ./lang.sh
|
||||||
|
|
||||||
include ../substitute.mk
|
include ../substitute.mk
|
||||||
|
|
||||||
EXTRA_DIST = $(TESTS) \
|
EXTRA_DIST = $(TESTS) \
|
||||||
|
@ -37,4 +40,5 @@ EXTRA_DIST = $(TESTS) \
|
||||||
build-hook.nix.in build-hook.hook.sh \
|
build-hook.nix.in build-hook.hook.sh \
|
||||||
substitutes.nix.in substituter.nix.in substituter.builder.sh \
|
substitutes.nix.in substituter.nix.in substituter.builder.sh \
|
||||||
substitutes2.nix.in substituter2.nix.in substituter2.builder.sh \
|
substitutes2.nix.in substituter2.nix.in substituter2.builder.sh \
|
||||||
fallback.nix.in
|
fallback.nix.in \
|
||||||
|
$(wildcard lang/*.nix) $(wildcard lang/*.exp)
|
||||||
|
|
47
tests/lang.sh
Normal file
47
tests/lang.sh
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
for i in lang/parse-fail-*.nix; do
|
||||||
|
echo "parsing $i (should fail)";
|
||||||
|
i=$(basename $i .nix)
|
||||||
|
if $TOP/src/nix-instantiate/nix-instantiate --parse-only - < lang/$i.nix; then
|
||||||
|
echo "FAIL: $i shouldn't parse"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in lang/parse-okay-*.nix; do
|
||||||
|
echo "parsing $i (should succeed)";
|
||||||
|
i=$(basename $i .nix)
|
||||||
|
if ! $TOP/src/nix-instantiate/nix-instantiate --parse-only - < lang/$i.nix > lang/$i.ast; then
|
||||||
|
echo "FAIL: $i should parse"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
if ! cmp lang/$i.ast lang/$i.exp; then
|
||||||
|
echo "FAIL: parse tree of $i not as expected"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in lang/eval-fail-*.nix; do
|
||||||
|
echo "evaluating $i (should fail)";
|
||||||
|
i=$(basename $i .nix)
|
||||||
|
if $TOP/src/nix-instantiate/nix-instantiate --eval-only - < lang/$i.nix; then
|
||||||
|
echo "FAIL: $i shouldn't evaluate"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in lang/eval-okay-*.nix; do
|
||||||
|
echo "evaluating $i (should succeed)";
|
||||||
|
i=$(basename $i .nix)
|
||||||
|
if ! $TOP/src/nix-instantiate/nix-instantiate --eval-only - < lang/$i.nix > lang/$i.out; then
|
||||||
|
echo "FAIL: $i should evaluate"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
if ! cmp lang/$i.out lang/$i.exp; then
|
||||||
|
echo "FAIL: evaluation result of $i not as expected"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $fail
|
5
tests/lang/eval-fail-blackhole.nix
Normal file
5
tests/lang/eval-fail-blackhole.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
let {
|
||||||
|
body = x;
|
||||||
|
x = y;
|
||||||
|
y = x;
|
||||||
|
}
|
1
tests/lang/eval-okay-let.exp
Normal file
1
tests/lang/eval-okay-let.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Str("foobar")
|
5
tests/lang/eval-okay-let.nix
Normal file
5
tests/lang/eval-okay-let.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
let {
|
||||||
|
x = "foo";
|
||||||
|
y = "bar";
|
||||||
|
body = x + y;
|
||||||
|
}
|
1
tests/lang/eval-okay-map.exp
Normal file
1
tests/lang/eval-okay-map.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
List([Call(Function1("x",OpPlus(Var("x"),Str("bar")),Pos("(string)",1,7)),Str("foo")),Call(Function1("x",OpPlus(Var("x"),Str("bar")),Pos("(string)",1,7)),Str("bla")),Call(Function1("x",OpPlus(Var("x"),Str("bar")),Pos("(string)",1,7)),Str("xyzzy"))])
|
1
tests/lang/eval-okay-map.nix
Normal file
1
tests/lang/eval-okay-map.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
map (x: x + "bar") [ "foo" "bla" "xyzzy" ]
|
1
tests/lang/eval-okay-scope-1.exp
Normal file
1
tests/lang/eval-okay-scope-1.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Int(3)
|
6
tests/lang/eval-okay-scope-1.nix
Normal file
6
tests/lang/eval-okay-scope-1.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
(({x}: x:
|
||||||
|
|
||||||
|
{ x = 1;
|
||||||
|
y = x;
|
||||||
|
}
|
||||||
|
) {x = 2;} 3).y
|
1
tests/lang/eval-okay-scope-2.exp
Normal file
1
tests/lang/eval-okay-scope-2.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Int(1)
|
6
tests/lang/eval-okay-scope-2.nix
Normal file
6
tests/lang/eval-okay-scope-2.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
((x: {x}:
|
||||||
|
rec {
|
||||||
|
x = 1;
|
||||||
|
y = x;
|
||||||
|
}
|
||||||
|
) 2 {x = 3;}).y
|
1
tests/lang/eval-okay-scope-3.exp
Normal file
1
tests/lang/eval-okay-scope-3.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Int(4)
|
6
tests/lang/eval-okay-scope-3.nix
Normal file
6
tests/lang/eval-okay-scope-3.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
((x: as: {x}:
|
||||||
|
rec {
|
||||||
|
inherit (as) x;
|
||||||
|
y = x;
|
||||||
|
}
|
||||||
|
) 2 {x = 4;} {x = 3;}).y
|
1
tests/lang/eval-okay-string.exp
Normal file
1
tests/lang/eval-okay-string.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Str("foobar/a/b/c/d")
|
1
tests/lang/eval-okay-string.nix
Normal file
1
tests/lang/eval-okay-string.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
"foo" + "bar" + toString (/a/b + /c/d)
|
1
tests/lang/parse-fail-1.nix
Normal file
1
tests/lang/parse-fail-1.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
x: y
|
1
tests/lang/parse-okay-1.exp
Normal file
1
tests/lang/parse-okay-1.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Function([NoDefFormal("x"),NoDefFormal("y"),NoDefFormal("z")],OpPlus(OpPlus(Var("x"),Var("y")),Var("z")),Pos("(string)",1,2))
|
1
tests/lang/parse-okay-1.nix
Normal file
1
tests/lang/parse-okay-1.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{x, y, z}: x + y + z
|
1
tests/lang/parse-okay-subversion.exp
Normal file
1
tests/lang/parse-okay-subversion.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Function([DefFormal("localServer",Var("false")),DefFormal("httpServer",Var("false")),DefFormal("sslSupport",Var("false")),DefFormal("pythonBindings",Var("false")),DefFormal("javaSwigBindings",Var("false")),DefFormal("javahlBindings",Var("false")),NoDefFormal("stdenv"),NoDefFormal("fetchurl"),DefFormal("openssl",Var("null")),DefFormal("httpd",Var("null")),DefFormal("db4",Var("null")),NoDefFormal("expat"),DefFormal("swig",Var("null")),DefFormal("j2sdk",Var("null"))],Assert(OpNEq(Var("expat"),Var("null")),Assert(OpImpl(Var("localServer"),OpNEq(Var("db4"),Var("null"))),Assert(OpImpl(Var("httpServer"),OpAnd(OpNEq(Var("httpd"),Var("null")),OpEq(Select(Var("httpd"),"expat"),Var("expat")))),Assert(OpImpl(Var("sslSupport"),OpAnd(OpNEq(Var("openssl"),Var("null")),OpImpl(Var("httpServer"),OpEq(Select(Var("httpd"),"openssl"),Var("openssl"))))),Assert(OpImpl(Var("pythonBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"pythonSupport"))),Assert(OpImpl(Var("javaSwigBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"javaSupport"))),Assert(OpImpl(Var("javahlBindings"),OpNEq(Var("j2sdk"),Var("null"))),Call(Select(Var("stdenv"),"mkDerivation"),Attrs([Bind("name",Str("subversion-1.1.1"),Pos("(string)",20,7)),Bind("builder",Path("/home/eelco/nix/tests/builder.sh"),Pos("(string)",22,10)),Bind("src",Call(Var("fetchurl"),Attrs([Bind("url",Uri("http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2"),Pos("(string)",24,8)),Bind("md5",Str("a180c3fe91680389c210c99def54d9e0"),Pos("(string)",25,8))])),Pos("(string)",23,6)),Bind("patches",If(Var("javahlBindings"),List([Path("/home/eelco/nix/tests/javahl.patch")]),List([])),Pos("(string)",31,10)),Bind("openssl",If(Var("sslSupport"),Var("openssl"),Var("null")),Pos("(string)",33,10)),Bind("httpd",If(Var("httpServer"),Var("httpd"),Var("null")),Pos("(string)",34,8)),Bind("db4",If(Var("localServer"),Var("db4"),Var("null")),Pos("(string)",35,6)),Bind("swig",If(OpOr(Var("pythonBindings"),Var("javaSwigBindings")),Var("swig"),Var("null")),Pos("(string)",36,7)),Bind("python",If(Var("pythonBindings"),Select(Var("swig"),"python"),Var("null")),Pos("(string)",37,9)),Bind("j2sdk",If(Var("javaSwigBindings"),Select(Var("swig"),"j2sdk"),If(Var("javahlBindings"),Var("j2sdk"),Var("null"))),Pos("(string)",38,8)),Bind("expat",Var("expat"),Pos("(string)",41,10)),Bind("localServer",Var("localServer"),Pos("(string)",41,10)),Bind("httpServer",Var("httpServer"),Pos("(string)",41,10)),Bind("sslSupport",Var("sslSupport"),Pos("(string)",41,10)),Bind("pythonBindings",Var("pythonBindings"),Pos("(string)",41,10)),Bind("javaSwigBindings",Var("javaSwigBindings"),Pos("(string)",41,10)),Bind("javahlBindings",Var("javahlBindings"),Pos("(string)",41,10))])),Pos("(string)",17,7)),Pos("(string)",16,7)),Pos("(string)",15,7)),Pos("(string)",14,7)),Pos("(string)",13,7)),Pos("(string)",12,7)),Pos("(string)",11,7)),Pos("(string)",1,2))
|
43
tests/lang/parse-okay-subversion.nix
Normal file
43
tests/lang/parse-okay-subversion.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{ localServer ? false
|
||||||
|
, httpServer ? false
|
||||||
|
, sslSupport ? false
|
||||||
|
, pythonBindings ? false
|
||||||
|
, javaSwigBindings ? false
|
||||||
|
, javahlBindings ? false
|
||||||
|
, stdenv, fetchurl
|
||||||
|
, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null
|
||||||
|
}:
|
||||||
|
|
||||||
|
assert expat != null;
|
||||||
|
assert localServer -> db4 != null;
|
||||||
|
assert httpServer -> httpd != null && httpd.expat == expat;
|
||||||
|
assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl);
|
||||||
|
assert pythonBindings -> swig != null && swig.pythonSupport;
|
||||||
|
assert javaSwigBindings -> swig != null && swig.javaSupport;
|
||||||
|
assert javahlBindings -> j2sdk != null;
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "subversion-1.1.1";
|
||||||
|
|
||||||
|
builder = ./builder.sh;
|
||||||
|
src = fetchurl {
|
||||||
|
url = http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2;
|
||||||
|
md5 = "a180c3fe91680389c210c99def54d9e0";
|
||||||
|
};
|
||||||
|
|
||||||
|
# This is a hopefully temporary fix for the problem that
|
||||||
|
# libsvnjavahl.so isn't linked against libstdc++, which causes
|
||||||
|
# loading the library into the JVM to fail.
|
||||||
|
patches = if javahlBindings then [./javahl.patch] else [];
|
||||||
|
|
||||||
|
openssl = if sslSupport then openssl else null;
|
||||||
|
httpd = if httpServer then httpd else null;
|
||||||
|
db4 = if localServer then db4 else null;
|
||||||
|
swig = if pythonBindings || javaSwigBindings then swig else null;
|
||||||
|
python = if pythonBindings then swig.python else null;
|
||||||
|
j2sdk = if javaSwigBindings then swig.j2sdk else
|
||||||
|
if javahlBindings then j2sdk else null;
|
||||||
|
|
||||||
|
inherit expat localServer httpServer sslSupport
|
||||||
|
pythonBindings javaSwigBindings javahlBindings;
|
||||||
|
}
|
1
tests/lang/parse-okay-url.exp
Normal file
1
tests/lang/parse-okay-url.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
List([Uri("x:x"),Uri("https://svn.cs.uu.nl:12443/repos/trace/trunk"),Uri("http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2"),Uri("http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz"),Uri("http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz"),Uri("ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz")])
|
7
tests/lang/parse-okay-url.nix
Normal file
7
tests/lang/parse-okay-url.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[ x:x
|
||||||
|
https://svn.cs.uu.nl:12443/repos/trace/trunk
|
||||||
|
http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
|
||||||
|
http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz
|
||||||
|
http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz
|
||||||
|
ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz
|
||||||
|
]
|
Loading…
Reference in a new issue