fix mutex_trylock bug
[c11tester.git] / run.sh
diff --git a/run.sh b/run.sh
index 45f962c1ab273f48f2ab6ee9d8859da28c2489d6..0807b2ec4a4557a05691c0f6a3315571f4b2681b 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -1,4 +1,28 @@
 #!/bin/sh
+#
+# Runs a simple test (default: ./test/userprog.o)
+# Syntax:
+#  ./run.sh [test program] [OPTIONS]
+#  ./run.sh [OPTIONS]
+#  ./run.sh [gdb [test program]]
+#
+# If you include a 'gdb' argument, the your program will be launched with gdb.
+# You can also supply a test program argument to run something besides the
+# default program.
+#
 
-export LD_LIBRARY_PATH=.
-gdb ./model
+# Get the directory in which this script and the binaries are located
+BINDIR="${0%/*}"
+
+BIN=${BINDIR}/test/userprog.o
+PREFIX=
+
+export LD_LIBRARY_PATH=${BINDIR}
+# For Mac OSX
+export DYLD_LIBRARY_PATH=${BINDIR}
+
+[ $# -gt 0 ] && [ "$1" = "gdb" ] && PREFIX=gdb && shift
+[ $# -gt 0 ] && [ -e "$1" ] && BIN="$1" && shift
+
+set -xe
+$PREFIX $BIN $@