[parted-devel] [PATCH] Make all tests get their initialization from the same place.
Jim Meyering
jim at meyering.net
Sat May 19 09:14:12 UTC 2007
One test used the old approach of sourcing test-lib.sh
directly, rather than sourcing the generated init.sh.
It doesn't currently make any difference when running
the test via "make check", but it would fail with some
patches I'm preparing:
Make all tests get their initialization from the same place.
* tests/t2000-mkfs.sh: Get initialization via ". ./init.sh",
not via ". ./test-lib.sh".
* Makefile.maint (sc_test_init): New test, to ensure we stay consistent.
Signed-off-by: Jim Meyering <jim at meyering.net>
---
Makefile.maint | 15 +++++++++++++++
tests/t2000-mkfs.sh | 2 +-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index ccb7370..d7b6aaa 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -179,6 +179,21 @@ sc_changelog:
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || :
+test_file_names = \
+ $(CVS_LIST_EXCEPT) | grep -E '/t[0-9].*\.sh$$'
+# Each test must source ./init.sh
+sc_test_init:
+ @if grep '^init\.sh:' tests/Makefile.am; then \
+ if $(test_file_names) > /dev/null; then \
+ grep -L '^\. \./init\.sh$$' $$($(test_file_names)) \
+ | grep . && \
+ { echo "$(ME): the above files lack '. ./init.sh'" \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi; \
+ else :; \
+ fi
+
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
dd_c = $(srcdir)/src/dd.c
diff --git a/tests/t2000-mkfs.sh b/tests/t2000-mkfs.sh
index fb42f7a..79d327e 100755
--- a/tests/t2000-mkfs.sh
+++ b/tests/t2000-mkfs.sh
@@ -19,7 +19,7 @@
test_description='Create some file systems using mkfs.'
-. ./test-lib.sh
+. ./init.sh
N=40M
dev=loop-file
More information about the parted-devel
mailing list