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][projectAPI] Minimize project build commands #12209

Merged
merged 6 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 1 addition & 3 deletions apps/microtvm/zephyr/template_project/microtvm_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,7 @@ def _find_board_from_cmake_file(cls) -> str:
break

if not zephyr_board:
mehrdadh marked this conversation as resolved.
Show resolved Hide resolved
raise RuntimeError(
f"No Zephyr board set in the {API_SERVER_DIR / CMAKELIST_FILENAME}."
)
raise RuntimeError(f"No Zephyr board set in the {API_SERVER_DIR / CMAKELIST_FILENAME}.")
return zephyr_board

def flash(self, options):
Expand Down
36 changes: 27 additions & 9 deletions tests/micro/common/test_tvmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def test_tvmc_exist(platform, board):
@tvm.testing.requires_micro
@pytest.mark.parametrize(
"output_dir,",
[pathlib.Path("./tvmc_relative_path_test"), pathlib.Path(tempfile.mkdtemp())],
[
pathlib.Path("./tvmc_relative_path_test"),
# pathlib.Path(tempfile.mkdtemp())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that line really to be a comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching, fixed it

],
)
def test_tvmc_model_build_only(platform, board, output_dir):
target = tvm.micro.testing.get_target(platform, board)
Expand Down Expand Up @@ -108,7 +111,10 @@ def test_tvmc_model_build_only(platform, board, output_dir):
cmd_result = _run_tvmc(create_project_cmd)
assert cmd_result == 0, "tvmc micro failed in step: create-project"

cmd_result = _run_tvmc(["micro", "build", project_dir, platform])
build_cmd = ["micro", "build", project_dir, platform]
if platform == "arduino":
build_cmd += ["--project-option", f"{platform}_board={board}"]
cmd_result = _run_tvmc(build_cmd)
assert cmd_result == 0, "tvmc micro failed in step: build"
shutil.rmtree(output_dir)

Expand Down Expand Up @@ -172,22 +178,34 @@ def test_tvmc_model_run(platform, board, output_dir):
cmd_result = _run_tvmc(create_project_cmd)
assert cmd_result == 0, "tvmc micro failed in step: create-project"

cmd_result = _run_tvmc(["micro", "build", project_dir, platform])
build_cmd = ["micro", "build", project_dir, platform]
if platform == "arduino":
build_cmd += ["--project-option", f"{platform}_board={board}"]
cmd_result = _run_tvmc(build_cmd)

assert cmd_result == 0, "tvmc micro failed in step: build"

cmd_result = _run_tvmc(["micro", "flash", project_dir, platform])
flash_cmd = ["micro", "flash", project_dir, platform]
if platform == "arduino":
flash_cmd += ["--project-option", f"{platform}_board={board}"]
cmd_result = _run_tvmc(flash_cmd)
assert cmd_result == 0, "tvmc micro failed in step: flash"

cmd_result = _run_tvmc(
run_cmd = [
"run",
"--device",
"micro",
project_dir,
]
if platform == "arduino":
run_cmd += ["--project-option", f"{platform}_board={board}"]
run_cmd.append(
[
"run",
"--device",
"micro",
project_dir,
"--fill-mode",
"random",
]
)
cmd_result = _run_tvmc()
assert cmd_result == 0, "tvmc micro failed in step: run"
shutil.rmtree(output_dir)

Expand Down