blob: 1ed03ea5c5f043bdc7f4723963689d0e96735f87 [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=""
Jeff Hao85139a32014-07-23 11:52:52 -070075trace="false"
jeffhao5d1ac922011-09-29 17:41:15 -070076
77while true; do
78 if [ "x$1" = "x--host" ]; then
Brian Carlstrom2613de42012-06-15 17:37:16 -070079 target_mode="no"
TDYa127b92bcab2012-04-08 00:09:51 -070080 DEX_LOCATION=$tmp_dir
jeffhao5d1ac922011-09-29 17:41:15 -070081 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -080082 elif [ "x$1" = "x--jvm" ]; then
Brian Carlstrom2613de42012-06-15 17:37:16 -070083 target_mode="no"
Jeff Hao201803f2013-11-20 18:11:39 -080084 runtime="jvm"
Elliott Hughesc717eef2012-06-15 16:01:26 -070085 NEED_DEX="false"
jeffhao5d1ac922011-09-29 17:41:15 -070086 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -080087 elif [ "x$1" = "x-O" ]; then
Brian Carlstromdc959ea2013-10-28 00:44:49 -070088 lib="libart.so"
89 shift
90 elif [ "x$1" = "x--dalvik" ]; then
91 lib="libdvm.so"
Jeff Hao201803f2013-11-20 18:11:39 -080092 runtime="dalvik"
Brian Carlstromdc959ea2013-10-28 00:44:49 -070093 shift
Alex Lighta59dd802014-07-02 16:28:08 -070094 elif [ "x$1" = "x--relocate" ]; then
95 relocate="yes"
96 shift
97 elif [ "x$1" = "x--no-relocate" ]; then
98 relocate="no"
99 shift
100 elif [ "x$1" = "x--prebuild" ]; then
101 prebuild_mode="yes"
102 shift;
103 elif [ "x$1" = "x--no-prebuild" ]; then
104 prebuild_mode="no"
105 shift;
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700106 elif [ "x$1" = "x--image" ]; then
107 shift
108 image="$1"
109 run_args="${run_args} --image $image"
Elliott Hughes7c046102011-10-19 18:16:03 -0700110 shift
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000111 elif [ "x$1" = "x-Xcompiler-option" ]; then
112 shift
113 option="$1"
114 run_args="${run_args} -Xcompiler-option $option"
115 shift
Mathieu Chartier769a5ad2014-05-18 15:30:10 -0700116 elif [ "x$1" = "x--runtime-option" ]; then
117 shift
118 option="$1"
119 run_args="${run_args} --runtime-option $option"
120 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700121 elif [ "x$1" = "x--debug" ]; then
122 run_args="${run_args} --debug"
123 shift
124 elif [ "x$1" = "x--gdb" ]; then
125 run_args="${run_args} --gdb"
126 dev_mode="yes"
127 shift
128 elif [ "x$1" = "x--zygote" ]; then
129 run_args="${run_args} --zygote"
130 shift
jeffhao0dff3f42012-11-20 15:13:43 -0800131 elif [ "x$1" = "x--interpreter" ]; then
132 run_args="${run_args} --interpreter"
133 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700134 elif [ "x$1" = "x--no-verify" ]; then
135 run_args="${run_args} --no-verify"
136 shift
137 elif [ "x$1" = "x--no-optimize" ]; then
138 run_args="${run_args} --no-optimize"
139 shift
140 elif [ "x$1" = "x--no-precise" ]; then
141 run_args="${run_args} --no-precise"
142 shift
Elliott Hughes7c046102011-10-19 18:16:03 -0700143 elif [ "x$1" = "x--invoke-with" ]; then
144 shift
145 what="$1"
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700146 if [ "x$what" = "x" ]; then
147 echo "$0 missing argument to --invoke-with" 1>&2
148 usage="yes"
149 break
150 fi
Ian Rogers0e033672013-04-19 10:22:46 -0700151 run_args="${run_args} --invoke-with ${what}"
jeffhao5d1ac922011-09-29 17:41:15 -0700152 shift
153 elif [ "x$1" = "x--dev" ]; then
154 run_args="${run_args} --dev"
155 dev_mode="yes"
156 shift
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700157 elif [ "x$1" = "x--build-only" ]; then
158 build_only="yes"
159 shift
160 elif [ "x$1" = "x--output-path" ]; then
161 shift
162 tmp_dir=$1
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700163 if [ "x$tmp_dir" = "x" ]; then
164 echo "$0 missing argument to --output-path" 1>&2
165 usage="yes"
166 break
167 fi
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700168 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700169 elif [ "x$1" = "x--update" ]; then
170 update_mode="yes"
171 shift
172 elif [ "x$1" = "x--help" ]; then
173 usage="yes"
174 shift
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700175 elif [ "x$1" = "x--64" ]; then
176 run_args="${run_args} --64"
Andreas Gampe2fe07922014-04-21 07:50:39 -0700177 suffix64="64"
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700178 shift
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200179 elif [ "x$1" = "x--trace" ]; then
Jeff Hao85139a32014-07-23 11:52:52 -0700180 trace="true"
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200181 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700182 elif expr "x$1" : "x--" >/dev/null 2>&1; then
Elliott Hughes7c046102011-10-19 18:16:03 -0700183 echo "unknown $0 option: $1" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700184 usage="yes"
185 break
186 else
187 break
188 fi
189done
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700190mkdir -p $tmp_dir
jeffhao5d1ac922011-09-29 17:41:15 -0700191
Jeff Hao85139a32014-07-23 11:52:52 -0700192if [ "$trace" = "true" ]; then
193 run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file:${DEX_LOCATION}/trace.bin --runtime-option -Xmethod-trace-file-size:2000000"
194fi
195
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700196# Most interesting target architecture variables are Makefile variables, not environment variables.
197# Try to map the suffix64 flag and what we find in ${OUT}/data/art-test to an architecture name.
198function guess_arch_name() {
199 grep32bit=`ls ${OUT}/data/art-test | grep -E '^(arm|x86|mips)$'`
200 grep64bit=`ls ${OUT}/data/art-test | grep -E '^(arm64|x86_64)$'`
201 if [ "x${suffix64}" = "x64" ]; then
202 target_arch_name=${grep64bit}
203 else
204 target_arch_name=${grep32bit}
205 fi
206}
207
Alex Lighta59dd802014-07-02 16:28:08 -0700208if [ "$target_mode" = "no" ]; then
209 if [ "$runtime" = "jvm" ]; then
210 RUN="${progdir}/etc/reference-run-test-classes"
211 if [ "$prebuild_mode" = "yes" ]; then
212 echo "--prebuild with --jvm is unsupported";
213 exit 1;
214 fi
215 else
216 RUN="${progdir}/etc/host-run-test-jar"
217 if [ "$prebuild_mode" = "yes" ]; then
218 run_args="${run_args} --prebuild"
219 fi
220 fi
221else
222 if [ "$prebuild_mode" = "yes" ]; then
223 RUN="${progdir}/etc/push-and-run-prebuilt-test-jar"
224 fi
225fi
226
Jeff Hao201803f2013-11-20 18:11:39 -0800227if [ ! "$runtime" = "jvm" ]; then
228 run_args="${run_args} --lib $lib"
229fi
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700230
Jeff Hao201803f2013-11-20 18:11:39 -0800231if [ "$runtime" = "dalvik" ]; then
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700232 if [ "$target_mode" = "no" ]; then
233 framework="${OUT}/system/framework"
234 bpath="${framework}/core.jar:${framework}/conscrypt.jar:${framework}/okhttp.jar:${framework}/core-junit.jar:${framework}/bouncycastle.jar:${framework}/ext.jar"
235 run_args="${run_args} --boot -Xbootclasspath:${bpath}"
236 else
237 true # defaults to using target BOOTCLASSPATH
238 fi
Jeff Hao201803f2013-11-20 18:11:39 -0800239elif [ "$runtime" = "art" ]; then
240 if [ "$target_mode" = "no" ]; then
Brian Carlstrom43534862014-02-19 01:13:52 -0800241 # ANDROID_BUILD_TOP and ANDROID_HOST_OUT are not set in a build environment.
242 if [ -z "$ANDROID_BUILD_TOP" ]; then
243 export ANDROID_BUILD_TOP=$oldwd
244 fi
245 if [ -z "$ANDROID_HOST_OUT" ]; then
246 export ANDROID_HOST_OUT=$ANDROID_BUILD_TOP/out/host/linux-x86
247 fi
Jeff Hao201803f2013-11-20 18:11:39 -0800248 run_args="${run_args} --boot -Ximage:${ANDROID_HOST_OUT}/framework/core.art"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700249 run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}"
Jeff Hao201803f2013-11-20 18:11:39 -0800250 else
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700251 guess_arch_name
252 run_args="${run_args} --runtime-option -Djava.library.path=/data/art-test/${target_arch_name}"
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700253 run_args="${run_args} --boot -Ximage:/data/art-test/core.art"
Jeff Hao201803f2013-11-20 18:11:39 -0800254 fi
Alex Lighta59dd802014-07-02 16:28:08 -0700255 if [ "$relocate" = "yes" ]; then
256 run_args="${run_args} --relocate"
257 else
258 run_args="${run_args} --no-relocate"
259 fi
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700260fi
261
jeffhao5d1ac922011-09-29 17:41:15 -0700262if [ "$dev_mode" = "yes" -a "$update_mode" = "yes" ]; then
263 echo "--dev and --update are mutually exclusive" 1>&2
264 usage="yes"
265fi
266
267if [ "$usage" = "no" ]; then
268 if [ "x$1" = "x" -o "x$1" = "x-" ]; then
269 test_dir=`basename "$oldwd"`
270 else
271 test_dir="$1"
272 fi
273
274 if [ '!' -d "$test_dir" ]; then
275 td2=`echo ${test_dir}-*`
276 if [ '!' -d "$td2" ]; then
277 echo "${test_dir}: no such test directory" 1>&2
278 usage="yes"
279 fi
280 test_dir="$td2"
281 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700282 # Shift to get rid of the test name argument. The rest of the arguments
283 # will get passed to the test run.
284 shift
285fi
286
287if [ "$usage" = "yes" ]; then
288 prog=`basename $prog`
289 (
290 echo "usage:"
291 echo " $prog --help Print this message."
292 echo " $prog [options] [test-name] Run test normally."
293 echo " $prog --dev [options] [test-name] Development mode" \
294 "(dumps to stdout)."
295 echo " $prog --update [options] [test-name] Update mode" \
296 "(replaces expected.txt)."
297 echo ' Omitting the test name or specifying "-" will use the' \
298 "current directory."
299 echo " Runtime Options:"
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000300 echo " -O Run non-debug rather than debug build (off by default)."
301 echo " -Xcompiler-option Pass an option to the compiler."
Ian Rogers701aa642014-07-18 11:38:13 -0700302 echo " --runtime-option Pass an option to the runtime."
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000303 echo " --debug Wait for a debugger to attach."
304 echo " --gdb Run under gdb; incompatible with some tests."
305 echo " --build-only Build test files only (off by default)."
306 echo " --interpreter Enable interpreter only mode (off by default)."
307 echo " --no-verify Turn off verification (on by default)."
308 echo " --no-optimize Turn off optimization (on by default)."
309 echo " --no-precise Turn off precise GC (on by default)."
310 echo " --zygote Spawn the process from the Zygote." \
jeffhao5d1ac922011-09-29 17:41:15 -0700311 "If used, then the"
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000312 echo " other runtime options are ignored."
Alex Light9d722532014-07-22 18:07:12 -0700313 echo " --prebuild Run dex2oat on the files before starting test. (default)"
Alex Lighta59dd802014-07-02 16:28:08 -0700314 echo " --no-prebuild Do not run dex2oat on the files before starting"
Alex Light9d722532014-07-22 18:07:12 -0700315 echo " the test."
Alex Lighta59dd802014-07-02 16:28:08 -0700316 echo " --relocate Force the use of relocating in the test, making"
317 echo " the image and oat files be relocated to a random"
318 echo " address before running. (default)"
319 echo " --no-relocate Force the use of no relocating in the test"
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000320 echo " --host Use the host-mode virtual machine."
321 echo " --invoke-with Pass --invoke-with option to runtime."
322 echo " --dalvik Use Dalvik (off by default)."
323 echo " --jvm Use a host-local RI virtual machine."
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700324 echo " --output-path [path] Location where to store the build" \
325 "files."
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700326 echo " --64 Run the test in 64-bit mode"
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200327 echo " --trace Run with method tracing"
jeffhao5d1ac922011-09-29 17:41:15 -0700328 ) 1>&2
329 exit 1
330fi
331
332cd "$test_dir"
333test_dir=`pwd`
334
335td_info="${test_dir}/${info}"
336td_expected="${test_dir}/${expected}"
337
Brian Carlstrom22469aa2012-09-07 10:34:57 -0700338if [ ! -r $td_info ]; then
339 echo "${test_dir}: missing file $td_info" 1>&2
340 exit 1
341fi
342
343if [ ! -r $td_expected ]; then
344 echo "${test_dir}: missing file $td_expected" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700345 exit 1
346fi
347
348# copy the test to a temp dir and run it
349
Elliott Hughes510c8782011-10-06 10:57:34 -0700350echo "${test_dir}: building..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700351
352rm -rf "$tmp_dir"
353cp -Rp "$test_dir" "$tmp_dir"
354cd "$tmp_dir"
355
356if [ '!' -r "$build" ]; then
357 cp "${progdir}/etc/default-build" build
358fi
359
360if [ '!' -r "$run" ]; then
361 cp "${progdir}/etc/default-run" run
362fi
363
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700364if [ '!' -r "$check_cmd" ]; then
365 cp "${progdir}/etc/default-check" check
366fi
367
jeffhao5d1ac922011-09-29 17:41:15 -0700368chmod 755 "$build"
369chmod 755 "$run"
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700370chmod 755 "$check_cmd"
jeffhao5d1ac922011-09-29 17:41:15 -0700371
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700372export TEST_NAME=`basename ${test_dir}`
373
Ian Rogers997f0f92014-06-21 22:58:05 -0700374# To cause tests to fail fast, limit the file sizes created by dx, dex2oat and ART output to 2MB.
375file_size_limit=2048
376if echo "$test_dir" | grep 089; then
377 file_size_limit=5120
378elif echo "$test_dir" | grep 083; then
379 file_size_limit=5120
380fi
Alex Lighta59dd802014-07-02 16:28:08 -0700381if ! ulimit -S "$file_size_limit"; then
Ian Rogers997f0f92014-06-21 22:58:05 -0700382 echo "ulimit file size setting failed"
383fi
384
jeffhao5d1ac922011-09-29 17:41:15 -0700385good="no"
386if [ "$dev_mode" = "yes" ]; then
387 "./${build}" 2>&1
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700388 build_exit="$?"
389 echo "build exit status: $build_exit" 1>&2
390 if [ "$build_exit" = '0' ]; then
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800391 echo "${test_dir}: running..." 1>&2
392 "./${run}" $run_args "$@" 2>&1
Brian Carlstromdc959ea2013-10-28 00:44:49 -0700393 run_exit="$?"
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800394 echo "run exit status: $run_exit" 1>&2
395 if [ "$run_exit" = "0" ]; then
396 good="yes"
397 fi
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700398 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700399elif [ "$update_mode" = "yes" ]; then
400 "./${build}" >"$build_output" 2>&1
401 build_exit="$?"
402 if [ "$build_exit" = '0' ]; then
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800403 echo "${test_dir}: running..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700404 "./${run}" $run_args "$@" >"$output" 2>&1
405 sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}"
406 good="yes"
407 else
408 cat "$build_output" 1>&2
409 echo "build exit status: $build_exit" 1>&2
410 fi
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700411elif [ "$build_only" = "yes" ]; then
412 good="yes"
413 "./${build}" >"$build_output" 2>&1
414 build_exit="$?"
415 if [ "$build_exit" '!=' '0' ]; then
416 cp "$build_output" "$output"
417 echo "build exit status: $build_exit" >>"$output"
418 diff --strip-trailing-cr -q "$expected" "$output" >/dev/null
419 if [ "$?" '!=' "0" ]; then
420 good="no"
421 echo "BUILD FAILED For ${TEST_NAME}"
422 fi
423 fi
Tsu Chiang Chuang379e2f52013-08-20 12:24:52 -0700424 # Clean up extraneous files that are not used by tests.
Tsu Chiang Chuang0160d992013-09-13 14:17:42 -0700425 find $tmp_dir -mindepth 1 ! -regex ".*/\(.*jar\|$output\|$expected\)" | xargs rm -rf
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700426 exit 0
jeffhao5d1ac922011-09-29 17:41:15 -0700427else
428 "./${build}" >"$build_output" 2>&1
429 build_exit="$?"
430 if [ "$build_exit" = '0' ]; then
Elliott Hughes2bfc6732012-11-27 20:40:51 -0800431 echo "${test_dir}: running..." 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700432 "./${run}" $run_args "$@" >"$output" 2>&1
433 else
434 cp "$build_output" "$output"
435 echo "build exit status: $build_exit" >>"$output"
436 fi
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700437 ./$check_cmd "$expected" "$output"
jeffhao5d1ac922011-09-29 17:41:15 -0700438 if [ "$?" = "0" ]; then
439 # output == expected
440 good="yes"
441 echo "${test_dir}: succeeded!" 1>&2
442 fi
443fi
444
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700445# Clean up test files.
446if [ "$good" == "yes" ]; then
jeffhao5d1ac922011-09-29 17:41:15 -0700447 cd "$oldwd"
448 rm -rf "$tmp_dir"
Elliott Hughes7ab3a2a2012-06-18 16:34:20 -0700449 if [ "$target_mode" = "yes" -a "$build_exit" = "0" ]; then
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700450 adb shell rm -rf $DEX_LOCATION
Brian Carlstrom105215d2012-06-14 12:50:44 -0700451 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700452 exit 0
453fi
454
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700455
jeffhao5d1ac922011-09-29 17:41:15 -0700456(
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700457 if [ "$update_mode" != "yes" ]; then
jeffhao5d1ac922011-09-29 17:41:15 -0700458 echo "${test_dir}: FAILED!"
459 echo ' '
460 echo '#################### info'
461 cat "${td_info}" | sed 's/^/# /g'
462 echo '#################### diffs'
Ian Rogers997f0f92014-06-21 22:58:05 -0700463 diff --strip-trailing-cr -u "$expected" "$output" | tail -n 500
jeffhao5d1ac922011-09-29 17:41:15 -0700464 echo '####################'
465 echo ' '
466 fi
Brian Carlstrom105215d2012-06-14 12:50:44 -0700467 echo "${TEST_NAME} files left in ${tmp_dir} on host"
Tsu Chiang Chuang011fade2012-07-09 18:34:47 -0700468 if [ "$target_mode" == "yes" ]; then
Brian Carlstrom105215d2012-06-14 12:50:44 -0700469 echo "and in ${DEX_LOCATION} on target"
470 fi
471
jeffhao5d1ac922011-09-29 17:41:15 -0700472) 1>&2
473
474exit 1