blob: 71a1d70281a592a47b22d06aa775dc22cf60429f [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"
20while [ -h "${prog}" ]; do
21 newProg=`/bin/ls -ld "${prog}"`
22 newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
23 if expr "x${newProg}" : 'x/' >/dev/null; then
24 prog="${newProg}"
25 else
26 progdir=`dirname "${prog}"`
27 prog="${progdir}/${newProg}"
28 fi
29done
30oldwd=`pwd`
31progdir=`dirname "${prog}"`
32cd "${progdir}"
33progdir=`pwd`
34prog="${progdir}"/`basename "${prog}"`
Brian Carlstrom105215d2012-06-14 12:50:44 -070035test_dir="test-$$"
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +070036tmp_dir="/tmp/$USER/${test_dir}"
jeffhao5d1ac922011-09-29 17:41:15 -070037
38export JAVA="java"
Brian Carlstrom5103ce62014-03-30 16:17:42 -070039export JAVAC="javac -g"
jeffhao5d1ac922011-09-29 17:41:15 -070040export RUN="${progdir}/etc/push-and-run-test-jar"
Brian Carlstrom105215d2012-06-14 12:50:44 -070041export DEX_LOCATION=/data/run-test/${test_dir}
Elliott Hughesc717eef2012-06-15 16:01:26 -070042export NEED_DEX="true"
jeffhao5d1ac922011-09-29 17:41:15 -070043
Tsu Chiang Chuang4407e612012-07-19 16:13:43 -070044# If dx was not set by the environment variable, assume it is in the path.
45if [ -z "$DX" ]; then
46 export DX="dx"
47fi
48
Tsu Chiang Chuang6674f8a2013-01-16 15:41:21 -080049# If jasmin was not set by the environment variable, assume it is in the path.
50if [ -z "$JASMIN" ]; then
51 export JASMIN="jasmin"
52fi
53
54
jeffhao5d1ac922011-09-29 17:41:15 -070055info="info.txt"
56build="build"
57run="run"
58expected="expected.txt"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -070059check_cmd="check"
jeffhao5d1ac922011-09-29 17:41:15 -070060output="output.txt"
61build_output="build-output.txt"
Brian Carlstromdc959ea2013-10-28 00:44:49 -070062lib="libartd.so"
jeffhao5d1ac922011-09-29 17:41:15 -070063run_args="--quiet"
64
Alex Light9d722532014-07-22 18:07:12 -070065prebuild_mode="yes"
Brian Carlstrom2613de42012-06-15 17:37:16 -070066target_mode="yes"
jeffhao5d1ac922011-09-29 17:41:15 -070067dev_mode="no"
68update_mode="no"
Alex Lighta59dd802014-07-02 16:28:08 -070069debug_mode="no"
70relocate="yes"
Jeff Hao201803f2013-11-20 18:11:39 -080071runtime="art"
jeffhao5d1ac922011-09-29 17:41:15 -070072usage="no"
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -070073build_only="no"
Andreas Gampe2fe07922014-04-21 07:50:39 -070074suffix64=""
jeffhao5d1ac922011-09-29 17:41:15 -070075
76while true; do
77 if [ "x$1" = "x--host" ]; then
Brian Carlstrom2613de42012-06-15 17:37:16 -070078 target_mode="no"
TDYa127b92bcab2012-04-08 00:09:51 -070079 DEX_LOCATION=$tmp_dir
jeffhao5d1ac922011-09-29 17:41:15 -070080 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -080081 elif [ "x$1" = "x--jvm" ]; then
Brian Carlstrom2613de42012-06-15 17:37:16 -070082 target_mode="no"
Jeff Hao201803f2013-11-20 18:11:39 -080083 runtime="jvm"
Elliott Hughesc717eef2012-06-15 16:01:26 -070084 NEED_DEX="false"
jeffhao5d1ac922011-09-29 17:41:15 -070085 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -080086 elif [ "x$1" = "x-O" ]; then
Brian Carlstromdc959ea2013-10-28 00:44:49 -070087 lib="libart.so"
88 shift
89 elif [ "x$1" = "x--dalvik" ]; then
90 lib="libdvm.so"
Jeff Hao201803f2013-11-20 18:11:39 -080091 runtime="dalvik"
Brian Carlstromdc959ea2013-10-28 00:44:49 -070092 shift
Alex Lighta59dd802014-07-02 16:28:08 -070093 elif [ "x$1" = "x--relocate" ]; then
94 relocate="yes"
95 shift
96 elif [ "x$1" = "x--no-relocate" ]; then
97 relocate="no"
98 shift
99 elif [ "x$1" = "x--prebuild" ]; then
100 prebuild_mode="yes"
101 shift;
102 elif [ "x$1" = "x--no-prebuild" ]; then
103 prebuild_mode="no"
104 shift;
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700105 elif [ "x$1" = "x--image" ]; then
106 shift
107 image="$1"
108 run_args="${run_args} --image $image"
Elliott Hughes7c046102011-10-19 18:16:03 -0700109 shift
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000110 elif [ "x$1" = "x-Xcompiler-option" ]; then
111 shift
112 option="$1"
113 run_args="${run_args} -Xcompiler-option $option"
114 shift
Mathieu Chartier769a5ad2014-05-18 15:30:10 -0700115 elif [ "x$1" = "x--runtime-option" ]; then
116 shift
117 option="$1"
118 run_args="${run_args} --runtime-option $option"
119 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700120 elif [ "x$1" = "x--debug" ]; then
121 run_args="${run_args} --debug"
122 shift
123 elif [ "x$1" = "x--gdb" ]; then
124 run_args="${run_args} --gdb"
125 dev_mode="yes"
126 shift
127 elif [ "x$1" = "x--zygote" ]; then
128 run_args="${run_args} --zygote"
129 shift
jeffhao0dff3f42012-11-20 15:13:43 -0800130 elif [ "x$1" = "x--interpreter" ]; then
131 run_args="${run_args} --interpreter"
132 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700133 elif [ "x$1" = "x--no-verify" ]; then
134 run_args="${run_args} --no-verify"
135 shift
136 elif [ "x$1" = "x--no-optimize" ]; then
137 run_args="${run_args} --no-optimize"
138 shift
139 elif [ "x$1" = "x--no-precise" ]; then
140 run_args="${run_args} --no-precise"
141 shift
Elliott Hughes7c046102011-10-19 18:16:03 -0700142 elif [ "x$1" = "x--invoke-with" ]; then
143 shift
144 what="$1"
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700145 if [ "x$what" = "x" ]; then
146 echo "$0 missing argument to --invoke-with" 1>&2
147 usage="yes"
148 break
149 fi
Ian Rogers0e033672013-04-19 10:22:46 -0700150 run_args="${run_args} --invoke-with ${what}"
jeffhao5d1ac922011-09-29 17:41:15 -0700151 shift
152 elif [ "x$1" = "x--dev" ]; then
153 run_args="${run_args} --dev"
154 dev_mode="yes"
155 shift
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700156 elif [ "x$1" = "x--build-only" ]; then
157 build_only="yes"
158 shift
159 elif [ "x$1" = "x--output-path" ]; then
160 shift
161 tmp_dir=$1
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700162 if [ "x$tmp_dir" = "x" ]; then
163 echo "$0 missing argument to --output-path" 1>&2
164 usage="yes"
165 break
166 fi
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700167 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700168 elif [ "x$1" = "x--update" ]; then
169 update_mode="yes"
170 shift
171 elif [ "x$1" = "x--help" ]; then
172 usage="yes"
173 shift
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700174 elif [ "x$1" = "x--64" ]; then
175 run_args="${run_args} --64"
Andreas Gampe2fe07922014-04-21 07:50:39 -0700176 suffix64="64"
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700177 shift
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200178 elif [ "x$1" = "x--trace" ]; then
Jeff Haocf2e7b02014-07-22 18:38:42 -0700179 run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file:${DEX_LOCATION}/trace.bin --runtime-option -Xmethod-trace-file-size:2000000"
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200180 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700181 elif expr "x$1" : "x--" >/dev/null 2>&1; then
Elliott Hughes7c046102011-10-19 18:16:03 -0700182 echo "unknown $0 option: $1" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700183 usage="yes"
184 break
185 else
186 break
187 fi
188done
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700189mkdir -p $tmp_dir
jeffhao5d1ac922011-09-29 17:41:15 -0700190
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700191# Most interesting target architecture variables are Makefile variables, not environment variables.
192# Try to map the suffix64 flag and what we find in ${OUT}/data/art-test to an architecture name.
193function guess_arch_name() {
194 grep32bit=`ls ${OUT}/data/art-test | grep -E '^(arm|x86|mips)$'`
195 grep64bit=`ls ${OUT}/data/art-test | grep -E '^(arm64|x86_64)$'`
196 if [ "x${suffix64}" = "x64" ]; then
197 target_arch_name=${grep64bit}
198 else
199 target_arch_name=${grep32bit}
200 fi
201}
202
Alex Lighta59dd802014-07-02 16:28:08 -0700203if [ "$target_mode" = "no" ]; then
204 if [ "$runtime" = "jvm" ]; then
205 RUN="${progdir}/etc/reference-run-test-classes"
206 if [ "$prebuild_mode" = "yes" ]; then
207 echo "--prebuild with --jvm is unsupported";
208 exit 1;
209 fi
210 else
211 RUN="${progdir}/etc/host-run-test-jar"
212 if [ "$prebuild_mode" = "yes" ]; then
213 run_args="${run_args} --prebuild"
214 fi
215 fi
216else
217 if [ "$prebuild_mode" = "yes" ]; then
218 RUN="${progdir}/etc/push-and-run-prebuilt-test-jar"
219 fi
220fi
221
Jeff Hao201803f2013-11-20 18:11:39 -0800222if [ ! "$runtime" = "jvm" ]; then
223 run_args="${run_args} --lib $lib"
224fi
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700225
Jeff Hao201803f2013-11-20 18:11:39 -0800226if [ "$runtime" = "dalvik" ]; then
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700227 if [ "$target_mode" = "no" ]; then
228 framework="${OUT}/system/framework"
229 bpath="${framework}/core.jar:${framework}/conscrypt.jar:${framework}/okhttp.jar:${framework}/core-junit.jar:${framework}/bouncycastle.jar:${framework}/ext.jar"
230 run_args="${run_args} --boot -Xbootclasspath:${bpath}"
231 else
232 true # defaults to using target BOOTCLASSPATH
233 fi
Jeff Hao201803f2013-11-20 18:11:39 -0800234elif [ "$runtime" = "art" ]; then
235 if [ "$target_mode" = "no" ]; then
Brian Carlstrom43534862014-02-19 01:13:52 -0800236 # ANDROID_BUILD_TOP and ANDROID_HOST_OUT are not set in a build environment.
237 if [ -z "$ANDROID_BUILD_TOP" ]; then
238 export ANDROID_BUILD_TOP=$oldwd
239 fi
240 if [ -z "$ANDROID_HOST_OUT" ]; then
241 export ANDROID_HOST_OUT=$ANDROID_BUILD_TOP/out/host/linux-x86
242 fi
Jeff Hao201803f2013-11-20 18:11:39 -0800243 run_args="${run_args} --boot -Ximage:${ANDROID_HOST_OUT}/framework/core.art"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700244 run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}"
Jeff Hao201803f2013-11-20 18:11:39 -0800245 else
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700246 guess_arch_name
247 run_args="${run_args} --runtime-option -Djava.library.path=/data/art-test/${target_arch_name}"
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700248 run_args="${run_args} --boot -Ximage:/data/art-test/core.art"
Jeff Hao201803f2013-11-20 18:11:39 -0800249 fi
Alex Lighta59dd802014-07-02 16:28:08 -0700250 if [ "$relocate" = "yes" ]; then
251 run_args="${run_args} --relocate"
252 else
253 run_args="${run_args} --no-relocate"
254 fi
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700255fi
256
jeffhao5d1ac922011-09-29 17:41:15 -0700257if [ "$dev_mode" = "yes" -a "$update_mode" = "yes" ]; then
258 echo "--dev and --update are mutually exclusive" 1>&2
259 usage="yes"
260fi
261
262if [ "$usage" = "no" ]; then
263 if [ "x$1" = "x" -o "x$1" = "x-" ]; then
264 test_dir=`basename "$oldwd"`
265 else
266 test_dir="$1"
267 fi
268
269 if [ '!' -d "$test_dir" ]; then
270 td2=`echo ${test_dir}-*`
271 if [ '!' -d "$td2" ]; then
272 echo "${test_dir}: no such test directory" 1>&2
273 usage="yes"
274 fi
275 test_dir="$td2"
276 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700277 # Shift to get rid of the test name argument. The rest of the arguments
278 # will get passed to the test run.
279 shift
280fi
281
282if [ "$usage" = "yes" ]; then
283 prog=`basename $prog`
284 (
285 echo "usage:"
286 echo " $prog --help Print this message."
287 echo " $prog [options] [test-name] Run test normally."
288 echo " $prog --dev [options] [test-name] Development mode" \
289 "(dumps to stdout)."
290 echo " $prog --update [options] [test-name] Update mode" \
291 "(replaces expected.txt)."
292 echo ' Omitting the test name or specifying "-" will use the' \
293 "current directory."
294 echo " Runtime Options:"
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000295 echo " -O Run non-debug rather than debug build (off by default)."
296 echo " -Xcompiler-option Pass an option to the compiler."
Ian Rogers701aa642014-07-18 11:38:13 -0700297 echo " --runtime-option Pass an option to the runtime."
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000298 echo " --debug Wait for a debugger to attach."
299 echo " --gdb Run under gdb; incompatible with some tests."
300 echo " --build-only Build test files only (off by default)."
301 echo " --interpreter Enable interpreter only mode (off by default)."
302 echo " --no-verify Turn off verification (on by default)."
303 echo " --no-optimize Turn off optimization (on by default)."
304 echo " --no-precise Turn off precise GC (on by default)."
305 echo " --zygote Spawn the process from the Zygote." \
jeffhao5d1ac922011-09-29 17:41:15 -0700306 "If used, then the"
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000307 echo " other runtime options are ignored."
Alex Light9d722532014-07-22 18:07:12 -0700308 echo " --prebuild Run dex2oat on the files before starting test. (default)"
Alex Lighta59dd802014-07-02 16:28:08 -0700309 echo " --no-prebuild Do not run dex2oat on the files before starting"
Alex Light9d722532014-07-22 18:07:12 -0700310 echo " the test."
Alex Lighta59dd802014-07-02 16:28:08 -0700311 echo " --relocate Force the use of relocating in the test, making"
312 echo " the image and oat files be relocated to a random"
313 echo " address before running. (default)"
314 echo " --no-relocate Force the use of no relocating in the test"
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000315 echo " --host Use the host-mode virtual machine."
316 echo " --invoke-with Pass --invoke-with option to runtime."
317 echo " --dalvik Use Dalvik (off by default)."
318 echo " --jvm Use a host-local RI virtual machine."
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700319 echo " --output-path [path] Location where to store the build" \
320 "files."
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700321 echo " --64 Run the test in 64-bit mode"
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200322 echo " --trace Run with method tracing"
jeffhao5d1ac922011-09-29 17:41:15 -0700323 ) 1>&2
324 exit 1
325fi
326
327cd "$test_dir"
328test_dir=`pwd`
329
330td_info="${test_dir}/${info}"
331td_expected="${test_dir}/${expected}"
332
Brian Carlstrom22469aa2012-09-07 10:34:57 -0700333if [ ! -r $td_info ]; then
334 echo "${test_dir}: missing file $td_info" 1>&2
335 exit 1
336fi
337
338if [ ! -r $td_expected ]; then
339 echo "${test_dir}: missing file $td_expected" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700340 exit 1
341fi
342
343# copy the test to a temp dir and run it
344
Elliott Hughes510c8782011-10-06 10:57:34 -0700345echo "${test_dir}: building..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700346
347rm -rf "$tmp_dir"
348cp -Rp "$test_dir" "$tmp_dir"
349cd "$tmp_dir"
350
351if [ '!' -r "$build" ]; then
352 cp "${progdir}/etc/default-build" build
353fi
354
355if [ '!' -r "$run" ]; then
356 cp "${progdir}/etc/default-run" run
357fi
358
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700359if [ '!' -r "$check_cmd" ]; then
360 cp "${progdir}/etc/default-check" check
361fi
362
jeffhao5d1ac922011-09-29 17:41:15 -0700363chmod 755 "$build"
364chmod 755 "$run"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700365chmod 755 "$check_cmd"
jeffhao5d1ac922011-09-29 17:41:15 -0700366
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700367export TEST_NAME=`basename ${test_dir}`
368
Ian Rogers997f0f92014-06-21 22:58:05 -0700369# To cause tests to fail fast, limit the file sizes created by dx, dex2oat and ART output to 2MB.
370file_size_limit=2048
371if echo "$test_dir" | grep 089; then
372 file_size_limit=5120
373elif echo "$test_dir" | grep 083; then
374 file_size_limit=5120
375fi
Alex Lighta59dd802014-07-02 16:28:08 -0700376if ! ulimit -S "$file_size_limit"; then
Ian Rogers997f0f92014-06-21 22:58:05 -0700377 echo "ulimit file size setting failed"
378fi
379
jeffhao5d1ac922011-09-29 17:41:15 -0700380good="no"
381if [ "$dev_mode" = "yes" ]; then
382 "./${build}" 2>&1
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700383 build_exit="$?"
384 echo "build exit status: $build_exit" 1>&2
385 if [ "$build_exit" = '0' ]; then
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800386 echo "${test_dir}: running..." 1>&2
387 "./${run}" $run_args "$@" 2>&1
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700388 run_exit="$?"
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800389 echo "run exit status: $run_exit" 1>&2
390 if [ "$run_exit" = "0" ]; then
391 good="yes"
392 fi
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700393 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700394elif [ "$update_mode" = "yes" ]; then
395 "./${build}" >"$build_output" 2>&1
396 build_exit="$?"
397 if [ "$build_exit" = '0' ]; then
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800398 echo "${test_dir}: running..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700399 "./${run}" $run_args "$@" >"$output" 2>&1
400 sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}"
401 good="yes"
402 else
403 cat "$build_output" 1>&2
404 echo "build exit status: $build_exit" 1>&2
405 fi
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700406elif [ "$build_only" = "yes" ]; then
407 good="yes"
408 "./${build}" >"$build_output" 2>&1
409 build_exit="$?"
410 if [ "$build_exit" '!=' '0' ]; then
411 cp "$build_output" "$output"
412 echo "build exit status: $build_exit" >>"$output"
413 diff --strip-trailing-cr -q "$expected" "$output" >/dev/null
414 if [ "$?" '!=' "0" ]; then
415 good="no"
416 echo "BUILD FAILED For ${TEST_NAME}"
417 fi
418 fi
Tsu Chiang Chuang379e2f52013-08-20 12:24:52 -0700419 # Clean up extraneous files that are not used by tests.
Tsu Chiang Chuang0160d992013-09-13 14:17:42 -0700420 find $tmp_dir -mindepth 1 ! -regex ".*/\(.*jar\|$output\|$expected\)" | xargs rm -rf
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700421 exit 0
jeffhao5d1ac922011-09-29 17:41:15 -0700422else
423 "./${build}" >"$build_output" 2>&1
424 build_exit="$?"
425 if [ "$build_exit" = '0' ]; then
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800426 echo "${test_dir}: running..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700427 "./${run}" $run_args "$@" >"$output" 2>&1
428 else
429 cp "$build_output" "$output"
430 echo "build exit status: $build_exit" >>"$output"
431 fi
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700432 ./$check_cmd "$expected" "$output"
jeffhao5d1ac922011-09-29 17:41:15 -0700433 if [ "$?" = "0" ]; then
434 # output == expected
435 good="yes"
436 echo "${test_dir}: succeeded!" 1>&2
437 fi
438fi
439
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700440# Clean up test files.
441if [ "$good" == "yes" ]; then
jeffhao5d1ac922011-09-29 17:41:15 -0700442 cd "$oldwd"
443 rm -rf "$tmp_dir"
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700444 if [ "$target_mode" = "yes" -a "$build_exit" = "0" ]; then
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700445 adb shell rm -rf $DEX_LOCATION
Brian Carlstrom105215d2012-06-14 12:50:44 -0700446 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700447 exit 0
448fi
449
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700450
jeffhao5d1ac922011-09-29 17:41:15 -0700451(
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700452 if [ "$update_mode" != "yes" ]; then
jeffhao5d1ac922011-09-29 17:41:15 -0700453 echo "${test_dir}: FAILED!"
454 echo ' '
455 echo '#################### info'
456 cat "${td_info}" | sed 's/^/# /g'
457 echo '#################### diffs'
Ian Rogers997f0f92014-06-21 22:58:05 -0700458 diff --strip-trailing-cr -u "$expected" "$output" | tail -n 500
jeffhao5d1ac922011-09-29 17:41:15 -0700459 echo '####################'
460 echo ' '
461 fi
Brian Carlstrom105215d2012-06-14 12:50:44 -0700462 echo "${TEST_NAME} files left in ${tmp_dir} on host"
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700463 if [ "$target_mode" == "yes" ]; then
Brian Carlstrom105215d2012-06-14 12:50:44 -0700464 echo "and in ${DEX_LOCATION} on target"
465 fi
466
jeffhao5d1ac922011-09-29 17:41:15 -0700467) 1>&2
468
469exit 1