From: Garrett C. <ris...@li...> - 2010-07-06 02:21:24
|
The branch, pu, has been updated via 3b6aeead1a65de3729c147ca41e66683b74ae54c (commit) via d680c877f41da1ccc5731c069b8fae81a0a189f2 (commit) via 515be5888ee07d87c4194afbf6ca69826cf2adfa (commit) via 2aec45df627cad013f17b7ab2fcad00dd069a4e5 (commit) via f8e6d24ced9584afeaee458e7872ff50aab6769b (commit) from 8ddfef16230888ae507540c9137a6b396dacba18 (commit) - Log ----------------------------------------------------------------- commit 3b6aeead1a65de3729c147ca41e66683b74ae54c Author: Garrett Cooper <yan...@gm...> Date: Mon Jul 5 19:18:19 2010 -0700 Apply test make environment to make test. Signed-off-by: Garrett Cooper <yan...@gm...> commit d680c877f41da1ccc5731c069b8fae81a0a189f2 Author: Garrett Cooper <yan...@gm...> Date: Mon Jul 5 19:16:51 2010 -0700 Fix up run-test.sh further. There were some missing args, a missing step to produce t0.val, a typo, etc. Signed-off-by: Garrett Cooper <yan...@gm...> commit 515be5888ee07d87c4194afbf6ca69826cf2adfa Author: Garrett Cooper <yan...@gm...> Date: Mon Jul 5 19:16:27 2010 -0700 Quiet down make test. Signed-off-by: Garrett Cooper <yan...@gm...> commit 2aec45df627cad013f17b7ab2fcad00dd069a4e5 Author: Garrett Cooper <yan...@gm...> Date: Mon Jul 5 18:34:42 2010 -0700 Correct script location; improve harness. Signed-off-by: Garrett Cooper <yan...@gm...> commit f8e6d24ced9584afeaee458e7872ff50aab6769b Author: Garrett Cooper <yan...@gm...> Date: Mon Jul 5 18:29:09 2010 -0700 Add missing target. Signed-off-by: Garrett Cooper <yan...@gm...> ----------------------------------------------------------------------- Summary of changes: testcases/open_posix_testsuite/Makefile | 19 ++-- testcases/open_posix_testsuite/bin/run-test.sh | 113 ++++++++++++++++++++ .../scripts/generate-makefiles.sh | 2 +- testcases/open_posix_testsuite/tools/Makefile | 2 + 4 files changed, 128 insertions(+), 8 deletions(-) create mode 100755 testcases/open_posix_testsuite/bin/run-test.sh diff --git a/testcases/open_posix_testsuite/Makefile b/testcases/open_posix_testsuite/Makefile index edf3fcc..172226b 100644 --- a/testcases/open_posix_testsuite/Makefile +++ b/testcases/open_posix_testsuite/Makefile @@ -21,11 +21,16 @@ LOGFILE?= logfile # Subdirectories to traverse down. SUBDIRS= conformance functional stress -MAKE_ENV= "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" -MAKE_ENV+= "LDLIBS=$(LDLIBS)" -MAKE_ENV+= LOGFILE=`if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ +MAKE_ENV= LOGFILE=`if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ -BUILD_MAKE= env $(MAKE_ENV) $(MAKE) +BUILD_MAKE_ENV= "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" +BUILD_MAKE_ENV+= "LDLIBS=$(LDLIBS)" $(MAKE_ENV) + +TEST_MAKE_ENV= $(MAKE_ENV) + +BUILD_MAKE= env $(BUILD_MAKE_ENV) $(MAKE) + +TEST_MAKE= env $(TEST_MAKE_ENV) $(MAKE) top_srcdir?= . @@ -63,7 +68,7 @@ conformance-install: @$(MAKE) -C conformance install conformance-test: - @$(MAKE) -C conformance test + @$(TEST_MAKE) -C conformance test functional-all: $(CRITICAL_FUNCTIONAL_MAKEFILE) @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ @@ -73,7 +78,7 @@ functional-install: @$(MAKE) -C functional install functional-test: - @$(MAKE) -C functional test + @$(TEST_MAKE) -C functional test stress-all: $(CRITICAL_STRESS_MAKEFILE) @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ @@ -83,7 +88,7 @@ stress-install: @$(MAKE) -C stress install stress-test: - @$(MAKE) -C stress test + @$(TEST_MAKE) -C stress test tools-all: @$(MAKE) -C tools all diff --git a/testcases/open_posix_testsuite/bin/run-test.sh b/testcases/open_posix_testsuite/bin/run-test.sh new file mode 100755 index 0000000..e3b676e --- /dev/null +++ b/testcases/open_posix_testsuite/bin/run-test.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# +# A simple wrapper for pre- and post-execution activities for any given +# openposix test. +# +# run_test contains logic moved out of Makefile. +# +# Garrett Cooper, June 2010 +# + +LOGFILE=${LOGFILE:=logfile} + +NUM_FAIL=0 +NUM_PASS=0 +NUM_TESTS=0 + +run_test_loop() { + + for t in "$@"; do + + if run_test "$t"; then + NUM_PASS=`expr $NUM_PASS + 1` + else + NUM_FAIL=`expr $NUM_FAIL + 1` + fi + NUM_TESTS=`expr $NUM_TESTS + 1` + + done + + cat <<EOF +***************** +SUMMARY +***************** +PASS $NUM_PASS +FAIL $NUM_FAIL +***************** +TOTAL $NUM_TESTS +***************** +EOF + +} + +run_test() { + + testname=`echo "$1" | sed -e 's,.run-test$,,'` + + complog=$testname.log.$$ + + $SHELL -c "$SCRIPT_DIR/t0 $TIMEOUT_VAL ./$1" > $complog 2>&1 + + ret_code=$? + + if [ "$ret_code" = "0" ]; then + echo "$testname: execution: PASS" >> "${LOGFILE}" + else + case "$ret_code" in + 1) + msg="FAILED" + ;; + 2) + msg="UNRESOLVED" + ;; + 4) + msg="UNSUPPORTED" + ;; + 5) + msg="UNTESTED" + ;; + $TIMEOUT_RET) + msg="HUNG" + ;; + *) + msg="SIGNALED" + esac + (echo "$testname: execution: $msg: Output: "; cat $complog) >> \ + "${LOGFILE}" + echo "$testname: execution: $msg " + fi + + rm -f $complog + + return $ret_code + +} + +# SETUP +if ! echo > "$LOGFILE"; then + echo >&2 "ERROR: $LOGFILE not writable" + exit 1 +fi + +SCRIPT_DIR=`dirname "$0"` +T0_VAL=$SCRIPT_DIR/t0.val + +if [ ! -f "$T0_VAL" ]; then + $SCRIPT_DIR/t0 0 + echo $? > "$T0_VAL" +fi +if TIMEOUT_RET=$(cat "$T0_VAL"); then + + TIMEOUT_VAL=${TIMEOUT_VAL:=240} + if [ -f test_defs ] ; then + . ./test_defs || exit $? + fi + trap '' INT + + # RUN + run_test_loop "$@" + exit $NUM_FAIL + +else + exit $? +fi diff --git a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh index 46c4838..6671941 100755 --- a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh +++ b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh @@ -126,7 +126,7 @@ install: \$(INSTALL_DIR) run.sh done test: all run.sh - \$(SHELL) ./run.sh + @\$(SHELL) ./run.sh \$(INSTALL_DIR): mkdir -p \$@ diff --git a/testcases/open_posix_testsuite/tools/Makefile b/testcases/open_posix_testsuite/tools/Makefile index 0550534..b09903d 100644 --- a/testcases/open_posix_testsuite/tools/Makefile +++ b/testcases/open_posix_testsuite/tools/Makefile @@ -6,6 +6,8 @@ srcdir?= . +all: t0 + clean: @rm -f t0 hooks/post-receive -- ltp |