blob: 94c7c3197642a231799c21d92ea73c64aa1ed942 [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
43 elif [ "x$1" = "x--reference" ]; then
44 run_args="${run_args} --reference"
45 shift
46 elif [ "x$1" = "x--jit" ]; then
47 run_args="${run_args} --jit"
48 shift
49 elif [ "x$1" = "x--fast" ]; then
50 run_args="${run_args} --fast"
51 shift
52 elif [ "x$1" = "x--portable" ]; then
53 run_args="${run_args} --portable"
54 shift
55 elif [ "x$1" = "x--debug" ]; then
56 run_args="${run_args} --debug"
57 shift
58 elif [ "x$1" = "x--zygote" ]; then
59 run_args="${run_args} --zygote"
60 shift
61 elif [ "x$1" = "x--no-verify" ]; then
62 run_args="${run_args} --no-verify"
63 shift
64 elif [ "x$1" = "x--no-optimize" ]; then
65 run_args="${run_args} --no-optimize"
66 shift
67 elif [ "x$1" = "x--valgrind" ]; then
68 run_args="${run_args} --valgrind"
69 shift
70 elif [ "x$1" = "x--dev" ]; then
71 run_args="${run_args} --dev"
72 shift
73 elif [ "x$1" = "x--update" ]; then
74 run_args="${run_args} --update"
75 shift
76 elif [ "x$1" = "x--help" ]; then
77 usage="yes"
78 shift
79 elif expr "x$1" : "x--" >/dev/null 2>&1; then
80 echo "unknown option: $1" 1>&2
81 usage="yes"
82 break
83 else
84 break
85 fi
86done
87
88if [ "$usage" = "yes" ]; then
89 prog=`basename $prog`
90 (
91 echo "usage:"
92 echo " $prog --help Print this message."
93 echo " $prog [options] Run all tests with the given options."
94 echo " Options are all passed to run-test; refer to that for " \
95 "further documentation:"
96 echo " --debug --dev --fast --host --no-optimize --no-verify" \
97 "--portable"
98 echo " --reference --update --valgrind --zygote"
99 ) 1>&2
100 exit 1
101fi
102
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700103# start all the tests
104i=0
105for test_name in *; do
106 if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
107 ./run-test ${run_args} "$test_name" &
108 test_pids[i]=$!
109 test_names[test_pids[i]]="$test_name"
110 let i+=1
111 fi
jeffhao5d1ac922011-09-29 17:41:15 -0700112done
113
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700114# wait for all the tests, collecting the failures
115failure_count=0
116failed_test_names=""
117for pid in ${test_pids[@]}; do
118 wait $pid
119 if [ "$?" != "0" ]; then
120 let failure_count+=1
121 failed_test_names="$failed_test_names $test_names[$pid]"
122 fi
123done
jeffhao5d1ac922011-09-29 17:41:15 -0700124
Elliott Hughes8cbc8bc2011-10-04 11:19:45 -0700125echo "failed tests: $failure_count"
126
127for i in $failed_test_names; do
128 echo "failed: $i"
jeffhao5d1ac922011-09-29 17:41:15 -0700129done