diff options
author | 2022-11-25 12:00:06 +0000 | |
---|---|---|
committer | 2022-11-25 12:00:06 +0000 | |
commit | 49506def246755de6eeea38b51a45b2fdcc77454 (patch) | |
tree | 25e57c538491298b4b23006a3c71317413884d7a /test | |
parent | beed1ca41a9d4c52dd54c22edb974c5df3827698 (diff) |
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
Diffstat (limited to 'test')
-rwxr-xr-x | test/default_run.py | 16 | ||||
-rwxr-xr-x | test/run-test | 13 |
2 files changed, 18 insertions, 11 deletions
diff --git a/test/default_run.py b/test/default_run.py index c30b651079..3f311a83e7 100755 --- a/test/default_run.py +++ b/test/default_run.py @@ -17,9 +17,10 @@ import sys, os, shutil, shlex, re, subprocess, glob 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 @@ def parse_args(argv): 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 @@ def default_run(ctx, args, **kwargs): 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}" diff --git a/test/run-test b/test/run-test index b405de1526..46126228e1 100755 --- a/test/run-test +++ b/test/run-test @@ -18,6 +18,7 @@ import os, sys, glob, re, shutil, subprocess, shlex, resource, atexit import default_run as default_run_module +from default_run import get_target_arch from importlib.machinery import SourceFileLoader from inspect import currentframe, getframeinfo, FrameInfo from pathlib import Path @@ -666,17 +667,9 @@ if True: else: target_arch_name = grep32bit - # We may build for two arches. Get the one with the expected bitness. - arches = [env.TARGET_ARCH, env.TARGET_2ND_ARCH] - if suffix64 == "64": - arch = [a for a in arches if a and a.endswith("64")] - assert len(arch) == 1, f"Can not find unique 64-bit arch in {arches}" - else: - arch = [a for a in arches if a and not a.endswith("64")] - assert len(arch) == 1, f"Can not find unique 32-bit arch in {arches}" - # Check that the heuristics matches build configuration. - assert target_arch_name.strip() == arch[0], f"{target_arch_name.strip()} != {arch[0]}" + arch = get_target_arch(suffix64 == "64") + assert target_arch_name.strip() == arch, f"{target_arch_name.strip()} != {arch}" return target_arch_name.strip() |