fix crash at session close/exit if a midi-control-surface is used
[ardour.git] / libs / ardour / run-tests.sh
index 85ddfeaf812aa0646c8026e774bb79eb6b241f28..e894fecb63d145e5b0ab607958375258baf8f311 100755 (executable)
@@ -1,11 +1,35 @@
-#!/bin/sh
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../build/default/libs/ardour
-if [ ! -f './bbt_time.cc' ]; then
-    echo "This script must be run from within the libs/ardour directory";
-       exit 1;
-fi
+#!/bin/bash
+#
+# Run libardour test suite.
+#
+. test-env.sh
 
-srcdir=`pwd`
+if [ "$1" == "--single" ] || [ "$2" == "--single" ]; then
+        if [ "$1" == "--single" ]; then
+               TESTS="test_*$2*"
+        elif [ "$2" == "--single" ]; then
+               TESTS="test_*$3*"
+       else
+                TESTS='test_*'
+        fi
+       for test_program in `find libs/ardour -name "$TESTS" -type f -perm /u+x`;
+       do
+               echo "Running $test_program..."
+                if [ "$1" == "--debug" ]; then
+                       gdb ./"$test_program"
+                elif [ "$1" == "--valgrind" ]; then
+                       valgrind ./"$test_program"
+               else
+                       ./"$test_program"
+               fi
+       done
+else
+        if [ "$1" == "--debug" ]; then
+                gdb ./libs/ardour/run-tests
+        elif [ "$1" == "--valgrind" ]; then
+                valgrind ./libs/ardour/run-tests
+        else
+                ./libs/ardour/run-tests $*
+        fi
+fi
 
-cd ../../build/default/libs/ardour
-./run-tests