summaryrefslogtreecommitdiff
path: root/test/testrunner
diff options
context:
space:
mode:
Diffstat (limited to 'test/testrunner')
-rw-r--r--test/testrunner/device_config.py5
-rw-r--r--test/testrunner/env.py7
-rwxr-xr-xtest/testrunner/run_build_test_target.py14
-rw-r--r--test/testrunner/target_config.py17
-rwxr-xr-xtest/testrunner/testrunner.py60
5 files changed, 74 insertions, 29 deletions
diff --git a/test/testrunner/device_config.py b/test/testrunner/device_config.py
index 1fad7d297d..c56a05d0ae 100644
--- a/test/testrunner/device_config.py
+++ b/test/testrunner/device_config.py
@@ -11,10 +11,11 @@ device_config = {
#
##########################################
# Fugu's don't have enough memory to support a 128m heap with normal concurrency.
+ # Also update timeout value as some tests can go beyond the default 600s.
'aosp_fugu' : {
- 'run-test-args': [ "--runtime-option", "-Xmx128m" ],
+ 'run-test-args': [ "--runtime-option", "-Xmx128m", "--timeout", "900" ],
},
'fugu' : {
- 'run-test-args': [ "--runtime-option", "-Xmx128m" ],
+ 'run-test-args': [ "--runtime-option", "-Xmx128m", "--timeout", "900" ],
},
}
diff --git a/test/testrunner/env.py b/test/testrunner/env.py
index 319e1a76b0..44d0db67ec 100644
--- a/test/testrunner/env.py
+++ b/test/testrunner/env.py
@@ -132,8 +132,8 @@ else:
HOST_OUT_EXECUTABLES = os.path.join(ANDROID_BUILD_TOP,
_get_build_var("HOST_OUT_EXECUTABLES"))
-# Set up default values for $DX, $SMALI, etc to the $HOST_OUT_EXECUTABLES/$name path.
-for tool in ['dx', 'smali', 'jasmin', 'd8']:
+# Set up default values for $D8, $SMALI, etc to the $HOST_OUT_EXECUTABLES/$name path.
+for tool in ['smali', 'jasmin', 'd8']:
os.environ.setdefault(tool.upper(), HOST_OUT_EXECUTABLES + '/' + tool)
ANDROID_JAVA_TOOLCHAIN = os.path.join(ANDROID_BUILD_TOP,
@@ -146,3 +146,6 @@ DIST_DIR = _get_build_var('DIST_DIR')
SOONG_OUT_DIR = _get_build_var('SOONG_OUT_DIR')
ART_TEST_RUN_ON_ARM_FVP = _getEnvBoolean('ART_TEST_RUN_ON_ARM_FVP', False)
+
+ART_TEST_ON_VM = _env.get('ART_TEST_ON_VM')
+ART_SSH_CMD = _env.get('ART_SSH_CMD')
diff --git a/test/testrunner/run_build_test_target.py b/test/testrunner/run_build_test_target.py
index 4191771d0d..d271b802a2 100755
--- a/test/testrunner/run_build_test_target.py
+++ b/test/testrunner/run_build_test_target.py
@@ -29,12 +29,18 @@ See target_config.py for the configuration syntax.
import argparse
import os
import pathlib
+import re
import subprocess
import sys
from target_config import target_config
import env
+# Check that we are using reasonably recent version of python
+print("Using", sys.executable, sys.version, flush=True)
+version = tuple(map(int, re.match(r"(\d*)\.(\d*)", sys.version).groups()))
+assert (version >= (3, 9)), "Python version is too old"
+
parser = argparse.ArgumentParser()
parser.add_argument('-j', default='1', dest='n_threads')
# either -l/--list OR build-target is required (but not both).
@@ -60,6 +66,7 @@ target = target_config[options.build_target]
n_threads = options.n_threads
custom_env = target.get('env', {})
custom_env['SOONG_ALLOW_MISSING_DEPENDENCIES'] = 'true'
+custom_env['BUILD_BROKEN_DISABLE_BAZEL'] = 'true'
# Switch the build system to unbundled mode in the reduced manifest branch.
if not os.path.isdir(env.ANDROID_BUILD_TOP + '/frameworks/base'):
custom_env['TARGET_BUILD_UNBUNDLED'] = 'true'
@@ -81,7 +88,7 @@ if subprocess.call(clean_command.split()):
if 'build' in target:
build_command = target.get('build').format(
ANDROID_BUILD_TOP = env.ANDROID_BUILD_TOP,
- MAKE_OPTIONS='DX= -j{threads}'.format(threads = n_threads))
+ MAKE_OPTIONS='D8= -j{threads}'.format(threads = n_threads))
sys.stdout.write(str(build_command) + '\n')
sys.stdout.flush()
if subprocess.call(build_command.split()):
@@ -90,7 +97,7 @@ if 'build' in target:
# make runs soong/kati to build the target listed in the entry.
if 'make' in target:
build_command = 'build/soong/soong_ui.bash --make-mode'
- build_command += ' DX='
+ build_command += ' D8='
build_command += ' -j' + str(n_threads)
build_command += ' ' + target.get('make')
if env.DIST_DIR:
@@ -119,7 +126,8 @@ if 'golem' in target:
sys.exit(1)
if 'run-test' in target:
- run_test_command = [os.path.join(env.ANDROID_BUILD_TOP,
+ run_test_command = [sys.executable, # Use the same python as we are using now.
+ os.path.join(env.ANDROID_BUILD_TOP,
'art/test/testrunner/testrunner.py')]
test_flags = target.get('run-test', [])
out_dir = pathlib.PurePath(env.SOONG_OUT_DIR)
diff --git a/test/testrunner/target_config.py b/test/testrunner/target_config.py
index 907f4ec556..eaf33b7fc4 100644
--- a/test/testrunner/target_config.py
+++ b/test/testrunner/target_config.py
@@ -138,7 +138,8 @@ target_config = {
}
},
'art-tracing' : {
- 'run-test' : ['--trace']
+ 'run-test' : ['--trace',
+ '--stream']
},
'art-interpreter-tracing' : {
'run-test' : ['--interpreter',
@@ -246,6 +247,20 @@ target_config = {
'ASAN_OPTIONS' : 'detect_leaks=0'
}
},
+ 'art-gtest-asan32': {
+ 'make' : 'test-art-host-gtest32',
+ 'env': {
+ 'SANITIZE_HOST' : 'address',
+ 'ASAN_OPTIONS' : 'detect_leaks=0'
+ }
+ },
+ 'art-gtest-asan64': {
+ 'make' : 'test-art-host-gtest64',
+ 'env': {
+ 'SANITIZE_HOST' : 'address',
+ 'ASAN_OPTIONS' : 'detect_leaks=0'
+ }
+ },
'art-asan': {
'run-test' : ['--interpreter',
'--interp-ac',
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index 935ce0ce0b..4499ffd6e1 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -354,8 +354,13 @@ def find_extra_device_arguments(target):
def get_device_name():
"""
- Gets the value of ro.product.name from remote device.
+ Gets the value of ro.product.name from remote device (unless running on a VM).
"""
+ if env.ART_TEST_ON_VM:
+ return subprocess.Popen(f"{env.ART_SSH_CMD} uname -a".split(),
+ stdout = subprocess.PIPE,
+ universal_newlines=True).stdout.read().strip()
+
proc = subprocess.Popen(['adb', 'shell', 'getprop', 'ro.product.name'],
stderr=subprocess.STDOUT,
stdout = subprocess.PIPE,
@@ -581,7 +586,9 @@ def run_tests(tests):
temp_path = tempfile.mkdtemp(dir=env.ART_HOST_TEST_DIR)
options_test = '--temp-path {} '.format(temp_path) + options_test
- run_test_sh = env.ANDROID_BUILD_TOP + '/art/test/run-test'
+ # Run the run-test script using the prebuilt python.
+ python3_bin = env.ANDROID_BUILD_TOP + "/prebuilts/build-tools/path/linux-x86/python3"
+ run_test_sh = python3_bin + ' ' + env.ANDROID_BUILD_TOP + '/art/test/run-test'
command = ' '.join((run_test_sh, options_test, ' '.join(extra_arguments[target]), test))
return executor.submit(run_test, command, test, variant_set, test_name)
@@ -665,9 +672,12 @@ def run_test(command, test, test_variant, test_name):
test_start_time = time.monotonic()
if verbose:
print_text("Starting %s at %s\n" % (test_name, test_start_time))
+ env = dict(os.environ)
+ env["FULL_TEST_NAME"] = test_name
if gdb or gdb_dex2oat:
proc = _popen(
args=command.split(),
+ env=env,
stderr=subprocess.STDOUT,
universal_newlines=True,
start_new_session=True
@@ -675,6 +685,7 @@ def run_test(command, test, test_variant, test_name):
else:
proc = _popen(
args=command.split(),
+ env=env,
stderr=subprocess.STDOUT,
stdout = subprocess.PIPE,
universal_newlines=True,
@@ -704,7 +715,7 @@ def run_test(command, test, test_variant, test_name):
failed_tests.append((test_name, 'Timed out in %d seconds' % timeout))
# HACK(b/142039427): Print extra backtraces on timeout.
- if "-target-" in test_name:
+ if "-target-" in test_name and not env.ART_TEST_ON_VM:
for i in range(8):
proc_name = "dalvikvm" + test_name[-2:]
pidof = subprocess.run(["adb", "shell", "pidof", proc_name], stdout=subprocess.PIPE)
@@ -1064,8 +1075,11 @@ def parse_test_name(test_name):
def get_target_cpu_count():
- adb_command = 'adb shell cat /sys/devices/system/cpu/present'
- cpu_info_proc = subprocess.Popen(adb_command.split(), stdout=subprocess.PIPE)
+ if env.ART_TEST_ON_VM:
+ command = f"{env.ART_SSH_CMD} cat /sys/devices/system/cpu/present"
+ else:
+ command = 'adb shell cat /sys/devices/system/cpu/present'
+ cpu_info_proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
cpu_info = cpu_info_proc.stdout.read()
if type(cpu_info) is bytes:
cpu_info = cpu_info.decode('utf-8')
@@ -1104,7 +1118,9 @@ def parse_option():
global csv_result
parser = argparse.ArgumentParser(description="Runs all or a subset of the ART test suite.")
- parser.add_argument('-t', '--test', action='append', dest='tests', help='name(s) of the test(s)')
+ parser.add_argument('tests', action='extend', nargs="*", help='name(s) of the test(s)')
+ parser.add_argument('-t', '--test', action='append', dest='tests', help='name(s) of the test(s)'
+ ' (deprecated: use positional arguments at the end without any option instead)')
global_group = parser.add_argument_group('Global options',
'Options that affect all tests being run')
global_group.add_argument('-j', type=int, dest='n_thread', help="""Number of CPUs to use.
@@ -1225,26 +1241,31 @@ def parse_option():
if options['run_all']:
run_all_configs = True
- return tests
+ return tests or RUN_TEST_SET
def main():
gather_test_info()
- user_requested_tests = parse_option()
+ tests = parse_option()
setup_test_env()
gather_disabled_test_info()
if build:
- build_targets = ''
- if 'host' in _user_input_variants['target']:
- build_targets += 'test-art-host-run-test-dependencies '
- if 'target' in _user_input_variants['target']:
- build_targets += 'test-art-target-run-test-dependencies '
- if 'jvm' in _user_input_variants['target']:
- build_targets += 'test-art-host-run-test-dependencies '
+ build_targets = []
+ # Build only the needed shards (depending on the selected tests).
+ shards = set(re.search("(\d\d)-", t).group(1) for t in tests)
+ if any("hiddenapi" in t for t in tests):
+ shards.add("HiddenApi") # Include special HiddenApi shard.
+ for mode in ['host', 'target', 'jvm']:
+ if mode in _user_input_variants['target']:
+ build_targets += ['test-art-{}-run-test-dependencies'.format(mode)]
+ if len(shards) >= 100:
+ build_targets += ["art-run-test-{}-data".format(mode)] # Build all.
+ else:
+ build_targets += ["art-run-test-{}-data-shard{}".format(mode, s) for s in shards]
build_command = env.ANDROID_BUILD_TOP + '/build/soong/soong_ui.bash --make-mode'
- build_command += ' DX='
+ build_command += ' D8='
if dist:
build_command += ' dist'
- build_command += ' ' + build_targets
+ build_command += ' ' + ' '.join(build_targets)
print_text('Build command: %s\n' % build_command)
if subprocess.call(build_command.split()):
# Debugging for b/62653020
@@ -1252,10 +1273,7 @@ def main():
shutil.copyfile(env.SOONG_OUT_DIR + '/build.ninja', env.DIST_DIR + '/soong.ninja')
sys.exit(1)
- if user_requested_tests:
- run_tests(user_requested_tests)
- else:
- run_tests(RUN_TEST_SET)
+ run_tests(tests)
print_analysis()
close_csv_file()