blob: 3176f02d54d0e222d2c64b458e7c54eafd09ec9c [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"
38
39while true; do
40 if [ "x$1" = "x--host" ]; then
41 run_args="${run_args} --host"
42 shift
Elliott Hughes58bcc402012-02-14 14:10:10 -080043 elif [ "x$1" = "x--jvm" ]; then
44 run_args="${run_args} --jvm"
jeffhao5d1ac922011-09-29 17:41:15 -070045 shift
jeffhao5d1ac922011-09-29 17:41:15 -070046 elif [ "x$1" = "x--debug" ]; then
47 run_args="${run_args} --debug"
48 shift
49 elif [ "x$1" = "x--zygote" ]; then
50 run_args="${run_args} --zygote"
51 shift
52 elif [ "x$1" = "x--no-verify" ]; then
53 run_args="${run_args} --no-verify"
54 shift
55 elif [ "x$1" = "x--no-optimize" ]; then
56 run_args="${run_args} --no-optimize"
57 shift
58 elif [ "x$1" = "x--valgrind" ]; then
59 run_args="${run_args} --valgrind"
60 shift
61 elif [ "x$1" = "x--dev" ]; then
62 run_args="${run_args} --dev"
63 shift
64 elif [ "x$1" = "x--update" ]; then
65 run_args="${run_args} --update"
66 shift
67 elif [ "x$1" = "x--help" ]; then
68 usage="yes"
69 shift
70 elif expr "x$1" : "x--" >/dev/null 2>&1; then
Elliott Hughes7c046102011-10-19 18:16:03 -070071 echo "unknown $0 option: $1" 1>&2
jeffhao5d1ac922011-09-29 17:41:15 -070072 usage="yes"
73 break
74 else
75 break
76 fi
77done
78
79if [ "$usage" = "yes" ]; then
80 prog=`basename $prog`
81 (
82 echo "usage:"
83 echo " $prog --help Print this message."
84 echo " $prog [options] Run all tests with the given options."
85 echo " Options are all passed to run-test; refer to that for " \
86 "further documentation:"
Elliott Hughes58bcc402012-02-14 14:10:10 -080087 echo " --debug --dev --host --jvm --no-optimize --no-verify"
88 echo " -O --update --valgrind --zygote"
jeffhao5d1ac922011-09-29 17:41:15 -070089 ) 1>&2
90 exit 1
91fi
92
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -070093# start all the tests
94i=0
95for test_name in *; do
96 if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
97 ./run-test ${run_args} "$test_name" &
98 test_pids[i]=$!
99 test_names[test_pids[i]]="$test_name"
100 let i+=1
101 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700102done
103
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700104# wait for all the tests, collecting the failures
105failure_count=0
TDYa127b92bcab2012-04-08 00:09:51 -0700106succeeded_count=0
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700107failed_test_names=""
108for pid in ${test_pids[@]}; do
109 wait $pid
110 if [ "$?" != "0" ]; then
111 let failure_count+=1
TDYa127b92bcab2012-04-08 00:09:51 -0700112 failed_test_names="$failed_test_names ${test_names[$pid]}[pid=$pid]"
113 else
114 let succeeded_count+=1
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700115 fi
116done
jeffhao5d1ac922011-09-29 17:41:15 -0700117
TDYa127b92bcab2012-04-08 00:09:51 -0700118echo "succeeded tests: $succeeded_count"
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700119echo "failed tests: $failure_count"
120
121for i in $failed_test_names; do
122 echo "failed: $i"
jeffhao5d1ac922011-09-29 17:41:15 -0700123done