Skip to content

Commit

Permalink
[Hexagon] Add skip option for RPC server initialization (apache#12368)
Browse files Browse the repository at this point in the history
* add hardware parallelism in hexagon

* fix name

* lint issue

* better description
  • Loading branch information
farshidsp authored Aug 11, 2022
1 parent 52152e0 commit 48354de
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions python/tvm/contrib/hexagon/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def adb_server_socket() -> str:

@pytest.fixture(scope="session")
def hexagon_server_process(
request, android_serial_number, rpc_server_port_for_session, adb_server_socket
request, android_serial_number, rpc_server_port_for_session, adb_server_socket, skip_rpc
) -> HexagonLauncherRPC:
"""Initials and returns hexagon launcher if ANDROID_SERIAL_NUMBER is defined.
This launcher is started only once per test session.
Expand All @@ -176,12 +176,13 @@ def hexagon_server_process(
"adb_server_socket": adb_server_socket,
}
launcher = HexagonLauncher(serial_number=android_serial_number, rpc_info=rpc_info)

try:
launcher.start_server()
if not skip_rpc:
launcher.start_server()
yield launcher
finally:
launcher.stop_server()
if not skip_rpc:
launcher.stop_server()


@pytest.fixture
Expand Down Expand Up @@ -260,9 +261,21 @@ def aot_target(aot_host_target):
assert False, "Incorrect AoT host target: {aot_host_target}. Options are [c, llvm]."


@pytest.fixture(scope="session")
def skip_rpc(request) -> bool:
return request.config.getoption("--skip-rpc")


def pytest_addoption(parser):
parser.addoption("--gtest_args", action="store", default="")

parser.addoption(
"--skip-rpc",
action="store_true",
default=False,
help="If set true, the RPC server initialization on Android would be skipped",
)


def pytest_generate_tests(metafunc):
option_value = metafunc.config.option.gtest_args
Expand Down

0 comments on commit 48354de

Please sign in to comment.