summaryrefslogtreecommitdiffstats
path: root/tests/test-subr.sh
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2013-04-26 23:44:25 +0200
committerMark Wielaard <[email protected]>2013-04-27 00:15:29 +0200
commit86be792c727ea0c09d687e76d98739a5af23a803 (patch)
tree34066a242bf21a32f43916bdfc069dbc4cb6a6e0 /tests/test-subr.sh
parent1704baf67698c269bc81fbaec0483e53d9709702 (diff)
Enable automake parallel-tests for make check.
The parallel-tests option was introduced in automake 1.11 and is the default since automake 1.13. All tests can now be ran in parallel with make check -j. To enable this all tests are ran in their own temporary directory so they don't stomp on each others input or output files. On my machine (4 cores) make check takes ~20 seconds, but now with make check -j8 takes only ~4 seconds. ChangeLog: * configure.ac (AM_INIT_AUTOMAKE): Request parallel-tests. tests/ChangeLog: * Makefile.am (installed_TESTS_ENVIRONMENT): Export environment, remove wrapper. (TESTS_ENVIRONMENT): Likewise. (installed_LOG_COMPILER): New variable defining wrapper. (LOG_COMPILER): Likewise. * run-*.sh: Fixup location of input and output files. * test-subr.sh: Create test_dir, pushd to execute test in. (trap): Remove test_dir. (testfiles): Use abs_srcdir. (installed_testrun): Match on abs_builddir or abs_top_builddir. (self_test_files): Adjust path. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests/test-subr.sh')
-rw-r--r--tests/test-subr.sh23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index 19a9836a..7bf1f71d 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -22,11 +22,16 @@
set -e
+# Each test runs in its own directory to make sure they can run in parallel.
+test_dir="test-$$"
+mkdir -p "$test_dir"
+pushd "$test_dir" > /dev/null
+
#LC_ALL=C
#export LC_ALL
remove_files=
-trap 'rm -f $remove_files' 0
+trap 'rm -f $remove_files; popd > /dev/null; rmdir $test_dir' 0
tempfiles()
{
@@ -36,7 +41,7 @@ tempfiles()
testfiles()
{
for file; do
- bunzip2 -c $srcdir/${file}.bz2 > ${file} 2>/dev/null || exit 77
+ bunzip2 -c ${abs_srcdir}/${file}.bz2 > ${file} 2>/dev/null || exit 77
remove_files="$remove_files $file"
done
}
@@ -80,13 +85,13 @@ installed_testrun()
program="$1"
shift
case "$program" in
- ./*)
+ ${abs_builddir}/*)
if [ "x$elfutils_tests_rpath" != xno ]; then
echo >&2 installcheck not possible with --enable-tests-rpath
exit 77
fi
;;
- ../*)
+ ${abs_top_builddir}/src/*)
program=${bindir}/`program_transform ${program##*/}`
;;
esac
@@ -104,10 +109,12 @@ program_transform()
echo "$*" | sed "${program_transform_name}"
}
-self_test_files=`echo ../src/addr2line ../src/elfcmp ../src/elflint \
-../src/findtextrel ../src/ld ../src/nm ../src/objdump ../src/readelf \
-../src/size ../src/strip ../libelf/libelf.so ../libdw/libdw.so \
-../libasm/libasm.so ../backends/libebl_*.so`
+self_test_files=`echo ${abs_top_builddir}/src/addr2line \
+${abs_top_builddir}/src/elfcmp ${abs_top_builddir}/src/elflint \
+${abs_top_builddir}/src/nm ${abs_top_builddir}/src/objdump \
+${abs_top_builddir}/src/readelf ${abs_top_builddir}/src/size \
+${abs_top_builddir}/src/strip ${abs_top_builddir}/libelf/libelf.so \
+${abs_top_builddir}/libdw/libdw.so ${abs_top_builddir}/backends/libebl_*.so`
# Provide a command to run on all self-test files with testrun.
testrun_on_self()