model: reformat some code
[model-checker.git] / run.sh
diff --git a/run.sh b/run.sh
index 45f962c1ab273f48f2ab6ee9d8859da28c2489d6..fecd43ddefc8b7a2460bb2d595ad9fc868f28fda 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 [gdb]
+#  ./run.sh [test program] [gdb]
+#
+# 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.
+#
+
+BIN=./test/userprog.o
 
 export LD_LIBRARY_PATH=.
-gdb ./model
+
+[ $# -gt 0 ] && [ "$1" != "gdb" ] && BIN=$1 && shift
+
+if [ $# -gt 0 ]; then
+       if [ "$1" = "gdb" ]; then
+               gdb $BIN
+       else
+               echo "Invalid argument(s)"
+               exit 1
+       fi
+else
+       $BIN
+fi