[Skiboot] [PATCH 1/3] make check: make test runs less noisy

Stewart Smith stewart at linux.vnet.ibm.com
Tue Jul 12 19:17:57 AEST 2016


Run a small wrapper around some unit tests with the QTEST makefile macro
(QTEST=Quiet TEST). Also, wrap boot tests in mambo and qemu to be quiet
by default.

Both ./test/run.sh and the modified mambo/qemu test runner scripts output
full stdout and stderr in the event of error.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 Makefile.rules                            |  4 ++++
 core/test/Makefile.check                  |  8 ++++----
 libflash/test/Makefile.check              |  4 ++--
 test/hello_world/run_mambo_hello_world.sh | 16 +++++++++++++++-
 test/hello_world/run_qemu_hello_world.sh  | 16 +++++++++++++++-
 test/run.sh                               | 16 ++++++++++++++++
 test/run_mambo_boot_test.sh               | 18 ++++++++++++++++--
 7 files changed, 72 insertions(+), 10 deletions(-)
 create mode 100755 test/run.sh

diff --git a/Makefile.rules b/Makefile.rules
index ea524886298c..80121c331094 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -25,6 +25,10 @@ endef
 endif
 endif
 
+define QTEST
+	$(call Q,$1, ./test/run.sh $2, $3)
+endef
+
 define cook_aflags
        $(filter-out $(AFLAGS_SKIP_$(1)), $(CPPFLAGS) $(AFLAGS)) $(AFLAGS_$(1))
 endef
diff --git a/core/test/Makefile.check b/core/test/Makefile.check
index 08180925131d..b24bc21f1e9d 100644
--- a/core/test/Makefile.check
+++ b/core/test/Makefile.check
@@ -36,16 +36,16 @@ check: core-check
 coverage: core-coverage
 
 $(CORE_TEST:%=%-gcov-run) : %-run: %
-	$(call Q, TEST-COVERAGE ,$< , $<)
+	$(call QTEST, TEST-COVERAGE ,$< , $<)
 
 $(CORE_TEST_NOSTUB:%=%-gcov-run) : %-run: %
-	$(call Q, TEST-COVERAGE ,$< , $<)
+	$(call QTEST, TEST-COVERAGE ,$< , $<)
 
 $(CORE_TEST:%=%-check) : %-check: %
-	$(call Q, RUN-TEST ,$(VALGRIND) $<, $<)
+	$(call QTEST, RUN-TEST ,$(VALGRIND) $<, $<)
 
 $(CORE_TEST_NOSTUB:%=%-check) : %-check: %
-	$(call Q, RUN-TEST ,$(VALGRIND) $<, $<)
+	$(call QTEST, RUN-TEST ,$(VALGRIND) $<, $<)
 
 core/test/stubs.o: core/test/stubs.c
 	$(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) -g -c -o $@ $<, $<)
diff --git a/libflash/test/Makefile.check b/libflash/test/Makefile.check
index b90c359e7aac..0351a6422e7f 100644
--- a/libflash/test/Makefile.check
+++ b/libflash/test/Makefile.check
@@ -11,10 +11,10 @@ check: libflash-check libc-coverage
 coverage: libflash-coverage
 
 $(LIBFLASH_TEST:%=%-gcov-run) : %-run: %
-	$(call Q, TEST-COVERAGE ,$< , $<)
+	$(call QTEST, TEST-COVERAGE ,$< , $<)
 
 $(LIBFLASH_TEST:%=%-check) : %-check: %
-	$(call Q, RUN-TEST ,$(VALGRIND) $<, $<)
+	$(call QTEST, RUN-TEST ,$(VALGRIND) $<, $<)
 
 libflash/test/stubs.o: libflash/test/stubs.c
 	$(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) -g -c -o $@ $<, $<)
diff --git a/test/hello_world/run_mambo_hello_world.sh b/test/hello_world/run_mambo_hello_world.sh
index ba28a2169d84..1589bd038588 100755
--- a/test/hello_world/run_mambo_hello_world.sh
+++ b/test/hello_world/run_mambo_hello_world.sh
@@ -31,6 +31,10 @@ export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel
 OLD_ULIMIT_C=`ulimit -c`
 ulimit -c 0
 
+t=$(tempfile) || exit 1
+
+trap "rm -f -- '$t'" EXIT
+
 ( cd external/mambo; 
 cat <<EOF | expect
 set timeout 30
@@ -43,7 +47,17 @@ eof { send_user "\nUnexpected EOF\n;" exit 1 }
 wait
 exit 0
 EOF
-)
+) 2>&1 > $t
+
+r=$?
+if [ $r != 0 ]; then
+    cat $t
+    exit $r
+fi
+
 ulimit -c $OLD_ULIMIT_C
+
 echo
+rm -f -- "$t"
+trap - EXIT
 exit 0;
diff --git a/test/hello_world/run_qemu_hello_world.sh b/test/hello_world/run_qemu_hello_world.sh
index 32921785646a..9a85b3d79a68 100755
--- a/test/hello_world/run_qemu_hello_world.sh
+++ b/test/hello_world/run_qemu_hello_world.sh
@@ -27,6 +27,9 @@ fi
 
 export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel
 
+t=$(tempfile) || exit 1
+
+trap "rm -f -- '$t'" EXIT
 
 (
 cat <<EOF | expect
@@ -41,5 +44,16 @@ close
 wait
 exit 0
 EOF
-)
+) 2>&1 > $t
+
+r=$?
+if [ $r != 0 ]; then
+    cat $t
+    exit $r
+fi
+
+echo
+rm -f -- "$t"
+trap - EXIT
+
 exit 0;
diff --git a/test/run.sh b/test/run.sh
new file mode 100755
index 000000000000..5185f5ab19ed
--- /dev/null
+++ b/test/run.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+t=$(tempfile) || exit 1
+
+trap "rm -f -- '$t'" EXIT
+
+$* 2>&1 > $t
+r=$?
+if [ $r != 0 ]; then
+    cat $t
+    exit $r
+fi
+
+rm -f -- "$t"
+trap - EXIT
+exit 0
diff --git a/test/run_mambo_boot_test.sh b/test/run_mambo_boot_test.sh
index 8ae7fdab5dfa..f3984778a1cb 100755
--- a/test/run_mambo_boot_test.sh
+++ b/test/run_mambo_boot_test.sh
@@ -41,6 +41,10 @@ fi
 OLD_ULIMIT_C=`ulimit -c`
 ulimit -c 0
 
+t=$(tempfile) || exit 1
+
+trap "rm -f -- '$t'" EXIT
+
 ( cd external/mambo;
 cat <<EOF | expect
 set timeout 600
@@ -53,7 +57,17 @@ eof { send_user "\nUnexpected EOF\n;" exit 1 }
 wait
 exit 0
 EOF
-)
+) 2>&1 > $t
+
+r=$?
+if [ $r != 0 ]; then
+    cat $t
+    exit $r
+fi
+
 ulimit -c $OLD_ULIMIT_C
+
 echo
-exit 0;
+rm -f -- "$t"
+trap - EXIT
+exit 0
-- 
2.1.4



More information about the Skiboot mailing list