From 742e4ad0fb818f41aeef52aad862e120b9a5d5af Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 Mar 2015 17:59:08 +0000 Subject: [PATCH] Test suite: Use make for parallel execution --- tests/Makefile | 14 ++++++++++++++ tests/run-all | 20 +++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 tests/Makefile diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 00000000..011bd3c2 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,14 @@ +# usage: tests/using-intree make -f tests/Makefile +# (optionally setting TESTSCRIPTS='tests/tests/foo tests/tests/bar') + +TESTSCRIPTS ?= $(shell run-parts --list tests/tests) +TESTNAMES := $(notdir $(TESTSCRIPTS)) + +all: $(foreach t,$(TESTNAMES),tests/tmp/$t.ok) + @echo "ALL PASSED" + +tests/tmp: + mkdir -p $@ + +tests/tmp/%.ok: tests/tmp + tests/tests/$* >tests/tmp/$*.log 2>&1 diff --git a/tests/run-all b/tests/run-all index e2e2a6f5..f298cb77 100755 --- a/tests/run-all +++ b/tests/run-all @@ -1,13 +1,15 @@ #!/bin/sh set -e # convenience script for running the tests outside adt-run -if [ $# = 0 ]; then - set `run-parts --list tests/tests` +# usage: tests/using-intree tests/run-all + +set +e +jcpus=`perl -MSys::CPU -we 'printf "-j%d\n",Sys::CPU::cpu_count()'` +set -e + +if [ $# != 0 ]; then + set TESTSCRIPTS="$*" fi -for f in $@; do - echo ================================================== - echo $f - $f - echo ================================================== -done -echo "ALL PASSED" + +set -x +exec make $jcpus -f tests/Makefile "$@" -- 2.30.2