[parted-devel] [PATCH] No longer require "srcdir=." when running a test manually.

Jim Meyering jim at meyering.net
Fri May 11 12:07:31 UTC 2007


This change makes it a little more convenient to run a test manually:

	No longer require "srcdir=." when running a test manually.
	* tests/Makefile.am (init.sh): New rule, so one doesn't have to
	set "srcdir=." when running a test manually.
	* .gitignore: Ignore new generated file: tests/init.sh.
	* tests/t0000-basic.sh: Source new init.sh, rather than test-lib.sh.
	* tests/t1000-mkpartfs.sh: Likewise.
	* tests/t2000-mkfs.sh: Likewise.

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..7348273 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,3 +8,10 @@ TESTS_ENVIRONMENT = \

 EXTRA_DIST = \
   $(TESTS) test-lib.sh
+
+CLEANFILES = init.sh
+all: init.sh
+init.sh: Makefile.in
+	echo 'srcdir=$(srcdir)'          > $@-t
+	echo '. $$srcdir/test-lib.sh' >> $@-t
+	mv $@-t $@
diff --git a/tests/t0000-basic.sh b/tests/t0000-basic.sh
index 6049e15..2d5daac 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
@@ -88,9 +88,7 @@ Warning: The existing disk label on DEVICE will be destroyed and all\
 Yes/No? y
 New disk label type?  [msdos]?
 EOF
-test_expect_success \
-    'create expected output file' \
-    'test $fail = 0'
+test_expect_success 'create expected output file' 'test $fail = 0'

 test_expect_success \
     'check its output -- slightly different here, due to prompts' \
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



More information about the parted-devel mailing list