blob: 11ed8b94be23b2540ccb6ff561143a0110f83f3d [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
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010022# Jar containing jsr166 tests.
Alex Lightb15fea22015-09-17 16:59:09 -070023jsr166_test_jar=${OUT_DIR-out}/target/common/obj/JAVA_LIBRARIES/jsr166-tests_intermediates/javalib.jar
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010024
25# Jar containing all the other tests.
Alex Lightb15fea22015-09-17 16:59:09 -070026test_jar=${OUT_DIR-out}/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000027
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010028
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000029if [ ! -f $test_jar ]; then
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010030 echo "Before running, you must build core-tests, jsr166-tests and vogar: \
31 make core-tests jsr166-tests vogar vogar.jar"
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000032 exit 1
33fi
34
Nicolas Geoffrayf794ad72015-09-11 12:08:49 +010035emulator="no"
36if [ "$ANDROID_SERIAL" = "emulator-5554" ]; then
37 emulator="yes"
38fi
39
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000040# Packages that currently work correctly with the expectation files.
Nicolas Geoffray1f8dbf82015-06-13 13:19:16 +000041working_packages=("dalvik.system"
Brian Carlstrom4c78ffa2015-06-11 07:33:51 -070042 "libcore.icu"
David Brazdil598b2202015-02-24 10:12:06 +000043 "libcore.io"
44 "libcore.java.lang"
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000045 "libcore.java.math"
David Brazdil598b2202015-02-24 10:12:06 +000046 "libcore.java.text"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000047 "libcore.java.util"
David Brazdil4cd7dfd2015-02-24 13:33:01 +000048 "libcore.javax.crypto"
David Brazdil598b2202015-02-24 10:12:06 +000049 "libcore.javax.security"
50 "libcore.javax.sql"
51 "libcore.javax.xml"
52 "libcore.net"
53 "libcore.reflect"
54 "libcore.util"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000055 "org.apache.harmony.annotation"
David Brazdil4cd7dfd2015-02-24 13:33:01 +000056 "org.apache.harmony.crypto"
David Brazdile2f28ad2015-02-24 10:44:29 +000057 "org.apache.harmony.luni"
58 "org.apache.harmony.nio"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000059 "org.apache.harmony.regex"
David Brazdile2f28ad2015-02-24 10:44:29 +000060 "org.apache.harmony.testframework"
61 "org.apache.harmony.tests.java.io"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000062 "org.apache.harmony.tests.java.lang"
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000063 "org.apache.harmony.tests.java.math"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000064 "org.apache.harmony.tests.java.util"
David Brazdile2f28ad2015-02-24 10:44:29 +000065 "org.apache.harmony.tests.java.text"
66 "org.apache.harmony.tests.javax.security"
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010067 "tests.java.lang.String"
68 "jsr166")
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000069
Nicolas Geoffraycdcd0002015-10-31 14:47:36 +000070# List of packages we could run, but don't have rights to revert
71# changes in case of failures.
72# "org.apache.harmony.security"
73
Nicolas Geoffray9648a632015-06-15 14:35:01 +010074vogar_args=$@
75while true; do
76 if [[ "$1" == "--mode=device" ]]; then
77 vogar_args="$vogar_args --device-dir=/data/local/tmp"
78 vogar_args="$vogar_args --vm-command=/data/local/tmp/system/bin/art"
79 vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core-optimizing.art"
80 shift
81 elif [[ "$1" == "--mode=host" ]]; then
Andreas Gampe8994a042015-12-30 19:03:17 +000082 # We explicitly give a wrong path for the image, to ensure vogar
83 # will create a boot image with the default compiler. Note that
84 # giving an existing image on host does not work because of
85 # classpath/resources differences when compiling the boot image.
86 vogar_args="$vogar_args --vm-arg -Ximage:/non/existent/vogar.art"
Nicolas Geoffray9648a632015-06-15 14:35:01 +010087 shift
Nicolas Geoffray7f437912015-06-15 14:35:01 +010088 elif [[ "$1" == "--debug" ]]; then
Nicolas Geoffray9648a632015-06-15 14:35:01 +010089 # Remove the --debug from the arguments.
90 vogar_args=${vogar_args/$1}
91 vogar_args="$vogar_args --vm-arg -XXlib:libartd.so"
Nicolas Geoffray9648a632015-06-15 14:35:01 +010092 shift
93 elif [[ "$1" == "" ]]; then
94 break
95 else
96 shift
97 fi
98done
99
Nicolas Geoffray44368e82015-09-30 12:02:21 +0100100# Increase the timeout, as vogar cannot set individual test
101# timeout when being asked to run packages, and some tests go above
102# the default timeout.
103vogar_args="$vogar_args --timeout 480"
Nicolas Geoffrayf794ad72015-09-11 12:08:49 +0100104
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +0000105# Run the tests using vogar.
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +0000106echo "Running tests for the following test packages:"
107echo ${working_packages[@]} | tr " " "\n"
Nicolas Geoffraye2725c52015-10-26 18:40:41 +0000108vogar $vogar_args --vm-arg -Xusejit:true --expectations art/tools/libcore_failures.txt --classpath $jsr166_test_jar --classpath $test_jar ${working_packages[@]}