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 17if [ ! -d libcore ]; then 18 echo "Script needs to be run at the root of the android tree" 19 exit 1 20fi 21 22if [ -z "$ANDROID_PRODUCT_OUT" ] ; then 23 JAVA_LIBRARIES=out/target/common/obj/JAVA_LIBRARIES 24else 25 JAVA_LIBRARIES=${ANDROID_PRODUCT_OUT}/../../common/obj/JAVA_LIBRARIES 26fi 27 28function cparg { 29 for var 30 do 31 printf -- "--classpath ${JAVA_LIBRARIES}/${var}_intermediates/classes.jack "; 32 done 33} 34 35DEPS="core-tests jsr166-tests mockito-target" 36 37for lib in $DEPS 38do 39 if [ ! -f "${JAVA_LIBRARIES}/${lib}_intermediates/classes.jack" ]; then 40 echo "${lib} is missing. Before running, you must run art/tools/buildbot-build.sh" 41 exit 1 42 fi 43done 44 45expectations="--expectations art/tools/libcore_failures.txt" 46 47emulator="no" 48if [ "$ANDROID_SERIAL" = "emulator-5554" ]; then 49 emulator="yes" 50fi 51 52# Use JIT compiling by default. 53use_jit=true 54 55# Packages that currently work correctly with the expectation files. 56working_packages=("dalvik.system" 57 "libcore.icu" 58 "libcore.io" 59 "libcore.java.lang" 60 "libcore.java.math" 61 "libcore.java.text" 62 "libcore.java.util" 63 "libcore.javax.crypto" 64 "libcore.javax.security" 65 "libcore.javax.sql" 66 "libcore.javax.xml" 67 "libcore.net" 68 "libcore.reflect" 69 "libcore.util" 70 "org.apache.harmony.annotation" 71 "org.apache.harmony.crypto" 72 "org.apache.harmony.luni" 73 "org.apache.harmony.nio" 74 "org.apache.harmony.regex" 75 "org.apache.harmony.testframework" 76 "org.apache.harmony.tests.java.io" 77 "org.apache.harmony.tests.java.lang" 78 "org.apache.harmony.tests.java.math" 79 "org.apache.harmony.tests.java.util" 80 "org.apache.harmony.tests.java.text" 81 "org.apache.harmony.tests.javax.security" 82 "tests.java.lang.String" 83 "jsr166") 84 85# List of packages we could run, but don't have rights to revert 86# changes in case of failures. 87# "org.apache.harmony.security" 88 89vogar_args=$@ 90while true; do 91 if [[ "$1" == "--mode=device" ]]; then 92 vogar_args="$vogar_args --device-dir=/data/local/tmp" 93 vogar_args="$vogar_args --vm-command=/data/local/tmp/system/bin/art" 94 vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core.art" 95 shift 96 elif [[ "$1" == "--mode=host" ]]; then 97 # We explicitly give a wrong path for the image, to ensure vogar 98 # will create a boot image with the default compiler. Note that 99 # giving an existing image on host does not work because of 100 # classpath/resources differences when compiling the boot image. 101 vogar_args="$vogar_args --vm-arg -Ximage:/non/existent/vogar.art" 102 shift 103 elif [[ "$1" == "--no-jit" ]]; then 104 # Remove the --no-jit from the arguments. 105 vogar_args=${vogar_args/$1} 106 use_jit=false 107 shift 108 elif [[ "$1" == "--debug" ]]; then 109 # Remove the --debug from the arguments. 110 vogar_args=${vogar_args/$1} 111 vogar_args="$vogar_args --vm-arg -XXlib:libartd.so" 112 shift 113 elif [[ "$1" == "" ]]; then 114 break 115 else 116 shift 117 fi 118done 119 120# Increase the timeout, as vogar cannot set individual test 121# timeout when being asked to run packages, and some tests go above 122# the default timeout. 123vogar_args="$vogar_args --timeout 480" 124 125# Use Jack with "1.8" configuration. 126vogar_args="$vogar_args --toolchain jack --language JO" 127 128# JIT settings. 129if $use_jit; then 130 vogar_args="$vogar_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken" 131fi 132vogar_args="$vogar_args --vm-arg -Xusejit:$use_jit" 133 134# Run the tests using vogar. 135echo "Running tests for the following test packages:" 136echo ${working_packages[@]} | tr " " "\n" 137vogar $vogar_args $expectations $(cparg $DEPS) ${working_packages[@]} 138