summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/t0000-basic.sh2
-rwxr-xr-xtests/t1000-mkpartfs.sh2
-rwxr-xr-xtests/t2000-mkfs.sh2
-rw-r--r--tests/test-lib.sh10
6 files changed, 10 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 6923021..28054a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@ parted-*.xdelta.sig
parted.spec
partprobe/partprobe
stamp-h1
+tests/init.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2948ae2..1d2a043 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,3 +8,9 @@ TESTS_ENVIRONMENT = \
EXTRA_DIST = \
$(TESTS) test-lib.sh
+
+CLEANFILES = init.sh
+all: init.sh
+init.sh: Makefile.in
+ ( echo 'srcdir=$(srcdir)'; echo '. $$srcdir/test-lib.sh' ) > $@-t
+ mv $@-t $@
diff --git a/tests/t0000-basic.sh b/tests/t0000-basic.sh
index 6049e15..f7a0c67 100755
--- a/tests/t0000-basic.sh
+++ b/tests/t0000-basic.sh
@@ -26,7 +26,7 @@ fi
test_description='Test the very basics part #1.'
-. $srcdir/test-lib.sh
+. ./init.sh
# FIXME: is id -u portable enough?
uid=`id -u` || uid=1
diff --git a/tests/t1000-mkpartfs.sh b/tests/t1000-mkpartfs.sh
index 37dc43a..30f7238 100755
--- a/tests/t1000-mkpartfs.sh
+++ b/tests/t1000-mkpartfs.sh
@@ -19,7 +19,7 @@
test_description='Create some file systems using mkpartfs.'
-. $srcdir/test-lib.sh
+. ./init.sh
N=1M
dev=loop-file
diff --git a/tests/t2000-mkfs.sh b/tests/t2000-mkfs.sh
index e47da8f..14140f6 100755
--- a/tests/t2000-mkfs.sh
+++ b/tests/t2000-mkfs.sh
@@ -19,7 +19,7 @@
test_description='Create some file systems using mkfs.'
-. $srcdir/test-lib.sh
+. ./test-lib.sh
N=40M
dev=loop-file
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index d6804cf..235f515 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -32,16 +32,6 @@ say () {
test "${test_description}" != "" ||
error "Test script did not set test_description."
-# If $srcdir is not set, set it, if it's ".". Otherwise, fail.
-if test -a "$srcdir"; then
- if test -f test-lib.sh; then
- srcdir=.
- else
- error '$srcdir is not set; either set it, or run the test' \
- 'from the source directory'
- fi
-fi
-
while test "$#" -ne 0
do
case "$1" in