aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-03 21:21:36 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-03 21:21:36 +0000
commita3da76a7780eb98017b185127693962316fd12ac (patch)
tree0dd3b22916f2868705032e71a47c8a0547d54a9b /test
parent262df8c46ae1fee336bfa93f1381adf8d9387f7a (diff)
downloadpaludis-a3da76a7780eb98017b185127693962316fd12ac.tar.gz
paludis-a3da76a7780eb98017b185127693962316fd12ac.tar.xz
Make parallel tests betterer
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am16
-rwxr-xr-xtest/run_test.sh46
2 files changed, 27 insertions, 35 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 2b14798db..a1137b790 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,10 +1,8 @@
-CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/misc/common-makefile.am
+
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
EXTRA_DIST = run_test.sh
-AUTOMAKE_OPTIONS = parallel-tests
-
libtest_a_SOURCES = \
test_framework.cc \
test_framework.hh \
@@ -17,11 +15,10 @@ libtestnomain_a_SOURCES = \
test_framework.hh \
test_concepts.hh
-XFAIL_TESTS = test_fail_TEST
-TESTS = test_pass_TEST $(XFAIL_TESTS)
+my_XFAIL_TESTS = test_fail_TEST
+XFAIL_TESTS = $(my_XFAIL_TESTS)
+TESTS = test_pass_TEST $(my_XFAIL_TESTS)
-TESTS_ENVIRONMENT = env PALUDIS_OPTIONS="" \
- TEST_SCRIPT_DIR="$(srcdir)/" bash $(top_srcdir)/test/run_test.sh
check_LIBRARIES = libtest.a libtestnomain.a
check_PROGRAMS = $(TESTS) $(XFAIL_TESTS)
check_SCRIPTS = run_test.sh
@@ -34,6 +31,3 @@ test_fail_TEST_SOURCES = test_fail_TEST.cc
test_fail_TEST_LDADD = libtest.a
test_fail_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-built-sources : $(BUILT_SOURCES)
- for s in $(SUBDIRS) ; do $(MAKE) -C $$s built-sources || exit 1 ; done
-
diff --git a/test/run_test.sh b/test/run_test.sh
index 0c435ac57..62e3da032 100755
--- a/test/run_test.sh
+++ b/test/run_test.sh
@@ -2,66 +2,64 @@
# vim: set ft=sh sw=4 sts=4 et :
testname=${2:-${1}}
+interp=
+[[ ${testname%.py} != ${testname} ]] && interp="${PYTHON}"
+[[ ${testname%.rb} != ${testname} ]] && interp="${RUBY} -I ./.libs/"
+
testname=${testname%.rb}
testname=${testname%.py}
testname=${testname%.bash}
-TEST_OUTPUT_WRAPPER="${OVERRIDE_TEST_OUTPUT_WRAPPER-${TEST_OUTPUT_WRAPPER}}"
+[[ -z "PALUDIS_TESTS_REAL_STDOUT_FD" ]] && export PALUDIS_TESTS_REAL_STDOUT_FD=1
if test -f "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
- echo ">>> cleanup for test ${testname}"
+ echo ">>> cleanup for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
if ! "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
- echo ">>> exiting with error for test ${testname}"
+ echo ">>> exiting with error for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
exit 255
fi
else
- echo ">>> No $TEST_SCRIPT_DIR${testname}_cleanup.sh to run"
+ echo ">>> No $TEST_SCRIPT_DIR${testname}_cleanup.sh to run" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
fi
if test -f "$TEST_SCRIPT_DIR""${testname}"_"setup.sh" ; then
- echo ">>> setup for test ${testname}"
+ echo ">>> setup for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
if ! "$TEST_SCRIPT_DIR""${testname}"_"setup.sh" ; then
- echo ">>> exiting with error for test ${testname}"
+ echo ">>> exiting with error for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
exit 255
fi
else
- echo ">>> No $TEST_SCRIPT_DIR${testname}_setup.sh to run"
+ echo ">>> No $TEST_SCRIPT_DIR${testname}_setup.sh to run" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
fi
-echo ">>> test ${testname}"
-if [[ -n "${TEST_OUTPUT_WRAPPER}" ]] ; then
- $TEST_OUTPUT_WRAPPER --stdout-prefix "${testname#./}> " --stderr-prefix \
- "${testname#./}> " --wrap-blanks -- ${@}
- code=$?
-else
- ${@}
- code=$?
-fi
+echo ">>> test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
+$interp ${@}
+code=$?
if [[ 0 != ${code} ]] ; then
- echo ">>> test ${testname} returned ${code}"
+ echo ">>> test ${testname} returned ${code}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
if [[ -z "${PALUDIS_TESTS_RERUN_VERBOSELY}" ]] && [[ "${testname#./}" != "test_fail_TEST" ]] ; then
out=`pwd`/${testname#./}.epicfail
- echo ">>> rerunning test ${testname} verbosely redirected to ${out}"
+ echo ">>> rerunning test ${testname} verbosely redirected to ${out}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
env PALUDIS_TESTS_RERUN_VERBOSELY=no PALUDIS_TESTS_KEEP_STDERR=yes \
PALUDIS_TESTS_KEEP_LOG=yes TEST_OUTPUT_WRAPPER= $0 $@ > $out 2>&1
- echo ">>> saved output of verbose ${testname} rerun to ${out}"
+ echo ">>> saved output of verbose ${testname} rerun to ${out}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
fi
- echo ">>> exiting with error for test ${testname}"
+ echo ">>> exiting with error for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
exit 255
fi
if test -f "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
- echo ">>> cleanup for test ${testname}"
+ echo ">>> cleanup for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
if ! "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
- echo ">>> exiting with error for test ${testname}"
+ echo ">>> exiting with error for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
exit 255
fi
else
- echo ">>> No $TEST_SCRIPT_DIR${testname}_cleanup.sh to run"
+ echo ">>> No $TEST_SCRIPT_DIR${testname}_cleanup.sh to run" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
fi
-echo ">>> exiting with success for test ${testname}"
+echo ">>> exiting with success for test ${testname}" 1>&$PALUDIS_TESTS_REAL_STDOUT_FD
exit 0