about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-03-01T12·15+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-03-01T12·15+0000
commita4c63c6e8e161d55778b797e566d9eca7c47f34f (patch)
tree9caaa0d38d12836f5de88b41aecff988b8ff9472
parent85793fa438847974330123a8d4160283fcfa18f7 (diff)
* Make it easy to run individual tests from the command line.
-rw-r--r--configure.ac8
-rw-r--r--substitute.mk2
-rw-r--r--tests/Makefile.am35
-rw-r--r--tests/build-hook.sh2
-rw-r--r--tests/common.sh.in26
-rw-r--r--tests/dependencies.sh2
-rw-r--r--tests/fallback.sh2
-rw-r--r--tests/gc-concurrent.sh2
-rw-r--r--tests/gc.sh2
-rw-r--r--tests/hash.sh2
-rw-r--r--tests/init.sh2
-rw-r--r--tests/lang.sh2
-rw-r--r--tests/locking.sh2
-rw-r--r--tests/misc.sh4
-rw-r--r--tests/nix-pull.sh2
-rw-r--r--tests/nix-push.sh2
-rw-r--r--tests/parallel.sh2
-rw-r--r--tests/referrers.sh2
-rw-r--r--tests/simple.sh2
-rw-r--r--tests/substitutes.sh2
-rw-r--r--tests/substitutes2.sh2
-rw-r--r--tests/user-envs.sh2
-rw-r--r--tests/verify.sh2
23 files changed, 78 insertions, 33 deletions
diff --git a/configure.ac b/configure.ac
index eee73c07be01..f6e548729cd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(nix, "0.10")
+AC_INIT(nix, 0.10)
 AC_CONFIG_SRCDIR(README)
 AC_CONFIG_AUX_DIR(config)
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
@@ -10,12 +10,14 @@ STABLE=0
 # Put the revision number in the version.
 if test "$STABLE" != "1"; 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
-        VERSION="${VERSION}pre${REVISION}"
+        VERSION=${VERSION}pre${REVISION}
     fi
 fi
 
+AC_DEFINE_UNQUOTED(NIX_VERSION, ["$(echo $VERSION)"], [version])
+
 AC_PREFIX_DEFAULT(/nix)
 
 AC_CANONICAL_HOST
diff --git a/substitute.mk b/substitute.mk
index 2b7f386103f8..2e28e586779a 100644
--- a/substitute.mk
+++ b/substitute.mk
@@ -16,6 +16,8 @@
 	 -e "s^@perl\@^$(perl)^g" \
 	 -e "s^@coreutils\@^$(coreutils)^g" \
 	 -e "s^@tar\@^$(tar)^g" \
+	 -e "s^@dot\@^$(dot)^g" \
+	 -e "s^@aterm_bin\@^$(aterm_bin)^g" \
 	 -e "s^@version\@^$(VERSION)^g" \
 	 < $< > $@ || rm $@
 	if test -x $<; then chmod +x $@; fi
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 933da520b460..d8493496d2b3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,29 +1,4 @@
-TEST_ROOT = $(shell pwd)/test-tmp
-
-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
+TESTS_ENVIRONMENT = $(SHELL) -e
 
 simple.sh: simple.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 =
 
-langtests:
-	$(TESTS_ENVIRONMENT) ./lang.sh
-
 include ../substitute.mk
 
+$(TESTS): common.sh
+
 EXTRA_DIST = $(TESTS) \
   simple.nix.in simple.builder.sh \
   dependencies.nix.in dependencies.builder*.sh \
@@ -62,4 +36,5 @@ EXTRA_DIST = $(TESTS) \
   gc-concurrent2.nix.in gc-concurrent2.builder.sh \
   fallback.nix.in \
   user-envs.nix.in user-envs.builder.sh \
-  $(wildcard lang/*.nix) $(wildcard lang/*.exp)
+  $(wildcard lang/*.nix) $(wildcard lang/*.exp) \
+  common.sh.in
diff --git a/tests/build-hook.sh b/tests/build-hook.sh
index f11cd15b8b72..6a71bbe56173 100644
--- a/tests/build-hook.sh
+++ b/tests/build-hook.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 export NIX_BUILD_HOOK="build-hook.hook.sh"
 
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)
diff --git a/tests/common.sh.in b/tests/common.sh.in
new file mode 100644
index 000000000000..979e60db26ac
--- /dev/null
+++ b/tests/common.sh.in
@@ -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@
diff --git a/tests/dependencies.sh b/tests/dependencies.sh
index 985d087273d5..0d19cd2bb0be 100644
--- a/tests/dependencies.sh
+++ b/tests/dependencies.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
 
 echo "derivation is $drvPath"
diff --git a/tests/fallback.sh b/tests/fallback.sh
index 4a3d29f39eb0..2ff4b0b9ceb4 100644
--- a/tests/fallback.sh
+++ b/tests/fallback.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate fallback.nix)
 echo "derivation is $drvPath"
 
diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh
index 8cc24565dc2a..7606a64c87e5 100644
--- a/tests/gc-concurrent.sh
+++ b/tests/gc-concurrent.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath1=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
 outPath1=$($TOP/src/nix-store/nix-store -q $drvPath1)
 
diff --git a/tests/gc.sh b/tests/gc.sh
index 9fe0068b38c3..c1bfc9ce4104 100644
--- a/tests/gc.sh
+++ b/tests/gc.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
 outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath")
 
diff --git a/tests/hash.sh b/tests/hash.sh
index 848a36c6b8d7..fbbf1a761e91 100644
--- a/tests/hash.sh
+++ b/tests/hash.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 try () {
     echo -n "$2" > $TEST_ROOT/vector
     hash=$($TOP/src/nix-hash/nix-hash $EXTRA --flat --type "$1" $TEST_ROOT/vector)
diff --git a/tests/init.sh b/tests/init.sh
index 316b2ec3d623..cd9fe60219dd 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 echo "NIX_STORE_DIR=$NIX_STORE_DIR NIX_DB_DIR=$NIX_DB_DIR"
 
 test -n "$TEST_ROOT"
diff --git a/tests/lang.sh b/tests/lang.sh
index bbdb3fb8a955..5e9d8d51e0f1 100644
--- a/tests/lang.sh
+++ b/tests/lang.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 fail=0
 
 for i in lang/parse-fail-*.nix; do
diff --git a/tests/locking.sh b/tests/locking.sh
index eeac569b81c1..3e1788660602 100644
--- a/tests/locking.sh
+++ b/tests/locking.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate locking.nix)
 
 echo "derivation is $drvPath"
diff --git a/tests/misc.sh b/tests/misc.sh
index d865df8ddeb6..2220ea18cb86 100644
--- a/tests/misc.sh
+++ b/tests/misc.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 # Tests miscellaneous commands.
 
 # 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-hash/nix-hash --help | grep -q base32
 
+# Can we ask for the version number?
+$TOP/src/nix-env/nix-env --version | grep "$version"
diff --git a/tests/nix-pull.sh b/tests/nix-pull.sh
index 4f53113bc853..a8dca8feaa42 100644
--- a/tests/nix-pull.sh
+++ b/tests/nix-pull.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 clearStore () {
     echo "clearing store..."
     chmod -R +w "$NIX_STORE_DIR"
diff --git a/tests/nix-push.sh b/tests/nix-push.sh
index 73499f1e9e35..6dbb2484013a 100644
--- a/tests/nix-push.sh
+++ b/tests/nix-push.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
 outPath=$($TOP/src/nix-store/nix-store -r $drvPath)
 
diff --git a/tests/parallel.sh b/tests/parallel.sh
index 0cc4ea9c346e..2382db7834ba 100644
--- a/tests/parallel.sh
+++ b/tests/parallel.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate parallel.nix)
 
 echo "derivation is $drvPath"
diff --git a/tests/referrers.sh b/tests/referrers.sh
index 6169e8e5515d..2ee97e65b5a9 100644
--- a/tests/referrers.sh
+++ b/tests/referrers.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 max=5000
 
 reference=$NIX_STORE_DIR/abcdef
diff --git a/tests/simple.sh b/tests/simple.sh
index 996ef4e78ffd..3e58bcc845c2 100644
--- a/tests/simple.sh
+++ b/tests/simple.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate simple.nix)
 
 echo "derivation is $drvPath"
diff --git a/tests/substitutes.sh b/tests/substitutes.sh
index 150d6b8a3f1a..680f114b5e17 100644
--- a/tests/substitutes.sh
+++ b/tests/substitutes.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 # Instantiate.
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes.nix)
 echo "derivation is $drvPath"
diff --git a/tests/substitutes2.sh b/tests/substitutes2.sh
index 6dcff6fd43a1..7303255af0ca 100644
--- a/tests/substitutes2.sh
+++ b/tests/substitutes2.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 # Instantiate.
 drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes2.nix)
 echo "derivation is $drvPath"
diff --git a/tests/user-envs.sh b/tests/user-envs.sh
index 59565cff0dc8..eddd4c22abe7 100644
--- a/tests/user-envs.sh
+++ b/tests/user-envs.sh
@@ -1,3 +1,5 @@
+source common.sh
+
 nixenv=$TOP/src/nix-env/nix-env
 profiles="$NIX_STATE_DIR"/profiles
 
diff --git a/tests/verify.sh b/tests/verify.sh
index ede3e7d74bea..a38544331af3 100644
--- a/tests/verify.sh
+++ b/tests/verify.sh
@@ -1 +1,3 @@
+source common.sh
+
 $TOP/src/nix-store/nix-store --verify