blob: 81e77be547b2b0a06005877fa69d37c63ab7cfec [file] [log] [blame]
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +01001#!/bin/bash
2#
3# Runner for an individual run-test.
4
5msg() {
6 if [ "$QUIET" = "n" ]; then
7 echo "$@"
8 fi
9}
10
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +000011ANDROID_ROOT="/system"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010012ARCHITECTURES_32="(arm|x86|mips|none)"
Andreas Gampe1a5c4062015-01-15 12:10:47 -080013ARCHITECTURES_64="(arm64|x86_64|mips64|none)"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010014ARCHITECTURES_PATTERN="${ARCHITECTURES_32}"
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +000015BOOT_IMAGE=""
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010016COMPILE_FLAGS=""
17DALVIKVM="dalvikvm32"
18DEBUGGER="n"
Alex Light0e151e72017-10-25 10:50:35 -070019WITH_AGENT=""
Alex Lightc281ba52017-10-11 11:35:55 -070020DEBUGGER_AGENT=""
21WRAP_DEBUGGER_AGENT="n"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010022DEV_MODE="n"
23DEX2OAT=""
Alex Light8a0e0332015-10-26 10:11:58 -070024EXPERIMENTAL=""
Nicolas Geoffray90355fe2017-02-20 09:25:40 +000025FALSE_BIN="false"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010026FLAGS=""
Alex Light7233c7e2016-07-28 10:07:45 -070027ANDROID_FLAGS=""
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010028GDB=""
Nicolas Geoffraybaf91022014-10-08 09:56:45 +010029GDB_ARGS=""
30GDB_SERVER="gdbserver"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010031HAVE_IMAGE="y"
32HOST="n"
33INTERPRETER="n"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080034JIT="n"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010035INVOKE_WITH=""
Alex Lighte06b6342017-01-05 14:37:21 -080036IS_JVMTI_TEST="n"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010037ISA=x86
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +000038LIBRARY_DIRECTORY="lib"
Colin Crossafd3c9e2016-09-16 13:47:21 -070039TEST_DIRECTORY="nativetest"
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +000040MAIN=""
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010041OPTIMIZE="y"
42PATCHOAT=""
43PREBUILD="y"
44QUIET="n"
Nicolas Geoffray94e25db2017-01-27 14:54:28 +000045RELOCATE="n"
Richard Uhler76f5cb62016-04-04 13:30:16 -070046STRIP_DEX="n"
Jeff Hao207a37d2014-10-29 17:24:25 -070047SECONDARY_DEX=""
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -070048TIME_OUT="gdb" # "n" (disabled), "timeout" (use timeout), "gdb" (use gdb)
49# Value in seconds
Hiroshi Yamauchifd3161a2017-01-18 14:47:25 -080050if [ "$ART_USE_READ_BARRIER" != "false" ]; then
Hiroshi Yamauchia9b296c2016-10-07 17:07:03 -070051 TIME_OUT_VALUE=2400 # 40 minutes.
Hiroshi Yamauchidcf0d4b2015-09-09 18:59:42 -070052else
Mathieu Chartier2576be22016-05-24 10:24:53 -070053 TIME_OUT_VALUE=1200 # 20 minutes.
Hiroshi Yamauchidcf0d4b2015-09-09 18:59:42 -070054fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010055USE_GDB="n"
Nicolas Geoffray288a4a22014-10-07 11:02:40 +010056USE_JVM="n"
Alex Lightc281ba52017-10-11 11:35:55 -070057USE_JVMTI="n"
Igor Murashkin7617abd2015-07-10 18:27:47 -070058VERIFY="y" # y=yes,n=no,s=softfail
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010059ZYGOTE=""
Andreas Gampe2b0fa5b2014-10-31 18:12:30 -070060DEX_VERIFY=""
Andreas Gampe65357032015-02-19 15:10:24 -080061USE_DEX2OAT_AND_PATCHOAT="y"
Andreas Gampe4d2ef332015-08-05 09:24:45 -070062INSTRUCTION_SET_FEATURES=""
Mathieu Chartier031768a2015-08-27 10:25:02 -070063ARGS=""
Wojciech Staszkiewiczd7a819a2016-09-01 14:43:39 -070064EXTERNAL_LOG_TAGS="n" # if y respect externally set ANDROID_LOG_TAGS.
65DRY_RUN="n" # if y prepare to run the test but don't run it.
Nicolas Geoffrayb0bbe8e2016-11-19 10:42:37 +000066TEST_VDEX="n"
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +000067TEST_DM="n"
Alex Lighte06b6342017-01-05 14:37:21 -080068TEST_IS_NDEBUG="n"
Calin Juravle857f0582016-12-20 14:36:59 +000069APP_IMAGE="y"
Alex Light8f2c6d42017-04-10 16:27:35 -070070JVMTI_STRESS="n"
Alex Lightc38c3692017-06-27 15:45:14 -070071JVMTI_STEP_STRESS="n"
Alex Light43e935d2017-06-19 15:40:40 -070072JVMTI_FIELD_STRESS="n"
Alex Lightb7edcda2017-04-27 13:20:31 -070073JVMTI_TRACE_STRESS="n"
74JVMTI_REDEFINE_STRESS="n"
Nicolas Geoffray74981052017-01-16 17:54:09 +000075VDEX_FILTER=""
Calin Juravle13439f02017-02-21 01:17:21 -080076PROFILE="n"
Jeff Hao002b9312017-03-27 16:23:08 -070077RANDOM_PROFILE="n"
Alex Light483208d2017-09-26 09:31:17 -070078# The normal dex2oat timeout.
Shubham Ajmeraf97cbd62017-10-11 10:00:57 -070079DEX2OAT_TIMEOUT="300" # 5 mins
Alex Light483208d2017-09-26 09:31:17 -070080# The *hard* timeout where we really start trying to kill the dex2oat.
Shubham Ajmeraf97cbd62017-10-11 10:00:57 -070081DEX2OAT_RT_TIMEOUT="360" # 6 mins
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010082
Igor Murashkin271a0f82017-02-14 21:14:17 +000083# if "y", run 'sync' before dalvikvm to make sure all files from
84# build step (e.g. dex2oat) were finished writing.
85SYNC_BEFORE_RUN="n"
86
Andreas Gampe1c5b42f2017-06-15 18:20:45 -070087# When running a debug build, we want to run with all checks.
88ANDROID_FLAGS="${ANDROID_FLAGS} -XX:SlowDebug=true"
Andreas Gampee8f74ca2018-01-02 09:26:16 -080089# The same for dex2oatd, both prebuild and runtime-driven.
90ANDROID_FLAGS="${ANDROID_FLAGS} -Xcompiler-option --runtime-arg -Xcompiler-option -XX:SlowDebug=true"
91COMPILER_FLAGS="${COMPILER_FLAGS} --runtime-arg -XX:SlowDebug=true"
Andreas Gampe1c5b42f2017-06-15 18:20:45 -070092
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010093while true; do
94 if [ "x$1" = "x--quiet" ]; then
95 QUIET="y"
96 shift
Alex Light483208d2017-09-26 09:31:17 -070097 elif [ "x$1" = "x--dex2oat-rt-timeout" ]; then
98 shift
99 if [ "x$1" = "x" ]; then
100 echo "$0 missing argument to --dex2oat-rt-timeout" 1>&2
101 exit 1
102 fi
103 DEX2OAT_RT_TIMEOUT="$1"
104 shift
105 elif [ "x$1" = "x--dex2oat-timeout" ]; then
106 shift
107 if [ "x$1" = "x" ]; then
108 echo "$0 missing argument to --dex2oat-timeout" 1>&2
109 exit 1
110 fi
111 DEX2OAT_TIMEOUT="$1"
112 shift
Alex Lighte06b6342017-01-05 14:37:21 -0800113 elif [ "x$1" = "x--jvmti" ]; then
Alex Lightc281ba52017-10-11 11:35:55 -0700114 USE_JVMTI="y"
Alex Lighte06b6342017-01-05 14:37:21 -0800115 IS_JVMTI_TEST="y"
116 shift
Alex Lightfaf90b62016-08-12 14:43:48 -0700117 elif [ "x$1" = "x-O" ]; then
Alex Lighte06b6342017-01-05 14:37:21 -0800118 TEST_IS_NDEBUG="y"
Alex Lightfaf90b62016-08-12 14:43:48 -0700119 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100120 elif [ "x$1" = "x--lib" ]; then
121 shift
122 if [ "x$1" = "x" ]; then
123 echo "$0 missing argument to --lib" 1>&2
124 exit 1
125 fi
126 LIB="$1"
127 shift
Alex Light97acf192016-03-17 09:59:38 -0700128 elif [ "x$1" = "x--gc-stress" ]; then
129 # Give an extra 5 mins if we are gc-stress.
130 TIME_OUT_VALUE=$((${TIME_OUT_VALUE} + 300))
131 shift
Mathieu Chartier031768a2015-08-27 10:25:02 -0700132 elif [ "x$1" = "x--testlib" ]; then
133 shift
134 if [ "x$1" = "x" ]; then
135 echo "$0 missing argument to --testlib" 1>&2
136 exit 1
137 fi
Mathieu Chartierde286fd2015-09-03 18:10:29 -0700138 ARGS="${ARGS} $1"
Mathieu Chartier031768a2015-08-27 10:25:02 -0700139 shift
David Srbecky52886112016-01-22 13:56:47 +0000140 elif [ "x$1" = "x--args" ]; then
141 shift
142 if [ "x$1" = "x" ]; then
143 echo "$0 missing argument to --args" 1>&2
144 exit 1
145 fi
146 ARGS="${ARGS} $1"
147 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100148 elif [ "x$1" = "x-Xcompiler-option" ]; then
149 shift
150 option="$1"
151 FLAGS="${FLAGS} -Xcompiler-option $option"
152 COMPILE_FLAGS="${COMPILE_FLAGS} $option"
153 shift
Alex Light7233c7e2016-07-28 10:07:45 -0700154 elif [ "x$1" = "x--android-runtime-option" ]; then
155 shift
156 option="$1"
157 ANDROID_FLAGS="${ANDROID_FLAGS} $option"
158 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100159 elif [ "x$1" = "x--runtime-option" ]; then
160 shift
161 option="$1"
162 FLAGS="${FLAGS} $option"
163 shift
164 elif [ "x$1" = "x--boot" ]; then
165 shift
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000166 BOOT_IMAGE="$1"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100167 shift
168 elif [ "x$1" = "x--no-dex2oat" ]; then
169 DEX2OAT="-Xcompiler:${FALSE_BIN}"
Andreas Gampe65357032015-02-19 15:10:24 -0800170 USE_DEX2OAT_AND_PATCHOAT="n"
Andreas Gampe5b8a1972017-11-07 10:23:48 -0800171 PREBUILD="n" # Do not use prebuilt odex, either.
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100172 shift
173 elif [ "x$1" = "x--no-patchoat" ]; then
174 PATCHOAT="-Xpatchoat:${FALSE_BIN}"
Andreas Gampe65357032015-02-19 15:10:24 -0800175 USE_DEX2OAT_AND_PATCHOAT="n"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100176 shift
177 elif [ "x$1" = "x--relocate" ]; then
178 RELOCATE="y"
179 shift
180 elif [ "x$1" = "x--no-relocate" ]; then
181 RELOCATE="n"
182 shift
183 elif [ "x$1" = "x--prebuild" ]; then
184 PREBUILD="y"
185 shift
Mathieu Chartierdcd56c92017-11-20 20:30:24 -0800186 elif [ "x$1" = "x--compact-dex-level" ]; then
187 shift
188 COMPILE_FLAGS="${COMPILE_FLAGS} --compact-dex-level=$1"
189 shift
Alex Lightb7edcda2017-04-27 13:20:31 -0700190 elif [ "x$1" = "x--jvmti-redefine-stress" ]; then
191 # APP_IMAGE doesn't really work with jvmti redefine stress
Alex Lightc281ba52017-10-11 11:35:55 -0700192 USE_JVMTI="y"
Alex Light8f2c6d42017-04-10 16:27:35 -0700193 APP_IMAGE="n"
194 JVMTI_STRESS="y"
Alex Lightb7edcda2017-04-27 13:20:31 -0700195 JVMTI_REDEFINE_STRESS="y"
196 shift
Alex Lightc38c3692017-06-27 15:45:14 -0700197 elif [ "x$1" = "x--jvmti-step-stress" ]; then
Alex Lightc281ba52017-10-11 11:35:55 -0700198 USE_JVMTI="y"
Alex Lightc38c3692017-06-27 15:45:14 -0700199 JVMTI_STRESS="y"
200 JVMTI_STEP_STRESS="y"
201 shift
Alex Light43e935d2017-06-19 15:40:40 -0700202 elif [ "x$1" = "x--jvmti-field-stress" ]; then
Alex Lightc281ba52017-10-11 11:35:55 -0700203 USE_JVMTI="y"
Alex Light43e935d2017-06-19 15:40:40 -0700204 JVMTI_STRESS="y"
205 JVMTI_FIELD_STRESS="y"
206 shift
Alex Lightb7edcda2017-04-27 13:20:31 -0700207 elif [ "x$1" = "x--jvmti-trace-stress" ]; then
Alex Lightc281ba52017-10-11 11:35:55 -0700208 USE_JVMTI="y"
Alex Lightb7edcda2017-04-27 13:20:31 -0700209 JVMTI_STRESS="y"
210 JVMTI_TRACE_STRESS="y"
Alex Light8f2c6d42017-04-10 16:27:35 -0700211 shift
Calin Juravle857f0582016-12-20 14:36:59 +0000212 elif [ "x$1" = "x--no-app-image" ]; then
213 APP_IMAGE="n"
214 shift
Richard Uhler76f5cb62016-04-04 13:30:16 -0700215 elif [ "x$1" = "x--strip-dex" ]; then
216 STRIP_DEX="y"
217 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100218 elif [ "x$1" = "x--host" ]; then
219 HOST="y"
Nicolas Geoffray8eedb472014-10-29 14:05:59 +0000220 ANDROID_ROOT="$ANDROID_HOST_OUT"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100221 shift
222 elif [ "x$1" = "x--no-prebuild" ]; then
223 PREBUILD="n"
224 shift
225 elif [ "x$1" = "x--no-image" ]; then
226 HAVE_IMAGE="n"
227 shift
Jeff Hao207a37d2014-10-29 17:24:25 -0700228 elif [ "x$1" = "x--secondary" ]; then
229 SECONDARY_DEX=":$DEX_LOCATION/$TEST_NAME-ex.jar"
Calin Juravle175dc732015-08-25 15:42:32 +0100230 # Enable cfg-append to make sure we get the dump for both dex files.
231 # (otherwise the runtime compilation of the secondary dex will overwrite
Roland Levillainb0103ca2016-11-01 14:48:47 +0000232 # the dump of the first one).
Calin Juravle175dc732015-08-25 15:42:32 +0100233 FLAGS="${FLAGS} -Xcompiler-option --dump-cfg-append"
234 COMPILE_FLAGS="${COMPILE_FLAGS} --dump-cfg-append"
Jeff Hao207a37d2014-10-29 17:24:25 -0700235 shift
Alex Light0e151e72017-10-25 10:50:35 -0700236 elif [ "x$1" = "x--with-agent" ]; then
237 shift
238 USE_JVMTI="y"
239 WITH_AGENT="$1"
240 shift
Alex Lightc281ba52017-10-11 11:35:55 -0700241 elif [ "x$1" = "x--debug-wrap-agent" ]; then
242 WRAP_DEBUGGER_AGENT="y"
243 shift
244 elif [ "x$1" = "x--debug-agent" ]; then
245 shift
246 DEBUGGER="agent"
247 USE_JVMTI="y"
248 DEBUGGER_AGENT="$1"
249 TIME_OUT="n"
250 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100251 elif [ "x$1" = "x--debug" ]; then
252 DEBUGGER="y"
Brian Carlstrom93d6ce52014-11-04 22:31:35 -0800253 TIME_OUT="n"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100254 shift
255 elif [ "x$1" = "x--gdb" ]; then
256 USE_GDB="y"
257 DEV_MODE="y"
Brian Carlstrom93d6ce52014-11-04 22:31:35 -0800258 TIME_OUT="n"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100259 shift
Mathieu Chartierc0a8a802014-10-17 15:58:01 -0700260 elif [ "x$1" = "x--gdb-arg" ]; then
261 shift
262 gdb_arg="$1"
263 GDB_ARGS="${GDB_ARGS} $gdb_arg"
264 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100265 elif [ "x$1" = "x--zygote" ]; then
266 ZYGOTE="-Xzygote"
267 msg "Spawning from zygote"
268 shift
269 elif [ "x$1" = "x--dev" ]; then
270 DEV_MODE="y"
271 shift
272 elif [ "x$1" = "x--interpreter" ]; then
273 INTERPRETER="y"
274 shift
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800275 elif [ "x$1" = "x--jit" ]; then
276 JIT="y"
277 shift
Nicolas Geoffray288a4a22014-10-07 11:02:40 +0100278 elif [ "x$1" = "x--jvm" ]; then
279 USE_JVM="y"
280 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100281 elif [ "x$1" = "x--invoke-with" ]; then
282 shift
283 if [ "x$1" = "x" ]; then
284 echo "$0 missing argument to --invoke-with" 1>&2
285 exit 1
286 fi
287 if [ "x$INVOKE_WITH" = "x" ]; then
288 INVOKE_WITH="$1"
289 else
290 INVOKE_WITH="$INVOKE_WITH $1"
291 fi
292 shift
293 elif [ "x$1" = "x--no-verify" ]; then
294 VERIFY="n"
295 shift
Igor Murashkin7617abd2015-07-10 18:27:47 -0700296 elif [ "x$1" = "x--verify-soft-fail" ]; then
297 VERIFY="s"
298 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100299 elif [ "x$1" = "x--no-optimize" ]; then
300 OPTIMIZE="n"
301 shift
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000302 elif [ "x$1" = "x--android-root" ]; then
303 shift
304 ANDROID_ROOT="$1"
305 shift
Andreas Gampe4d2ef332015-08-05 09:24:45 -0700306 elif [ "x$1" = "x--instruction-set-features" ]; then
307 shift
308 INSTRUCTION_SET_FEATURES="$1"
309 shift
Mathieu Chartier2576be22016-05-24 10:24:53 -0700310 elif [ "x$1" = "x--timeout" ]; then
311 shift
312 TIME_OUT_VALUE="$1"
313 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100314 elif [ "x$1" = "x--" ]; then
315 shift
316 break
317 elif [ "x$1" = "x--64" ]; then
318 ISA="x86_64"
319 GDB_SERVER="gdbserver64"
320 DALVIKVM="dalvikvm64"
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000321 LIBRARY_DIRECTORY="lib64"
Colin Crossafd3c9e2016-09-16 13:47:21 -0700322 TEST_DIRECTORY="nativetest64"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100323 ARCHITECTURES_PATTERN="${ARCHITECTURES_64}"
324 shift
Andreas Gampec23c9c92014-10-28 14:47:25 -0700325 elif [ "x$1" = "x--pic-test" ]; then
326 FLAGS="${FLAGS} -Xcompiler-option --compile-pic"
327 COMPILE_FLAGS="${COMPILE_FLAGS} --compile-pic"
328 shift
Alex Light8a0e0332015-10-26 10:11:58 -0700329 elif [ "x$1" = "x--experimental" ]; then
330 if [ "$#" -lt 2 ]; then
331 echo "missing --experimental option" 1>&2
332 exit 1
333 fi
334 EXPERIMENTAL="$EXPERIMENTAL $2"
335 shift 2
Wojciech Staszkiewiczd7a819a2016-09-01 14:43:39 -0700336 elif [ "x$1" = "x--external-log-tags" ]; then
337 EXTERNAL_LOG_TAGS="y"
338 shift
339 elif [ "x$1" = "x--dry-run" ]; then
340 DRY_RUN="y"
341 shift
Nicolas Geoffrayb0bbe8e2016-11-19 10:42:37 +0000342 elif [ "x$1" = "x--vdex" ]; then
343 TEST_VDEX="y"
344 shift
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +0000345 elif [ "x$1" = "x--dm" ]; then
346 TEST_DM="y"
347 shift
Nicolas Geoffray74981052017-01-16 17:54:09 +0000348 elif [ "x$1" = "x--vdex-filter" ]; then
349 shift
350 option="$1"
351 VDEX_FILTER="--compiler-filter=$option"
352 shift
Igor Murashkin271a0f82017-02-14 21:14:17 +0000353 elif [ "x$1" = "x--sync" ]; then
354 SYNC_BEFORE_RUN="y"
355 shift
Calin Juravle13439f02017-02-21 01:17:21 -0800356 elif [ "x$1" = "x--profile" ]; then
357 PROFILE="y"
358 shift
Jeff Hao002b9312017-03-27 16:23:08 -0700359 elif [ "x$1" = "x--random-profile" ]; then
360 RANDOM_PROFILE="y"
361 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100362 elif expr "x$1" : "x--" >/dev/null 2>&1; then
363 echo "unknown $0 option: $1" 1>&2
364 exit 1
365 else
366 break
367 fi
368done
369
Alex Light8a0e0332015-10-26 10:11:58 -0700370if [ "$USE_JVM" = "n" ]; then
Alex Light7233c7e2016-07-28 10:07:45 -0700371 FLAGS="${FLAGS} ${ANDROID_FLAGS}"
Alex Light8a0e0332015-10-26 10:11:58 -0700372 for feature in ${EXPERIMENTAL}; do
Alex Lightfa022852015-10-28 09:13:20 -0700373 FLAGS="${FLAGS} -Xexperimental:${feature} -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:${feature}"
Alex Light8a0e0332015-10-26 10:11:58 -0700374 COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xexperimental:${feature}"
375 done
376fi
377
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100378if [ "x$1" = "x" ] ; then
379 MAIN="Main"
380else
381 MAIN="$1"
Andreas Gampef2fdc732014-06-11 08:20:47 -0700382 shift
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100383fi
384
385if [ "$ZYGOTE" = "" ]; then
386 if [ "$OPTIMIZE" = "y" ]; then
387 if [ "$VERIFY" = "y" ]; then
388 DEX_OPTIMIZE="-Xdexopt:verified"
389 else
390 DEX_OPTIMIZE="-Xdexopt:all"
391 fi
392 msg "Performing optimizations"
393 else
394 DEX_OPTIMIZE="-Xdexopt:none"
395 msg "Skipping optimizations"
396 fi
397
398 if [ "$VERIFY" = "y" ]; then
Nicolas Geoffray288a4a22014-10-07 11:02:40 +0100399 JVM_VERIFY_ARG="-Xverify:all"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100400 msg "Performing verification"
Igor Murashkin7617abd2015-07-10 18:27:47 -0700401 elif [ "$VERIFY" = "s" ]; then
402 JVM_VERIFY_ARG="Xverify:all"
403 DEX_VERIFY="-Xverify:softfail"
404 msg "Forcing verification to be soft fail"
405 else # VERIFY = "n"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100406 DEX_VERIFY="-Xverify:none"
Nicolas Geoffray288a4a22014-10-07 11:02:40 +0100407 JVM_VERIFY_ARG="-Xverify:none"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100408 msg "Skipping verification"
409 fi
410fi
411
412msg "------------------------------"
413
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100414if [ "$DEBUGGER" = "y" ]; then
415 # Use this instead for ddms and connect by running 'ddms':
416 # DEBUGGER_OPTS="-agentlib:jdwp=transport=dt_android_adb,server=y,suspend=y"
417 # TODO: add a separate --ddms option?
418
419 PORT=12345
420 msg "Waiting for jdb to connect:"
421 if [ "$HOST" = "n" ]; then
422 msg " adb forward tcp:$PORT tcp:$PORT"
423 fi
424 msg " jdb -attach localhost:$PORT"
Alex Light264a4862018-01-31 16:47:58 +0000425 if [ "$USE_JVM" = "n" ]; then
426 # TODO We should switch over to using the jvmti agent by default.
427 # Need to tell the runtime to enable the internal jdwp implementation.
428 DEBUGGER_OPTS="-XjdwpOptions:transport=dt_socket,address=$PORT,server=y,suspend=y -XjdwpProvider:internal"
429 else
430 DEBUGGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
431 fi
Alex Lightc281ba52017-10-11 11:35:55 -0700432elif [ "$DEBUGGER" = "agent" ]; then
433 PORT=12345
434 # TODO Support ddms connection and support target.
435 if [ "$HOST" = "n" ]; then
436 echo "--debug-agent not supported yet for target!"
437 exit 1
438 fi
439 AGENTPATH=${DEBUGGER_AGENT}
440 if [ "$WRAP_DEBUGGER_AGENT" = "y" ]; then
441 WRAPPROPS="${ANDROID_ROOT}/${LIBRARY_DIRECTORY}/libwrapagentpropertiesd.so"
442 if [ "$TEST_IS_NDEBUG" = "y" ]; then
443 WRAPPROPS="${ANDROID_ROOT}/${LIBRARY_DIRECTORY}/libwrapagentproperties.so"
444 fi
445 AGENTPATH="${WRAPPROPS}=${ANDROID_BUILD_TOP}/art/tools/libjdwp-compat.props,${AGENTPATH}"
446 fi
447 msg "Connect to localhost:$PORT"
448 DEBUGGER_OPTS="-agentpath:${AGENTPATH}=transport=dt_socket,address=$PORT,server=y,suspend=y"
449fi
450
Alex Light0e151e72017-10-25 10:50:35 -0700451if [ "x$WITH_AGENT" != "x" ]; then
452 FLAGS="${FLAGS} -agentpath:${WITH_AGENT}"
453fi
454
Alex Lightc281ba52017-10-11 11:35:55 -0700455if [ "$USE_JVMTI" = "y" ]; then
456 if [ "$USE_JVM" = "n" ]; then
457 plugin=libopenjdkjvmtid.so
458 if [[ "$TEST_IS_NDEBUG" = "y" ]]; then
459 plugin=libopenjdkjvmti.so
460 fi
Alex Light2ce6fc82017-12-18 16:42:36 -0800461 # We used to add flags here that made the runtime debuggable but that is not
462 # needed anymore since the plugin can do it for us now.
Alex Lightc281ba52017-10-11 11:35:55 -0700463 FLAGS="${FLAGS} -Xplugin:${plugin}"
Alex Lightc281ba52017-10-11 11:35:55 -0700464 fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100465fi
466
Alex Lightfba89fe2017-01-12 16:11:02 -0800467if [ "$IS_JVMTI_TEST" = "y" ]; then
Alex Lightfba89fe2017-01-12 16:11:02 -0800468 agent=libtiagentd.so
469 lib=tiagentd
470 if [[ "$TEST_IS_NDEBUG" = "y" ]]; then
471 agent=libtiagent.so
Alex Lightfba89fe2017-01-12 16:11:02 -0800472 lib=tiagent
473 fi
474
475 ARGS="${ARGS} ${lib}"
476 if [[ "$USE_JVM" = "y" ]]; then
477 FLAGS="${FLAGS} -agentpath:${ANDROID_HOST_OUT}/nativetest64/${agent}=${TEST_NAME},jvm"
478 else
479 FLAGS="${FLAGS} -agentpath:${agent}=${TEST_NAME},art"
Alex Lightfba89fe2017-01-12 16:11:02 -0800480 fi
481fi
482
Alex Light8f2c6d42017-04-10 16:27:35 -0700483if [[ "$JVMTI_STRESS" = "y" ]]; then
Alex Light42151c02017-04-20 15:54:25 -0700484 agent=libtistressd.so
485 if [[ "$TEST_IS_NDEBUG" = "y" ]]; then
486 agent=libtistress.so
Alex Light42151c02017-04-20 15:54:25 -0700487 fi
Alex Light8f2c6d42017-04-10 16:27:35 -0700488
Alex Lightb7edcda2017-04-27 13:20:31 -0700489 # Just give it a default start so we can always add ',' to it.
490 agent_args="jvmti-stress"
491 if [[ "$JVMTI_REDEFINE_STRESS" = "y" ]]; then
492 # We really cannot do this on RI so don't both passing it in that case.
493 if [[ "$USE_JVM" = "n" ]]; then
Alex Lightceae9542017-09-07 13:28:00 -0700494 agent_args="${agent_args},redefine"
Alex Lightb7edcda2017-04-27 13:20:31 -0700495 fi
496 fi
Alex Light43e935d2017-06-19 15:40:40 -0700497 if [[ "$JVMTI_FIELD_STRESS" = "y" ]]; then
498 agent_args="${agent_args},field"
499 fi
Alex Lightc38c3692017-06-27 15:45:14 -0700500 if [[ "$JVMTI_STEP_STRESS" = "y" ]]; then
501 agent_args="${agent_args},step"
502 fi
Alex Lightb7edcda2017-04-27 13:20:31 -0700503 if [[ "$JVMTI_TRACE_STRESS" = "y" ]]; then
504 agent_args="${agent_args},trace"
505 fi
506 # In the future add onto this;
Alex Light42151c02017-04-20 15:54:25 -0700507 if [[ "$USE_JVM" = "y" ]]; then
Alex Lightb7edcda2017-04-27 13:20:31 -0700508 FLAGS="${FLAGS} -agentpath:${ANDROID_HOST_OUT}/nativetest64/${agent}=${agent_args}"
Alex Light42151c02017-04-20 15:54:25 -0700509 else
Alex Lightb7edcda2017-04-27 13:20:31 -0700510 FLAGS="${FLAGS} -agentpath:${agent}=${agent_args}"
Alex Light8f2c6d42017-04-10 16:27:35 -0700511 fi
512fi
513
Nicolas Geoffray288a4a22014-10-07 11:02:40 +0100514if [ "$USE_JVM" = "y" ]; then
Alex Light9c20a142016-08-23 15:05:12 -0700515 export LD_LIBRARY_PATH=${ANDROID_HOST_OUT}/lib64
Alex Light47d49b82017-07-25 14:06:34 -0700516 # Some jvmti tests are flaky without -Xint on the RI.
517 if [ "$IS_JVMTI_TEST" = "y" ]; then
518 FLAGS="${FLAGS} -Xint"
519 fi
Mathieu Chartiera61894d2015-04-23 16:32:54 -0700520 # Xmx is necessary since we don't pass down the ART flags to JVM.
Vladimir Markoc5798bf2016-12-09 10:20:54 +0000521 # We pass the classes2 path whether it's used (src-multidex) or not.
522 cmdline="${JAVA} ${DEBUGGER_OPTS} ${JVM_VERIFY_ARG} -Xmx256m -classpath classes:classes2 ${FLAGS} $MAIN $@ ${ARGS}"
Andreas Gampe3f1dc562015-05-18 15:52:22 -0700523 if [ "$DEV_MODE" = "y" ]; then
524 echo $cmdline
525 fi
526 $cmdline
Nicolas Geoffray288a4a22014-10-07 11:02:40 +0100527 exit
528fi
529
530
531if [ "$HAVE_IMAGE" = "n" ]; then
Vladimir Markoe00e5592017-02-24 14:58:29 +0000532 if [ "${HOST}" = "y" ]; then
533 framework="${ANDROID_HOST_OUT}/framework"
534 bpath_suffix="-hostdex"
535 else
536 framework="${ANDROID_ROOT}/framework"
Nicolas Geoffray320ccca2017-03-01 10:03:08 +0000537 bpath_suffix="-testdex"
Vladimir Markoe00e5592017-02-24 14:58:29 +0000538 fi
Vladimir Markoe00e5592017-02-24 14:58:29 +0000539 bpath="${framework}/core-libart${bpath_suffix}.jar"
540 bpath="${bpath}:${framework}/core-oj${bpath_suffix}.jar"
541 bpath="${bpath}:${framework}/conscrypt${bpath_suffix}.jar"
542 bpath="${bpath}:${framework}/okhttp${bpath_suffix}.jar"
543 bpath="${bpath}:${framework}/bouncycastle${bpath_suffix}.jar"
544 # Pass down the bootclasspath
545 FLAGS="${FLAGS} -Xbootclasspath:${bpath}"
Andreas Gampe1078d152017-11-07 18:00:54 -0800546 # Disable image dex2oat - this will forbid the runtime to patch or compile an image.
547 FLAGS="${FLAGS} -Xnoimage-dex2oat"
548
549 # We'll abuse a second flag here to test different behavior. If --relocate, use the
550 # existing image - relocation will fail as patching is disallowed. If --no-relocate,
551 # pass a non-existent image - compilation will fail as dex2oat is disallowed.
552 if [ "${RELOCATE}" = "y" ] ; then
553 DALVIKVM_BOOT_OPT="-Ximage:${BOOT_IMAGE}"
554 else
Roland Levillainef012222017-06-21 16:28:06 +0100555 DALVIKVM_BOOT_OPT="-Ximage:/system/non-existent/core.art"
Andreas Gampe1078d152017-11-07 18:00:54 -0800556 fi
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000557else
558 DALVIKVM_BOOT_OPT="-Ximage:${BOOT_IMAGE}"
Nicolas Geoffray288a4a22014-10-07 11:02:40 +0100559fi
560
561
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100562if [ "$USE_GDB" = "y" ]; then
563 if [ "$HOST" = "n" ]; then
564 GDB="$GDB_SERVER :5039"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100565 else
566 if [ `uname` = "Darwin" ]; then
567 GDB=lldb
Mathieu Chartierc0a8a802014-10-17 15:58:01 -0700568 GDB_ARGS="$GDB_ARGS -- $DALVIKVM"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100569 DALVIKVM=
570 else
571 GDB=gdb
Mathieu Chartierc0a8a802014-10-17 15:58:01 -0700572 GDB_ARGS="$GDB_ARGS --args $DALVIKVM"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100573 # Enable for Emacs "M-x gdb" support. TODO: allow extra gdb arguments on command line.
574 # gdbargs="--annotate=3 $gdbargs"
575 fi
576 fi
577fi
578
579if [ "$INTERPRETER" = "y" ]; then
Nicolas Geoffraye722d292015-12-15 11:51:37 +0000580 INT_OPTS="-Xint"
Andreas Gampe2b0fa5b2014-10-31 18:12:30 -0700581 if [ "$VERIFY" = "y" ] ; then
Nicolas Geoffray49cda062017-04-21 13:08:25 +0100582 INT_OPTS="${INT_OPTS} -Xcompiler-option --compiler-filter=quicken"
583 COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=quicken"
Igor Murashkin7617abd2015-07-10 18:27:47 -0700584 elif [ "$VERIFY" = "s" ]; then
Nicolas Geoffray49cda062017-04-21 13:08:25 +0100585 INT_OPTS="${INT_OPTS} -Xcompiler-option --compiler-filter=extract"
586 COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=extract"
Igor Murashkin7617abd2015-07-10 18:27:47 -0700587 DEX_VERIFY="${DEX_VERIFY} -Xverify:softfail"
588 else # VERIFY = "n"
Nicolas Geoffray49cda062017-04-21 13:08:25 +0100589 INT_OPTS="${INT_OPTS} -Xcompiler-option --compiler-filter=assume-verified"
590 COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=assume-verified"
Andreas Gampe2b0fa5b2014-10-31 18:12:30 -0700591 DEX_VERIFY="${DEX_VERIFY} -Xverify:none"
592 fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100593fi
594
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800595if [ "$JIT" = "y" ]; then
Nicolas Geoffraye722d292015-12-15 11:51:37 +0000596 INT_OPTS="-Xusejit:true"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800597 if [ "$VERIFY" = "y" ] ; then
Nicolas Geoffray49cda062017-04-21 13:08:25 +0100598 INT_OPTS="${INT_OPTS} -Xcompiler-option --compiler-filter=quicken"
599 COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=quicken"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800600 else
Nicolas Geoffray49cda062017-04-21 13:08:25 +0100601 INT_OPTS="${INT_OPTS} -Xcompiler-option --compiler-filter=assume-verified"
602 COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=assume-verified"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800603 DEX_VERIFY="${DEX_VERIFY} -Xverify:none"
604 fi
605fi
606
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100607JNI_OPTS="-Xjnigreflimit:512 -Xcheck:jni"
608
Richard Uhler020c0f32017-03-14 16:23:17 +0000609COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xnorelocate"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100610if [ "$RELOCATE" = "y" ]; then
Richard Uhlerc52f3032017-03-02 13:45:45 +0000611 FLAGS="${FLAGS} -Xrelocate"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100612else
613 FLAGS="$FLAGS -Xnorelocate"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100614fi
615
616if [ "$HOST" = "n" ]; then
Nicolas Geoffrayd295bc82016-11-04 13:03:05 +0000617 # Need to be root to query /data/dalvik-cache
618 adb root > /dev/null
619 adb wait-for-device
620 ISA=
621 ISA_adb_invocation=
622 ISA_outcome=
623 # We iterate a few times to workaround an adb issue. b/32655576
624 for i in {1..10}; do
625 ISA_adb_invocation=$(adb shell ls -F /data/dalvik-cache)
626 ISA_outcome=$?
627 ISA=$(echo $ISA_adb_invocation | grep -Ewo "${ARCHITECTURES_PATTERN}")
628 if [ x"$ISA" != "x" ]; then
629 break;
630 fi
631 done
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100632 if [ x"$ISA" = "x" ]; then
633 echo "Unable to determine architecture"
Nicolas Geoffray8f500fa2016-11-03 11:18:48 +0000634 # Print a few things for helping diagnosing the problem.
Nicolas Geoffrayd295bc82016-11-04 13:03:05 +0000635 echo "adb invocation output: $ISA_adb_invocation"
636 echo "adb invocation outcome: $ISA_outcome"
Nicolas Geoffray8f500fa2016-11-03 11:18:48 +0000637 echo $(adb shell ls -F /data/dalvik-cache)
638 echo $(adb shell ls /data/dalvik-cache)
639 echo ${ARCHITECTURES_PATTERN}
640 echo $(adb shell ls -F /data/dalvik-cache | grep -Ewo "${ARCHITECTURES_PATTERN}")
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100641 exit 1
642 fi
643fi
644
Wojciech Staszkiewicze6636532016-09-23 10:59:55 -0700645# Prevent test from silently falling back to interpreter in no-prebuild mode. This happens
646# when DEX_LOCATION path is too long, because vdex/odex filename is constructed by taking
647# full path to dex, stripping leading '/', appending '@classes.vdex' and changing every
648# remaining '/' into '@'.
649if [ "$HOST" = "y" ]; then
650 max_filename_size=$(getconf NAME_MAX $DEX_LOCATION)
651else
Roland Levillain2ae376f2018-01-30 11:35:11 +0000652 # There is no getconf on device, fallback to standard value.
653 # See NAME_MAX in kernel <linux/limits.h>
Wojciech Staszkiewicze6636532016-09-23 10:59:55 -0700654 max_filename_size=255
655fi
656# Compute VDEX_NAME.
657DEX_LOCATION_STRIPPED="${DEX_LOCATION#/}"
658VDEX_NAME="${DEX_LOCATION_STRIPPED//\//@}@$TEST_NAME.jar@classes.vdex"
659if [ ${#VDEX_NAME} -gt $max_filename_size ]; then
Nicolas Geoffraybea3e312017-03-07 09:59:05 +0000660 echo "Dex location path too long:"
661 echo "$VDEX_NAME is ${#VDEX_NAME} character long, and the limit is $max_filename_size."
Wojciech Staszkiewicze6636532016-09-23 10:59:55 -0700662 exit 1
663fi
664
Calin Juravle13439f02017-02-21 01:17:21 -0800665profman_cmdline="true"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100666dex2oat_cmdline="true"
Nicolas Geoffrayb0bbe8e2016-11-19 10:42:37 +0000667vdex_cmdline="true"
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +0000668dm_cmdline="true"
Andreas Gampeb09abb22018-05-03 11:51:22 -0700669mkdir_locations="${DEX_LOCATION}/dalvik-cache/$ISA"
Richard Uhler76f5cb62016-04-04 13:30:16 -0700670strip_cmdline="true"
Igor Murashkin271a0f82017-02-14 21:14:17 +0000671sync_cmdline="true"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100672
Jeff Hao002b9312017-03-27 16:23:08 -0700673# PROFILE takes precedence over RANDOM_PROFILE, since PROFILE tests require a
674# specific profile to run properly.
675if [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
Nicolas Geoffray0b6a6382017-03-10 09:38:35 +0000676 profman_cmdline="${ANDROID_ROOT}/bin/profman \
677 --apk=$DEX_LOCATION/$TEST_NAME.jar \
Jeff Hao002b9312017-03-27 16:23:08 -0700678 --dex-location=$DEX_LOCATION/$TEST_NAME.jar"
Calin Juravle6df62f72017-04-28 19:58:01 -0700679 if [ -f $DEX_LOCATION/$TEST_NAME-ex.jar ]; then
680 profman_cmdline="${profman_cmdline} \
681 --apk=$DEX_LOCATION/$TEST_NAME-ex.jar \
682 --dex-location=$DEX_LOCATION/$TEST_NAME-ex.jar"
683 fi
Nicolas Geoffray0b6a6382017-03-10 09:38:35 +0000684 COMPILE_FLAGS="${COMPILE_FLAGS} --profile-file=$DEX_LOCATION/$TEST_NAME.prof"
685 FLAGS="${FLAGS} -Xcompiler-option --profile-file=$DEX_LOCATION/$TEST_NAME.prof"
Jeff Hao002b9312017-03-27 16:23:08 -0700686 if [ "$PROFILE" = "y" ]; then
687 profman_cmdline="${profman_cmdline} --create-profile-from=$DEX_LOCATION/profile \
688 --reference-profile-file=$DEX_LOCATION/$TEST_NAME.prof"
689 else
690 profman_cmdline="${profman_cmdline} --generate-test-profile=$DEX_LOCATION/$TEST_NAME.prof \
691 --generate-test-profile-seed=0"
692 fi
Nicolas Geoffray0b6a6382017-03-10 09:38:35 +0000693fi
694
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100695if [ "$PREBUILD" = "y" ]; then
Alex Lightafb5d192016-05-24 15:57:45 -0700696 mkdir_locations="${mkdir_locations} ${DEX_LOCATION}/oat/$ISA"
Calin Juravle857f0582016-12-20 14:36:59 +0000697 if [ "$APP_IMAGE" = "y" ]; then
698 # Pick a base that will force the app image to get relocated.
699 app_image="--base=0x4000 --app-image-file=$DEX_LOCATION/oat/$ISA/$TEST_NAME.art"
700 fi
701
Roland Levillain6c3af162017-04-27 11:18:56 +0100702 dex2oat_binary=dex2oatd
703 if [[ "$TEST_IS_NDEBUG" = "y" ]]; then
704 dex2oat_binary=dex2oat
705 fi
706 dex2oat_cmdline="$INVOKE_WITH $ANDROID_ROOT/bin/$dex2oat_binary \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100707 $COMPILE_FLAGS \
Nicolas Geoffray68e25eb2014-10-29 23:02:11 +0000708 --boot-image=${BOOT_IMAGE} \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100709 --dex-file=$DEX_LOCATION/$TEST_NAME.jar \
Andreas Gampe14759242016-03-23 10:54:21 -0700710 --oat-file=$DEX_LOCATION/oat/$ISA/$TEST_NAME.odex \
Jeff Haodcdc85b2015-12-04 14:06:18 -0800711 ${app_image} \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100712 --instruction-set=$ISA"
Andreas Gampe4d2ef332015-08-05 09:24:45 -0700713 if [ "x$INSTRUCTION_SET_FEATURES" != "x" ] ; then
714 dex2oat_cmdline="${dex2oat_cmdline} --instruction-set-features=${INSTRUCTION_SET_FEATURES}"
715 fi
Andreas Gampe2ea7b702015-08-07 08:07:16 -0700716
717 # Add in a timeout. This is important for testing the compilation/verification time of
718 # pathological cases.
719 # Note: as we don't know how decent targets are (e.g., emulator), only do this on the host for
720 # now. We should try to improve this.
721 # The current value is rather arbitrary. run-tests should compile quickly.
Alex Light483208d2017-09-26 09:31:17 -0700722 # Watchdog timeout is in milliseconds so add 3 '0's to the dex2oat timeout.
Andreas Gampe2ea7b702015-08-07 08:07:16 -0700723 if [ "$HOST" != "n" ]; then
724 # Use SIGRTMIN+2 to try to dump threads.
725 # Use -k 1m to SIGKILL it a minute later if it hasn't ended.
Alex Light483208d2017-09-26 09:31:17 -0700726 dex2oat_cmdline="timeout -k ${DEX2OAT_TIMEOUT}s -s SIGRTMIN+2 ${DEX2OAT_RT_TIMEOUT}s ${dex2oat_cmdline} --watchdog-timeout=${DEX2OAT_TIMEOUT}000"
Andreas Gampe2ea7b702015-08-07 08:07:16 -0700727 fi
Nicolas Geoffrayfbc4f112017-04-27 21:45:35 +0100728 if [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
729 vdex_cmdline="${dex2oat_cmdline} ${VDEX_FILTER} --input-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex --output-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex"
730 elif [ "$TEST_VDEX" = "y" ]; then
Nicolas Geoffray74981052017-01-16 17:54:09 +0000731 vdex_cmdline="${dex2oat_cmdline} ${VDEX_FILTER} --input-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex"
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +0000732 elif [ "$TEST_DM" = "y" ]; then
733 dex2oat_cmdline="${dex2oat_cmdline} --output-vdex=$DEX_LOCATION/oat/$ISA/primary.vdex"
734 dm_cmdline="zip -qj $DEX_LOCATION/oat/$ISA/$TEST_NAME.dm $DEX_LOCATION/oat/$ISA/primary.vdex"
735 vdex_cmdline="${dex2oat_cmdline} --dump-timings --dm-file=$DEX_LOCATION/oat/$ISA/$TEST_NAME.dm"
Nicolas Geoffraycab65572017-04-21 17:16:44 +0100736 elif [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
737 vdex_cmdline="${dex2oat_cmdline} --input-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex --output-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex"
Nicolas Geoffrayb0bbe8e2016-11-19 10:42:37 +0000738 fi
Andreas Gampe4d2ef332015-08-05 09:24:45 -0700739fi
740
Richard Uhler76f5cb62016-04-04 13:30:16 -0700741if [ "$STRIP_DEX" = "y" ]; then
742 strip_cmdline="zip --quiet --delete $DEX_LOCATION/$TEST_NAME.jar classes.dex"
743fi
744
Igor Murashkin271a0f82017-02-14 21:14:17 +0000745if [ "$SYNC_BEFORE_RUN" = "y" ]; then
746 sync_cmdline="sync"
747fi
748
Andreas Gampe4d2ef332015-08-05 09:24:45 -0700749DALVIKVM_ISA_FEATURES_ARGS=""
750if [ "x$INSTRUCTION_SET_FEATURES" != "x" ] ; then
751 DALVIKVM_ISA_FEATURES_ARGS="-Xcompiler-option --instruction-set-features=${INSTRUCTION_SET_FEATURES}"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100752fi
753
Nicolas Geoffrayc5256042015-12-26 19:41:37 +0000754# java.io.tmpdir can only be set at launch time.
755TMP_DIR_OPTION=""
756if [ "$HOST" = "n" ]; then
757 TMP_DIR_OPTION="-Djava.io.tmpdir=/data/local/tmp"
758fi
759
Nicolas Geoffray6ee49712018-03-30 14:39:05 +0000760# We set DumpNativeStackOnSigQuit to false to avoid stressing libunwind.
761# b/27185632
762# b/24664297
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000763dalvikvm_cmdline="$INVOKE_WITH $GDB $ANDROID_ROOT/bin/$DALVIKVM \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100764 $GDB_ARGS \
765 $FLAGS \
Andreas Gampe2b0fa5b2014-10-31 18:12:30 -0700766 $DEX_VERIFY \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100767 -XXlib:$LIB \
768 $PATCHOAT \
769 $DEX2OAT \
Andreas Gampe4d2ef332015-08-05 09:24:45 -0700770 $DALVIKVM_ISA_FEATURES_ARGS \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100771 $ZYGOTE \
772 $JNI_OPTS \
773 $INT_OPTS \
774 $DEBUGGER_OPTS \
775 $DALVIKVM_BOOT_OPT \
Nicolas Geoffrayc5256042015-12-26 19:41:37 +0000776 $TMP_DIR_OPTION \
Nicolas Geoffray6ee49712018-03-30 14:39:05 +0000777 -XX:DumpNativeStackOnSigQuit:false \
Mathieu Chartier031768a2015-08-27 10:25:02 -0700778 -cp $DEX_LOCATION/$TEST_NAME.jar$SECONDARY_DEX $MAIN $ARGS"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100779
Andreas Gampe3ad5d5e2015-02-03 18:26:55 -0800780# Remove whitespace.
781dex2oat_cmdline=$(echo $dex2oat_cmdline)
782dalvikvm_cmdline=$(echo $dalvikvm_cmdline)
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +0000783dm_cmdline=$(echo $dm_cmdline)
Nicolas Geoffrayb0bbe8e2016-11-19 10:42:37 +0000784vdex_cmdline=$(echo $vdex_cmdline)
Calin Juravle13439f02017-02-21 01:17:21 -0800785profman_cmdline=$(echo $profman_cmdline)
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100786
Andreas Gampeb31a8e72017-05-16 10:30:24 -0700787# Use an empty ASAN_OPTIONS to enable defaults.
788# Note: this is required as envsetup right now exports detect_leaks=0.
789RUN_TEST_ASAN_OPTIONS=""
790
Andreas Gampe58408392017-05-16 10:45:46 -0700791# Multiple shutdown leaks. b/38341789
792if [ "x$RUN_TEST_ASAN_OPTIONS" != "x" ] ; then
793 RUN_TEST_ASAN_OPTIONS="${RUN_TEST_ASAN_OPTIONS}:"
794fi
795RUN_TEST_ASAN_OPTIONS="${RUN_TEST_ASAN_OPTIONS}detect_leaks=0"
796
Nicolas Geoffrayf39f04c2018-03-05 15:42:11 +0000797# For running, we must turn off logging when dex2oat or patchoat are missing. Otherwise we use
798# the same defaults as for prebuilt: everything when --dev, otherwise errors and above only.
799if [ "$EXTERNAL_LOG_TAGS" = "n" ]; then
800 if [ "$DEV_MODE" = "y" ]; then
801 export ANDROID_LOG_TAGS='*:d'
802 elif [ "$USE_DEX2OAT_AND_PATCHOAT" = "n" ]; then
803 # All tests would log the error of failing dex2oat/patchoat. Be silent here and only
804 # log fatal events.
805 export ANDROID_LOG_TAGS='*:s'
806 elif [ "$HAVE_IMAGE" = "n" ]; then
807 # All tests would log the error of missing image. Be silent here and only log fatal
808 # events.
809 export ANDROID_LOG_TAGS='*:s'
810 else
811 # We are interested in LOG(ERROR) output.
812 export ANDROID_LOG_TAGS='*:e'
813 fi
814fi
815
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100816if [ "$HOST" = "n" ]; then
817 adb root > /dev/null
818 adb wait-for-device
819 if [ "$QUIET" = "n" ]; then
Calin Juravle24bd3f92017-05-11 00:36:53 -0700820 adb shell rm -rf $DEX_LOCATION
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100821 adb shell mkdir -p $DEX_LOCATION
822 adb push $TEST_NAME.jar $DEX_LOCATION
823 adb push $TEST_NAME-ex.jar $DEX_LOCATION
Jeff Hao002b9312017-03-27 16:23:08 -0700824 if [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
Calin Juravle13439f02017-02-21 01:17:21 -0800825 adb push profile $DEX_LOCATION
826 fi
David Brazdil7d2ec612018-01-19 14:19:59 +0000827 # Copy resource folder
828 if [ -d res ]; then
829 adb push res $DEX_LOCATION
830 fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100831 else
832 adb shell rm -r $DEX_LOCATION >/dev/null 2>&1
833 adb shell mkdir -p $DEX_LOCATION >/dev/null 2>&1
834 adb push $TEST_NAME.jar $DEX_LOCATION >/dev/null 2>&1
835 adb push $TEST_NAME-ex.jar $DEX_LOCATION >/dev/null 2>&1
Jeff Hao002b9312017-03-27 16:23:08 -0700836 if [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
Calin Juravle13439f02017-02-21 01:17:21 -0800837 adb push profile $DEX_LOCATION >/dev/null 2>&1
838 fi
David Brazdil7d2ec612018-01-19 14:19:59 +0000839 # Copy resource folder
840 if [ -d res ]; then
841 adb push res $DEX_LOCATION >/dev/null 2>&1
842 fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100843 fi
844
Colin Crossafd3c9e2016-09-16 13:47:21 -0700845 LD_LIBRARY_PATH=/data/$TEST_DIRECTORY/art/$ISA
Nicolas Geoffrayeb441dd2014-10-31 15:34:50 +0000846 if [ "$ANDROID_ROOT" != "/system" ]; then
847 # Current default installation is dalvikvm 64bits and dex2oat 32bits,
848 # so we can only use LD_LIBRARY_PATH when testing on a local
849 # installation.
Alex Light7233c7e2016-07-28 10:07:45 -0700850 LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBRARY_DIRECTORY:$LD_LIBRARY_PATH
Nicolas Geoffrayeb441dd2014-10-31 15:34:50 +0000851 fi
852
Dimitry Ivanov49c2c922017-02-14 11:06:14 -0800853 # System libraries needed by libarttestd.so
Vladimir Marko2da72ed2018-03-07 12:58:11 +0000854 PUBLIC_LIBS=libc++.so:libbacktrace.so:libbase.so:libnativehelper.so
855 if [ "$TEST_IS_NDEBUG" = "y" ]; then
Nicolas Geoffray83b74192018-04-27 10:58:45 +0100856 PUBLIC_LIBS=$PUBLIC_LIBS:libart.so:libdexfile.so:libprofile.so
Vladimir Marko2da72ed2018-03-07 12:58:11 +0000857 else
Nicolas Geoffray83b74192018-04-27 10:58:45 +0100858 PUBLIC_LIBS=$PUBLIC_LIBS:libartd.so:libdexfiled.so:libprofiled.so
Vladimir Marko2da72ed2018-03-07 12:58:11 +0000859 fi
Dimitry Ivanov90d48f22016-05-05 17:24:28 -0700860
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100861 # Create a script with the command. The command can get longer than the longest
862 # allowed adb command and there is no way to get the exit status from a adb shell
Wojciech Staszkiewiczd7a819a2016-09-01 14:43:39 -0700863 # command. Dalvik cache is cleaned before running to make subsequent executions
864 # of the script follow the same runtime path.
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100865 cmdline="cd $DEX_LOCATION && \
Andreas Gampeb31a8e72017-05-16 10:30:24 -0700866 export ASAN_OPTIONS=$RUN_TEST_ASAN_OPTIONS && \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100867 export ANDROID_DATA=$DEX_LOCATION && \
Dimitry Ivanov90d48f22016-05-05 17:24:28 -0700868 export ANDROID_ADDITIONAL_PUBLIC_LIBRARIES=$PUBLIC_LIBS && \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100869 export DEX_LOCATION=$DEX_LOCATION && \
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000870 export ANDROID_ROOT=$ANDROID_ROOT && \
Nicolas Geoffrayf39f04c2018-03-05 15:42:11 +0000871 export ANDROID_LOG_TAGS=$ANDROID_LOG_TAGS && \
Wojciech Staszkiewiczd7a819a2016-09-01 14:43:39 -0700872 rm -rf ${DEX_LOCATION}/dalvik-cache/ && \
Alex Lightafb5d192016-05-24 15:57:45 -0700873 mkdir -p ${mkdir_locations} && \
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100874 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH && \
Nicolas Geoffray4f7fdd22015-04-24 11:57:37 +0100875 export PATH=$ANDROID_ROOT/bin:$PATH && \
Calin Juravle13439f02017-02-21 01:17:21 -0800876 $profman_cmdline && \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100877 $dex2oat_cmdline && \
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +0000878 $dm_cmdline && \
Nicolas Geoffrayb0bbe8e2016-11-19 10:42:37 +0000879 $vdex_cmdline && \
Richard Uhler76f5cb62016-04-04 13:30:16 -0700880 $strip_cmdline && \
Igor Murashkin271a0f82017-02-14 21:14:17 +0000881 $sync_cmdline && \
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100882 $dalvikvm_cmdline"
883
884 cmdfile=$(tempfile -p "cmd-" -s "-$TEST_NAME")
885 echo "$cmdline" > $cmdfile
886
887 if [ "$DEV_MODE" = "y" ]; then
888 echo $cmdline
889 fi
890
891 if [ "$QUIET" = "n" ]; then
892 adb push $cmdfile $DEX_LOCATION/cmdline.sh
893 else
894 adb push $cmdfile $DEX_LOCATION/cmdline.sh > /dev/null 2>&1
895 fi
896
Alex Light722d6712018-02-12 17:41:12 +0000897 exit_status=0
Wojciech Staszkiewiczd7a819a2016-09-01 14:43:39 -0700898 if [ "$DRY_RUN" != "y" ]; then
899 adb shell sh $DEX_LOCATION/cmdline.sh
Alex Light722d6712018-02-12 17:41:12 +0000900 exit_status=$?
Wojciech Staszkiewiczd7a819a2016-09-01 14:43:39 -0700901 fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100902
903 rm -f $cmdfile
Alex Light722d6712018-02-12 17:41:12 +0000904 exit $exit_status
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100905else
Calin Juravle24bd3f92017-05-11 00:36:53 -0700906 # Host run.
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100907 export ANDROID_PRINTF_LOG=brief
Andreas Gampea8780822015-03-13 19:51:09 -0700908
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100909 export ANDROID_DATA="$DEX_LOCATION"
Nicolas Geoffray8eedb472014-10-29 14:05:59 +0000910 export ANDROID_ROOT="${ANDROID_ROOT}"
Colin Crossafd3c9e2016-09-16 13:47:21 -0700911 export LD_LIBRARY_PATH="${ANDROID_ROOT}/${LIBRARY_DIRECTORY}:${ANDROID_ROOT}/${TEST_DIRECTORY}"
912 export DYLD_LIBRARY_PATH="${ANDROID_ROOT}/${LIBRARY_DIRECTORY}:${ANDROID_ROOT}/${TEST_DIRECTORY}"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100913 export PATH="$PATH:${ANDROID_ROOT}/bin"
914
David Srbeckyc9ede382015-06-20 06:03:53 +0100915 # Temporarily disable address space layout randomization (ASLR).
916 # This is needed on the host so that the linker loads core.oat at the necessary address.
917 export LD_USE_LOAD_BIAS=1
918
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100919 cmdline="$dalvikvm_cmdline"
920
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -0700921 if [ "$TIME_OUT" = "gdb" ]; then
922 if [ `uname` = "Darwin" ]; then
923 # Fall back to timeout on Mac.
924 TIME_OUT="timeout"
Hiroshi Yamauchic823eff2015-09-01 16:21:35 -0700925 elif [ "$ISA" = "x86" ]; then
926 # prctl call may fail in 32-bit on an older (3.2) 64-bit Linux kernel. Fall back to timeout.
927 TIME_OUT="timeout"
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -0700928 else
929 # Check if gdb is available.
930 gdb --eval-command="quit" > /dev/null 2>&1
931 if [ $? != 0 ]; then
932 # gdb isn't available. Fall back to timeout.
933 TIME_OUT="timeout"
934 fi
935 fi
936 fi
937
938 if [ "$TIME_OUT" = "timeout" ]; then
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100939 # Add timeout command if time out is desired.
Andreas Gampe038bb222015-01-13 19:48:14 -0800940 #
Andreas Gampe6fb92562016-08-01 21:53:57 -0700941 # Note: We first send SIGRTMIN+2 (usually 36) to ART, which will induce a full thread dump
942 # before abort. However, dumping threads might deadlock, so we also use the "-k"
943 # option to definitely kill the child.
944 cmdline="timeout -k 120s -s SIGRTMIN+2 ${TIME_OUT_VALUE}s $cmdline"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100945 fi
946
947 if [ "$DEV_MODE" = "y" ]; then
Orion Hodsonee06c5a2018-04-23 13:46:24 +0100948 for var in ANDROID_PRINTF_LOG ANDROID_DATA ANDROID_ROOT LD_LIBRARY_PATH DYLD_LIBRARY_PATH PATH LD_USE_LOAD_BIAS; do
949 echo EXPORT $var=${!var}
950 done
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +0000951 echo "mkdir -p ${mkdir_locations} && $profman_cmdline && $dex2oat_cmdline && $dm_cmdline && $vdex_cmdline && $strip_cmdline && $sync_cmdline && $cmdline"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100952 fi
953
954 cd $ANDROID_BUILD_TOP
955
Calin Juravle24bd3f92017-05-11 00:36:53 -0700956 # Make sure we delete any existing compiler artifacts.
957 # This enables tests to call the RUN script multiple times in a row
958 # without worrying about interference.
959 rm -rf ${DEX_LOCATION}/oat
David Srbecky2e4afe82016-01-27 18:42:06 +0000960 rm -rf ${DEX_LOCATION}/dalvik-cache/
Calin Juravle24bd3f92017-05-11 00:36:53 -0700961
Andreas Gampeb31a8e72017-05-16 10:30:24 -0700962 export ASAN_OPTIONS=$RUN_TEST_ASAN_OPTIONS
963
Alex Lightafb5d192016-05-24 15:57:45 -0700964 mkdir -p ${mkdir_locations} || exit 1
Calin Juravle13439f02017-02-21 01:17:21 -0800965 $profman_cmdline || { echo "Profman failed." >&2 ; exit 2; }
Andreas Gampea8780822015-03-13 19:51:09 -0700966 $dex2oat_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
Nicolas Geoffraybaeaa9b2018-01-26 14:31:17 +0000967 $dm_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
Nicolas Geoffrayb0bbe8e2016-11-19 10:42:37 +0000968 $vdex_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
Richard Uhler76f5cb62016-04-04 13:30:16 -0700969 $strip_cmdline || { echo "Strip failed." >&2 ; exit 3; }
Igor Murashkin271a0f82017-02-14 21:14:17 +0000970 $sync_cmdline || { echo "Sync failed." >&2 ; exit 4; }
Andreas Gampea8780822015-03-13 19:51:09 -0700971
Wojciech Staszkiewiczd7a819a2016-09-01 14:43:39 -0700972 if [ "$DRY_RUN" = "y" ]; then
973 exit 0
Andreas Gampea8780822015-03-13 19:51:09 -0700974 fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100975
976 if [ "$USE_GDB" = "y" ]; then
977 # When running under gdb, we cannot do piping and grepping...
Dmitriy Ivanovf57874d2014-10-07 13:43:23 -0700978 $cmdline "$@"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100979 else
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -0700980 if [ "$TIME_OUT" != "gdb" ]; then
981 trap 'kill -INT -$pid' INT
982 $cmdline "$@" 2>&1 & pid=$!
983 wait $pid
Alex Light722d6712018-02-12 17:41:12 +0000984 exit_value=$?
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -0700985 # Add extra detail if time out is enabled.
Alex Light722d6712018-02-12 17:41:12 +0000986 if [ $exit_value = 124 ] && [ "$TIME_OUT" = "timeout" ]; then
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -0700987 echo -e "\e[91mTEST TIMED OUT!\e[0m" >&2
988 fi
Alex Light722d6712018-02-12 17:41:12 +0000989 exit $exit_value
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -0700990 else
991 # With a thread dump that uses gdb if a timeout.
992 trap 'kill -INT -$pid' INT
993 $cmdline "$@" 2>&1 & pid=$!
994 # Spawn a watcher process.
995 ( sleep $TIME_OUT_VALUE && \
996 echo "##### Thread dump using gdb on test timeout" && \
997 ( gdb -q -p $pid --eval-command="info thread" --eval-command="thread apply all bt" \
998 --eval-command="call exit(124)" --eval-command=quit || \
999 kill $pid )) 2> /dev/null & watcher=$!
1000 wait $pid
1001 test_exit_status=$?
1002 pkill -P $watcher 2> /dev/null # kill the sleep which will in turn end the watcher as well
1003 if [ $test_exit_status = 0 ]; then
1004 # The test finished normally.
1005 exit 0
1006 else
1007 # The test failed or timed out.
1008 if [ $test_exit_status = 124 ]; then
1009 # The test timed out.
1010 echo -e "\e[91mTEST TIMED OUT!\e[0m" >&2
1011 fi
Alex Light722d6712018-02-12 17:41:12 +00001012 exit $test_exit_status
Hiroshi Yamauchi6ffb9cc2015-08-31 15:14:17 -07001013 fi
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +01001014 fi
1015 fi
1016fi