@@ -1,2 +1,3 @@
*.log
*.trs
+tests-validation.env
@@ -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
new file mode 100755
@@ -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
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> --- Change in v2: moved an endif in the Makefile to fix issue with distcheck platform/linux-generic/test/.gitignore | 1 + platform/linux-generic/test/Makefile.am | 13 +++++++ platform/linux-generic/test/run-test | 67 +++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100755 platform/linux-generic/test/run-test