fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / run-tests.sh
index 9bcaca6f5ccadd1864157003d86261d5eb5e112d..cf98211753733e4b46035b62ccd3f7aa12b89b8c 100755 (executable)
@@ -1,16 +1,38 @@
-#!/bin/sh
+#!/bin/bash
+#
+# Run libardour test suite.
+#
 
-if [ ! -f './tempo.cc' ]; then
-    echo "This script must be run from within the libs/ardour directory";
-       exit 1;
-fi
-
-srcdir=`pwd`
-cd ../../build/default
+TOP=`dirname "$0"`/../..
+. $TOP/build/gtk2_ardour/ardev_common_waf.sh
+ARDOUR_LIBS_DIR=$TOP/build/libs/ardour
 
-libs='libs'
-
-export LD_LIBRARY_PATH=$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/sigc++2:$libs/glibmm2:$libs/gtkmm2/atk:$libs/gtkmm2/pango:$libs/gtkmm2/gdk:$libs/gtkmm2/gtk:$libs/libgnomecanvasmm:$libs/libsndfile:$libs/appleutility:$libs/cairomm:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$LD_LIBRARY_PATH
+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 $ARDOUR_LIBS_DIR -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 $ARDOUR_LIBS_DIR/run-tests
+        elif [ "$1" == "--valgrind" ]; then
+                valgrind $ARDOUR_LIBS_DIR/run-tests
+        else
+                $ARDOUR_LIBS_DIR/run-tests $*
+        fi
+fi
 
-echo $LD_LIBRARY_PATH
-./libs/ardour/run-tests