onnxruntime/tools/python/run_adb.py
Edward Chen 2fa18ea77e
[React Native CI] Record more info to debug E2E test (#13329)
Record more info from the React Native CI E2E test. In particular, log the view hierarchy when exiting the test and dump logs from Android emulator to the build output.
2022-10-18 17:21:28 -07:00

35 lines
877 B
Python
Executable file

#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import logging
import os
import sys
import typing
from util import run
from util.android import get_sdk_tool_paths
def run_adb(android_sdk_root: str, args: typing.List[str]):
sdk_tool_paths = get_sdk_tool_paths(android_sdk_root)
run(sdk_tool_paths.adb, *args)
def main():
logging.getLogger().setLevel(logging.WARNING)
adb_args = sys.argv[1:]
android_sdk_root = os.environ.get("ANDROID_HOME") or os.environ.get("ANDROID_SDK_ROOT")
if android_sdk_root is None:
raise RuntimeError(
"Please provide the Android SDK root with environment variable 'ANDROID_HOME' or "
"environment variable 'ANDROID_SDK_ROOT'."
)
run_adb(android_sdk_root, adb_args)
if __name__ == "__main__":
main()