diff options
Diffstat (limited to 'test/testrunner/testrunner.py')
| -rwxr-xr-x | test/testrunner/testrunner.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py index ca29d0a484..a9aed6c520 100755 --- a/test/testrunner/testrunner.py +++ b/test/testrunner/testrunner.py @@ -60,6 +60,7 @@ import time import env from target_config import target_config +from device_config import device_config # timeout for individual tests. # TODO: make it adjustable per tests and for buildbots @@ -116,6 +117,9 @@ stop_testrunner = False dex2oat_jobs = -1 # -1 corresponds to default threads for dex2oat run_all_configs = False +# Dict containing extra arguments +extra_arguments = { "host" : [], "target" : [] } + # Dict to store user requested test variants. # key: variant_type. # value: set of variants user wants to run of type <key>. @@ -239,6 +243,10 @@ def setup_test_env(): n_thread = get_default_threads('host') print_text("Concurrency: " + str(n_thread) + "\n") + global extra_arguments + for target in _user_input_variants['target']: + extra_arguments[target] = find_extra_device_arguments(target) + global semaphore semaphore = threading.Semaphore(n_thread) @@ -252,6 +260,33 @@ def setup_test_env(): COLOR_SKIP = '' COLOR_NORMAL = '' +def find_extra_device_arguments(target): + """ + Gets any extra arguments from the device_config. + """ + if target == 'host': + return device_config.get(target, { 'run-test-args' : [] })['run-test-args'] + else: + device = get_device_name() + return device_config.get(device, { 'run-test-args' : [] })['run-test-args'] + +def get_device_name(): + """ + Gets the value of ro.product.name from remote device. + """ + proc = subprocess.Popen(['adb', 'shell', 'getprop', 'ro.product.name'], + stderr=subprocess.STDOUT, + stdout = subprocess.PIPE, + universal_newlines=True) + # only wait 2 seconds. + output = proc.communicate(timeout = 2)[0] + success = not proc.wait() + if success: + return output.strip() + else: + print_text("Unable to determine device type!\n") + print_text("Continuing anyway.\n") + return "UNKNOWN_TARGET" def run_tests(tests): """Creates thread workers to run the tests. @@ -434,7 +469,7 @@ def run_tests(tests): tempfile.mkdtemp(dir=env.ART_HOST_TEST_DIR)) + options_test run_test_sh = env.ANDROID_BUILD_TOP + '/art/test/run-test' - command = run_test_sh + ' ' + options_test + ' ' + test + command = ' '.join((run_test_sh, options_test, ' '.join(extra_arguments[target]), test)) semaphore.acquire() worker = threading.Thread(target=run_test, args=(command, test, variant_set, test_name)) @@ -913,6 +948,7 @@ def main(): if 'target' in _user_input_variants['target']: build_targets += 'test-art-target-run-test-dependencies' build_command = 'make' + build_command += ' DX=' build_command += ' -j' build_command += ' -C ' + env.ANDROID_BUILD_TOP build_command += ' ' + build_targets |