-
Notifications
You must be signed in to change notification settings - Fork 10
/
mcr_cmd
executable file
·112 lines (92 loc) · 2.5 KB
/
mcr_cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
# args validation
usage() {
cat <<EOU
usage: $0 [options] test_class [parameters]
e.g., $0 edu.tamu.aser.tests.RVExample.RVExample
options:
--help -h usage
--debug -D print debug information
--static -S using static dependency analysis
--optimal -O using optimal MCR
--explorer -E choosing the exploring method (mcr or icb)
--class_path classpath -c classpath (Default: bin/)
--memmory-model MM -m MM selecting the memory model SC/TSO/PSO (Dedault: SC)
EOU
exit 1
}
if [ "$#" = 0 ]; then
usage ;
exit 1 ;
fi
declare -a ARGS
ARGS=($@)
for ((j = 0; j < $#; j++)) ; do
# echo ${ARGS[$j]}
case "${ARGS[$j]}" in
--debug) ARGS[$j]=-D ;;
--static) ARGS[$j]=-S ;;
--optimal) ARGS[$j]=-O ;;
--explorer) ARGS[$j]=-E ;;
--memmory-model) ARGS[$j]=-m ;;
--class_path) ARGS[$j]=-c ;;
--*) usage ; exit 1 ;;
*) ARGS[$j]="${ARGS[$j]}" ;;
esac
done
debug="false" #default: not show the debug infrormation
static_opt="false"
omcr="false"
model=SC #default: using sequential consistency memmory model
class_path=./mcr-test/target/classes/
class_name=""
params=""
while getopts "ODSE:m:hc:" opt ; do
case "$opt" in
D) debug="true" ;;
S) static_opt="true" ;;
O) opt_mcr="true" ;;
E) strategy="$OPTARG" ;;
m) model="$OPTARG" ;;
c) class_path="$OPTARG" ;;
h) usage ; exit 1 ;;
*) break ;;
esac
done
#default explorer
explorer="edu.tamu.aser.scheduling.strategy.MCRStrategy"
if [ "$strategy" == "mcr" ]; then
explorer="edu.tamu.aser.scheduling.strategy.MCRStrategy"
elif [ "$strategy" == "icb" ]
then
explorer="edu.tamu.aser.scheduling.strategy.IterativeContextBoundingStrategy"
fi
#echo $model
#echo $explorer
shift "$((OPTIND-1))"
declare -a TEST
TEST=($@)
class_name=${TEST[0]}
for ((j = 1; j < $#; j++)) ; do
params="$params ${TEST[$j]}"
done
# functions
# $1 -- test class
function runTests()
{
echo "Running tests from: ${class_name}"
java -ea -javaagent:libs/agent.jar \
-cp '.:./build/*:./libs/*:./mcr-test/target/classes/' \
-Ddebug=$debug \
-Ddep_mcr=$static_opt \
-Dopt_mcr=$opt_mcr \
-Dmcr.exploration.scheduling.strategy=$explorer \
-Dmemory_model=$model \
-Dclass_path=$class_path -Dclass_name=$class_name \
org.junit.runner.JUnitCore $class_name $params
}
# test if it needs to run the static analysis to generate the SGD
if [ "$static_opt" == "true" ]; then
java -cp .:./libs/joana/*:./build/mcr-sdggen-1.0-SNAPSHOT.jar main.generateSDG $class_path $class_name
fi
runTests ${test_class}