Skip to content

Commit

Permalink
remove skip-build arg
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh committed Aug 10, 2021
1 parent dbb1353 commit f6bb1e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
10 changes: 0 additions & 10 deletions tests/micro/zephyr/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ def pytest_addoption(parser):
parser.addoption(
"--west-cmd", default="west", help="Path to `west` command for flashing device."
)
parser.addoption(
"--skip-build",
action="store_true",
help="If set true, reuses build from the previous test run. Otherwise, build from the scratch.",
)
parser.addoption(
"--tvm-debug",
action="store_true",
Expand All @@ -74,11 +69,6 @@ def west_cmd(request):
return request.config.getoption("--west-cmd")


@pytest.fixture
def skip_build(request):
return request.config.getoption("--skip-build")


@pytest.fixture
def tvm_debug(request):
return request.config.getoption("--tvm-debug")
Expand Down
31 changes: 15 additions & 16 deletions tests/micro/zephyr/test_zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def _make_session(temp_dir, zephyr_board, west_cmd, mod, build_config):
"zephyr_board": zephyr_board,
},
)
if not build_config.get("skip_build"):
project.build()
project.build()
project.flash()
return tvm.micro.Session(project.transport())

Expand All @@ -102,11 +101,11 @@ def _make_add_sess(temp_dir, model, zephyr_board, west_cmd, build_config, dtype=

# The same test code can be executed on both the QEMU simulation and on real hardware.
@tvm.testing.requires_micro
def test_add_uint(temp_dir, platform, west_cmd, skip_build, tvm_debug):
def test_add_uint(temp_dir, platform, west_cmd, tvm_debug):
"""Test compiling the on-device runtime."""

model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
build_config = {"debug": tvm_debug}

# NOTE: run test in a nested function so cPython will delete arrays before closing the session.
def test_basic_add(sess):
Expand Down Expand Up @@ -137,13 +136,13 @@ def has_fpu(zephyr_board):

# The same test code can be executed on both the QEMU simulation and on real hardware.
@tvm.testing.requires_micro
def test_add_float(temp_dir, platform, west_cmd, skip_build, tvm_debug):
def test_add_float(temp_dir, platform, west_cmd, tvm_debug):
"""Test compiling the on-device runtime."""
model, zephyr_board = PLATFORMS[platform]
if not has_fpu(zephyr_board):
pytest.skip(f"FPU not enabled for {platform}")

build_config = {"skip_build": skip_build, "debug": tvm_debug}
build_config = {"debug": tvm_debug}

# NOTE: run test in a nested function so cPython will delete arrays before closing the session.
def test_basic_add(sess):
Expand All @@ -165,11 +164,11 @@ def test_basic_add(sess):


@tvm.testing.requires_micro
def test_platform_timer(temp_dir, platform, west_cmd, skip_build, tvm_debug):
def test_platform_timer(temp_dir, platform, west_cmd, tvm_debug):
"""Test compiling the on-device runtime."""

model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
build_config = {"debug": tvm_debug}

# NOTE: run test in a nested function so cPython will delete arrays before closing the session.
def test_basic_add(sess):
Expand All @@ -194,10 +193,10 @@ def test_basic_add(sess):


@tvm.testing.requires_micro
def test_relay(temp_dir, platform, west_cmd, skip_build, tvm_debug):
def test_relay(temp_dir, platform, west_cmd, tvm_debug):
"""Testing a simple relay graph"""
model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
build_config = {"debug": tvm_debug}
shape = (10,)
dtype = "int8"

Expand Down Expand Up @@ -226,10 +225,10 @@ def test_relay(temp_dir, platform, west_cmd, skip_build, tvm_debug):


@tvm.testing.requires_micro
def test_onnx(temp_dir, platform, west_cmd, skip_build, tvm_debug):
def test_onnx(temp_dir, platform, west_cmd, tvm_debug):
"""Testing a simple ONNX model."""
model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
build_config = {"debug": tvm_debug}

# Load test images.
this_dir = os.path.dirname(__file__)
Expand Down Expand Up @@ -307,10 +306,10 @@ def check_result(


@tvm.testing.requires_micro
def test_byoc_microtvm(temp_dir, platform, west_cmd, skip_build, tvm_debug):
def test_byoc_microtvm(temp_dir, platform, west_cmd, tvm_debug):
"""This is a simple test case to check BYOC capabilities of microTVM"""
model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
build_config = {"debug": tvm_debug}
x = relay.var("x", shape=(10, 10))
w0 = relay.var("w0", shape=(10, 10))
w1 = relay.var("w1", shape=(10, 10))
Expand Down Expand Up @@ -387,10 +386,10 @@ def _make_add_sess_with_shape(temp_dir, model, zephyr_board, west_cmd, shape, bu
],
)
@tvm.testing.requires_micro
def test_rpc_large_array(temp_dir, platform, west_cmd, skip_build, tvm_debug, shape):
def test_rpc_large_array(temp_dir, platform, west_cmd, tvm_debug, shape):
"""Test large RPC array transfer."""
model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
build_config = {"debug": tvm_debug}

# NOTE: run test in a nested function so cPython will delete arrays before closing the session.
def test_tensors(sess):
Expand Down

0 comments on commit f6bb1e1

Please sign in to comment.