David Srbecky | 854725b | 2021-04-27 19:30:41 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | # |
| 3 | # [VPYTHON:BEGIN] |
| 4 | # python_version: "3.8" |
| 5 | # [VPYTHON:END] |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 6 | # |
| 7 | # Copyright (C) 2021 The Android Open Source Project |
| 8 | # |
| 9 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | # you may not use this file except in compliance with the License. |
| 11 | # You may obtain a copy of the License at |
| 12 | # |
| 13 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | # |
| 15 | # Unless required by applicable law or agreed to in writing, software |
| 16 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | # See the License for the specific language governing permissions and |
| 19 | # limitations under the License. |
| 20 | |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 21 | import sys, os, argparse, subprocess, shlex, re, concurrent.futures, multiprocessing |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 22 | |
| 23 | def parse_args(): |
| 24 | parser = argparse.ArgumentParser(description="Run libcore tests using the vogar testing tool.") |
| 25 | parser.add_argument('--mode', choices=['device', 'host', 'jvm'], required=True, |
| 26 | help='Specify where tests should be run.') |
| 27 | parser.add_argument('--variant', choices=['X32', 'X64'], |
| 28 | help='Which dalvikvm variant to execute with.') |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 29 | parser.add_argument('-j', '--jobs', type=int, |
| 30 | help='Number of tests to run simultaneously.') |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 31 | parser.add_argument('--timeout', type=int, |
| 32 | help='How long to run the test before aborting (seconds).') |
| 33 | parser.add_argument('--debug', action='store_true', |
| 34 | help='Use debug version of ART (device|host only).') |
| 35 | parser.add_argument('--dry-run', action='store_true', |
| 36 | help='Print vogar command-line, but do not run.') |
| 37 | parser.add_argument('--no-getrandom', action='store_false', dest='getrandom', |
| 38 | help='Ignore failures from getrandom() (for kernel < 3.17).') |
| 39 | parser.add_argument('--no-jit', action='store_false', dest='jit', |
| 40 | help='Disable JIT (device|host only).') |
| 41 | parser.add_argument('--gcstress', action='store_true', |
| 42 | help='Enable GC stress configuration (device|host only).') |
| 43 | parser.add_argument('tests', nargs="*", |
| 44 | help='Name(s) of the test(s) to run') |
Orion Hodson | 77aa45d | 2022-10-14 16:11:56 +0100 | [diff] [blame] | 45 | parser.add_argument('--verbose', action='store_true', help='Print verbose output from vogar.') |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 46 | return parser.parse_args() |
| 47 | |
| 48 | ART_TEST_ANDROID_ROOT = os.environ.get("ART_TEST_ANDROID_ROOT", "/system") |
| 49 | ART_TEST_CHROOT = os.environ.get("ART_TEST_CHROOT") |
| 50 | ANDROID_PRODUCT_OUT = os.environ.get("ANDROID_PRODUCT_OUT") |
| 51 | |
| 52 | LIBCORE_TEST_NAMES = [ |
Nikita Iashchenko | 2eebc53 | 2022-04-07 15:09:33 +0100 | [diff] [blame] | 53 | ### luni tests. ### |
Santiago Aboy Solanes | 6a1d9b9 | 2022-04-06 08:28:51 +0000 | [diff] [blame] | 54 | # Naive critical path optimization: Run the longest tests first. |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 55 | "org.apache.harmony.tests.java.util", # 90min under gcstress |
| 56 | "libcore.java.lang", # 90min under gcstress |
| 57 | "jsr166", # 60min under gcstress |
| 58 | "libcore.java.util", # 60min under gcstress |
| 59 | "libcore.java.math", # 50min under gcstress |
| 60 | "org.apache.harmony.crypto", # 30min under gcstress |
| 61 | "org.apache.harmony.tests.java.io", # 30min under gcstress |
| 62 | "org.apache.harmony.tests.java.text", # 30min under gcstress |
Santiago Aboy Solanes | 6a1d9b9 | 2022-04-06 08:28:51 +0000 | [diff] [blame] | 63 | # Split highmemorytest to individual classes since it is too big. |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 64 | "libcore.highmemorytest.java.text.DateFormatTest", |
| 65 | "libcore.highmemorytest.java.text.DecimalFormatTest", |
| 66 | "libcore.highmemorytest.java.text.SimpleDateFormatTest", |
| 67 | "libcore.highmemorytest.java.time.format.DateTimeFormatterTest", |
| 68 | "libcore.highmemorytest.java.util.CalendarTest", |
| 69 | "libcore.highmemorytest.java.util.CurrencyTest", |
Victor Chang | ae7335e | 2022-02-09 10:59:42 +0000 | [diff] [blame] | 70 | "libcore.highmemorytest.libcore.icu.SimpleDateFormatDataTest", |
Nikita Iashchenko | 2eebc53 | 2022-04-07 15:09:33 +0100 | [diff] [blame] | 71 | # All other luni tests in alphabetical order. |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 72 | "libcore.android.system", |
| 73 | "libcore.build", |
| 74 | "libcore.dalvik.system", |
| 75 | "libcore.java.awt", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 76 | "libcore.java.text", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 77 | "libcore.javax.crypto", |
| 78 | "libcore.javax.net", |
| 79 | "libcore.javax.security", |
| 80 | "libcore.javax.sql", |
| 81 | "libcore.javax.xml", |
| 82 | "libcore.libcore.icu", |
| 83 | "libcore.libcore.internal", |
| 84 | "libcore.libcore.io", |
| 85 | "libcore.libcore.net", |
| 86 | "libcore.libcore.reflect", |
| 87 | "libcore.libcore.util", |
| 88 | "libcore.sun.invoke", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 89 | "libcore.sun.misc", |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 90 | "libcore.sun.net", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 91 | "libcore.sun.security", |
| 92 | "libcore.sun.util", |
| 93 | "libcore.xml", |
| 94 | "org.apache.harmony.annotation", |
Orion Hodson | 8a5c2f3 | 2022-11-08 12:57:11 +0000 | [diff] [blame] | 95 | "org.apache.harmony.luni.tests.internal.net.www.protocol.http.HttpURLConnection", |
| 96 | "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnection", |
| 97 | "org.apache.harmony.luni.tests.java.io", |
| 98 | "org.apache.harmony.luni.tests.java.net", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 99 | "org.apache.harmony.nio", |
| 100 | "org.apache.harmony.regex", |
| 101 | "org.apache.harmony.testframework", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 102 | "org.apache.harmony.tests.java.lang", |
| 103 | "org.apache.harmony.tests.java.math", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 104 | "org.apache.harmony.tests.javax.security", |
| 105 | "tests.java.lang.String", |
Nikita Iashchenko | 2eebc53 | 2022-04-07 15:09:33 +0100 | [diff] [blame] | 106 | ### OpenJDK upstream tests (ojluni). ### |
| 107 | # "test.java.awt", |
| 108 | "test.java.awt", |
| 109 | # test.java.io |
| 110 | "test.java.io.ByteArrayInputStream", |
| 111 | "test.java.io.ByteArrayOutputStream", |
| 112 | "test.java.io.FileReader", |
| 113 | "test.java.io.FileWriter", |
| 114 | "test.java.io.InputStream", |
| 115 | "test.java.io.OutputStream", |
| 116 | "test.java.io.PrintStream", |
| 117 | "test.java.io.PrintWriter", |
| 118 | "test.java.io.Reader", |
| 119 | "test.java.io.Writer", |
| 120 | # test.java.lang |
| 121 | "test.java.lang.Boolean", |
| 122 | "test.java.lang.ClassLoader", |
| 123 | "test.java.lang.Double", |
| 124 | "test.java.lang.Float", |
| 125 | "test.java.lang.Integer", |
| 126 | "test.java.lang.Long", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 127 | # Sharded test.java.lang.StrictMath |
| 128 | "test.java.lang.StrictMath.CubeRootTests", |
Victor Chang | 37c04d8 | 2022-09-28 10:44:22 +0100 | [diff] [blame] | 129 | # TODO: disable the test until b/248208762 is fixed. |
| 130 | # "test.java.lang.StrictMath.ExactArithTests", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 131 | "test.java.lang.StrictMath.Expm1Tests", |
| 132 | "test.java.lang.StrictMath.ExpTests", |
| 133 | "test.java.lang.StrictMath.HyperbolicTests", |
| 134 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard1", |
| 135 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard2", |
| 136 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard3", |
| 137 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard4", |
| 138 | "test.java.lang.StrictMath.HypotTests#testHypot", |
| 139 | "test.java.lang.StrictMath.Log1pTests", |
| 140 | "test.java.lang.StrictMath.Log10Tests", |
| 141 | "test.java.lang.StrictMath.MultiplicationTests", |
| 142 | "test.java.lang.StrictMath.PowTests", |
Nikita Iashchenko | 2eebc53 | 2022-04-07 15:09:33 +0100 | [diff] [blame] | 143 | "test.java.lang.String", |
| 144 | "test.java.lang.Thread", |
| 145 | # test.java.lang.invoke |
| 146 | "test.java.lang.invoke", |
| 147 | # test.java.lang.ref |
| 148 | "test.java.lang.ref.SoftReference", |
| 149 | "test.java.lang.ref.BasicTest", |
| 150 | "test.java.lang.ref.EnqueueNullRefTest", |
| 151 | "test.java.lang.ref.EnqueuePollRaceTest", |
| 152 | "test.java.lang.ref.ReferenceCloneTest", |
| 153 | "test.java.lang.ref.ReferenceEnqueuePendingTest", |
| 154 | # test.java.math |
| 155 | "test.java.math.BigDecimal", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 156 | # Sharded test.java.math.BigInteger |
| 157 | "test.java.math.BigInteger#testArithmetic", |
| 158 | "test.java.math.BigInteger#testBitCount", |
| 159 | "test.java.math.BigInteger#testBitLength", |
| 160 | "test.java.math.BigInteger#testbitOps", |
| 161 | "test.java.math.BigInteger#testBitwise", |
| 162 | "test.java.math.BigInteger#testByteArrayConv", |
| 163 | "test.java.math.BigInteger#testConstructor", |
| 164 | "test.java.math.BigInteger#testDivideAndReminder", |
| 165 | "test.java.math.BigInteger#testDivideLarge", |
| 166 | "test.java.math.BigInteger#testModExp", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 167 | "test.java.math.BigInteger#testMultiplyLarge", |
| 168 | "test.java.math.BigInteger#testNextProbablePrime", |
| 169 | "test.java.math.BigInteger#testPow", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 170 | "test.java.math.BigInteger#testSerialize", |
| 171 | "test.java.math.BigInteger#testShift", |
| 172 | "test.java.math.BigInteger#testSquare", |
| 173 | "test.java.math.BigInteger#testSquareLarge", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 174 | "test.java.math.BigInteger#testSquareRootAndReminder", |
| 175 | "test.java.math.BigInteger#testStringConv_generic", |
Nikita Iashchenko | 2eebc53 | 2022-04-07 15:09:33 +0100 | [diff] [blame] | 176 | "test.java.math.RoundingMode", |
| 177 | # test.java.net |
| 178 | "test.java.net.DatagramSocket", |
| 179 | "test.java.net.Socket", |
| 180 | "test.java.net.SocketOptions", |
| 181 | "test.java.net.URLDecoder", |
| 182 | "test.java.net.URLEncoder", |
| 183 | # test.java.nio |
| 184 | "test.java.nio.channels.Channels", |
| 185 | "test.java.nio.channels.SelectionKey", |
| 186 | "test.java.nio.channels.Selector", |
| 187 | "test.java.nio.file", |
| 188 | # test.java.security |
| 189 | "test.java.security.cert", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 190 | # Sharded test.java.security.KeyAgreement |
| 191 | "test.java.security.KeyAgreement.KeyAgreementTest", |
Nikita Iashchenko | 86f1b3f | 2022-04-20 15:39:23 +0100 | [diff] [blame] | 192 | "test.java.security.KeyAgreement.KeySizeTest#testECDHKeySize", |
| 193 | "test.java.security.KeyAgreement.KeySpecTest", |
| 194 | "test.java.security.KeyAgreement.MultiThreadTest", |
| 195 | "test.java.security.KeyAgreement.NegativeTest", |
Nikita Iashchenko | 2eebc53 | 2022-04-07 15:09:33 +0100 | [diff] [blame] | 196 | "test.java.security.KeyStore", |
| 197 | "test.java.security.Provider", |
| 198 | # test.java.time |
| 199 | "test.java.time", |
| 200 | # test.java.util |
| 201 | "test.java.util.Arrays", |
| 202 | "test.java.util.Collection", |
| 203 | "test.java.util.Collections", |
| 204 | "test.java.util.Date", |
| 205 | "test.java.util.EnumMap", |
| 206 | "test.java.util.EnumSet", |
| 207 | "test.java.util.GregorianCalendar", |
| 208 | "test.java.util.LinkedHashMap", |
| 209 | "test.java.util.LinkedHashSet", |
| 210 | "test.java.util.List", |
| 211 | "test.java.util.Map", |
| 212 | "test.java.util.Optional", |
| 213 | "test.java.util.TestFormatter", |
| 214 | "test.java.util.TimeZone", |
| 215 | # test.java.util.concurrent |
| 216 | "test.java.util.concurrent", |
| 217 | # test.java.util.function |
| 218 | "test.java.util.function", |
| 219 | # test.java.util.stream |
| 220 | "test.java.util.stream", |
| 221 | # test.java.util.zip |
| 222 | "test.java.util.zip.ZipFile", |
| 223 | # tck.java.time |
| 224 | "tck.java.time", |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 225 | ] |
| 226 | # "org.apache.harmony.security", # We don't have rights to revert changes in case of failures. |
| 227 | |
| 228 | # Note: This must start with the CORE_IMG_JARS in Android.common_path.mk |
| 229 | # because that's what we use for compiling the boot.art image. |
| 230 | # It may contain additional modules from TEST_CORE_JARS. |
| 231 | BOOT_CLASSPATH = [ |
| 232 | "/apex/com.android.art/javalib/core-oj.jar", |
| 233 | "/apex/com.android.art/javalib/core-libart.jar", |
| 234 | "/apex/com.android.art/javalib/okhttp.jar", |
| 235 | "/apex/com.android.art/javalib/bouncycastle.jar", |
| 236 | "/apex/com.android.art/javalib/apache-xml.jar", |
| 237 | "/apex/com.android.i18n/javalib/core-icu4j.jar", |
| 238 | "/apex/com.android.conscrypt/javalib/conscrypt.jar", |
| 239 | ] |
| 240 | |
Nikita Iashchenko | 62df93b | 2022-03-25 16:55:56 +0000 | [diff] [blame] | 241 | CLASSPATH = ["core-tests", "core-ojtests", "jsr166-tests", "mockito-target"] |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 242 | |
Nikita Iashchenko | 195e38b | 2022-04-29 17:16:25 +0100 | [diff] [blame] | 243 | SLOW_OJLUNI_TESTS = { |
| 244 | "test.java.awt", |
| 245 | "test.java.lang.String", |
| 246 | "test.java.lang.invoke", |
| 247 | "test.java.nio.channels.Selector", |
| 248 | "test.java.time", |
| 249 | "test.java.util.Arrays", |
| 250 | "test.java.util.Map", |
| 251 | "test.java.util.concurrent", |
| 252 | "test.java.util.stream", |
| 253 | "test.java.util.zip.ZipFile", |
| 254 | "tck.java.time", |
| 255 | } |
| 256 | |
Nikita Iashchenko | 6f82e43 | 2022-06-23 17:58:07 +0100 | [diff] [blame] | 257 | # Disabled to unblock art-buildbot |
| 258 | # These tests fail with "java.io.IOException: Stream closed", tracked in |
| 259 | # http://b/235566533 and http://b/208639267 |
| 260 | DISABLED_GCSTRESS_DEBUG_TESTS = { |
David Srbecky | 27e028a | 2022-06-30 10:23:39 +0100 | [diff] [blame] | 261 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard1", |
| 262 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard2", |
| 263 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard3", |
| 264 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard4", |
Nikita Iashchenko | 6f82e43 | 2022-06-23 17:58:07 +0100 | [diff] [blame] | 265 | "test.java.math.BigDecimal", |
David Srbecky | 27e028a | 2022-06-30 10:23:39 +0100 | [diff] [blame] | 266 | "test.java.math.BigInteger#testConstructor", |
Nikita Iashchenko | 6f82e43 | 2022-06-23 17:58:07 +0100 | [diff] [blame] | 267 | } |
| 268 | |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 269 | DISABLED_FUGU_TESTS = { |
Orion Hodson | 8a5c2f3 | 2022-11-08 12:57:11 +0000 | [diff] [blame] | 270 | "org.apache.harmony.luni.tests.internal.net.www.protocol.http.HttpURLConnection", |
| 271 | "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnection", |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 272 | "test.java.awt", |
| 273 | "test.java.io.ByteArrayInputStream", |
| 274 | "test.java.io.ByteArrayOutputStream", |
Nikita Iashchenko | 731e480 | 2022-07-06 17:03:00 +0100 | [diff] [blame] | 275 | "test.java.io.InputStream", |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 276 | "test.java.io.OutputStream", |
| 277 | "test.java.io.PrintStream", |
| 278 | "test.java.io.PrintWriter", |
| 279 | "test.java.io.Reader", |
| 280 | "test.java.io.Writer", |
| 281 | "test.java.lang.Boolean", |
| 282 | "test.java.lang.ClassLoader", |
| 283 | "test.java.lang.Double", |
| 284 | "test.java.lang.Float", |
| 285 | "test.java.lang.Integer", |
| 286 | "test.java.lang.Long", |
| 287 | "test.java.lang.StrictMath.CubeRootTests", |
| 288 | "test.java.lang.StrictMath.Expm1Tests", |
| 289 | "test.java.lang.StrictMath.ExpTests", |
| 290 | "test.java.lang.StrictMath.HyperbolicTests", |
Nikita Iashchenko | 38cb5ad | 2022-07-04 14:37:49 +0100 | [diff] [blame] | 291 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard1", |
| 292 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard2", |
| 293 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard3", |
| 294 | "test.java.lang.StrictMath.HypotTests#testAgainstTranslit_shard4", |
| 295 | "test.java.lang.StrictMath.HypotTests#testHypot", |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 296 | "test.java.lang.StrictMath.Log1pTests", |
| 297 | "test.java.lang.StrictMath.Log10Tests", |
| 298 | "test.java.lang.StrictMath.MultiplicationTests", |
| 299 | "test.java.lang.StrictMath.PowTests", |
| 300 | "test.java.lang.String", |
| 301 | "test.java.lang.Thread", |
| 302 | "test.java.lang.invoke", |
| 303 | "test.java.lang.ref.SoftReference", |
| 304 | "test.java.lang.ref.BasicTest", |
| 305 | "test.java.lang.ref.EnqueueNullRefTest", |
| 306 | "test.java.lang.ref.EnqueuePollRaceTest", |
| 307 | "test.java.lang.ref.ReferenceCloneTest", |
| 308 | "test.java.lang.ref.ReferenceEnqueuePendingTest", |
| 309 | "test.java.math.BigDecimal", |
Nikita Iashchenko | 38cb5ad | 2022-07-04 14:37:49 +0100 | [diff] [blame] | 310 | "test.java.math.BigInteger#testArithmetic", |
| 311 | "test.java.math.BigInteger#testBitCount", |
| 312 | "test.java.math.BigInteger#testBitLength", |
| 313 | "test.java.math.BigInteger#testbitOps", |
| 314 | "test.java.math.BigInteger#testBitwise", |
| 315 | "test.java.math.BigInteger#testByteArrayConv", |
| 316 | "test.java.math.BigInteger#testConstructor", |
| 317 | "test.java.math.BigInteger#testDivideAndReminder", |
| 318 | "test.java.math.BigInteger#testDivideLarge", |
| 319 | "test.java.math.BigInteger#testModExp", |
| 320 | "test.java.math.BigInteger#testMultiplyLarge", |
| 321 | "test.java.math.BigInteger#testNextProbablePrime", |
| 322 | "test.java.math.BigInteger#testPow", |
| 323 | "test.java.math.BigInteger#testSerialize", |
| 324 | "test.java.math.BigInteger#testShift", |
| 325 | "test.java.math.BigInteger#testSquare", |
| 326 | "test.java.math.BigInteger#testSquareLarge", |
| 327 | "test.java.math.BigInteger#testSquareRootAndReminder", |
| 328 | "test.java.math.BigInteger#testStringConv_generic", |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 329 | "test.java.math.RoundingMode", |
| 330 | "test.java.net.DatagramSocket", |
| 331 | "test.java.net.Socket", |
| 332 | "test.java.net.SocketOptions", |
| 333 | "test.java.net.URLDecoder", |
| 334 | "test.java.net.URLEncoder", |
| 335 | "test.java.nio.channels.Channels", |
| 336 | "test.java.nio.channels.SelectionKey", |
Nikita Iashchenko | 731e480 | 2022-07-06 17:03:00 +0100 | [diff] [blame] | 337 | "test.java.nio.channels.Selector", |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 338 | "test.java.nio.file", |
| 339 | "test.java.security.cert", |
| 340 | "test.java.security.KeyAgreement.KeyAgreementTest", |
Nikita Iashchenko | 38cb5ad | 2022-07-04 14:37:49 +0100 | [diff] [blame] | 341 | "test.java.security.KeyAgreement.KeySizeTest#testECDHKeySize", |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 342 | "test.java.security.KeyAgreement.KeySpecTest", |
| 343 | "test.java.security.KeyAgreement.MultiThreadTest", |
| 344 | "test.java.security.KeyAgreement.NegativeTest", |
| 345 | "test.java.security.KeyStore", |
| 346 | "test.java.security.Provider", |
Nikita Iashchenko | 731e480 | 2022-07-06 17:03:00 +0100 | [diff] [blame] | 347 | "test.java.time", |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 348 | "test.java.util.Arrays", |
| 349 | "test.java.util.Collection", |
| 350 | "test.java.util.Collections", |
| 351 | "test.java.util.Date", |
| 352 | "test.java.util.EnumMap", |
| 353 | "test.java.util.EnumSet", |
| 354 | "test.java.util.GregorianCalendar", |
| 355 | "test.java.util.LinkedHashMap", |
| 356 | "test.java.util.LinkedHashSet", |
| 357 | "test.java.util.List", |
| 358 | "test.java.util.Map", |
| 359 | "test.java.util.Optional", |
| 360 | "test.java.util.TestFormatter", |
| 361 | "test.java.util.TimeZone", |
| 362 | "test.java.util.function", |
| 363 | "test.java.util.stream", |
| 364 | "tck.java.time", |
| 365 | } |
| 366 | |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 367 | def get_jar_filename(classpath): |
| 368 | base_path = (ANDROID_PRODUCT_OUT + "/../..") if ANDROID_PRODUCT_OUT else "out/target" |
| 369 | base_path = os.path.normpath(base_path) # Normalize ".." components for readability. |
| 370 | return f"{base_path}/common/obj/JAVA_LIBRARIES/{classpath}_intermediates/classes.jar" |
| 371 | |
| 372 | def get_timeout_secs(): |
| 373 | default_timeout_secs = 600 |
David Srbecky | 2ce26fd | 2021-05-19 18:26:54 +0100 | [diff] [blame] | 374 | if args.gcstress: |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 375 | default_timeout_secs = 1200 |
| 376 | if args.debug: |
| 377 | default_timeout_secs = 1800 |
| 378 | return args.timeout or default_timeout_secs |
| 379 | |
| 380 | def get_expected_failures(): |
| 381 | failures = ["art/tools/libcore_failures.txt"] |
| 382 | if args.mode != "jvm": |
| 383 | if args.gcstress: |
| 384 | failures.append("art/tools/libcore_gcstress_failures.txt") |
| 385 | if args.gcstress and args.debug: |
| 386 | failures.append("art/tools/libcore_gcstress_debug_failures.txt") |
David Srbecky | 680d768 | 2021-05-04 16:56:37 +0100 | [diff] [blame] | 387 | if args.debug and not args.gcstress and args.getrandom: |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 388 | failures.append("art/tools/libcore_debug_failures.txt") |
| 389 | if not args.getrandom: |
| 390 | failures.append("art/tools/libcore_fugu_failures.txt") |
| 391 | return failures |
| 392 | |
| 393 | def get_test_names(): |
| 394 | if args.tests: |
| 395 | return args.tests |
| 396 | test_names = list(LIBCORE_TEST_NAMES) |
| 397 | # See b/78228743 and b/178351808. |
| 398 | if args.gcstress or args.debug or args.mode == "jvm": |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 399 | test_names = list(t for t in test_names if not t.startswith("libcore.highmemorytest")) |
Nikita Iashchenko | 195e38b | 2022-04-29 17:16:25 +0100 | [diff] [blame] | 400 | test_names = list(filter(lambda x: x not in SLOW_OJLUNI_TESTS, test_names)) |
David Srbecky | 27e028a | 2022-06-30 10:23:39 +0100 | [diff] [blame] | 401 | if args.gcstress and args.debug: |
Nikita Iashchenko | 6f82e43 | 2022-06-23 17:58:07 +0100 | [diff] [blame] | 402 | test_names = list(filter(lambda x: x not in DISABLED_GCSTRESS_DEBUG_TESTS, test_names)) |
Nikita Iashchenko | dbf5f6a | 2022-06-23 18:38:38 +0100 | [diff] [blame] | 403 | if not args.getrandom: |
Victor Chang | 52ab1e9 | 2022-11-08 14:38:25 +0000 | [diff] [blame] | 404 | # Disable libcore.highmemorytest due to limited ram on fugu. http://b/258173036 |
| 405 | test_names = list(filter(lambda x: x not in DISABLED_FUGU_TESTS and |
| 406 | not x.startswith("libcore.highmemorytest"), test_names)) |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 407 | return test_names |
| 408 | |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 409 | def get_vogar_command(test_name): |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 410 | cmd = ["vogar"] |
| 411 | if args.mode == "device": |
Jiakai Zhang | 45c6d8b | 2022-02-18 14:17:31 +0000 | [diff] [blame] | 412 | cmd.append("--mode=device --vm-arg -Ximage:/system/framework/art_boot_images/boot.art") |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 413 | cmd.append("--vm-arg -Xbootclasspath:" + ":".join(BOOT_CLASSPATH)) |
Orion Hodson | 77aa45d | 2022-10-14 16:11:56 +0100 | [diff] [blame] | 414 | |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 415 | if args.mode == "host": |
| 416 | # We explicitly give a wrong path for the image, to ensure vogar |
| 417 | # will create a boot image with the default compiler. Note that |
| 418 | # giving an existing image on host does not work because of |
| 419 | # classpath/resources differences when compiling the boot image. |
| 420 | cmd.append("--mode=host --vm-arg -Ximage:/non/existent/vogar.art") |
| 421 | if args.mode == "jvm": |
| 422 | cmd.append("--mode=jvm") |
| 423 | if args.variant: |
| 424 | cmd.append("--variant=" + args.variant) |
| 425 | if args.gcstress: |
| 426 | cmd.append("--vm-arg -Xgc:gcstress") |
Sorin Basca | 24bdf64 | 2022-02-07 15:47:01 +0000 | [diff] [blame] | 427 | cmd.append('--vm-arg -Djsr166.delay.factor="1.50"') |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 428 | if args.debug: |
| 429 | cmd.append("--vm-arg -XXlib:libartd.so --vm-arg -XX:SlowDebug=true") |
| 430 | |
Orion Hodson | 8858dc2 | 2022-11-14 10:52:15 +0000 | [diff] [blame] | 431 | # The only device in go/art-buildbot without getrandom is fugu. We limit the amount of memory |
| 432 | # per runtime for fugu to avoid low memory killer, fugu has 4-cores 1GB RAM (b/258171768). |
| 433 | if not args.getrandom: |
| 434 | cmd.append("--vm-arg -Xmx128M") |
| 435 | |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 436 | if args.mode == "device": |
| 437 | if ART_TEST_CHROOT: |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 438 | cmd.append(f"--chroot {ART_TEST_CHROOT} --device-dir=/tmp/vogar/test-{test_name}") |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 439 | else: |
Nikita Iashchenko | 3698310 | 2022-06-24 15:21:53 +0100 | [diff] [blame] | 440 | cmd.append(f"--device-dir=/data/local/tmp/vogar/test-{test_name}") |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 441 | cmd.append(f"--vm-command={ART_TEST_ANDROID_ROOT}/bin/art") |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 442 | else: |
| 443 | cmd.append(f"--device-dir=/tmp/vogar/test-{test_name}") |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 444 | |
| 445 | if args.mode != "jvm": |
| 446 | cmd.append("--timeout {}".format(get_timeout_secs())) |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 447 | cmd.append("--toolchain d8 --language CUR") |
| 448 | if args.jit: |
| 449 | cmd.append("--vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken") |
| 450 | cmd.append("--vm-arg -Xusejit:{}".format(str(args.jit).lower())) |
| 451 | |
Orion Hodson | 77aa45d | 2022-10-14 16:11:56 +0100 | [diff] [blame] | 452 | if args.verbose: |
| 453 | cmd.append("--verbose") |
| 454 | |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 455 | # Suppress color codes if not attached to a terminal |
| 456 | if not sys.stdout.isatty(): |
| 457 | cmd.append("--no-color") |
| 458 | |
| 459 | cmd.extend("--expectations " + f for f in get_expected_failures()) |
| 460 | cmd.extend("--classpath " + get_jar_filename(cp) for cp in CLASSPATH) |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 461 | cmd.append(test_name) |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 462 | return cmd |
| 463 | |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 464 | def get_target_cpu_count(): |
| 465 | adb_command = 'adb shell cat /sys/devices/system/cpu/present' |
| 466 | with subprocess.Popen(adb_command.split(), |
| 467 | stderr=subprocess.STDOUT, |
| 468 | stdout=subprocess.PIPE, |
| 469 | universal_newlines=True) as proc: |
| 470 | assert(proc.wait() == 0) # Check the exit code. |
| 471 | match = re.match(r'\d*-(\d*)', proc.stdout.read()) |
| 472 | assert(match) |
| 473 | return int(match.group(1)) + 1 # Add one to convert from "last-index" to "count" |
| 474 | |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 475 | def main(): |
| 476 | global args |
| 477 | args = parse_args() |
| 478 | |
| 479 | if not os.path.exists('build/envsetup.sh'): |
| 480 | raise AssertionError("Script needs to be run at the root of the android tree") |
| 481 | for jar in map(get_jar_filename, CLASSPATH): |
| 482 | if not os.path.exists(jar): |
| 483 | raise AssertionError(f"Missing {jar}. Run buildbot-build.sh first.") |
| 484 | |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 485 | if not args.jobs: |
David Srbecky | f75b8e9 | 2021-06-07 11:11:38 +0000 | [diff] [blame] | 486 | if args.mode == "device": |
| 487 | args.jobs = get_target_cpu_count() |
| 488 | else: |
| 489 | args.jobs = multiprocessing.cpu_count() |
| 490 | if args.gcstress: |
| 491 | # TODO: Investigate and fix the underlying issues. |
| 492 | args.jobs = args.jobs // 2 |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 493 | |
| 494 | def run_test(test_name): |
| 495 | cmd = " ".join(get_vogar_command(test_name)) |
| 496 | if args.dry_run: |
| 497 | return test_name, cmd, "Dry-run: skipping execution", 0 |
| 498 | with subprocess.Popen(shlex.split(cmd), |
| 499 | stderr=subprocess.STDOUT, |
| 500 | stdout=subprocess.PIPE, |
| 501 | universal_newlines=True) as proc: |
| 502 | return test_name, cmd, proc.communicate()[0], proc.wait() |
| 503 | |
David Srbecky | e059ef1 | 2021-05-04 18:54:34 +0100 | [diff] [blame] | 504 | failed_regex = re.compile(r"^.* FAIL \((?:EXEC_FAILED|ERROR)\)$", re.MULTILINE) |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 505 | failed_tests, max_exit_code = [], 0 |
| 506 | with concurrent.futures.ThreadPoolExecutor(max_workers=args.jobs) as pool: |
| 507 | futures = [pool.submit(run_test, test_name) for test_name in get_test_names()] |
David Srbecky | 0849c1c | 2021-04-30 12:22:50 +0100 | [diff] [blame] | 508 | print(f"Running {len(futures)} tasks on {args.jobs} core(s)...\n") |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 509 | for i, future in enumerate(concurrent.futures.as_completed(futures)): |
| 510 | test_name, cmd, stdout, exit_code = future.result() |
Orion Hodson | 77aa45d | 2022-10-14 16:11:56 +0100 | [diff] [blame] | 511 | if exit_code != 0 or args.dry_run or args.verbose: |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 512 | print(cmd) |
David Srbecky | 0849c1c | 2021-04-30 12:22:50 +0100 | [diff] [blame] | 513 | print(stdout.strip()) |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 514 | else: |
| 515 | print(stdout.strip().split("\n")[-1]) # Vogar final summary line. |
David Srbecky | 0849c1c | 2021-04-30 12:22:50 +0100 | [diff] [blame] | 516 | failed_match = failed_regex.findall(stdout) |
| 517 | failed_tests.extend(failed_match) |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 518 | max_exit_code = max(max_exit_code, exit_code) |
David Srbecky | 0849c1c | 2021-04-30 12:22:50 +0100 | [diff] [blame] | 519 | result = "PASSED" if exit_code == 0 else f"FAILED ({len(failed_match)} test(s) failed)" |
| 520 | print(f"[{i+1}/{len(futures)}] Test set {test_name} {result}\n") |
| 521 | print(f"Overall, {len(failed_tests)} test(s) failed:") |
| 522 | print("\n".join(failed_tests)) |
David Srbecky | a0ef40d | 2021-04-25 21:15:01 +0100 | [diff] [blame] | 523 | sys.exit(max_exit_code) |
David Srbecky | 10132a0 | 2021-04-23 22:28:15 +0100 | [diff] [blame] | 524 | |
| 525 | if __name__ == '__main__': |
| 526 | main() |