From a5d355683e577f018ceba2fbfdfac98bcc88bb48 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 13 May 2024 20:35:10 +0200 Subject: Pass environment prefix to test runner. --- cscript | 2 ++ run/tests | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/cscript b/cscript index 52d7e914..618b2fb9 100644 --- a/cscript +++ b/cscript @@ -81,6 +81,8 @@ def make_doxygen(target): def test(target, options, test): target.set('LC_ALL', 'C') cmd = 'run\\tests ' if target.platform == 'windows' else 'run/tests ' + if target.environment_prefix: + cmd += '-e %s' % target.environment_prefix if test is not None: cmd += '-t %s' % test target.command(cmd) diff --git a/run/tests b/run/tests index f3b43666..483d2469 100755 --- a/run/tests +++ b/run/tests @@ -10,9 +10,35 @@ work=build/test dcpinfo=build/tools/dcpinfo dcpverify=build/tools/dcpverify +type="" +while [[ $# -gt 0 ]]; do + case $1 in + -e) + environment=$2 + shift + shift + ;; + --debug) + type="debug" + shift + ;; + --valgrind) + type="valgrind" + shift + ;; + --callgrind) + type="callgrind" + shift + ;; + *) + break + ;; + esac +done + export LD_LIBRARY_PATH=build/src:/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH # SIP stops this being passed in from the caller's environment -export DYLD_LIBRARY_PATH=/Users/ci/osx-environment/x86_64/10.10/lib:/Users/ci/workspace/lib +export DYLD_LIBRARY_PATH=$environment/x86_64/10.10/lib:/Users/ci/workspace/lib export LIBDCP_RESOURCES=. # Make sure we have the required tools @@ -23,14 +49,11 @@ done echo "--- Unit tests" # Run the unit tests in test/ -if [ "$1" == "--debug" ]; then - shift +if [ "$type" == "debug" ]; then gdb --args $work/tests $private $* -elif [ "$1" == "--valgrind" ]; then - shift +elif [ "$type" == "valgrind" ]; then valgrind --tool="memcheck" $work/tests $private $* -elif [ "$1" == "--callgrind" ]; then - shift +elif [ "$type" == "callgrind" ]; then valgrind --tool="callgrind" $work/tests $private $* else $work/tests $* -- $private -- cgit v1.2.3