-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·222 lines (186 loc) · 4.58 KB
/
run.sh
File metadata and controls
executable file
·222 lines (186 loc) · 4.58 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
# This is the only way to correct run JDBLENDER tests
help() {
echo "
__ ___ ___ __ ___ _ _ ___ ___ ___
( )( \( ,)( ) ( _)( \( )( \( _)( ,)
__)( ) ) )) ,\ )(__ ) _) ) ( ) ) )) _) ) \
(___/ (___/(___/(____)(___)(_)\_)(___/(___)(_)\_)
Usage: $0 [options] implementation/s
Argument:
implementation/s Implementation to run or comma separated list (type all to run all)
Options:
-t number Times to run each test implementation (by default 1)
-r number Reduce tests data sets up to N times if possible
-d Disable JIT
-p port Enable local profiler connection at specific port
-j string Additional JVM arguments
-f flags Specific test flags. Example: -F \"h2ds;hibernate=cache,jta;caynne=fast\"
Flags are just strings delimited by comma.
There are flag groups, that are delimited by semicolon.
Flags group related to some implemntation must have prefix like \"mybatis=f1,f2,f3\"
otherwise such flags will be treated as global.
There are no global flags yet available.
"
}
start_db() {
db_start_command &
PID=$!
}
run_test() {
JAR="${APP_DIR}/$1/build/libs/${1}.jar"
OUT="${APP_DIR}/report-${1}.csv"
if [ $INIT -eq 0 ]; then
#Compile project here
echo "COMPILE $1"
./gradlew ":${1}:jar"
fi
echo "RUN: $1"
#echo "java $JVM -jar $JAR $OUT $REDUCE $FLAGS"
java $JVM -jar $JAR $OUT $REDUCE $FLAGS
}
INIT=0
run_tests() {
if [ $CYCLES -gt 1 ]; then
echo "WILL RUN $CYCLES CYCLES"
fi
COUNTER=0
while [ $COUNTER -lt $CYCLES ]; do
let COUNTER=COUNTER+1
echo "CYCLE $COUNTER"
for i in $(echo $1 | sed "s/,/ /g")
do
run_test $i || break
done
INIT=1
done
}
cd "$(dirname "$0")"
#INITIALIZE DEFAULTS
HELP=0
CYCLES=1
REDUCE=1
ALL="jdbc,springjdbc,mybatis,jooq,cayenne,eclipse-link,hibernate,springdata"
JVM="-XX:CompileThreshold=10000 "
FLAGS=""
APP_DIR="$(dirname "$0")"
while getopts ":dp:t:r:f:h" opt; do
case $opt in
h)
HELP=1
;;
d)
JVM="${JVM} -Djava.compiler=NONE "
export JDB_JIT="FALSE"
;;
p)
if [ -z "$OPTARG" ]; then
echo -e "\n ERROR: Invalid -p port value"
HELP=-1
else
export JDB_PROFILE="TRUE"
JVM="$JVM -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$OPTARG -Dcom.sun.management.jmxremote.local.only=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false "
fi
;;
t)
if [ -z "$OPTARG" ]; then
echo -e "\n ERROR: Invalid -t argument value"
HELP=-1
else
let CYCLES=$(($OPTARG))
fi
;;
r)
if [ -z "$OPTARG" ]; then
echo -e "\n ERROR: Invalid reduce value"
HELP=-1
else
let REDUCE=$(($OPTARG))
fi
;;
f)
if [ -z "$OPTARG" ]; then
echo -e "\n ERROR: Invalid flags"
HELP=-1
else
FLAGS="$OPTARG"
fi
;;
*)
echo -e "\n ERROR: Invalid arguments!!!"
HELP=-1
;;
esac
done
shift $((OPTIND - 1))
if [[ -z "$1" ]]; then
echo -e "\n ERROR: Implementation argument is not specified!!!"
HELP=-1
fi
if [[ 0 -ne $HELP ]]; then
help
exit 0;
else
if [ "$1" == "all" ]; then
run_tests $ALL
else
run_tests $1
fi
fi
echo "ERROR"
exit 1;
## OLD CODE
usage() {
echo "Usage: $0 project_name|all cycles_to_run"
echo " project_name - project to execute or type \"all\" to run on all projects"
echo " cycles_to_run - number of cycles to run (default 1)"
echo " test_set_factor - (default 1)"
}
JIT="jitc"
while getopts ":j" option; do
case $option in
j)
JIT="NONE"
;;
esac
done
shift $((OPTIND - 1))
if [[ -z "$1" ]]; then
usage
exit 0
fi
run_one() {
CYCLES=$2
echo "RUN $1 $CYCLES times"
COUNTER=0
ARG=${@:3}
while [ $COUNTER -lt $CYCLES ]; do
let COUNTER=COUNTER+1
echo "CYCLE $COUNTER"
./gradlew :$1:run -Dargs="$ARG" -Pjit="$JIT" || break
done
}
run_all() {
COUNTER=0
CYCLES=$1
echo "RUN ALL $CYCLES times"
ARG=${@:2}
while [ $COUNTER -lt $CYCLES ]; do
let COUNTER=COUNTER+1
echo "CYCLE $COUNTER"
./gradlew run -Dargs="$ARG" -Pjit="$JIT" || break
done
}
CYCLES=1
if [ ! -z "$2" ]; then
let CYCLES=$(($2))
fi
ARGS=""
if [ ! -z "$3" ]; then
ARGS="-f $3"
fi
if [ "$1" == "all" ]; then
run_all $CYCLES $ARGS
else
run_one $1 $CYCLES $ARGS
fi