blob: 0e52444f81d41a4dc25ae4aeafd8a36d57bdfa43 [file] [log] [blame]
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +00001#!/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
17if [ ! -d libcore ]; then
18 echo "Script needs to be run at the root of the android tree"
19 exit 1
20fi
21
22# Jar containing all the tests.
23test_jar=out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
24
25if [ ! -f $test_jar ]; then
26 echo "Before running, you must build core-tests and vogar: make core-tests vogar vogar.jar"
27 exit 1
28fi
29
30# Packages that currently report no failures.
31working_packages=("java/lang"
32 "java/math"
33 "java/util")
34
35# Create a regexp suitable for egrep.
36working_packages=$(printf "|%s" "${working_packages[@]}")
37working_packages=${working_packages:1}
38
39# Get all the tests for these packages.
40test_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.
45echo "Running tests for following test packages:"
46echo $test_packages | tr " " "\n"
47vogar $@ --classpath $test_jar $test_packages