blob: 26b5c0a09bdaa20e39ae550158a15fd112d2c2ad [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
Colin Crosse0ef0a82017-07-27 21:29:18 +000022source build/envsetup.sh >&/dev/null # for get_build_var, setpaths
23setpaths # include platform prebuilt java, javac, etc in $PATH.
Shubham Ajmerac33c0872017-07-20 18:41:52 -070024
Andreas Gampeebd089d2016-07-18 14:56:56 -070025if [ -z "$ANDROID_PRODUCT_OUT" ] ; then
26 JAVA_LIBRARIES=out/target/common/obj/JAVA_LIBRARIES
27else
28 JAVA_LIBRARIES=${ANDROID_PRODUCT_OUT}/../../common/obj/JAVA_LIBRARIES
29fi
30
Roland Levillain1c361882018-03-02 14:23:51 +000031android_root="/system"
32if [ -n "$ART_TEST_ANDROID_ROOT" ]; then
33 android_root="$ART_TEST_ANDROID_ROOT"
34fi
35
Igor Murashkin84f26322017-06-06 11:36:33 -070036function classes_jar_path {
37 local var="$1"
38 local suffix="jar"
39
Igor Murashkin84f26322017-06-06 11:36:33 -070040 echo "${JAVA_LIBRARIES}/${var}_intermediates/classes.${suffix}"
41}
42
Tobias Thiererb3ec0892016-08-03 16:13:04 +010043function cparg {
44 for var
45 do
Igor Murashkin84f26322017-06-06 11:36:33 -070046 printf -- "--classpath $(classes_jar_path "$var") ";
Tobias Thiererb3ec0892016-08-03 16:13:04 +010047 done
48}
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010049
Tobias Thiererb3ec0892016-08-03 16:13:04 +010050DEPS="core-tests jsr166-tests mockito-target"
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010051
Tobias Thiererb3ec0892016-08-03 16:13:04 +010052for lib in $DEPS
53do
Igor Murashkin84f26322017-06-06 11:36:33 -070054 if [[ ! -f "$(classes_jar_path "$lib")" ]]; then
Tobias Thiererb3ec0892016-08-03 16:13:04 +010055 echo "${lib} is missing. Before running, you must run art/tools/buildbot-build.sh"
56 exit 1
57 fi
58done
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000059
Roland Levillainafd6f9e2016-01-11 15:51:00 +000060expectations="--expectations art/tools/libcore_failures.txt"
Roland Levillainafd6f9e2016-01-11 15:51:00 +000061
Nicolas Geoffrayf794ad72015-09-11 12:08:49 +010062emulator="no"
63if [ "$ANDROID_SERIAL" = "emulator-5554" ]; then
64 emulator="yes"
65fi
66
Roland Levillain5db109b2016-05-19 12:24:17 +010067# Use JIT compiling by default.
68use_jit=true
69
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000070# Packages that currently work correctly with the expectation files.
Andreas Gampee1661362017-11-08 16:42:14 -080071working_packages=("libcore.dalvik.system"
David Brazdil598b2202015-02-24 10:12:06 +000072 "libcore.java.lang"
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000073 "libcore.java.math"
David Brazdil598b2202015-02-24 10:12:06 +000074 "libcore.java.text"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000075 "libcore.java.util"
David Brazdil4cd7dfd2015-02-24 13:33:01 +000076 "libcore.javax.crypto"
David Brazdil598b2202015-02-24 10:12:06 +000077 "libcore.javax.security"
78 "libcore.javax.sql"
79 "libcore.javax.xml"
Andreas Gampee1661362017-11-08 16:42:14 -080080 "libcore.libcore.io"
81 "libcore.libcore.net"
82 "libcore.libcore.reflect"
83 "libcore.libcore.util"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000084 "org.apache.harmony.annotation"
David Brazdil4cd7dfd2015-02-24 13:33:01 +000085 "org.apache.harmony.crypto"
David Brazdile2f28ad2015-02-24 10:44:29 +000086 "org.apache.harmony.luni"
87 "org.apache.harmony.nio"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000088 "org.apache.harmony.regex"
David Brazdile2f28ad2015-02-24 10:44:29 +000089 "org.apache.harmony.testframework"
90 "org.apache.harmony.tests.java.io"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000091 "org.apache.harmony.tests.java.lang"
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000092 "org.apache.harmony.tests.java.math"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000093 "org.apache.harmony.tests.java.util"
David Brazdile2f28ad2015-02-24 10:44:29 +000094 "org.apache.harmony.tests.java.text"
95 "org.apache.harmony.tests.javax.security"
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010096 "tests.java.lang.String"
97 "jsr166")
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000098
Nicolas Geoffraycdcd0002015-10-31 14:47:36 +000099# List of packages we could run, but don't have rights to revert
100# changes in case of failures.
101# "org.apache.harmony.security"
102
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100103vogar_args=$@
Nicolas Geoffray622e2e22017-06-15 09:33:01 +0100104gcstress=false
105debug=false
106
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100107while true; do
108 if [[ "$1" == "--mode=device" ]]; then
109 vogar_args="$vogar_args --device-dir=/data/local/tmp"
Roland Levillain1c361882018-03-02 14:23:51 +0000110 vogar_args="$vogar_args --vm-command=$android_root/bin/art"
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000111 vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core.art"
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100112 shift
113 elif [[ "$1" == "--mode=host" ]]; then
Andreas Gampe8994a042015-12-30 19:03:17 +0000114 # We explicitly give a wrong path for the image, to ensure vogar
115 # will create a boot image with the default compiler. Note that
116 # giving an existing image on host does not work because of
117 # classpath/resources differences when compiling the boot image.
118 vogar_args="$vogar_args --vm-arg -Ximage:/non/existent/vogar.art"
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100119 shift
Roland Levillain5db109b2016-05-19 12:24:17 +0100120 elif [[ "$1" == "--no-jit" ]]; then
121 # Remove the --no-jit from the arguments.
122 vogar_args=${vogar_args/$1}
123 use_jit=false
124 shift
Nicolas Geoffray7f437912015-06-15 14:35:01 +0100125 elif [[ "$1" == "--debug" ]]; then
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100126 # Remove the --debug from the arguments.
127 vogar_args=${vogar_args/$1}
Andreas Gampe1c5b42f2017-06-15 18:20:45 -0700128 vogar_args="$vogar_args --vm-arg -XXlib:libartd.so --vm-arg -XX:SlowDebug=true"
Nicolas Geoffray622e2e22017-06-15 09:33:01 +0100129 debug=true
130 shift
131 elif [[ "$1" == "-Xgc:gcstress" ]]; then
132 gcstress=true
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100133 shift
134 elif [[ "$1" == "" ]]; then
135 break
136 else
137 shift
138 fi
139done
140
Nicolas Geoffray44368e82015-09-30 12:02:21 +0100141# Increase the timeout, as vogar cannot set individual test
142# timeout when being asked to run packages, and some tests go above
143# the default timeout.
144vogar_args="$vogar_args --timeout 480"
Nicolas Geoffrayf794ad72015-09-11 12:08:49 +0100145
Neil Fuller239bdf62018-01-08 18:55:36 +0000146# set the toolchain to use.
147vogar_args="$vogar_args --toolchain d8 --language CUR"
Neil Fullerb8300fc2016-02-10 13:09:10 +0000148
Roland Levillain5db109b2016-05-19 12:24:17 +0100149# JIT settings.
150if $use_jit; then
Nicolas Geoffray49cda062017-04-21 13:08:25 +0100151 vogar_args="$vogar_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken"
Roland Levillain5db109b2016-05-19 12:24:17 +0100152fi
153vogar_args="$vogar_args --vm-arg -Xusejit:$use_jit"
154
Nicolas Geoffray5b455d32017-07-05 10:51:06 +0100155# gcstress may lead to timeouts, so we need dedicated expectations files for it.
Nicolas Geoffraya6555752018-05-02 10:39:09 +0100156if $gcstress; then
Nicolas Geoffray5b455d32017-07-05 10:51:06 +0100157 expectations="$expectations --expectations art/tools/libcore_gcstress_failures.txt"
Nicolas Geoffraya6555752018-05-02 10:39:09 +0100158 if $debug; then
Nicolas Geoffray5b455d32017-07-05 10:51:06 +0100159 expectations="$expectations --expectations art/tools/libcore_gcstress_debug_failures.txt"
160 fi
Nicolas Geoffraya6555752018-05-02 10:39:09 +0100161else
162 # We only run this package when not under gcstress as it can cause timeouts. See b/78228743.
163 working_packages+=("libcore.libcore.icu")
Nicolas Geoffray622e2e22017-06-15 09:33:01 +0100164fi
165
Roland Levillain3840b342018-03-29 19:36:12 +0100166# Disable network-related libcore tests that are failing on the following
167# devices running Android O, as a workaround for b/74725685:
168# - FA7BN1A04406 (walleye device testing configuration aosp-poison/volantis-armv7-poison-debug)
169# - FA7BN1A04412 (walleye device testing configuration aosp-poison/volantis-armv8-poison-ndebug)
170# - FA7BN1A04433 (walleye device testing configuration aosp-poison/volantis-armv8-poison-debug)
171case "$ANDROID_SERIAL" in
172 (FA7BN1A04406|FA7BN1A04412|FA7BN1A04433)
173 expectations="$expectations --expectations art/tools/libcore_network_failures.txt";;
174esac
175
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +0000176# Run the tests using vogar.
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +0000177echo "Running tests for the following test packages:"
178echo ${working_packages[@]} | tr " " "\n"
Nicolas Geoffray58985372017-11-09 14:38:02 +0000179vogar $vogar_args $expectations $(cparg $DEPS) ${working_packages[@]}