blob: 3d6f073d31f385decb541999e7552a7d52a7e00a [file] [log] [blame]
jeffhao5d1ac922011-09-29 17:41:15 -07001#!/bin/bash
2#
3# Copyright (C) 2007 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Set up prog to be the path of this script, including following symlinks,
18# and set up progdir to be the fully-qualified pathname of its directory.
19prog="$0"
Andreas Gampedeb48a02014-10-22 00:44:35 -070020args="$@"
jeffhao5d1ac922011-09-29 17:41:15 -070021while [ -h "${prog}" ]; do
22 newProg=`/bin/ls -ld "${prog}"`
23 newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
24 if expr "x${newProg}" : 'x/' >/dev/null; then
25 prog="${newProg}"
26 else
27 progdir=`dirname "${prog}"`
28 prog="${progdir}/${newProg}"
29 fi
30done
31oldwd=`pwd`
32progdir=`dirname "${prog}"`
33cd "${progdir}"
34progdir=`pwd`
35prog="${progdir}"/`basename "${prog}"`
Brian Carlstrom105215d2012-06-14 12:50:44 -070036test_dir="test-$$"
Andreas Gampe5a79fde2014-08-06 13:12:26 -070037if [ -z "$TMPDIR" ]; then
38 tmp_dir="/tmp/$USER/${test_dir}"
39else
40 tmp_dir="${TMPDIR}/$USER/${test_dir}"
41fi
David Brazdil2c27f2c2015-05-12 18:06:38 +010042checker="${progdir}/../tools/checker/checker.py"
jeffhao5d1ac922011-09-29 17:41:15 -070043
44export JAVA="java"
Brian Carlstrom5103ce62014-03-30 16:17:42 -070045export JAVAC="javac -g"
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +010046export RUN="${progdir}/etc/run-test-jar"
Brian Carlstrom105215d2012-06-14 12:50:44 -070047export DEX_LOCATION=/data/run-test/${test_dir}
Elliott Hughesc717eef2012-06-15 16:01:26 -070048export NEED_DEX="true"
Sebastien Hertz19ac0272015-02-24 17:39:50 +010049export USE_JACK="false"
jeffhao5d1ac922011-09-29 17:41:15 -070050
Tsu Chiang Chuang4407e612012-07-19 16:13:43 -070051# If dx was not set by the environment variable, assume it is in the path.
52if [ -z "$DX" ]; then
53 export DX="dx"
54fi
55
Tsu Chiang Chuang6674f8a2013-01-16 15:41:21 -080056# If jasmin was not set by the environment variable, assume it is in the path.
57if [ -z "$JASMIN" ]; then
58 export JASMIN="jasmin"
59fi
60
Andreas Gampe8fda9f22014-10-03 16:15:37 -070061# If smali was not set by the environment variable, assume it is in the path.
62if [ -z "$SMALI" ]; then
63 export SMALI="smali"
64fi
65
66# If dexmerger was not set by the environment variable, assume it is in the path.
67if [ -z "$DXMERGER" ]; then
68 export DXMERGER="dexmerger"
69fi
70
Sebastien Hertz19ac0272015-02-24 17:39:50 +010071# If jack was not set by the environment variable, assume it is in the path.
72if [ -z "$JACK" ]; then
73 export JACK="jack"
74fi
75
76# If the tree is compiled with Jack, build test with Jack by default.
77if [ "$ANDROID_COMPILE_WITH_JACK" = "true" ]; then
78 USE_JACK="true"
79fi
80
81# ANDROID_BUILD_TOP is not set in a build environment.
82if [ -z "$ANDROID_BUILD_TOP" ]; then
83 export ANDROID_BUILD_TOP=$oldwd
84fi
85
86# If JACK_VM_COMMAND is not set, assume it launches the prebuilt jack-launcher.
87if [ -z "$JACK_VM_COMMAND" ]; then
88 if [ ! -z "$TMPDIR" ]; then
89 jack_temp_dir="-Djava.io.tmpdir=$TMPDIR"
90 fi
91 export JACK_VM_COMMAND="java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation $jack_temp_dir -jar $ANDROID_BUILD_TOP/prebuilts/sdk/tools/jack-launcher.jar"
92fi
93
94# If JACK_CLASSPATH is not set, assume it only contains core-libart.
95if [ -z "$JACK_CLASSPATH" ]; then
96 export JACK_CLASSPATH="$ANDROID_BUILD_TOP/out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_intermediates/classes.jack"
97fi
98
99# If JACK_JAR is not set, assume it is located in the prebuilts directory.
100if [ -z "$JACK_JAR" ]; then
101 export JACK_JAR="$ANDROID_BUILD_TOP/prebuilts/sdk/tools/jack.jar"
102fi
103
104# If JILL_JAR is not set, assume it is located in the prebuilts directory.
105if [ -z "$JILL_JAR" ]; then
106 export JILL_JAR="$ANDROID_BUILD_TOP/prebuilts/sdk/tools/jill.jar"
107fi
108
109export JACK="$JACK -g -cp $JACK_CLASSPATH"
110export JILL="java -jar $JILL_JAR"
Tsu Chiang Chuang6674f8a2013-01-16 15:41:21 -0800111
jeffhao5d1ac922011-09-29 17:41:15 -0700112info="info.txt"
113build="build"
114run="run"
115expected="expected.txt"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700116check_cmd="check"
jeffhao5d1ac922011-09-29 17:41:15 -0700117output="output.txt"
118build_output="build-output.txt"
David Brazdil24128c62015-05-21 12:06:13 +0100119cfg_output="graph.cfg"
Hiroshi Yamauchi1d4184d2015-07-13 17:11:22 -0700120strace_output="strace-output.txt"
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700121lib="libartd.so"
jeffhao5d1ac922011-09-29 17:41:15 -0700122run_args="--quiet"
David Brazdil4846d132015-01-15 19:07:08 +0000123build_args=""
jeffhao5d1ac922011-09-29 17:41:15 -0700124
Nicolas Geoffraya3d90fb2015-03-16 13:55:40 +0000125debuggable="no"
Alex Light9d722532014-07-22 18:07:12 -0700126prebuild_mode="yes"
Brian Carlstrom2613de42012-06-15 17:37:16 -0700127target_mode="yes"
jeffhao5d1ac922011-09-29 17:41:15 -0700128dev_mode="no"
129update_mode="no"
Alex Lighta59dd802014-07-02 16:28:08 -0700130debug_mode="no"
131relocate="yes"
Jeff Hao201803f2013-11-20 18:11:39 -0800132runtime="art"
jeffhao5d1ac922011-09-29 17:41:15 -0700133usage="no"
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700134build_only="no"
Andreas Gampe2fe07922014-04-21 07:50:39 -0700135suffix64=""
Jeff Hao85139a32014-07-23 11:52:52 -0700136trace="false"
Andreas Gampe7526d782015-06-22 22:53:45 -0700137trace_stream="false"
Alex Lighte7873ec2014-08-12 09:53:50 -0700138basic_verify="false"
139gc_verify="false"
140gc_stress="false"
Hiroshi Yamauchi1d4184d2015-07-13 17:11:22 -0700141strace="false"
Alex Lightbfac14a2014-07-30 09:41:21 -0700142always_clean="no"
Igor Murashkin05f30e12015-06-10 15:57:17 -0700143never_clean="no"
Alex Light03a112d2014-08-25 13:25:56 -0700144have_dex2oat="yes"
145have_patchoat="yes"
146have_image="yes"
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700147image_suffix=""
Andreas Gampec23c9c92014-10-28 14:47:25 -0700148pic_image_suffix=""
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000149android_root="/system"
jeffhao5d1ac922011-09-29 17:41:15 -0700150
151while true; do
152 if [ "x$1" = "x--host" ]; then
Brian Carlstrom2613de42012-06-15 17:37:16 -0700153 target_mode="no"
TDYa127b92bcab2012-04-08 00:09:51 -0700154 DEX_LOCATION=$tmp_dir
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100155 run_args="${run_args} --host"
jeffhao5d1ac922011-09-29 17:41:15 -0700156 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -0800157 elif [ "x$1" = "x--jvm" ]; then
Brian Carlstrom2613de42012-06-15 17:37:16 -0700158 target_mode="no"
Jeff Hao201803f2013-11-20 18:11:39 -0800159 runtime="jvm"
Brian Carlstrom01afdba2014-10-03 10:28:47 -0700160 prebuild_mode="no"
Elliott Hughesc717eef2012-06-15 16:01:26 -0700161 NEED_DEX="false"
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100162 USE_JACK="false"
Nicolas Geoffray288a4a22014-10-07 11:02:40 +0100163 run_args="${run_args} --jvm"
jeffhao5d1ac922011-09-29 17:41:15 -0700164 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -0800165 elif [ "x$1" = "x-O" ]; then
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700166 lib="libart.so"
167 shift
168 elif [ "x$1" = "x--dalvik" ]; then
169 lib="libdvm.so"
Jeff Hao201803f2013-11-20 18:11:39 -0800170 runtime="dalvik"
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700171 shift
Alex Light03a112d2014-08-25 13:25:56 -0700172 elif [ "x$1" = "x--no-dex2oat" ]; then
173 have_dex2oat="no"
174 shift
175 elif [ "x$1" = "x--no-patchoat" ]; then
176 have_patchoat="no"
177 shift
178 elif [ "x$1" = "x--no-image" ]; then
179 have_image="no"
180 shift
Andreas Gampec23c9c92014-10-28 14:47:25 -0700181 elif [ "x$1" = "x--pic-image" ]; then
182 pic_image_suffix="-pic"
183 shift
184 elif [ "x$1" = "x--pic-test" ]; then
185 run_args="${run_args} --pic-test"
186 shift
Alex Lighta59dd802014-07-02 16:28:08 -0700187 elif [ "x$1" = "x--relocate" ]; then
188 relocate="yes"
189 shift
190 elif [ "x$1" = "x--no-relocate" ]; then
191 relocate="no"
192 shift
193 elif [ "x$1" = "x--prebuild" ]; then
Nicolas Geoffray5fd18ba2014-10-03 12:08:38 +0100194 run_args="${run_args} --prebuild"
Alex Lighta59dd802014-07-02 16:28:08 -0700195 prebuild_mode="yes"
196 shift;
Nicolas Geoffray43c162f2015-03-09 12:21:26 +0000197 elif [ "x$1" = "x--debuggable" ]; then
198 run_args="${run_args} -Xcompiler-option --debuggable"
Nicolas Geoffraya3d90fb2015-03-16 13:55:40 +0000199 debuggable="yes"
Nicolas Geoffray43c162f2015-03-09 12:21:26 +0000200 shift;
Alex Lighta59dd802014-07-02 16:28:08 -0700201 elif [ "x$1" = "x--no-prebuild" ]; then
Nicolas Geoffray5fd18ba2014-10-03 12:08:38 +0100202 run_args="${run_args} --no-prebuild"
Alex Lighta59dd802014-07-02 16:28:08 -0700203 prebuild_mode="no"
204 shift;
Alex Lighte7873ec2014-08-12 09:53:50 -0700205 elif [ "x$1" = "x--gcverify" ]; then
206 basic_verify="true"
207 gc_verify="true"
208 shift
209 elif [ "x$1" = "x--gcstress" ]; then
210 basic_verify="true"
211 gc_stress="true"
212 shift
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700213 elif [ "x$1" = "x--image" ]; then
214 shift
215 image="$1"
216 run_args="${run_args} --image $image"
Elliott Hughes7c046102011-10-19 18:16:03 -0700217 shift
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000218 elif [ "x$1" = "x-Xcompiler-option" ]; then
219 shift
220 option="$1"
221 run_args="${run_args} -Xcompiler-option $option"
222 shift
Mathieu Chartier769a5ad2014-05-18 15:30:10 -0700223 elif [ "x$1" = "x--runtime-option" ]; then
224 shift
225 option="$1"
226 run_args="${run_args} --runtime-option $option"
227 shift
Mathieu Chartierc0a8a802014-10-17 15:58:01 -0700228 elif [ "x$1" = "x--gdb-arg" ]; then
229 shift
230 gdb_arg="$1"
231 run_args="${run_args} --gdb-arg $gdb_arg"
232 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700233 elif [ "x$1" = "x--debug" ]; then
234 run_args="${run_args} --debug"
235 shift
236 elif [ "x$1" = "x--gdb" ]; then
237 run_args="${run_args} --gdb"
238 dev_mode="yes"
239 shift
Hiroshi Yamauchi1d4184d2015-07-13 17:11:22 -0700240 elif [ "x$1" = "x--strace" ]; then
241 strace="yes"
242 run_args="${run_args} --invoke-with strace --invoke-with -o --invoke-with $tmp_dir/$strace_output"
243 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700244 elif [ "x$1" = "x--zygote" ]; then
245 run_args="${run_args} --zygote"
246 shift
jeffhao0dff3f42012-11-20 15:13:43 -0800247 elif [ "x$1" = "x--interpreter" ]; then
248 run_args="${run_args} --interpreter"
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700249 image_suffix="-interpreter"
250 shift
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800251 elif [ "x$1" = "x--jit" ]; then
252 run_args="${run_args} --jit"
Mathieu Chartiere2a12c02015-02-27 13:21:15 -0800253 image_suffix="-interpreter"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800254 shift
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700255 elif [ "x$1" = "x--optimizing" ]; then
256 run_args="${run_args} -Xcompiler-option --compiler-backend=Optimizing"
257 image_suffix="-optimizing"
jeffhao0dff3f42012-11-20 15:13:43 -0800258 shift
Nicolas Geoffrayc9338b92014-12-03 13:36:10 +0000259 elif [ "x$1" = "x--quick" ]; then
260 run_args="${run_args} -Xcompiler-option --compiler-backend=Quick"
261 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700262 elif [ "x$1" = "x--no-verify" ]; then
263 run_args="${run_args} --no-verify"
264 shift
Igor Murashkin7617abd2015-07-10 18:27:47 -0700265 elif [ "x$1" = "x--verify-soft-fail" ]; then
266 run_args="${run_args} --verify-soft-fail"
Andreas Gampe825570c2015-07-26 10:26:03 -0700267 image_suffix="-interp-ac"
Igor Murashkin7617abd2015-07-10 18:27:47 -0700268 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700269 elif [ "x$1" = "x--no-optimize" ]; then
270 run_args="${run_args} --no-optimize"
271 shift
272 elif [ "x$1" = "x--no-precise" ]; then
273 run_args="${run_args} --no-precise"
274 shift
Elliott Hughes7c046102011-10-19 18:16:03 -0700275 elif [ "x$1" = "x--invoke-with" ]; then
276 shift
277 what="$1"
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700278 if [ "x$what" = "x" ]; then
279 echo "$0 missing argument to --invoke-with" 1>&2
280 usage="yes"
281 break
282 fi
Ian Rogers0e033672013-04-19 10:22:46 -0700283 run_args="${run_args} --invoke-with ${what}"
jeffhao5d1ac922011-09-29 17:41:15 -0700284 shift
285 elif [ "x$1" = "x--dev" ]; then
286 run_args="${run_args} --dev"
287 dev_mode="yes"
288 shift
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700289 elif [ "x$1" = "x--build-only" ]; then
290 build_only="yes"
291 shift
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100292 elif [ "x$1" = "x--build-with-javac-dx" ]; then
293 USE_JACK="false"
294 shift
295 elif [ "x$1" = "x--build-with-jack" ]; then
296 USE_JACK="true"
297 shift
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700298 elif [ "x$1" = "x--output-path" ]; then
299 shift
300 tmp_dir=$1
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700301 if [ "x$tmp_dir" = "x" ]; then
302 echo "$0 missing argument to --output-path" 1>&2
303 usage="yes"
304 break
305 fi
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700306 shift
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000307 elif [ "x$1" = "x--android-root" ]; then
308 shift
309 if [ "x$1" = "x" ]; then
310 echo "$0 missing argument to --android-root" 1>&2
311 usage="yes"
312 break
313 fi
314 android_root="$1"
315 run_args="${run_args} --android-root $1"
316 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700317 elif [ "x$1" = "x--update" ]; then
318 update_mode="yes"
319 shift
320 elif [ "x$1" = "x--help" ]; then
321 usage="yes"
322 shift
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700323 elif [ "x$1" = "x--64" ]; then
324 run_args="${run_args} --64"
Andreas Gampe2fe07922014-04-21 07:50:39 -0700325 suffix64="64"
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700326 shift
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200327 elif [ "x$1" = "x--trace" ]; then
Jeff Hao85139a32014-07-23 11:52:52 -0700328 trace="true"
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200329 shift
Andreas Gampe7526d782015-06-22 22:53:45 -0700330 elif [ "x$1" = "x--stream" ]; then
331 trace_stream="true"
332 shift
Alex Lightbfac14a2014-07-30 09:41:21 -0700333 elif [ "x$1" = "x--always-clean" ]; then
334 always_clean="yes"
335 shift
Igor Murashkin05f30e12015-06-10 15:57:17 -0700336 elif [ "x$1" = "x--never-clean" ]; then
337 never_clean="yes"
338 shift
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800339 elif [ "x$1" = "x--dex2oat-swap" ]; then
340 run_args="${run_args} --dex2oat-swap"
341 shift
Andreas Gampe4d2ef332015-08-05 09:24:45 -0700342 elif [ "x$1" = "x--instruction-set-features" ]; then
343 shift
344 run_args="${run_args} --instruction-set-features $1"
345 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700346 elif expr "x$1" : "x--" >/dev/null 2>&1; then
Elliott Hughes7c046102011-10-19 18:16:03 -0700347 echo "unknown $0 option: $1" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700348 usage="yes"
349 break
350 else
351 break
352 fi
353done
Andreas Gampe3a12cfe2014-08-13 15:40:22 -0700354
355# tmp_dir may be relative, resolve.
356#
357# Cannot use realpath, as it does not exist on Mac.
358# Cannot us a simple "cd", as the path might not be created yet.
Brian Carlstromc580e042014-09-08 21:37:39 -0700359# Cannot use readlink -m, as it does not exist on Mac.
360# Fallback to nuclear option:
Andreas Gampe907b6992014-08-18 22:26:49 -0700361noncanonical_tmp_dir=$tmp_dir
Brian Carlstromc580e042014-09-08 21:37:39 -0700362tmp_dir="`cd $oldwd ; python -c "import os; print os.path.realpath('$tmp_dir')"`"
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700363mkdir -p $tmp_dir
jeffhao5d1ac922011-09-29 17:41:15 -0700364
Alex Lighte7873ec2014-08-12 09:53:50 -0700365if [ "$basic_verify" = "true" ]; then
Hiroshi Yamauchi312baf12015-01-12 12:11:05 -0800366 # Set HspaceCompactForOOMMinIntervalMs to zero to run hspace compaction for OOM more frequently in tests.
367 run_args="${run_args} --runtime-option -Xgc:preverify --runtime-option -Xgc:postverify --runtime-option -XX:HspaceCompactForOOMMinIntervalMs=0"
Alex Lighte7873ec2014-08-12 09:53:50 -0700368fi
369if [ "$gc_verify" = "true" ]; then
370 run_args="${run_args} --runtime-option -Xgc:preverify_rosalloc --runtime-option -Xgc:postverify_rosalloc"
371fi
372if [ "$gc_stress" = "true" ]; then
Mathieu Chartiereb193622015-06-27 15:42:27 -0700373 run_args="${run_args} --runtime-option -Xgc:SS,gcstress --runtime-option -Xms2m --runtime-option -Xmx16m"
Alex Lighte7873ec2014-08-12 09:53:50 -0700374fi
Jeff Hao85139a32014-07-23 11:52:52 -0700375if [ "$trace" = "true" ]; then
Andreas Gampe7526d782015-06-22 22:53:45 -0700376 run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file-size:2000000"
377 if [ "$trace_stream" = "true" ]; then
378 # Streaming mode uses the file size as the buffer size. So output gets really large. Drop
379 # the ability to analyze the file and just write to /dev/null.
380 run_args="${run_args} --runtime-option -Xmethod-trace-file:/dev/null"
381 # Enable streaming mode.
382 run_args="${run_args} --runtime-option -Xmethod-trace-stream"
383 else
384 run_args="${run_args} --runtime-option -Xmethod-trace-file:${DEX_LOCATION}/trace.bin"
385 fi
386elif [ "$trace_stream" = "true" ]; then
387 echo "Cannot use --stream without --trace."
388 exit 1
Jeff Hao85139a32014-07-23 11:52:52 -0700389fi
390
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700391# Most interesting target architecture variables are Makefile variables, not environment variables.
Nicolas Geoffray6fbcc122014-07-24 00:36:48 +0100392# Try to map the suffix64 flag and what we find in ${ANDROID_PRODUCT_OUT}/data/art-test to an architecture name.
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700393function guess_arch_name() {
Nicolas Geoffray6fbcc122014-07-24 00:36:48 +0100394 grep32bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm|x86|mips)$'`
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800395 grep64bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm64|x86_64|mips64)$'`
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700396 if [ "x${suffix64}" = "x64" ]; then
397 target_arch_name=${grep64bit}
398 else
399 target_arch_name=${grep32bit}
400 fi
401}
402
Alex Lighta59dd802014-07-02 16:28:08 -0700403if [ "$target_mode" = "no" ]; then
404 if [ "$runtime" = "jvm" ]; then
Alex Lighta59dd802014-07-02 16:28:08 -0700405 if [ "$prebuild_mode" = "yes" ]; then
406 echo "--prebuild with --jvm is unsupported";
407 exit 1;
408 fi
Alex Lighta59dd802014-07-02 16:28:08 -0700409 fi
410fi
411
Alex Light03a112d2014-08-25 13:25:56 -0700412if [ "$have_patchoat" = "no" ]; then
413 run_args="${run_args} --no-patchoat"
414fi
415
416if [ "$have_dex2oat" = "no" ]; then
417 run_args="${run_args} --no-dex2oat"
418fi
419
Jeff Hao201803f2013-11-20 18:11:39 -0800420if [ ! "$runtime" = "jvm" ]; then
421 run_args="${run_args} --lib $lib"
422fi
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700423
Jeff Hao201803f2013-11-20 18:11:39 -0800424if [ "$runtime" = "dalvik" ]; then
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700425 if [ "$target_mode" = "no" ]; then
Nicolas Geoffray6fbcc122014-07-24 00:36:48 +0100426 framework="${ANDROID_PRODUCT_OUT}/system/framework"
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700427 bpath="${framework}/core.jar:${framework}/conscrypt.jar:${framework}/okhttp.jar:${framework}/core-junit.jar:${framework}/bouncycastle.jar:${framework}/ext.jar"
428 run_args="${run_args} --boot -Xbootclasspath:${bpath}"
429 else
430 true # defaults to using target BOOTCLASSPATH
431 fi
Jeff Hao201803f2013-11-20 18:11:39 -0800432elif [ "$runtime" = "art" ]; then
433 if [ "$target_mode" = "no" ]; then
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100434 # ANDROID_HOST_OUT is not set in a build environment.
Brian Carlstrom43534862014-02-19 01:13:52 -0800435 if [ -z "$ANDROID_HOST_OUT" ]; then
Nicolas Geoffray1a58b7f2014-10-06 12:23:04 +0100436 export ANDROID_HOST_OUT=$ANDROID_BUILD_TOP/out/host/linux-x86
Brian Carlstrom43534862014-02-19 01:13:52 -0800437 fi
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000438 run_args="${run_args} --boot ${ANDROID_HOST_OUT}/framework/core${image_suffix}${pic_image_suffix}.art"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700439 run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}"
Jeff Hao201803f2013-11-20 18:11:39 -0800440 else
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700441 guess_arch_name
442 run_args="${run_args} --runtime-option -Djava.library.path=/data/art-test/${target_arch_name}"
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000443 run_args="${run_args} --boot /data/art-test/core${image_suffix}${pic_image_suffix}.art"
Jeff Hao201803f2013-11-20 18:11:39 -0800444 fi
Alex Lighta59dd802014-07-02 16:28:08 -0700445 if [ "$relocate" = "yes" ]; then
446 run_args="${run_args} --relocate"
447 else
448 run_args="${run_args} --no-relocate"
449 fi
Andreas Gampe3f1dc562015-05-18 15:52:22 -0700450elif [ "$runtime" = "jvm" ]; then
451 # TODO: Detect whether the host is 32-bit or 64-bit.
452 run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib64"
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700453fi
454
Alex Light03a112d2014-08-25 13:25:56 -0700455if [ "$have_image" = "no" ]; then
Alex Light1ef4ce82014-08-27 11:13:47 -0700456 if [ "$runtime" != "art" ]; then
457 echo "--no-image is only supported on the art runtime"
458 exit 1
459 fi
460 if [ "$target_mode" = "no" ]; then
461 framework="${ANDROID_HOST_OUT}/framework"
462 bpath_suffix="-hostdex"
463 else
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000464 framework="${android_root}/framework"
Alex Light1ef4ce82014-08-27 11:13:47 -0700465 bpath_suffix=""
466 fi
467 # TODO If the target was compiled WITH_DEXPREOPT=true then these tests will
468 # fail since these jar files will be stripped.
469 bpath="${framework}/core-libart${bpath_suffix}.jar"
470 bpath="${bpath}:${framework}/conscrypt${bpath_suffix}.jar"
471 bpath="${bpath}:${framework}/okhttp${bpath_suffix}.jar"
472 bpath="${bpath}:${framework}/core-junit${bpath_suffix}.jar"
473 bpath="${bpath}:${framework}/bouncycastle${bpath_suffix}.jar"
474 # Pass down the bootclasspath
475 run_args="${run_args} --runtime-option -Xbootclasspath:${bpath}"
Alex Light03a112d2014-08-25 13:25:56 -0700476 run_args="${run_args} --no-image"
477fi
478
jeffhao5d1ac922011-09-29 17:41:15 -0700479if [ "$dev_mode" = "yes" -a "$update_mode" = "yes" ]; then
480 echo "--dev and --update are mutually exclusive" 1>&2
481 usage="yes"
482fi
483
484if [ "$usage" = "no" ]; then
485 if [ "x$1" = "x" -o "x$1" = "x-" ]; then
486 test_dir=`basename "$oldwd"`
487 else
488 test_dir="$1"
489 fi
490
491 if [ '!' -d "$test_dir" ]; then
492 td2=`echo ${test_dir}-*`
493 if [ '!' -d "$td2" ]; then
494 echo "${test_dir}: no such test directory" 1>&2
495 usage="yes"
496 fi
497 test_dir="$td2"
498 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700499 # Shift to get rid of the test name argument. The rest of the arguments
500 # will get passed to the test run.
501 shift
502fi
503
504if [ "$usage" = "yes" ]; then
505 prog=`basename $prog`
506 (
507 echo "usage:"
508 echo " $prog --help Print this message."
509 echo " $prog [options] [test-name] Run test normally."
510 echo " $prog --dev [options] [test-name] Development mode" \
511 "(dumps to stdout)."
512 echo " $prog --update [options] [test-name] Update mode" \
513 "(replaces expected.txt)."
514 echo ' Omitting the test name or specifying "-" will use the' \
515 "current directory."
516 echo " Runtime Options:"
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000517 echo " -O Run non-debug rather than debug build (off by default)."
518 echo " -Xcompiler-option Pass an option to the compiler."
519 echo " --runtime-option Pass an option to the runtime."
520 echo " --debug Wait for a debugger to attach."
Nicolas Geoffray43c162f2015-03-09 12:21:26 +0000521 echo " --debuggable Whether to compile Java code for a debugger."
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000522 echo " --gdb Run under gdb; incompatible with some tests."
523 echo " --build-only Build test files only (off by default)."
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100524 echo " --build-with-javac-dx Build test files with javac and dx (on by default)."
525 echo " --build-with-jack Build test files with jack and jill (off by default)."
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000526 echo " --interpreter Enable interpreter only mode (off by default)."
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800527 echo " --jit Enable jit (off by default)."
Nicolas Geoffray0e071252015-03-21 13:43:15 +0000528 echo " --optimizing Enable optimizing compiler (default)."
529 echo " --quick Use Quick compiler (off by default)."
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000530 echo " --no-verify Turn off verification (on by default)."
Igor Murashkin7617abd2015-07-10 18:27:47 -0700531 echo " --verify-soft-fail Force soft fail verification (off by default)."
532 echo " Verification is enabled if neither --no-verify"
533 echo " nor --verify-soft-fail is specified."
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000534 echo " --no-optimize Turn off optimization (on by default)."
535 echo " --no-precise Turn off precise GC (on by default)."
536 echo " --zygote Spawn the process from the Zygote." \
jeffhao5d1ac922011-09-29 17:41:15 -0700537 "If used, then the"
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000538 echo " other runtime options are ignored."
539 echo " --no-dex2oat Run as though dex2oat was failing."
540 echo " --no-patchoat Run as though patchoat was failing."
541 echo " --prebuild Run dex2oat on the files before starting test. (default)"
542 echo " --no-prebuild Do not run dex2oat on the files before starting"
543 echo " the test."
544 echo " --relocate Force the use of relocating in the test, making"
545 echo " the image and oat files be relocated to a random"
546 echo " address before running. (default)"
547 echo " --no-relocate Force the use of no relocating in the test"
548 echo " --host Use the host-mode virtual machine."
549 echo " --invoke-with Pass --invoke-with option to runtime."
550 echo " --dalvik Use Dalvik (off by default)."
551 echo " --jvm Use a host-local RI virtual machine."
552 echo " --output-path [path] Location where to store the build" \
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700553 "files."
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000554 echo " --64 Run the test in 64-bit mode"
555 echo " --trace Run with method tracing"
Andreas Gampe7526d782015-06-22 22:53:45 -0700556 echo " --stream Run method tracing in streaming mode (requires --trace)"
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000557 echo " --gcstress Run with gc stress testing"
558 echo " --gcverify Run with gc verification"
559 echo " --always-clean Delete the test files even if the test fails."
Igor Murashkin05f30e12015-06-10 15:57:17 -0700560 echo " --never-clean Keep the test files even if the test succeeds."
Nicolas Geoffrayc8f23fc2014-10-28 17:59:47 +0000561 echo " --android-root [path] The path on target for the android root. (/system by default)."
Nicolas Geoffray43c162f2015-03-09 12:21:26 +0000562 echo " --dex2oat-swap Use a dex2oat swap file."
Andreas Gampe4d2ef332015-08-05 09:24:45 -0700563 echo " --instruction-set-features [string]"
564 echo " Set instruction-set-features for compilation."
jeffhao5d1ac922011-09-29 17:41:15 -0700565 ) 1>&2
566 exit 1
567fi
568
569cd "$test_dir"
570test_dir=`pwd`
571
572td_info="${test_dir}/${info}"
573td_expected="${test_dir}/${expected}"
574
Brian Carlstrom22469aa2012-09-07 10:34:57 -0700575if [ ! -r $td_info ]; then
576 echo "${test_dir}: missing file $td_info" 1>&2
577 exit 1
578fi
579
580if [ ! -r $td_expected ]; then
581 echo "${test_dir}: missing file $td_expected" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700582 exit 1
583fi
584
585# copy the test to a temp dir and run it
586
Elliott Hughes510c8782011-10-06 10:57:34 -0700587echo "${test_dir}: building..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700588
589rm -rf "$tmp_dir"
590cp -Rp "$test_dir" "$tmp_dir"
591cd "$tmp_dir"
592
593if [ '!' -r "$build" ]; then
594 cp "${progdir}/etc/default-build" build
Zheng Xuc6667102015-05-15 16:08:45 +0800595else
596 cp "${progdir}/etc/default-build" .
jeffhao5d1ac922011-09-29 17:41:15 -0700597fi
598
599if [ '!' -r "$run" ]; then
600 cp "${progdir}/etc/default-run" run
Zheng Xuc6667102015-05-15 16:08:45 +0800601else
602 cp "${progdir}/etc/default-run" .
jeffhao5d1ac922011-09-29 17:41:15 -0700603fi
604
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700605if [ '!' -r "$check_cmd" ]; then
606 cp "${progdir}/etc/default-check" check
Zheng Xuc6667102015-05-15 16:08:45 +0800607else
608 cp "${progdir}/etc/default-check" .
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700609fi
610
jeffhao5d1ac922011-09-29 17:41:15 -0700611chmod 755 "$build"
612chmod 755 "$run"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700613chmod 755 "$check_cmd"
jeffhao5d1ac922011-09-29 17:41:15 -0700614
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700615export TEST_NAME=`basename ${test_dir}`
616
David Brazdil4846d132015-01-15 19:07:08 +0000617# Tests named '<number>-checker-*' will also have their CFGs verified with
618# Checker when compiled with Optimizing on host.
619if [[ "$TEST_NAME" =~ ^[0-9]+-checker- ]]; then
620 # Build Checker DEX files without dx's optimizations so the input to dex2oat
621 # better resembles the Java source. We always build the DEX the same way, even
622 # if Checker is not invoked and the test only runs the program.
623 build_args="${build_args} --dx-option --no-optimize"
624
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100625 # Jack does not necessarily generate the same DEX output than dx. Because these tests depend
626 # on a particular DEX output, keep building them with dx for now (b/19467889).
627 USE_JACK="false"
628
Nicolas Geoffraye7307292015-03-17 18:12:06 +0000629 if [ "$runtime" = "art" -a "$image_suffix" = "-optimizing" -a "$target_mode" = "no" -a "$debuggable" = "no" ]; then
David Brazdil80fb3942015-07-23 11:53:42 +0100630 # In no-prebuild mode, the compiler is only invoked if both dex2oat and
631 # patchoat are available. Disable Checker otherwise (b/22552692).
632 if [ "$prebuild_mode" = "yes" ] || [ "$have_patchoat" = "yes" -a "$have_dex2oat" = "yes" ]; then
633 run_checker="yes"
634 run_args="${run_args} -Xcompiler-option --dump-cfg=$tmp_dir/$cfg_output \
635 -Xcompiler-option -j1"
636 fi
David Brazdil4846d132015-01-15 19:07:08 +0000637 fi
638fi
639
Ian Rogers997f0f92014-06-21 22:58:05 -0700640# To cause tests to fail fast, limit the file sizes created by dx, dex2oat and ART output to 2MB.
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100641build_file_size_limit=2048
642run_file_size_limit=2048
Ian Rogers997f0f92014-06-21 22:58:05 -0700643if echo "$test_dir" | grep 089; then
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100644 build_file_size_limit=5120
645 run_file_size_limit=5120
Ian Rogers997f0f92014-06-21 22:58:05 -0700646elif echo "$test_dir" | grep 083; then
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100647 build_file_size_limit=5120
648 run_file_size_limit=5120
Ian Rogers997f0f92014-06-21 22:58:05 -0700649fi
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100650if [ ${USE_JACK} = "false" ]; then
651 # Set ulimit if we build with dx only, Jack can generate big temp files.
652 if ! ulimit -S "$build_file_size_limit"; then
653 echo "ulimit file size setting failed"
654 fi
Ian Rogers997f0f92014-06-21 22:58:05 -0700655fi
656
jeffhao5d1ac922011-09-29 17:41:15 -0700657good="no"
Nicolas Geoffray1ed097d2014-11-13 15:15:39 +0000658good_build="yes"
659good_run="yes"
jeffhao5d1ac922011-09-29 17:41:15 -0700660if [ "$dev_mode" = "yes" ]; then
David Brazdil4846d132015-01-15 19:07:08 +0000661 "./${build}" $build_args 2>&1
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700662 build_exit="$?"
663 echo "build exit status: $build_exit" 1>&2
664 if [ "$build_exit" = '0' ]; then
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100665 if ! ulimit -S "$run_file_size_limit"; then
666 echo "ulimit file size setting failed"
667 fi
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800668 echo "${test_dir}: running..." 1>&2
669 "./${run}" $run_args "$@" 2>&1
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700670 run_exit="$?"
Calin Juravle3cf48772015-01-26 16:47:33 +0000671
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800672 if [ "$run_exit" = "0" ]; then
Calin Juravle3cf48772015-01-26 16:47:33 +0000673 if [ "$run_checker" = "yes" ]; then
674 "$checker" "$cfg_output" "$tmp_dir" 2>&1
675 checker_exit="$?"
676 if [ "$checker_exit" = "0" ]; then
677 good="yes"
678 fi
679 echo "checker exit status: $checker_exit" 1>&2
680 else
681 good="yes"
682 fi
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800683 fi
Calin Juravle3cf48772015-01-26 16:47:33 +0000684 echo "run exit status: $run_exit" 1>&2
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700685 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700686elif [ "$update_mode" = "yes" ]; then
David Brazdil4846d132015-01-15 19:07:08 +0000687 "./${build}" $build_args >"$build_output" 2>&1
jeffhao5d1ac922011-09-29 17:41:15 -0700688 build_exit="$?"
689 if [ "$build_exit" = '0' ]; then
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100690 if ! ulimit -S "$run_file_size_limit"; then
691 echo "ulimit file size setting failed"
692 fi
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800693 echo "${test_dir}: running..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700694 "./${run}" $run_args "$@" >"$output" 2>&1
David Brazdil4846d132015-01-15 19:07:08 +0000695 if [ "$run_checker" = "yes" ]; then
696 "$checker" -q "$cfg_output" "$tmp_dir" >> "$output" 2>&1
697 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700698 sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}"
699 good="yes"
700 else
701 cat "$build_output" 1>&2
702 echo "build exit status: $build_exit" 1>&2
703 fi
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700704elif [ "$build_only" = "yes" ]; then
705 good="yes"
David Brazdil4846d132015-01-15 19:07:08 +0000706 "./${build}" $build_args >"$build_output" 2>&1
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700707 build_exit="$?"
708 if [ "$build_exit" '!=' '0' ]; then
709 cp "$build_output" "$output"
710 echo "build exit status: $build_exit" >>"$output"
711 diff --strip-trailing-cr -q "$expected" "$output" >/dev/null
712 if [ "$?" '!=' "0" ]; then
713 good="no"
714 echo "BUILD FAILED For ${TEST_NAME}"
715 fi
716 fi
Tsu Chiang Chuang379e2f52013-08-20 12:24:52 -0700717 # Clean up extraneous files that are not used by tests.
Tsu Chiang Chuang0160d992013-09-13 14:17:42 -0700718 find $tmp_dir -mindepth 1 ! -regex ".*/\(.*jar\|$output\|$expected\)" | xargs rm -rf
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700719 exit 0
jeffhao5d1ac922011-09-29 17:41:15 -0700720else
David Brazdil4846d132015-01-15 19:07:08 +0000721 "./${build}" $build_args >"$build_output" 2>&1
jeffhao5d1ac922011-09-29 17:41:15 -0700722 build_exit="$?"
723 if [ "$build_exit" = '0' ]; then
Sebastien Hertz19ac0272015-02-24 17:39:50 +0100724 if ! ulimit -S "$run_file_size_limit"; then
725 echo "ulimit file size setting failed"
726 fi
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800727 echo "${test_dir}: running..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700728 "./${run}" $run_args "$@" >"$output" 2>&1
Nicolas Geoffray1ed097d2014-11-13 15:15:39 +0000729 run_exit="$?"
730 if [ "$run_exit" != "0" ]; then
731 echo "run exit status: $run_exit" 1>&2
732 good_run="no"
David Brazdil4846d132015-01-15 19:07:08 +0000733 elif [ "$run_checker" = "yes" ]; then
734 "$checker" -q "$cfg_output" "$tmp_dir" >> "$output" 2>&1
735 checker_exit="$?"
736 if [ "$checker_exit" != "0" ]; then
737 echo "checker exit status: $checker_exit" 1>&2
738 good_run="no"
739 else
740 good_run="yes"
741 fi
Nicolas Geoffray1ed097d2014-11-13 15:15:39 +0000742 else
743 good_run="yes"
744 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700745 else
Nicolas Geoffray1ed097d2014-11-13 15:15:39 +0000746 good_build="no"
jeffhao5d1ac922011-09-29 17:41:15 -0700747 cp "$build_output" "$output"
Andreas Gampef6930a82014-10-21 09:33:08 -0700748 echo "Failed to build in tmpdir=${tmp_dir} from oldwd=${oldwd} and cwd=`pwd`" >> "$output"
749 echo "Non-canonical tmpdir was ${noncanonical_tmp_dir}" >> "$output"
Ian Rogersd9ad27d2014-10-27 13:48:21 -0700750 echo "Args: ${args}" >> "$output"
Andreas Gampef6930a82014-10-21 09:33:08 -0700751 echo "build exit status: $build_exit" >> "$output"
Andreas Gampe5c114902014-10-27 17:03:58 -0700752 max_name_length=$(getconf NAME_MAX ${tmp_dir})
753 echo "Max filename (NAME_MAX): ${max_name_length}" >> "$output"
754 max_path_length=$(getconf PATH_MAX ${tmp_dir})
Andreas Gampe602fbcd2014-10-27 17:06:29 -0700755 echo "Max pathlength (PATH_MAX): ${max_path_length}" >> "$output"
jeffhao5d1ac922011-09-29 17:41:15 -0700756 fi
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700757 ./$check_cmd "$expected" "$output"
jeffhao5d1ac922011-09-29 17:41:15 -0700758 if [ "$?" = "0" ]; then
Nicolas Geoffray1ed097d2014-11-13 15:15:39 +0000759 if [ "$good_build" = "no" -o "$good_run" = "yes" ]; then
760 # output == expected
761 good="yes"
762 echo "${test_dir}: succeeded!" 1>&2
763 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700764 fi
765fi
766
jeffhao5d1ac922011-09-29 17:41:15 -0700767(
Alex Lightbfac14a2014-07-30 09:41:21 -0700768 if [ "$good" != "yes" -a "$update_mode" != "yes" ]; then
jeffhao5d1ac922011-09-29 17:41:15 -0700769 echo "${test_dir}: FAILED!"
770 echo ' '
771 echo '#################### info'
772 cat "${td_info}" | sed 's/^/# /g'
773 echo '#################### diffs'
Ian Rogers75deec02014-11-23 20:07:39 -0800774 diff --strip-trailing-cr -u "$expected" "$output" | tail -n 2000
jeffhao5d1ac922011-09-29 17:41:15 -0700775 echo '####################'
Hiroshi Yamauchi1d4184d2015-07-13 17:11:22 -0700776 if [ "$strace" = "yes" ]; then
777 echo '#################### strace output'
778 tail -n 2000 "$tmp_dir/$strace_output"
779 echo '####################'
780 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700781 echo ' '
782 fi
Alex Lightbfac14a2014-07-30 09:41:21 -0700783
784) 1>&2
785
786# Clean up test files.
Igor Murashkin05f30e12015-06-10 15:57:17 -0700787if [ "$always_clean" = "yes" -o "$good" = "yes" ] && [ "$never_clean" = "no" ]; then
Alex Lightbfac14a2014-07-30 09:41:21 -0700788 cd "$oldwd"
789 rm -rf "$tmp_dir"
790 if [ "$target_mode" = "yes" -a "$build_exit" = "0" ]; then
791 adb shell rm -rf $DEX_LOCATION
792 fi
793 if [ "$good" = "yes" ]; then
794 exit 0
795 fi
796fi
797
798
799(
800 if [ "$always_clean" = "yes" ]; then
801 echo "${TEST_NAME} files deleted from host "
802 if [ "$target_mode" == "yes" ]; then
803 echo "and from target"
804 fi
805 else
806 echo "${TEST_NAME} files left in ${tmp_dir} on host"
807 if [ "$target_mode" == "yes" ]; then
808 echo "and in ${DEX_LOCATION} on target"
809 fi
Brian Carlstrom105215d2012-06-14 12:50:44 -0700810 fi
811
jeffhao5d1ac922011-09-29 17:41:15 -0700812) 1>&2
813
814exit 1