test: add support for: make V=1 TESTS="01 20 40" check
authorHarald Hoyer <harald@redhat.com>
Wed, 11 Jul 2012 07:33:32 +0000 (09:33 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 11 Jul 2012 07:33:32 +0000 (09:33 +0200)
$ sudo make V=1 clean check
now runs the testsuite in verbose mode

$ sudo make TESTS="01 20 40" clean check
now only runs the 01, 20 and 40 tests.

16 files changed:
test/Makefile
test/TEST-01-BASIC/Makefile
test/TEST-02-SYSTEMD/Makefile
test/TEST-03-USR-MOUNT/Makefile
test/TEST-10-RAID/Makefile
test/TEST-11-LVM/Makefile
test/TEST-12-RAID-DEG/Makefile
test/TEST-13-ENC-RAID-LVM/Makefile
test/TEST-15-BTRFSRAID/Makefile
test/TEST-16-DMSQUASH/Makefile
test/TEST-20-NFS/Makefile
test/TEST-30-ISCSI/Makefile
test/TEST-40-NBD/Makefile
test/TEST-50-MULTINIC/Makefile
test/TEST-99-RPM/Makefile
test/test-functions

index 38bfecc..f4881b5 100644 (file)
@@ -4,14 +4,15 @@ check:
        @for i in TEST-[0-9]*; do \
                [ -d $$i ] || continue ; \
                [ -f $$i/Makefile ] || continue ; \
-               make -C $$i all ; \
+               if [ -n "$$TESTS" ]; then t=$${i##TEST-}; t=$${t%-*}; [ "$${TESTS#*$$t*}" != "$$TESTS" ] || continue; fi; \
+               $(MAKE) -C $$i all ; \
        done
 
 clean:
        @for i in TEST-[0-9]*; do \
                [ -d $$i ] || continue ; \
                [ -f $$i/Makefile ] || continue ; \
-               make -C $$i clean ; \
+               $(MAKE) -C $$i clean ; \
        done
 
 all:
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index bc0ddb6..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. all
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. all
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index 5513c52..3cc8993 100644 (file)
@@ -1,8 +1,8 @@
 all:
-       @make -s --no-print-directory -C ../.. clean all rpm
-       @basedir=../.. testdir=../ ./test.sh --all
+       $(MAKE) -s --no-print-directory -C ../.. all
+       V=$(V) basedir=../.. testdir=../ ./test.sh --all
 setup:
-       @make --no-print-directory -C ../.. clean rpm
+       @$(MAKE) --no-print-directory -C ../.. all
        @basedir=../.. testdir=../ ./test.sh --setup
 clean:
        @basedir=../.. testdir=../ ./test.sh --clean
index 10d78ed..968551f 100644 (file)
@@ -37,6 +37,7 @@ while (($# > 0)); do
                 echo "[SKIPPED]"
                exit 0;
             fi
+            if [ "$V" != "1" ]; then
            (
                test_setup && test_run
                ret=$?
@@ -45,7 +46,19 @@ while (($# > 0)); do
                rm -f .testdir
                exit $ret
            ) </dev/null >test.log 2>&1
+            else
+            set -o pipefail
+            (
+               test_setup && test_run
+               ret=$?
+               test_cleanup
+               rm -fr "$TESTDIR"
+               rm -f .testdir
+               exit $ret
+           ) </dev/null 2>&1 | tee test.log
+            fi
            ret=$?
+            set +o pipefail
            if [ $ret -eq 0 ]; then
                rm test.log
               echo "[OK]"