X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=run.sh;h=00ffd94b338c223710f15198e06f1fd40ca25509;hb=732f2a6b8c2083eb47fadcdf1eae0f9a837be32f;hp=7ef8e9bcf00193c1e44c9243bec39cefd754d25b;hpb=10de861d3a9908e75b6f94283cc67b3f1b4d93ab;p=model-checker.git diff --git a/run.sh b/run.sh index 7ef8e9b..00ffd94 100755 --- a/run.sh +++ b/run.sh @@ -1,13 +1,23 @@ #!/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. +# + +BIN=./test/userprog.o +PREFIX= + export LD_LIBRARY_PATH=. -if [ $# -gt 0 ]; then - if [ "$1" = "gdb" ]; then - gdb ./model - else - echo "Invalid argument(s)" - exit 1 - fi -else - ./model -fi +[ $# -gt 0 ] && [ "$1" = "gdb" ] && PREFIX=gdb && shift +[ $# -gt 0 ] && [ -x "$1" ] && [ -f "$1" ] && BIN="$1" && shift + +set -x +$PREFIX $BIN $@