blob: 402c299b55771662849262c4910d52a3e305741f [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}"`
35
36run_args=""
37usage="no"
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +070038sequental="no"
jeffhao5d1ac922011-09-29 17:41:15 -070039
40while true; do
41 if [ "x$1" = "x--host" ]; then
42 run_args="${run_args} --host"
43 shift
Alex Lighteb7c1442015-08-31 13:17:42 -070044 elif [ "x$1" = "x--use-java-home" ]; then
45 run_args="${run_args} --use-java-home"
46 shift
Alex Lightfadfee92015-10-28 09:40:10 -070047 elif [ "x$1" = "x--no-image" ]; then
48 run_args="${run_args} --no-image"
49 shift
Alex Lightfadfee92015-10-28 09:40:10 -070050 elif [ "x$1" = "x--optimizing" ]; then
51 run_args="${run_args} --optimizing"
52 shift
53 elif [ "x$1" = "x--image" ]; then
54 run_args="${run_args} --image"
55 shift
56 elif [ "x$1" = "x--never-clean" ]; then
57 run_args="${run_args} --never-clean"
58 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -080059 elif [ "x$1" = "x--jvm" ]; then
60 run_args="${run_args} --jvm"
jeffhao5d1ac922011-09-29 17:41:15 -070061 shift
jeffhao5d1ac922011-09-29 17:41:15 -070062 elif [ "x$1" = "x--debug" ]; then
63 run_args="${run_args} --debug"
64 shift
Alex Lightfadfee92015-10-28 09:40:10 -070065 elif [ "x$1" = "x--build-only" ]; then
66 run_args="${run_args} --build-only"
67 shift
68 elif [ "x$1" = "x--build-with-jack" ]; then
69 run_args="${run_args} --build-with-jack"
70 shift
71 elif [ "x$1" = "x--build-with-javac-dx" ]; then
72 run_args="${run_args} --build-with-javac-dx"
73 shift
74 elif [ "x$1" = "x--dex2oat-swap" ]; then
75 run_args="${run_args} --dex2oat-swap"
76 shift
77 elif [ "x$1" = "x--dalvik" ]; then
78 run_args="${run_args} --dalvik"
79 shift
80 elif [ "x$1" = "x--debuggable" ]; then
81 run_args="${run_args} --debuggable"
82 shift
jeffhao5d1ac922011-09-29 17:41:15 -070083 elif [ "x$1" = "x--zygote" ]; then
84 run_args="${run_args} --zygote"
85 shift
jeffhao0dff3f42012-11-20 15:13:43 -080086 elif [ "x$1" = "x--interpreter" ]; then
87 run_args="${run_args} --interpreter"
88 shift
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080089 elif [ "x$1" = "x--jit" ]; then
90 run_args="${run_args} --jit"
91 shift
Alex Lightfadfee92015-10-28 09:40:10 -070092 elif [ "x$1" = "x--verify-soft-fail" ]; then
93 run_args="${run_args} --verify-soft-fail"
94 shift
jeffhao5d1ac922011-09-29 17:41:15 -070095 elif [ "x$1" = "x--no-verify" ]; then
96 run_args="${run_args} --no-verify"
97 shift
98 elif [ "x$1" = "x--no-optimize" ]; then
99 run_args="${run_args} --no-optimize"
100 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700101 elif [ "x$1" = "x--dev" ]; then
102 run_args="${run_args} --dev"
103 shift
104 elif [ "x$1" = "x--update" ]; then
105 run_args="${run_args} --update"
106 shift
107 elif [ "x$1" = "x--help" ]; then
108 usage="yes"
109 shift
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700110 elif [ "x$1" = "x--seq" ]; then
111 sequental="yes"
112 shift
113 elif [ "x$1" = "x-O" ]; then
114 run_args="${run_args} -O"
115 shift
Zheng Xudc8e7322014-05-07 17:07:20 +0100116 elif [ "x$1" = "x--64" ]; then
117 run_args="${run_args} --64"
118 shift
Alex Lighte7873ec2014-08-12 09:53:50 -0700119 elif [ "x$1" = "x--gcstress" ]; then
120 run_args="${run_args} --gcstress"
121 shift
122 elif [ "x$1" = "x--gcverify" ]; then
123 run_args="${run_args} --gcverify"
124 shift
Sebastien Hertz07aaac82014-07-09 15:59:05 +0200125 elif [ "x$1" = "x--trace" ]; then
126 run_args="${run_args} --trace"
127 shift
Alex Lighta59dd802014-07-02 16:28:08 -0700128 elif [ "x$1" = "x--relocate" ]; then
129 run_args="${run_args} --relocate"
130 shift
131 elif [ "x$1" = "x--no-relocate" ]; then
132 run_args="${run_args} --no-relocate"
133 shift
Alex Light9d722532014-07-22 18:07:12 -0700134 elif [ "x$1" = "x--no-prebuild" ]; then
135 run_args="${run_args} --no-prebuild"
136 shift;
Alex Lighta59dd802014-07-02 16:28:08 -0700137 elif [ "x$1" = "x--prebuild" ]; then
138 run_args="${run_args} --prebuild"
139 shift;
Alex Light03a112d2014-08-25 13:25:56 -0700140 elif [ "x$1" = "x--no-dex2oat" ]; then
141 run_args="${run_args} --no-dex2oat"
142 shift;
143 elif [ "x$1" = "x--no-patchoat" ]; then
144 run_args="${run_args} --no-patchoat"
145 shift;
Alex Lightbfac14a2014-07-30 09:41:21 -0700146 elif [ "x$1" = "x--always-clean" ]; then
147 run_args="${run_args} --always-clean"
Goran Jakovljevic79829cb2015-03-27 11:48:25 +0100148 shift
Alex Lightfadfee92015-10-28 09:40:10 -0700149 elif [ "x$1" = "x--pic-test" ]; then
150 run_args="${run_args} --pic-test"
151 shift
152 elif [ "x$1" = "x--pic-image" ]; then
153 run_args="${run_args} --pic-image"
154 shift
155 elif [ "x$1" = "x--strace" ]; then
156 run_args="${run_args} --strace"
157 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700158 elif expr "x$1" : "x--" >/dev/null 2>&1; then
Elliott Hughes7c046102011-10-19 18:16:03 -0700159 echo "unknown $0 option: $1" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700160 usage="yes"
161 break
162 else
163 break
164 fi
165done
166
167if [ "$usage" = "yes" ]; then
168 prog=`basename $prog`
169 (
170 echo "usage:"
171 echo " $prog --help Print this message."
172 echo " $prog [options] Run all tests with the given options."
173 echo " Options are all passed to run-test; refer to that for " \
174 "further documentation:"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800175 echo " --debug --dev --host --interpreter --jit --jvm --no-optimize"
Alex Lightfadfee92015-10-28 09:40:10 -0700176 echo " --no-verify --verify-soft-fail -O --update --zygote --64"
177 echo " --relocate --prebuild --always-clean --gcstress --gcverify"
178 echo " --trace --no-patchoat --no-dex2oat --use-java-home --pic-image"
179 echo " --pic-test --strace --debuggable --dalvik --dex2oat-swap"
180 echo " --build-only --build-with-jack --build-with-javac-dx"
Nicolas Geoffray7db00cd2016-03-22 10:43:01 +0000181 echo " --never-clean --image --no-image --optimizing"
Alex Lightfadfee92015-10-28 09:40:10 -0700182 echo " --no-relocate --no-prebuild"
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700183 echo " Specific Runtime Options:"
184 echo " --seq Run tests one-by-one, avoiding failures caused by busy CPU"
jeffhao5d1ac922011-09-29 17:41:15 -0700185 ) 1>&2
186 exit 1
187fi
188
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700189if [ "$sequental" == "yes" ]; then
190 i=0
191 for test_name in *; do
192 if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
193 ./run-test ${run_args} "$test_name"
194 RES=$?
195 test_pids[i]=i
196 test_names[test_pids[i]]="$test_name"
197 if [ "$RES" != "0" ]; then
198 let failure_count+=1
199 failed_test_names="$failed_test_names ${test_names[i]}"
200 else
201 let succeeded_count+=1
202 fi
203 let i+=1
204 fi
205 done
206else
207 # start all the tests
208 i=0
209 for test_name in *; do
210 if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
211 ./run-test ${run_args} "$test_name" &
212 test_pids[i]=$!
213 test_names[test_pids[i]]="$test_name"
214 let i+=1
215 fi
216 done
jeffhao5d1ac922011-09-29 17:41:15 -0700217
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700218 # wait for all the tests, collecting the failures
219 failure_count=0
220 succeeded_count=0
221 failed_test_names=""
222 for pid in ${test_pids[@]}; do
223 wait $pid
224 if [ "$?" != "0" ]; then
225 let failure_count+=1
226 failed_test_names="$failed_test_names ${test_names[$pid]}[pid=$pid]"
227 else
228 let succeeded_count+=1
229 fi
230 done
231fi
jeffhao5d1ac922011-09-29 17:41:15 -0700232
TDYa127b92bcab2012-04-08 00:09:51 -0700233echo "succeeded tests: $succeeded_count"
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700234echo "failed tests: $failure_count"
235
236for i in $failed_test_names; do
237 echo "failed: $i"
jeffhao5d1ac922011-09-29 17:41:15 -0700238done