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