The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame^] | 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. |
| 19 | prog="$0" |
| 20 | while [ -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 |
| 29 | done |
| 30 | oldwd=`pwd` |
| 31 | progdir=`dirname "${prog}"` |
| 32 | cd "${progdir}" |
| 33 | progdir=`pwd` |
| 34 | prog="${progdir}"/`basename "${prog}"` |
| 35 | |
| 36 | run_args="" |
| 37 | usage="no" |
| 38 | |
| 39 | while true; do |
| 40 | if [ "x$1" = "x--local" ]; then |
| 41 | run_args="${run_args} --local" |
| 42 | shift |
| 43 | elif [ "x$1" = "x--reference" ]; then |
| 44 | run_args="${run_args} --reference" |
| 45 | shift |
| 46 | elif [ "x$1" = "x--fast" ]; then |
| 47 | run_args="${run_args} --fast" |
| 48 | shift |
| 49 | elif [ "x$1" = "x--portable" ]; then |
| 50 | run_args="${run_args} --portable" |
| 51 | shift |
| 52 | elif [ "x$1" = "x--debug" ]; then |
| 53 | run_args="${run_args} --debug" |
| 54 | shift |
| 55 | elif [ "x$1" = "x--zygote" ]; then |
| 56 | run_args="${run_args} --zygote" |
| 57 | shift |
| 58 | elif [ "x$1" = "x--no-verify" ]; then |
| 59 | run_args="${run_args} --no-verify" |
| 60 | shift |
| 61 | elif [ "x$1" = "x--no-optimize" ]; then |
| 62 | run_args="${run_args} --no-optimize" |
| 63 | shift |
| 64 | elif [ "x$1" = "x--valgrind" ]; then |
| 65 | run_args="${run_args} --valgrind" |
| 66 | shift |
| 67 | elif [ "x$1" = "x--dev" ]; then |
| 68 | run_args="${run_args} --dev" |
| 69 | shift |
| 70 | elif [ "x$1" = "x--update" ]; then |
| 71 | run_args="${run_args} --update" |
| 72 | shift |
| 73 | elif [ "x$1" = "x--help" ]; then |
| 74 | usage="yes" |
| 75 | shift |
| 76 | elif expr "x$1" : "x--" >/dev/null 2>&1; then |
| 77 | echo "unknown option: $1" 1>&2 |
| 78 | usage="yes" |
| 79 | break |
| 80 | else |
| 81 | break |
| 82 | fi |
| 83 | done |
| 84 | |
| 85 | if [ "$usage" = "yes" ]; then |
| 86 | prog=`basename $prog` |
| 87 | ( |
| 88 | echo "usage:" |
| 89 | echo " $prog --help Print this message." |
| 90 | echo " $prog [options] Run all tests with the given options." |
| 91 | echo " Options are all passed to run-test; refer to that for " \ |
| 92 | "further documentation:" |
| 93 | echo " --debug --dev --fast --local --no-optimize --no-verify" \ |
| 94 | "--portable" |
| 95 | echo " --reference --update --valgrind --zygote" |
| 96 | ) 1>&2 |
| 97 | exit 1 |
| 98 | fi |
| 99 | |
| 100 | passed=0 |
| 101 | failed=0 |
| 102 | failNames="" |
| 103 | |
| 104 | for i in *; do |
| 105 | if [ -d "$i" -a -r "$i" -a -r "${i}/info.txt" ]; then |
| 106 | ./run-test ${run_args} "$i" |
| 107 | if [ "$?" = "0" ]; then |
| 108 | ((passed += 1)) |
| 109 | else |
| 110 | ((failed += 1)) |
| 111 | failNames="$failNames $i" |
| 112 | fi |
| 113 | fi |
| 114 | done |
| 115 | |
| 116 | echo "passed: $passed test(s)" |
| 117 | echo "failed: $failed test(s)" |
| 118 | |
| 119 | for i in $failNames; do |
| 120 | echo "failed: $i" |
| 121 | done |
| 122 | |