blob: 6e123ce7e48650b8ab442505099c1defdb74bafb [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
Nicolas Geoffrayb1cde6a2017-02-13 20:55:27 +000017# Exit as a stop-gap measure for b/35308152.
18exit 0
19
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000020if [ ! -d libcore ]; then
21 echo "Script needs to be run at the root of the android tree"
22 exit 1
23fi
24
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
Tobias Thiererb3ec0892016-08-03 16:13:04 +010031function cparg {
32 for var
33 do
34 printf -- "--classpath ${JAVA_LIBRARIES}/${var}_intermediates/classes.jack ";
35 done
36}
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010037
Tobias Thiererb3ec0892016-08-03 16:13:04 +010038DEPS="core-tests jsr166-tests mockito-target"
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010039
Tobias Thiererb3ec0892016-08-03 16:13:04 +010040for lib in $DEPS
41do
42 if [ ! -f "${JAVA_LIBRARIES}/${lib}_intermediates/classes.jack" ]; then
43 echo "${lib} is missing. Before running, you must run art/tools/buildbot-build.sh"
44 exit 1
45 fi
46done
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000047
Roland Levillainafd6f9e2016-01-11 15:51:00 +000048expectations="--expectations art/tools/libcore_failures.txt"
Roland Levillainafd6f9e2016-01-11 15:51:00 +000049
Nicolas Geoffrayf794ad72015-09-11 12:08:49 +010050emulator="no"
51if [ "$ANDROID_SERIAL" = "emulator-5554" ]; then
52 emulator="yes"
53fi
54
Roland Levillain5db109b2016-05-19 12:24:17 +010055# Use JIT compiling by default.
56use_jit=true
57
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000058# Packages that currently work correctly with the expectation files.
Nicolas Geoffray1f8dbf82015-06-13 13:19:16 +000059working_packages=("dalvik.system"
Brian Carlstrom4c78ffa2015-06-11 07:33:51 -070060 "libcore.icu"
David Brazdil598b2202015-02-24 10:12:06 +000061 "libcore.io"
62 "libcore.java.lang"
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000063 "libcore.java.math"
David Brazdil598b2202015-02-24 10:12:06 +000064 "libcore.java.text"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000065 "libcore.java.util"
David Brazdil4cd7dfd2015-02-24 13:33:01 +000066 "libcore.javax.crypto"
David Brazdil598b2202015-02-24 10:12:06 +000067 "libcore.javax.security"
68 "libcore.javax.sql"
69 "libcore.javax.xml"
70 "libcore.net"
71 "libcore.reflect"
72 "libcore.util"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000073 "org.apache.harmony.annotation"
David Brazdil4cd7dfd2015-02-24 13:33:01 +000074 "org.apache.harmony.crypto"
David Brazdile2f28ad2015-02-24 10:44:29 +000075 "org.apache.harmony.luni"
76 "org.apache.harmony.nio"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000077 "org.apache.harmony.regex"
David Brazdile2f28ad2015-02-24 10:44:29 +000078 "org.apache.harmony.testframework"
79 "org.apache.harmony.tests.java.io"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000080 "org.apache.harmony.tests.java.lang"
Nicolas Geoffrayc3837e42014-12-03 11:30:26 +000081 "org.apache.harmony.tests.java.math"
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +000082 "org.apache.harmony.tests.java.util"
David Brazdile2f28ad2015-02-24 10:44:29 +000083 "org.apache.harmony.tests.java.text"
84 "org.apache.harmony.tests.javax.security"
Wojciech Staszkiewicz08cf1482015-05-21 17:31:38 +010085 "tests.java.lang.String"
86 "jsr166")
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +000087
Nicolas Geoffraycdcd0002015-10-31 14:47:36 +000088# List of packages we could run, but don't have rights to revert
89# changes in case of failures.
90# "org.apache.harmony.security"
91
Nicolas Geoffray9648a632015-06-15 14:35:01 +010092vogar_args=$@
93while true; do
94 if [[ "$1" == "--mode=device" ]]; then
95 vogar_args="$vogar_args --device-dir=/data/local/tmp"
96 vogar_args="$vogar_args --vm-command=/data/local/tmp/system/bin/art"
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +000097 vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core.art"
Nicolas Geoffray9648a632015-06-15 14:35:01 +010098 shift
99 elif [[ "$1" == "--mode=host" ]]; then
Andreas Gampe8994a042015-12-30 19:03:17 +0000100 # We explicitly give a wrong path for the image, to ensure vogar
101 # will create a boot image with the default compiler. Note that
102 # giving an existing image on host does not work because of
103 # classpath/resources differences when compiling the boot image.
104 vogar_args="$vogar_args --vm-arg -Ximage:/non/existent/vogar.art"
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100105 shift
Roland Levillain5db109b2016-05-19 12:24:17 +0100106 elif [[ "$1" == "--no-jit" ]]; then
107 # Remove the --no-jit from the arguments.
108 vogar_args=${vogar_args/$1}
109 use_jit=false
110 shift
Nicolas Geoffray7f437912015-06-15 14:35:01 +0100111 elif [[ "$1" == "--debug" ]]; then
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100112 # Remove the --debug from the arguments.
113 vogar_args=${vogar_args/$1}
114 vogar_args="$vogar_args --vm-arg -XXlib:libartd.so"
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100115 shift
116 elif [[ "$1" == "" ]]; then
117 break
118 else
119 shift
120 fi
121done
122
Nicolas Geoffray44368e82015-09-30 12:02:21 +0100123# Increase the timeout, as vogar cannot set individual test
124# timeout when being asked to run packages, and some tests go above
125# the default timeout.
126vogar_args="$vogar_args --timeout 480"
Nicolas Geoffrayf794ad72015-09-11 12:08:49 +0100127
Neil Fullerb8300fc2016-02-10 13:09:10 +0000128# Use Jack with "1.8" configuration.
Nicolas Geoffray9b573312017-02-10 12:33:45 +0000129vogar_args="$vogar_args --toolchain jack --language JO"
Neil Fullerb8300fc2016-02-10 13:09:10 +0000130
Roland Levillain5db109b2016-05-19 12:24:17 +0100131# JIT settings.
132if $use_jit; then
133 vogar_args="$vogar_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=interpret-only"
134fi
135vogar_args="$vogar_args --vm-arg -Xusejit:$use_jit"
136
Nicolas Geoffrayb2e7e242014-11-28 14:24:28 +0000137# Run the tests using vogar.
Nicolas Geoffray3cdf8182014-12-01 10:12:15 +0000138echo "Running tests for the following test packages:"
139echo ${working_packages[@]} | tr " " "\n"
Tobias Thiererb3ec0892016-08-03 16:13:04 +0100140vogar $vogar_args $expectations $(cparg $DEPS) ${working_packages[@]}