From 2024e6359c40f38ebc42140025244c3ec54084b5 Mon Sep 17 00:00:00 2001 From: Mehrdad Hessar Date: Wed, 14 Dec 2022 09:25:53 -0800 Subject: [PATCH] [microTVM][Zephyr] Fix TVMC test on hardware (#13598) * fixed test * fix flag for arduino --- tests/micro/common/test_tvmc.py | 46 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/micro/common/test_tvmc.py b/tests/micro/common/test_tvmc.py index b2321f7d86a3..3aa7fec2f299 100644 --- a/tests/micro/common/test_tvmc.py +++ b/tests/micro/common/test_tvmc.py @@ -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"]) @@ -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] @@ -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]