Nicolas Geoffray | b2e7e24 | 2014-11-28 14:24:28 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2014 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 | if [ ! -d libcore ]; then |
| 18 | echo "Script needs to be run at the root of the android tree" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | # Jar containing all the tests. |
| 23 | test_jar=out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar |
| 24 | |
| 25 | if [ ! -f $test_jar ]; then |
| 26 | echo "Before running, you must build core-tests and vogar: make core-tests vogar vogar.jar" |
| 27 | exit 1 |
| 28 | fi |
| 29 | |
| 30 | # Packages that currently report no failures. |
| 31 | working_packages=("java/lang" |
| 32 | "java/math" |
| 33 | "java/util") |
| 34 | |
| 35 | # Create a regexp suitable for egrep. |
| 36 | working_packages=$(printf "|%s" "${working_packages[@]}") |
| 37 | working_packages=${working_packages:1} |
| 38 | |
| 39 | # Get all the tests for these packages. |
| 40 | test_packages=$(find libcore/*/src/test -name "*.java" | \ |
| 41 | egrep -E $working_packages | \ |
| 42 | xargs grep -h '^package ' | sed 's/^package //' | sed 's/;$//' | sort | uniq | tr "\n" " ") |
| 43 | |
| 44 | # Run the tests using vogar. |
| 45 | echo "Running tests for following test packages:" |
| 46 | echo $test_packages | tr " " "\n" |
| 47 | vogar $@ --classpath $test_jar $test_packages |