summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-13 20:35:10 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-13 20:35:36 +0200
commita5d355683e577f018ceba2fbfdfac98bcc88bb48 (patch)
treee984e286f058e32d1088b4c781e15d8058516152
parent4d03b76ff759e30ea079944c31a87e2b3e7a21ac (diff)
Pass environment prefix to test runner.
-rw-r--r--cscript2
-rwxr-xr-xrun/tests37
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