Skip to content

Commit

Permalink
[microTVM][Zephyr] Fix TVMC test on hardware (apache#13598)
Browse files Browse the repository at this point in the history
* fixed test

* fix flag for arduino
  • Loading branch information
mehrdadh authored and fzi-peccia committed Mar 27, 2023
1 parent 1a6798f commit 2024e63
Showing 1 changed file with 22 additions and 24 deletions.
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

0 comments on commit 2024e63

Please sign in to comment.