Skip to content

Commit 31351b0

Browse files
Arm backend: Add SkipIfNoModelConverter for VGF unit test (#12445)
Signed-off-by: Yufeng Shi <yufeng.shi@arm.com>
1 parent d85fc05 commit 31351b0

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

backends/arm/test/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
arm_executor_runner_exists,
1919
corstone300_installed,
2020
corstone320_installed,
21+
model_converter_installed,
2122
)
2223
from executorch.backends.arm.tosa_specification import TosaSpecification
2324
from executorch.exir.backend.compile_spec_schema import CompileSpec
@@ -245,6 +246,13 @@ def get_u85_compile_spec_unbuilt(
245246
)
246247
"""Xfails a test if Corsone320 FVP is not installed, or if the executor runner is not built"""
247248

249+
SkipIfNoModelConverter = pytest.mark.skipif(
250+
condition=not (model_converter_installed()),
251+
raises=FileNotFoundError,
252+
reason="Did not find model-converter on path",
253+
)
254+
"""Xfails a test if model-converter is not installed"""
255+
248256
xfail_type = str | tuple[str, type[Exception]]
249257

250258

backends/arm/test/ops/test_add.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
from typing import Tuple
99

10-
import pytest
11-
1210
import torch
1311
from executorch.backends.arm.arm_backend import get_tosa_spec
1412
from executorch.backends.arm.quantizer import arm_quantizer
@@ -190,7 +188,7 @@ def test_add_tensor_u85_BI_2(test_data: input_t2):
190188

191189

192190
@common.parametrize("test_data", Add.test_data)
193-
@pytest.mark.skip(reason="Model converter not yet made available")
191+
@common.SkipIfNoModelConverter
194192
def test_add_tensor_vgf_fp(test_data: input_t1):
195193
pipeline = VgfPipeline[input_t1](
196194
Add(), test_data(), aten_op, exir_op, tosa_version="TOSA-1.0+FP"
@@ -199,7 +197,7 @@ def test_add_tensor_vgf_fp(test_data: input_t1):
199197

200198

201199
@common.parametrize("test_data", Add.test_data)
202-
@pytest.mark.skip(reason="Model converter not yet made available")
200+
@common.SkipIfNoModelConverter
203201
def test_add_tensor_vgf_int(test_data: input_t1):
204202
pipeline = VgfPipeline[input_t1](
205203
Add(),

backends/arm/test/runner_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,15 @@ def corstone320_installed() -> bool:
549549
return True
550550

551551

552+
def model_converter_installed() -> bool:
553+
cmd = ["model-converter", "--version"]
554+
try:
555+
_run_cmd(cmd, check=True)
556+
except:
557+
return False
558+
return True
559+
560+
552561
def get_elf_path(target_board):
553562
elf_path = os.path.join(
554563
"arm_test",

0 commit comments

Comments
 (0)