blob: 76283b7a8d2b609187ef4d6710a17577478be601 [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
Elliott Hughes58bcc402012-02-14 14:10:10 -080047 elif [ "x$1" = "x--jvm" ]; then
48 run_args="${run_args} --jvm"
jeffhao5d1ac922011-09-29 17:41:15 -070049 shift
jeffhao5d1ac922011-09-29 17:41:15 -070050 elif [ "x$1" = "x--debug" ]; then
51 run_args="${run_args} --debug"
52 shift
53 elif [ "x$1" = "x--zygote" ]; then
54 run_args="${run_args} --zygote"
55 shift
jeffhao0dff3f42012-11-20 15:13:43 -080056 elif [ "x$1" = "x--interpreter" ]; then
57 run_args="${run_args} --interpreter"
58 shift
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080059 elif [ "x$1" = "x--jit" ]; then
60 run_args="${run_args} --jit"
61 shift
jeffhao5d1ac922011-09-29 17:41:15 -070062 elif [ "x$1" = "x--no-verify" ]; then
63 run_args="${run_args} --no-verify"
64 shift
65 elif [ "x$1" = "x--no-optimize" ]; then
66 run_args="${run_args} --no-optimize"
67 shift
68 elif [ "x$1" = "x--valgrind" ]; then
69 run_args="${run_args} --valgrind"
70 shift
71 elif [ "x$1" = "x--dev" ]; then
72 run_args="${run_args} --dev"
73 shift
74 elif [ "x$1" = "x--update" ]; then
75 run_args="${run_args} --update"
76 shift
77 elif [ "x$1" = "x--help" ]; then
78 usage="yes"
79 shift
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +070080 elif [ "x$1" = "x--seq" ]; then
81 sequental="yes"
82 shift
83 elif [ "x$1" = "x-O" ]; then
84 run_args="${run_args} -O"
85 shift
Zheng Xudc8e7322014-05-07 17:07:20 +010086 elif [ "x$1" = "x--64" ]; then
87 run_args="${run_args} --64"
88 shift
Alex Lighte7873ec2014-08-12 09:53:50 -070089 elif [ "x$1" = "x--gcstress" ]; then
90 run_args="${run_args} --gcstress"
91 shift
92 elif [ "x$1" = "x--gcverify" ]; then
93 run_args="${run_args} --gcverify"
94 shift
Sebastien Hertz07aaac82014-07-09 15:59:05 +020095 elif [ "x$1" = "x--trace" ]; then
96 run_args="${run_args} --trace"
97 shift
Alex Lighta59dd802014-07-02 16:28:08 -070098 elif [ "x$1" = "x--relocate" ]; then
99 run_args="${run_args} --relocate"
100 shift
101 elif [ "x$1" = "x--no-relocate" ]; then
102 run_args="${run_args} --no-relocate"
103 shift
Alex Light9d722532014-07-22 18:07:12 -0700104 elif [ "x$1" = "x--no-prebuild" ]; then
105 run_args="${run_args} --no-prebuild"
106 shift;
Alex Lighta59dd802014-07-02 16:28:08 -0700107 elif [ "x$1" = "x--prebuild" ]; then
108 run_args="${run_args} --prebuild"
109 shift;
Alex Light03a112d2014-08-25 13:25:56 -0700110 elif [ "x$1" = "x--no-dex2oat" ]; then
111 run_args="${run_args} --no-dex2oat"
112 shift;
113 elif [ "x$1" = "x--no-patchoat" ]; then
114 run_args="${run_args} --no-patchoat"
115 shift;
Alex Lightbfac14a2014-07-30 09:41:21 -0700116 elif [ "x$1" = "x--always-clean" ]; then
117 run_args="${run_args} --always-clean"
Goran Jakovljevic79829cb2015-03-27 11:48:25 +0100118 shift
jeffhao5d1ac922011-09-29 17:41:15 -0700119 elif expr "x$1" : "x--" >/dev/null 2>&1; then
Elliott Hughes7c046102011-10-19 18:16:03 -0700120 echo "unknown $0 option: $1" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -0700121 usage="yes"
122 break
123 else
124 break
125 fi
126done
127
128if [ "$usage" = "yes" ]; then
129 prog=`basename $prog`
130 (
131 echo "usage:"
132 echo " $prog --help Print this message."
133 echo " $prog [options] Run all tests with the given options."
134 echo " Options are all passed to run-test; refer to that for " \
135 "further documentation:"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800136 echo " --debug --dev --host --interpreter --jit --jvm --no-optimize"
Alex Lighta59dd802014-07-02 16:28:08 -0700137 echo " --no-verify -O --update --valgrind --zygote --64 --relocate"
Alex Lighte7873ec2014-08-12 09:53:50 -0700138 echo " --prebuild --always-clean --gcstress --gcverify --trace"
Alex Lighteb7c1442015-08-31 13:17:42 -0700139 echo " --no-patchoat --no-dex2oat --use-java-home"
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700140 echo " Specific Runtime Options:"
141 echo " --seq Run tests one-by-one, avoiding failures caused by busy CPU"
jeffhao5d1ac922011-09-29 17:41:15 -0700142 ) 1>&2
143 exit 1
144fi
145
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700146if [ "$sequental" == "yes" ]; then
147 i=0
148 for test_name in *; do
149 if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
150 ./run-test ${run_args} "$test_name"
151 RES=$?
152 test_pids[i]=i
153 test_names[test_pids[i]]="$test_name"
154 if [ "$RES" != "0" ]; then
155 let failure_count+=1
156 failed_test_names="$failed_test_names ${test_names[i]}"
157 else
158 let succeeded_count+=1
159 fi
160 let i+=1
161 fi
162 done
163else
164 # start all the tests
165 i=0
166 for test_name in *; do
167 if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
168 ./run-test ${run_args} "$test_name" &
169 test_pids[i]=$!
170 test_names[test_pids[i]]="$test_name"
171 let i+=1
172 fi
173 done
jeffhao5d1ac922011-09-29 17:41:15 -0700174
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +0700175 # wait for all the tests, collecting the failures
176 failure_count=0
177 succeeded_count=0
178 failed_test_names=""
179 for pid in ${test_pids[@]}; do
180 wait $pid
181 if [ "$?" != "0" ]; then
182 let failure_count+=1
183 failed_test_names="$failed_test_names ${test_names[$pid]}[pid=$pid]"
184 else
185 let succeeded_count+=1
186 fi
187 done
188fi
jeffhao5d1ac922011-09-29 17:41:15 -0700189
TDYa127b92bcab2012-04-08 00:09:51 -0700190echo "succeeded tests: $succeeded_count"
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700191echo "failed tests: $failure_count"
192
193for i in $failed_test_names; do
194 echo "failed: $i"
jeffhao5d1ac922011-09-29 17:41:15 -0700195done