Enable run of tests on devices and emulators
This CL updates the DexVm enum to add add an information
about the kind of runtime used to run the tests, whether
it's a host version of the runtime or a target one
(device or emulator).
It adds also the DeviceRunner class which drives the target
device for the tests.
Change-Id: I10666951f083a4f1da2efe3e9d368803a223a1b2
Bug:
diff --git a/tools/create_art_tests.py b/tools/create_art_tests.py
index 7cf53b9..600c140 100755
--- a/tools/create_art_tests.py
+++ b/tools/create_art_tests.py
@@ -3,14 +3,16 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
+import os
from os import makedirs, listdir
from os.path import join, exists, isdir
from string import Template, upper
from sys import exit
from shutil import rmtree
-OUTPUT_DIR = "build/generated/test/java/com/android/tools/r8/art"
-TEST_DIR = "tests/2017-07-27/art"
+OUTPUT_DIR = os.path.join('build', 'generated', 'test', 'java', 'com',
+ 'android', 'tools', 'r8', 'art')
+TEST_DIR = os.path.join('tests', '2017-07-27', 'art')
TOOLCHAINS = ["dx", "jack", "none"]
TOOLS = ["r8", "d8"]
TEMPLATE = Template(
diff --git a/tools/test.py b/tools/test.py
index 7818915..0440f57c 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -16,6 +16,7 @@
import uuid
import notify
+
ALL_ART_VMS = ["default", "7.0.0", "6.0.1", "5.1.1", "4.4.4"]
BUCKET = 'r8-test-results'
@@ -41,6 +42,11 @@
'all art vm versions (stopping after first failed execution)',
default="default",
choices=ALL_ART_VMS + ["all"])
+ result.add_option('--dex_vm_kind',
+ help='Whether to use host or target version of runtime',
+ default="host",
+ nargs=1,
+ choices=["host", "target"])
result.add_option('--one_line_per_test',
help='Print a line before a tests starts and after it ends to stdout.',
default=False, action='store_true')
@@ -139,7 +145,8 @@
# Now run tests on selected runtime(s).
vms_to_test = [options.dex_vm] if options.dex_vm != "all" else ALL_ART_VMS
for art_vm in vms_to_test:
- return_code = gradle.RunGradle(gradle_args + ['-Pdex_vm=%s' % art_vm],
+ vm_kind_to_test = "_" + options.dex_vm_kind if art_vm != "default" else ""
+ return_code = gradle.RunGradle(gradle_args + ['-Pdex_vm=%s' % (art_vm + vm_kind_to_test)],
throw_on_failure=False)
if return_code != 0:
if options.archive_failures and os.name != 'nt':