add result file
[model-checker-benchmarks.git] / bench.sh
1 #!/bin/bash
2
3 # A (work-in-progress) test script for running our benchmarks
4 # Runs all tests, with timing information
5
6 DATECMD="date +%Y-%m-%d-%R"
7 DATE="`${DATECMD}`"
8
9 TESTS="chase-lev-deque/main"
10 TESTS+=" spsc-queue/spsc-queue"
11 TESTS+=" spsc-bugfix/spsc-queue"
12 TESTS+=" barrier/barrier"
13 TESTS+=" dekker-fences/dekker-fences"
14 TESTS+=" mcs-lock/mcs-lock"
15 TESTS+=" mpmc-queue/mpmc-queue-rdwr"
16 TESTS+=" ms-queue/main"
17 TESTS+=" linuxrwlocks/linuxrwlocks"
18
19 MODEL_ARGS="-y -m 2 -u 3"
20
21 #TESTS+=" mpmc-queue/mpmc-2r1w"
22 #TESTS+=" mpmc-queue/mpmc-1r2w-noinit"
23 #TESTS+=" mpmc-queue/mpmc-queue-rdwr"
24 #TESTS+=" mpmc-queue/mpmc-queue-noinit"
25
26 COUNT=0
27
28 function run_test {
29         t=$1
30         shift
31         ARGS="$@"
32         RUN="./run.sh"
33
34         echo "-----------------------------------------------"
35         echo "*******************************"
36         echo "Running test ${COUNT} (${t})"
37         echo "ARGS=${ARGS}"
38         echo "*******************************"
39         (time ${RUN} ${t} ${ARGS} 2>&1) 2>&1
40         echo
41         echo "Test done; sleeping for a few seconds"
42         echo
43
44         let COUNT++
45 }
46
47 function run_all_tests {
48         echo ${DATE}
49
50         for t in ${TESTS}
51         do
52                 run_test ${t} ${MODEL_ARGS}
53         done
54         #run_test mpmc-queue/mpmc-queue ${MODEL_ARGS} -- -r 2 -w 1
55         #run_test mpmc-queue/mpmc-queue ${MODEL_ARGS} -- -r 1 -w 2
56         #run_test mpmc-queue/mpmc-queue ${MODEL_ARGS} -- -r 2 -w 2
57 }
58
59 # Check if git is available, and this is a git repository
60 GIT=0
61 which git &> /dev/null && git rev-parse &> /dev/null && GIT=1
62
63 # Print out some git information, if available
64 if [ ${GIT} -ne 0 ]; then
65         cd ..
66         git log --oneline -1
67         cd - > /dev/null
68         git log --oneline -1
69         echo
70 fi
71 run_all_tests