mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
* Make it easy to run individual tests from the command line.
This commit is contained in:
parent
85793fa438
commit
a4c63c6e8e
23 changed files with 78 additions and 33 deletions
|
@ -1,4 +1,4 @@
|
||||||
AC_INIT(nix, "0.10")
|
AC_INIT(nix, 0.10)
|
||||||
AC_CONFIG_SRCDIR(README)
|
AC_CONFIG_SRCDIR(README)
|
||||||
AC_CONFIG_AUX_DIR(config)
|
AC_CONFIG_AUX_DIR(config)
|
||||||
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
|
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
|
||||||
|
@ -10,12 +10,14 @@ STABLE=0
|
||||||
# Put the revision number in the version.
|
# Put the revision number in the version.
|
||||||
if test "$STABLE" != "1"; then
|
if test "$STABLE" != "1"; then
|
||||||
if REVISION=`test -d $srcdir/.svn && svnversion $srcdir 2> /dev/null`; then
|
if REVISION=`test -d $srcdir/.svn && svnversion $srcdir 2> /dev/null`; then
|
||||||
VERSION="${VERSION}pre${REVISION}"
|
VERSION=${VERSION}pre${REVISION}
|
||||||
elif REVISION=`cat $srcdir/svn-revision 2> /dev/null`; then
|
elif REVISION=`cat $srcdir/svn-revision 2> /dev/null`; then
|
||||||
VERSION="${VERSION}pre${REVISION}"
|
VERSION=${VERSION}pre${REVISION}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_DEFINE_UNQUOTED(NIX_VERSION, ["$(echo $VERSION)"], [version])
|
||||||
|
|
||||||
AC_PREFIX_DEFAULT(/nix)
|
AC_PREFIX_DEFAULT(/nix)
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
-e "s^@perl\@^$(perl)^g" \
|
-e "s^@perl\@^$(perl)^g" \
|
||||||
-e "s^@coreutils\@^$(coreutils)^g" \
|
-e "s^@coreutils\@^$(coreutils)^g" \
|
||||||
-e "s^@tar\@^$(tar)^g" \
|
-e "s^@tar\@^$(tar)^g" \
|
||||||
|
-e "s^@dot\@^$(dot)^g" \
|
||||||
|
-e "s^@aterm_bin\@^$(aterm_bin)^g" \
|
||||||
-e "s^@version\@^$(VERSION)^g" \
|
-e "s^@version\@^$(VERSION)^g" \
|
||||||
< $< > $@ || rm $@
|
< $< > $@ || rm $@
|
||||||
if test -x $<; then chmod +x $@; fi
|
if test -x $<; then chmod +x $@; fi
|
||||||
|
|
|
@ -1,29 +1,4 @@
|
||||||
TEST_ROOT = $(shell pwd)/test-tmp
|
TESTS_ENVIRONMENT = $(SHELL) -e
|
||||||
|
|
||||||
extra1 = $(TEST_ROOT)/shared
|
|
||||||
|
|
||||||
TESTS_ENVIRONMENT = TEST_ROOT=$(TEST_ROOT) \
|
|
||||||
NIX_STORE_DIR=$(TEST_ROOT)/store \
|
|
||||||
NIX_DATA_DIR=$(TEST_ROOT)/data \
|
|
||||||
NIX_LOCALSTATE_DIR=$(TEST_ROOT)/var \
|
|
||||||
NIX_LOG_DIR=$(TEST_ROOT)/var/log/nix \
|
|
||||||
NIX_STATE_DIR=$(TEST_ROOT)/var/nix \
|
|
||||||
NIX_DB_DIR=$(TEST_ROOT)/db \
|
|
||||||
NIX_CONF_DIR=$(TEST_ROOT)/etc \
|
|
||||||
NIX_BIN_DIR=$(TEST_ROOT)/bin \
|
|
||||||
NIX_LIBEXEC_DIR=$(TEST_ROOT)/bin \
|
|
||||||
REAL_BIN_DIR=$(bindir) \
|
|
||||||
REAL_LIBEXEC_DIR=$(libexecdir) \
|
|
||||||
REAL_LOCALSTATE_DIR=$(localstatedir) \
|
|
||||||
REAL_DATA_DIR=$(datadir) \
|
|
||||||
REAL_STORE_DIR=$(storedir) \
|
|
||||||
NIX_BUILD_HOOK= \
|
|
||||||
PERL=$(perl) \
|
|
||||||
TOP=$(shell pwd)/.. \
|
|
||||||
SHARED=$(extra1) \
|
|
||||||
aterm_bin=$(aterm_bin) \
|
|
||||||
dot=$(dot) \
|
|
||||||
$(SHELL) -e
|
|
||||||
|
|
||||||
simple.sh: simple.nix
|
simple.sh: simple.nix
|
||||||
dependencies.sh: dependencies.nix
|
dependencies.sh: dependencies.nix
|
||||||
|
@ -45,11 +20,10 @@ TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh
|
||||||
|
|
||||||
XFAIL_TESTS =
|
XFAIL_TESTS =
|
||||||
|
|
||||||
langtests:
|
|
||||||
$(TESTS_ENVIRONMENT) ./lang.sh
|
|
||||||
|
|
||||||
include ../substitute.mk
|
include ../substitute.mk
|
||||||
|
|
||||||
|
$(TESTS): common.sh
|
||||||
|
|
||||||
EXTRA_DIST = $(TESTS) \
|
EXTRA_DIST = $(TESTS) \
|
||||||
simple.nix.in simple.builder.sh \
|
simple.nix.in simple.builder.sh \
|
||||||
dependencies.nix.in dependencies.builder*.sh \
|
dependencies.nix.in dependencies.builder*.sh \
|
||||||
|
@ -62,4 +36,5 @@ EXTRA_DIST = $(TESTS) \
|
||||||
gc-concurrent2.nix.in gc-concurrent2.builder.sh \
|
gc-concurrent2.nix.in gc-concurrent2.builder.sh \
|
||||||
fallback.nix.in \
|
fallback.nix.in \
|
||||||
user-envs.nix.in user-envs.builder.sh \
|
user-envs.nix.in user-envs.builder.sh \
|
||||||
$(wildcard lang/*.nix) $(wildcard lang/*.exp)
|
$(wildcard lang/*.nix) $(wildcard lang/*.exp) \
|
||||||
|
common.sh.in
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
export NIX_BUILD_HOOK="build-hook.hook.sh"
|
export NIX_BUILD_HOOK="build-hook.hook.sh"
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)
|
||||||
|
|
26
tests/common.sh.in
Normal file
26
tests/common.sh.in
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export TEST_ROOT=$(pwd)/test-tmp
|
||||||
|
export NIX_STORE_DIR=$TEST_ROOT/store
|
||||||
|
export NIX_DATA_DIR=$TEST_ROOT/data
|
||||||
|
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||||
|
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||||
|
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||||
|
export NIX_DB_DIR=$TEST_ROOT/db
|
||||||
|
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||||
|
export NIX_BIN_DIR=$TEST_ROOT/bin
|
||||||
|
export NIX_LIBEXEC_DIR=$TEST_ROOT/bin
|
||||||
|
export SHARED=$TEST_ROOT/shared
|
||||||
|
|
||||||
|
export REAL_BIN_DIR=@bindir@
|
||||||
|
export REAL_LIBEXEC_DIR=@libexecdir@
|
||||||
|
export REAL_LOCALSTATE_DIR=@localstatedir@
|
||||||
|
export REAL_DATA_DIR=@datadir@
|
||||||
|
export REAL_STORE_DIR=@storedir@
|
||||||
|
export NIX_BUILD_HOOK=
|
||||||
|
export PERL=perl
|
||||||
|
export TOP=$(pwd)/..
|
||||||
|
export aterm_bin=@aterm_bin@
|
||||||
|
export dot=@dot@
|
||||||
|
|
||||||
|
export version=@version@
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
|
||||||
|
|
||||||
echo "derivation is $drvPath"
|
echo "derivation is $drvPath"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate fallback.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate fallback.nix)
|
||||||
echo "derivation is $drvPath"
|
echo "derivation is $drvPath"
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath1=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
|
drvPath1=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
|
||||||
outPath1=$($TOP/src/nix-store/nix-store -q $drvPath1)
|
outPath1=$($TOP/src/nix-store/nix-store -q $drvPath1)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
|
||||||
outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath")
|
outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath")
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
try () {
|
try () {
|
||||||
echo -n "$2" > $TEST_ROOT/vector
|
echo -n "$2" > $TEST_ROOT/vector
|
||||||
hash=$($TOP/src/nix-hash/nix-hash $EXTRA --flat --type "$1" $TEST_ROOT/vector)
|
hash=$($TOP/src/nix-hash/nix-hash $EXTRA --flat --type "$1" $TEST_ROOT/vector)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
echo "NIX_STORE_DIR=$NIX_STORE_DIR NIX_DB_DIR=$NIX_DB_DIR"
|
echo "NIX_STORE_DIR=$NIX_STORE_DIR NIX_DB_DIR=$NIX_DB_DIR"
|
||||||
|
|
||||||
test -n "$TEST_ROOT"
|
test -n "$TEST_ROOT"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
fail=0
|
fail=0
|
||||||
|
|
||||||
for i in lang/parse-fail-*.nix; do
|
for i in lang/parse-fail-*.nix; do
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate locking.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate locking.nix)
|
||||||
|
|
||||||
echo "derivation is $drvPath"
|
echo "derivation is $drvPath"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
# Tests miscellaneous commands.
|
# Tests miscellaneous commands.
|
||||||
|
|
||||||
# Do all commands have help?
|
# Do all commands have help?
|
||||||
|
@ -6,3 +8,5 @@ $TOP/src/nix-store/nix-store --help | grep -q realise
|
||||||
$TOP/src/nix-instantiate/nix-instantiate --help | grep -q eval-only
|
$TOP/src/nix-instantiate/nix-instantiate --help | grep -q eval-only
|
||||||
$TOP/src/nix-hash/nix-hash --help | grep -q base32
|
$TOP/src/nix-hash/nix-hash --help | grep -q base32
|
||||||
|
|
||||||
|
# Can we ask for the version number?
|
||||||
|
$TOP/src/nix-env/nix-env --version | grep "$version"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
clearStore () {
|
clearStore () {
|
||||||
echo "clearing store..."
|
echo "clearing store..."
|
||||||
chmod -R +w "$NIX_STORE_DIR"
|
chmod -R +w "$NIX_STORE_DIR"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
|
||||||
outPath=$($TOP/src/nix-store/nix-store -r $drvPath)
|
outPath=$($TOP/src/nix-store/nix-store -r $drvPath)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate parallel.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate parallel.nix)
|
||||||
|
|
||||||
echo "derivation is $drvPath"
|
echo "derivation is $drvPath"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
max=5000
|
max=5000
|
||||||
|
|
||||||
reference=$NIX_STORE_DIR/abcdef
|
reference=$NIX_STORE_DIR/abcdef
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate simple.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate simple.nix)
|
||||||
|
|
||||||
echo "derivation is $drvPath"
|
echo "derivation is $drvPath"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
# Instantiate.
|
# Instantiate.
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes.nix)
|
||||||
echo "derivation is $drvPath"
|
echo "derivation is $drvPath"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
# Instantiate.
|
# Instantiate.
|
||||||
drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes2.nix)
|
drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes2.nix)
|
||||||
echo "derivation is $drvPath"
|
echo "derivation is $drvPath"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
nixenv=$TOP/src/nix-env/nix-env
|
nixenv=$TOP/src/nix-env/nix-env
|
||||||
profiles="$NIX_STATE_DIR"/profiles
|
profiles="$NIX_STATE_DIR"/profiles
|
||||||
|
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
$TOP/src/nix-store/nix-store --verify
|
$TOP/src/nix-store/nix-store --verify
|
||||||
|
|
Loading…
Reference in a new issue