Run test: Remove use of 'get-device-isa' (part 1)
Get the ISA from build configuration rather than investigating
the attached device.
As the first step, assert that those two match.
Test: ./art/test.py -b -r --optimizing --32 001-HelloWorld
Test: ./art/test.py -b -r --optimizing --64 001-HelloWorld
Change-Id: I74e750666f427e741be417e755bd11ad65e32a99
diff --git a/test/default_run.py b/test/default_run.py
index c30b651..3f311a8 100755
--- a/test/default_run.py
+++ b/test/default_run.py
@@ -17,9 +17,10 @@
from argparse import ArgumentParser, BooleanOptionalAction, Namespace
from os import path
from os.path import isfile, isdir, basename
-from typing import List
from subprocess import DEVNULL, PIPE, STDOUT
from tempfile import NamedTemporaryFile
+from testrunner import env
+from typing import List
COLOR = (os.environ.get("LUCI_CONTEXT") == None) # Disable colors on LUCI.
COLOR_BLUE = '\033[94m' if COLOR else ''
@@ -133,6 +134,17 @@
return argp.parse_args(argv)
+def get_target_arch(is64: bool) -> str:
+ # We may build for two arches. Get the one with the expected bitness.
+ arches = [a for a in [env.TARGET_ARCH, env.TARGET_2ND_ARCH] if a]
+ assert len(arches) > 0, "TARGET_ARCH/TARGET_2ND_ARCH not set"
+ if is64:
+ arches = [a for a in arches if a.endswith("64")]
+ assert len(arches) == 1, f"Can not find (unique) 64-bit arch in {arches}"
+ else:
+ arches = [a for a in arches if not a.endswith("64")]
+ assert len(arches) == 1, f"Can not find (unique) 32-bit arch in {arches}"
+ return arches[0]
# Note: This must start with the CORE_IMG_JARS in Android.common_path.mk
# because that's what we use for compiling the boot.art image.
@@ -580,6 +592,8 @@
f"{ANDROID_BUILD_TOP}/art/test/utils/get-device-isa {GET_DEVICE_ISA_BITNESS_FLAG}",
adb.env,
save_cmd=False).stdout.strip()
+ target_arch = get_target_arch(args.is64) # Should return the same ISA.
+ assert ISA == target_arch, f"{ISA} vs {target_arch}"
if not USE_JVM:
FLAGS += f" {ANDROID_FLAGS}"