Skip to content

Commit

Permalink
[microTVM] Add fixture to zephyr test (apache#8393)
Browse files Browse the repository at this point in the history
* fix testing

* trigger
  • Loading branch information
mehrdadh authored and ylc committed Sep 29, 2021
1 parent 6f8ed14 commit 3aa414c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/micro/zephyr/test_zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import tvm
import tvm.rpc
import tvm.micro
import tvm.testing
import tvm.relay as relay

from tvm.micro.contrib import zephyr
Expand Down Expand Up @@ -124,6 +125,7 @@ def _make_add_sess(model, zephyr_board, west_cmd, build_config):


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

Expand All @@ -147,6 +149,7 @@ def test_basic_add(sess):
test_basic_add(sess)


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

Expand Down Expand Up @@ -175,6 +178,7 @@ def test_basic_add(sess):
test_basic_add(sess)


@tvm.testing.requires_micro
def test_relay(platform, west_cmd, skip_build, tvm_debug):
"""Testing a simple relay graph"""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -204,6 +208,7 @@ def test_relay(platform, west_cmd, skip_build, tvm_debug):
tvm.testing.assert_allclose(result, x_in * x_in + 1)


@tvm.testing.requires_micro
def test_onnx(platform, west_cmd, skip_build, tvm_debug):
"""Testing a simple ONNX model."""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -334,6 +339,7 @@ def check_result(
tvm.testing.assert_allclose(out.numpy(), results[idx], rtol=TOL, atol=TOL)


@tvm.testing.requires_micro
def test_byoc_microtvm(platform, west_cmd, skip_build, tvm_debug):
"""This is a simple test case to check BYOC capabilities of microTVM"""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -410,6 +416,7 @@ def _make_add_sess_with_shape(model, zephyr_board, west_cmd, shape, build_config
pytest.param((16 * 1024,), id="(16*1024)"),
],
)
@tvm.testing.requires_micro
def test_rpc_large_array(platform, west_cmd, skip_build, tvm_debug, shape):
"""Test large RPC array transfer."""
model, zephyr_board = PLATFORMS[platform]
Expand Down
6 changes: 6 additions & 0 deletions tests/micro/zephyr/test_zephyr_aot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import tvm
import tvm.rpc
import tvm.micro
import tvm.testing
import tvm.relay as relay

from tvm.micro.contrib import zephyr
Expand Down Expand Up @@ -152,6 +153,7 @@ def _get_message(fd, expr: str):
return data


@tvm.testing.requires_micro
def test_tflite(platform, west_cmd, skip_build, tvm_debug):
"""Testing a TFLite model."""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -213,7 +215,11 @@ def test_tflite(platform, west_cmd, skip_build, tvm_debug):
assert result == 8


@tvm.testing.requires_micro
def test_qemu_make_fail(platform, west_cmd, skip_build, tvm_debug):
if platform not in ["host", "mps2_an521"]:
pytest.skip(msg="Only for QEMU targets.")

"""Testing QEMU make fail."""
model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
Expand Down

0 comments on commit 3aa414c

Please sign in to comment.