Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microTVM][Zephyr] Fix TVMC test on hardware #13598

Merged
merged 2 commits into from
Dec 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions tests/micro/common/test_tvmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ def _run_tvmc(cmd_args: list, *args, **kwargs):
return subprocess.check_call(cmd_args_list, *args, **kwargs)


def create_project_command(project_path: str, mlf_path: str, platform: str, board: str) -> list:
"""Returns create project command with tvmc micro."""
cmd = [
"micro",
"create-project",
project_path,
mlf_path,
platform,
"--project-option",
"project_type=host_driven",
f"board={board}",
]

if platform == "zephyr":
# TODO: 4096 is driven by experiment on nucleo_l4r5zi. We should cleanup this after we have
# better memory management.
cmd.append("config_main_stack_size=4096")
return cmd


@tvm.testing.requires_micro
def test_tvmc_exist(platform, board):
cmd_result = _run_tvmc(["micro", "-h"])
Expand Down Expand Up @@ -93,18 +113,7 @@ def test_tvmc_model_build_only(platform, board, output_dir):
)
assert cmd_result == 0, "tvmc failed in step: compile"

create_project_cmd = [
"micro",
"create-project",
project_dir,
tar_path,
platform,
"--project-option",
"project_type=host_driven",
f"board={board}",
]

cmd_result = _run_tvmc(create_project_cmd)
cmd_result = _run_tvmc(create_project_command(project_dir, tar_path, platform, board))
assert cmd_result == 0, "tvmc micro failed in step: create-project"

build_cmd = ["micro", "build", project_dir, platform]
Expand Down Expand Up @@ -157,18 +166,7 @@ def test_tvmc_model_run(platform, board, output_dir):
)
assert cmd_result == 0, "tvmc failed in step: compile"

create_project_cmd = [
"micro",
"create-project",
project_dir,
tar_path,
platform,
"--project-option",
"project_type=host_driven",
f"board={board}",
]

cmd_result = _run_tvmc(create_project_cmd)
cmd_result = _run_tvmc(create_project_command(project_dir, tar_path, platform, board))
assert cmd_result == 0, "tvmc micro failed in step: create-project"

build_cmd = ["micro", "build", project_dir, platform]
Expand Down