diff options
author | Stuart Haslam <stuart.haslam@linaro.org> | 2015-11-24 13:35:00 +0000 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-11-25 21:59:29 +0300 |
commit | c67bdfaa4095aa2a0b13fd5da30d583c36ea5029 (patch) | |
tree | 74ab37f5a8bdf8f4e9023b0c0af6f8944e269065 /platform | |
parent | 944c36965cff2c28a0c7f62d2a342b3eaeafc92b (diff) |
linux-generic: validation: add run-test script for post install testing
Add a run-test script that replicates some of the "make check"
functionality without depending on a whole load of Makefile gubbins.
This makes it easier to perform on-target testing following a
cross-build (as we want to do in CI) and gives a simple way to verify
that all the required components do actually get installed correctly,
using "make installcheck".
./configure --enable-test-vald --with-testdir
DESTDIR=$(pwd)/test-install make install installcheck
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
Reviewed-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linux-generic/test/.gitignore | 1 | ||||
-rw-r--r-- | platform/linux-generic/test/Makefile.am | 13 | ||||
-rwxr-xr-x | platform/linux-generic/test/run-test | 67 |
3 files changed, 81 insertions, 0 deletions
diff --git a/platform/linux-generic/test/.gitignore b/platform/linux-generic/test/.gitignore index 7e563b8b3..5dabf91c1 100644 --- a/platform/linux-generic/test/.gitignore +++ b/platform/linux-generic/test/.gitignore @@ -1,2 +1,3 @@ *.log *.trs +tests-validation.env diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index 11648d4b2..147558942 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -30,7 +30,20 @@ SUBDIRS = $(ODP_MODULES) if HAVE_PCAP TESTS += pktio/pktio_run_pcap endif +endif + +dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER) + +test_SCRIPTS = $(dist_check_SCRIPTS) + +tests-validation.env: + echo "TESTS=\"$(TESTS)\"" > $@ + echo "$(TESTS_ENVIRONMENT)" >> $@ + echo "$(LOG_COMPILER)" >> $@ +if test_installdir +installcheck-local: + $(DESTDIR)/$(testdir)/run-test endif #performance tests refer to pktio_env diff --git a/platform/linux-generic/test/run-test b/platform/linux-generic/test/run-test new file mode 100755 index 000000000..2bff651cc --- /dev/null +++ b/platform/linux-generic/test/run-test @@ -0,0 +1,67 @@ +#!/bin/bash +# +# Run the ODP test applications and report status in a format that +# matches the automake "make check" output. +# +# The list of tests to be run is obtained by sourcing a file that +# contains an environment variable in the form; +# +# TEST="test_app1 test_app2" +# +# The default behaviour is to run all the tests defined in files +# named tests-*.env in the same directory as this script, but a single +# test definition file can be specified using the TEST_DEF environment +# variable. +# +# Test definition files may optionally also specify a LOG_COMPILER +# which will be invoked as a wrapper to each of the test application +# (as per automake). +# +TDIR=$(dirname $(readlink -f $0)) +PASS=0 +FAIL=0 +SKIP=0 +res=0 + +if [ "$V" != "0" ]; then + verbose=1 +else + verbose=0 + mkdir -p logs +fi + +do_run_tests() { + source $1 + + for tc in $TESTS; do + tc=$(basename $tc) + if [ "$verbose" = "0" ]; then + logfile=logs/${tc}.log + touch $logfile || logfile=/dev/null + $LOG_COMPILER $TDIR/$tc > $logfile 2>&1 + else + $LOG_COMPILER $TDIR/$tc + fi + + tres=$? + case $tres in + 0) echo "PASS: $tc"; let PASS=$PASS+1 ;; + 77) echo "SKIP: $tc"; let SKIP=$SKIP+1 ;; + *) echo "FAIL: $tc"; let FAIL=$FAIL+1; res=1 ;; + esac + done +} + +if [ "$TEST_DEFS" != "" -a -f "$TEST_DEFS" ]; then + do_run_tests $TEST_DEFS +elif [ "$1" != "" ]; then + do_run_tests $TDIR/tests-${1}.env +else + for tenv in $TDIR/tests-*.env; do + do_run_tests $tenv + done +fi + +echo "TEST RESULT: $PASS tests passed, $SKIP skipped, $FAIL failed" + +exit $res |