bench.sh: only print git information when we're in git
[model-checker-benchmarks.git] / bench.sh
index e7efc6dceb72cdd9e016c059010e9259ae017696..cbe29bc5bce8f82fd9cf6c310bb0225c0a9e1ba3 100755 (executable)
--- a/bench.sh
+++ b/bench.sh
@@ -1,31 +1,31 @@
 #!/bin/bash
 
 # A (work-in-progress) test script for running our benchmarks
-# Runs all tests, logging output to a directory named
-# '${BASEDIR}/run-<date-time>', where ${BASEDIR} is either the current
-# directory or the first parameter to this script
+# Runs all tests, with timing information
 
 ## Unfinished benchmarks - do not use
 # queue williams-queue
 
 DATECMD="date +%Y-%m-%d-%R"
 DATE="`${DATECMD}`"
-BASEDIR=.
 
-[ $# -gt 0 ] && [ -d "$1" ] && BASEDIR="$1" && shift
-
-DIR="${BASEDIR}/run-${DATE}"
-
-TESTS="barrier/barrier"
-TESTS+=" mcs-lock/mcs-lock"
+TESTS="chase-lev-deque/main"
 TESTS+=" spsc-queue/spsc-queue"
 TESTS+=" spsc-bugfix/spsc-queue"
-TESTS+=" mpmc-queue/mpmc-2r1w"
-TESTS+=" mpmc-queue/mpmc-1r2w-noinit"
-TESTS+=" mpmc-queue/mpmc-queue-noinit"
+TESTS+=" barrier/barrier"
+TESTS+=" dekker-fences/dekker-fences"
+TESTS+=" mcs-lock/mcs-lock"
+TESTS+=" mpmc-queue/mpmc-queue-rdwr"
+TESTS+=" ms-queue/main"
 TESTS+=" linuxrwlocks/linuxrwlocks"
 
-MODEL_ARGS="-f 10 -m 2 -e 1"
+MODEL_ARGS="-y -m 2 -u 3"
+
+#TESTS+=" mpmc-queue/mpmc-2r1w"
+#TESTS+=" mpmc-queue/mpmc-1r2w-noinit"
+#TESTS+=" mpmc-queue/mpmc-queue-rdwr"
+#TESTS+=" mpmc-queue/mpmc-queue-noinit"
+
 COUNT=0
 
 function run_test {
@@ -33,23 +33,13 @@ function run_test {
        shift
        ARGS="$@"
        RUN="./run.sh"
-       LOG=${DIR}/log-${COUNT}
 
        echo "-----------------------------------------------"
        echo "*******************************"
-       echo "Running test ${COUNT} (${t}): logging to ${LOG}"
+       echo "Running test ${COUNT} (${t})"
        echo "ARGS=${ARGS}"
        echo "*******************************"
-       time ${RUN} ${t} ${ARGS} 2>&1 | tee ${LOG}
-       echo
-       echo "Test done; sleeping for a few seconds"
-       echo
-       sleep 3
-
-       echo "*******************************"
-       echo "Re-running test for timing data"
-       echo "*******************************"
-       (time ${RUN} ${t} ${ARGS} > /dev/null 2>&1) 2>&1
+       (time ${RUN} ${t} ${ARGS} 2>&1) 2>&1
        echo
        echo "Test done; sleeping for a few seconds"
        echo
@@ -69,5 +59,16 @@ function run_all_tests {
        #run_test mpmc-queue/mpmc-queue ${MODEL_ARGS} -- -r 2 -w 2
 }
 
-mkdir ${DIR}
-(git log --oneline -1; echo; run_all_tests) | tee ${DIR}/timing.log
+# Check if git is available, and this is a git repository
+GIT=0
+which git &> /dev/null && git rev-parse &> /dev/null && GIT=1
+
+# Print out some git information, if available
+if [ ${GIT} -ne 0 ]; then
+       cd ..
+       git log --oneline -1
+       cd - > /dev/null
+       git log --oneline -1
+       echo
+fi
+run_all_tests