Nicolas Geoffray | b2e7e24 | 2014-11-28 14:24:28 +0000 | [diff] [blame] | 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 | |
Colin Cross | d092e74 | 2017-07-27 06:03:00 +0000 | [diff] [blame] | 22 | if [ -z "$ANDROID_JAVA_TOOLCHAIN" ] ; then |
| 23 | source build/envsetup.sh |
| 24 | setpaths # include platform prebuilt java, javac, etc in $PATH. |
| 25 | fi |
Shubham Ajmera | c33c087 | 2017-07-20 18:41:52 -0700 | [diff] [blame] | 26 | |
Andreas Gampe | ebd089d | 2016-07-18 14:56:56 -0700 | [diff] [blame] | 27 | if [ -z "$ANDROID_PRODUCT_OUT" ] ; then |
| 28 | JAVA_LIBRARIES=out/target/common/obj/JAVA_LIBRARIES |
| 29 | else |
| 30 | JAVA_LIBRARIES=${ANDROID_PRODUCT_OUT}/../../common/obj/JAVA_LIBRARIES |
| 31 | fi |
| 32 | |
Colin Cross | d092e74 | 2017-07-27 06:03:00 +0000 | [diff] [blame] | 33 | using_jack=true |
| 34 | if [[ $ANDROID_COMPILE_WITH_JACK == false ]]; then |
| 35 | using_jack=false |
| 36 | fi |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 37 | |
| 38 | function classes_jar_path { |
| 39 | local var="$1" |
| 40 | local suffix="jar" |
| 41 | |
Colin Cross | d092e74 | 2017-07-27 06:03:00 +0000 | [diff] [blame] | 42 | if $using_jack; then |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 43 | suffix="jack" |
| 44 | fi |
| 45 | |
| 46 | echo "${JAVA_LIBRARIES}/${var}_intermediates/classes.${suffix}" |
| 47 | } |
| 48 | |
Tobias Thierer | b3ec089 | 2016-08-03 16:13:04 +0100 | [diff] [blame] | 49 | function cparg { |
| 50 | for var |
| 51 | do |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 52 | printf -- "--classpath $(classes_jar_path "$var") "; |
Tobias Thierer | b3ec089 | 2016-08-03 16:13:04 +0100 | [diff] [blame] | 53 | done |
| 54 | } |
Wojciech Staszkiewicz | 08cf148 | 2015-05-21 17:31:38 +0100 | [diff] [blame] | 55 | |
Tobias Thierer | b3ec089 | 2016-08-03 16:13:04 +0100 | [diff] [blame] | 56 | DEPS="core-tests jsr166-tests mockito-target" |
Wojciech Staszkiewicz | 08cf148 | 2015-05-21 17:31:38 +0100 | [diff] [blame] | 57 | |
Tobias Thierer | b3ec089 | 2016-08-03 16:13:04 +0100 | [diff] [blame] | 58 | for lib in $DEPS |
| 59 | do |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 60 | if [[ ! -f "$(classes_jar_path "$lib")" ]]; then |
Tobias Thierer | b3ec089 | 2016-08-03 16:13:04 +0100 | [diff] [blame] | 61 | echo "${lib} is missing. Before running, you must run art/tools/buildbot-build.sh" |
| 62 | exit 1 |
| 63 | fi |
| 64 | done |
Nicolas Geoffray | b2e7e24 | 2014-11-28 14:24:28 +0000 | [diff] [blame] | 65 | |
Roland Levillain | afd6f9e | 2016-01-11 15:51:00 +0000 | [diff] [blame] | 66 | expectations="--expectations art/tools/libcore_failures.txt" |
Roland Levillain | afd6f9e | 2016-01-11 15:51:00 +0000 | [diff] [blame] | 67 | |
Nicolas Geoffray | f794ad7 | 2015-09-11 12:08:49 +0100 | [diff] [blame] | 68 | emulator="no" |
| 69 | if [ "$ANDROID_SERIAL" = "emulator-5554" ]; then |
| 70 | emulator="yes" |
| 71 | fi |
| 72 | |
Roland Levillain | 5db109b | 2016-05-19 12:24:17 +0100 | [diff] [blame] | 73 | # Use JIT compiling by default. |
| 74 | use_jit=true |
| 75 | |
Nicolas Geoffray | c3837e4 | 2014-12-03 11:30:26 +0000 | [diff] [blame] | 76 | # Packages that currently work correctly with the expectation files. |
Nicolas Geoffray | 1f8dbf8 | 2015-06-13 13:19:16 +0000 | [diff] [blame] | 77 | working_packages=("dalvik.system" |
Brian Carlstrom | 4c78ffa | 2015-06-11 07:33:51 -0700 | [diff] [blame] | 78 | "libcore.icu" |
David Brazdil | 598b220 | 2015-02-24 10:12:06 +0000 | [diff] [blame] | 79 | "libcore.io" |
| 80 | "libcore.java.lang" |
Nicolas Geoffray | c3837e4 | 2014-12-03 11:30:26 +0000 | [diff] [blame] | 81 | "libcore.java.math" |
David Brazdil | 598b220 | 2015-02-24 10:12:06 +0000 | [diff] [blame] | 82 | "libcore.java.text" |
Nicolas Geoffray | 3cdf818 | 2014-12-01 10:12:15 +0000 | [diff] [blame] | 83 | "libcore.java.util" |
David Brazdil | 4cd7dfd | 2015-02-24 13:33:01 +0000 | [diff] [blame] | 84 | "libcore.javax.crypto" |
David Brazdil | 598b220 | 2015-02-24 10:12:06 +0000 | [diff] [blame] | 85 | "libcore.javax.security" |
| 86 | "libcore.javax.sql" |
| 87 | "libcore.javax.xml" |
| 88 | "libcore.net" |
| 89 | "libcore.reflect" |
| 90 | "libcore.util" |
Nicolas Geoffray | 3cdf818 | 2014-12-01 10:12:15 +0000 | [diff] [blame] | 91 | "org.apache.harmony.annotation" |
David Brazdil | 4cd7dfd | 2015-02-24 13:33:01 +0000 | [diff] [blame] | 92 | "org.apache.harmony.crypto" |
David Brazdil | e2f28ad | 2015-02-24 10:44:29 +0000 | [diff] [blame] | 93 | "org.apache.harmony.luni" |
| 94 | "org.apache.harmony.nio" |
Nicolas Geoffray | 3cdf818 | 2014-12-01 10:12:15 +0000 | [diff] [blame] | 95 | "org.apache.harmony.regex" |
David Brazdil | e2f28ad | 2015-02-24 10:44:29 +0000 | [diff] [blame] | 96 | "org.apache.harmony.testframework" |
| 97 | "org.apache.harmony.tests.java.io" |
Nicolas Geoffray | 3cdf818 | 2014-12-01 10:12:15 +0000 | [diff] [blame] | 98 | "org.apache.harmony.tests.java.lang" |
Nicolas Geoffray | c3837e4 | 2014-12-03 11:30:26 +0000 | [diff] [blame] | 99 | "org.apache.harmony.tests.java.math" |
Nicolas Geoffray | 3cdf818 | 2014-12-01 10:12:15 +0000 | [diff] [blame] | 100 | "org.apache.harmony.tests.java.util" |
David Brazdil | e2f28ad | 2015-02-24 10:44:29 +0000 | [diff] [blame] | 101 | "org.apache.harmony.tests.java.text" |
| 102 | "org.apache.harmony.tests.javax.security" |
Wojciech Staszkiewicz | 08cf148 | 2015-05-21 17:31:38 +0100 | [diff] [blame] | 103 | "tests.java.lang.String" |
| 104 | "jsr166") |
Nicolas Geoffray | b2e7e24 | 2014-11-28 14:24:28 +0000 | [diff] [blame] | 105 | |
Nicolas Geoffray | cdcd000 | 2015-10-31 14:47:36 +0000 | [diff] [blame] | 106 | # List of packages we could run, but don't have rights to revert |
| 107 | # changes in case of failures. |
| 108 | # "org.apache.harmony.security" |
| 109 | |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 110 | vogar_args=$@ |
Nicolas Geoffray | 622e2e2 | 2017-06-15 09:33:01 +0100 | [diff] [blame] | 111 | gcstress=false |
| 112 | debug=false |
| 113 | |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 114 | while true; do |
| 115 | if [[ "$1" == "--mode=device" ]]; then |
| 116 | vogar_args="$vogar_args --device-dir=/data/local/tmp" |
| 117 | vogar_args="$vogar_args --vm-command=/data/local/tmp/system/bin/art" |
Nicolas Geoffray | b76bc78 | 2016-09-14 12:33:34 +0000 | [diff] [blame] | 118 | vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core.art" |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 119 | shift |
| 120 | elif [[ "$1" == "--mode=host" ]]; then |
Andreas Gampe | 8994a04 | 2015-12-30 19:03:17 +0000 | [diff] [blame] | 121 | # We explicitly give a wrong path for the image, to ensure vogar |
| 122 | # will create a boot image with the default compiler. Note that |
| 123 | # giving an existing image on host does not work because of |
| 124 | # classpath/resources differences when compiling the boot image. |
| 125 | vogar_args="$vogar_args --vm-arg -Ximage:/non/existent/vogar.art" |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 126 | shift |
Roland Levillain | 5db109b | 2016-05-19 12:24:17 +0100 | [diff] [blame] | 127 | elif [[ "$1" == "--no-jit" ]]; then |
| 128 | # Remove the --no-jit from the arguments. |
| 129 | vogar_args=${vogar_args/$1} |
| 130 | use_jit=false |
| 131 | shift |
Nicolas Geoffray | 7f43791 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 132 | elif [[ "$1" == "--debug" ]]; then |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 133 | # Remove the --debug from the arguments. |
| 134 | vogar_args=${vogar_args/$1} |
Andreas Gampe | 1c5b42f | 2017-06-15 18:20:45 -0700 | [diff] [blame] | 135 | vogar_args="$vogar_args --vm-arg -XXlib:libartd.so --vm-arg -XX:SlowDebug=true" |
Nicolas Geoffray | 622e2e2 | 2017-06-15 09:33:01 +0100 | [diff] [blame] | 136 | debug=true |
| 137 | shift |
| 138 | elif [[ "$1" == "-Xgc:gcstress" ]]; then |
| 139 | gcstress=true |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 140 | shift |
| 141 | elif [[ "$1" == "" ]]; then |
| 142 | break |
| 143 | else |
| 144 | shift |
| 145 | fi |
| 146 | done |
| 147 | |
Nicolas Geoffray | 44368e8 | 2015-09-30 12:02:21 +0100 | [diff] [blame] | 148 | # Increase the timeout, as vogar cannot set individual test |
| 149 | # timeout when being asked to run packages, and some tests go above |
| 150 | # the default timeout. |
| 151 | vogar_args="$vogar_args --timeout 480" |
Nicolas Geoffray | f794ad7 | 2015-09-11 12:08:49 +0100 | [diff] [blame] | 152 | |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 153 | # Switch between using jack or javac+desugar+dx |
Colin Cross | d092e74 | 2017-07-27 06:03:00 +0000 | [diff] [blame] | 154 | if $using_jack; then |
Igor Murashkin | 84f2632 | 2017-06-06 11:36:33 -0700 | [diff] [blame] | 155 | vogar_args="$vogar_args --toolchain jack --language JO" |
| 156 | else |
| 157 | vogar_args="$vogar_args --toolchain jdk --language CUR" |
| 158 | fi |
Neil Fuller | b8300fc | 2016-02-10 13:09:10 +0000 | [diff] [blame] | 159 | |
Roland Levillain | 5db109b | 2016-05-19 12:24:17 +0100 | [diff] [blame] | 160 | # JIT settings. |
| 161 | if $use_jit; then |
Nicolas Geoffray | 49cda06 | 2017-04-21 13:08:25 +0100 | [diff] [blame] | 162 | vogar_args="$vogar_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken" |
Roland Levillain | 5db109b | 2016-05-19 12:24:17 +0100 | [diff] [blame] | 163 | fi |
| 164 | vogar_args="$vogar_args --vm-arg -Xusejit:$use_jit" |
| 165 | |
Nicolas Geoffray | 5b455d3 | 2017-07-05 10:51:06 +0100 | [diff] [blame] | 166 | # gcstress may lead to timeouts, so we need dedicated expectations files for it. |
| 167 | if [[ $gcstress ]]; then |
| 168 | expectations="$expectations --expectations art/tools/libcore_gcstress_failures.txt" |
| 169 | if [[ $debug ]]; then |
| 170 | expectations="$expectations --expectations art/tools/libcore_gcstress_debug_failures.txt" |
| 171 | fi |
Nicolas Geoffray | 622e2e2 | 2017-06-15 09:33:01 +0100 | [diff] [blame] | 172 | fi |
| 173 | |
Nicolas Geoffray | b2e7e24 | 2014-11-28 14:24:28 +0000 | [diff] [blame] | 174 | # Run the tests using vogar. |
Nicolas Geoffray | 3cdf818 | 2014-12-01 10:12:15 +0000 | [diff] [blame] | 175 | echo "Running tests for the following test packages:" |
| 176 | echo ${working_packages[@]} | tr " " "\n" |
Tobias Thierer | b3ec089 | 2016-08-03 16:13:04 +0100 | [diff] [blame] | 177 | vogar $vogar_args $expectations $(cparg $DEPS) ${working_packages[@]} |