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