Skip to content

Commit 3cb155c

Browse files
committed
update tests: add architecture selection from config file in emulator helper, update AVD creation logic
1 parent a60c9b6 commit 3cb155c

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

tests/e2e/test_emulator_helper.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,41 @@ def get_sdk_path_from_config(config_file=None):
5858
return str(Path.cwd() / "ovmb_cache" / "android-sdk")
5959

6060

61-
# Global variable that will be initialized in main()
61+
def get_arch_from_config(config_file=None):
62+
"""Get architecture from OVMobileBench config."""
63+
# Use provided config file or default
64+
if config_file:
65+
config_path = Path(config_file)
66+
else:
67+
config_path = Path.cwd() / "experiments" / "android_example.yaml"
68+
69+
if config_path.exists():
70+
with open(config_path) as f:
71+
config = yaml.safe_load(f)
72+
73+
# Get architecture from openvino.toolchain.abi
74+
arch = config.get("openvino", {}).get("toolchain", {}).get("abi", "arm64-v8a")
75+
logger.info(f"Using architecture from config: {arch}")
76+
return arch
77+
78+
# Fallback to default
79+
logger.warning(f"Config not found at {config_path}, using default architecture")
80+
return "arm64-v8a"
81+
82+
83+
# Global variables that will be initialized in main()
6284
ANDROID_HOME = None
85+
ARCHITECTURE = None
6386

6487

6588
def create_avd(api_level: int, avd_name: str = None):
6689
"""Create Android Virtual Device."""
6790
if not avd_name:
6891
avd_name = f"ovmobilebench_avd_api{api_level}"
6992

70-
logger.info(f"Creating AVD '{avd_name}' for API {api_level}...")
93+
logger.info(
94+
f"Creating AVD '{avd_name}' for API {api_level} with architecture {ARCHITECTURE}..."
95+
)
7196

7297
avdmanager_path = Path(ANDROID_HOME) / "cmdline-tools" / "latest" / "bin" / "avdmanager"
7398
cmd = [
@@ -77,7 +102,7 @@ def create_avd(api_level: int, avd_name: str = None):
77102
"-n",
78103
avd_name,
79104
"-k",
80-
f"system-images;android-{api_level};google_apis;arm64-v8a",
105+
f"system-images;android-{api_level};google_apis;{ARCHITECTURE}",
81106
"-d",
82107
"pixel_5",
83108
"--force",
@@ -215,12 +240,14 @@ def main():
215240

216241
args = parser.parse_args()
217242

218-
# Initialize ANDROID_HOME from config
219-
global ANDROID_HOME
243+
# Initialize ANDROID_HOME and ARCHITECTURE from config
244+
global ANDROID_HOME, ARCHITECTURE
220245
ANDROID_HOME = get_sdk_path_from_config(args.config)
246+
ARCHITECTURE = get_arch_from_config(args.config)
221247
os.environ["ANDROID_HOME"] = ANDROID_HOME
222248
os.environ["ANDROID_SDK_ROOT"] = ANDROID_HOME
223249
logger.info(f"Using Android SDK: {ANDROID_HOME}")
250+
logger.info(f"Using architecture: {ARCHITECTURE}")
224251

225252
if args.command == "create-avd":
226253
create_avd(args.api, args.name)

0 commit comments

Comments
 (0)