Skip to content

Commit 2daf99c

Browse files
committed
Add check for executor runner + minor documentation fixes
Change-Id: I7cc0d06321282824d1af55f027cd15de0ce95b99
1 parent 417ea05 commit 2daf99c

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

backends/arm/test/common.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from executorch.backends.arm.arm_backend import ArmCompileSpecBuilder
1818
from executorch.backends.arm.tosa_specification import TosaSpecification
1919
from executorch.exir.backend.compile_spec_schema import CompileSpec
20-
from runner_utils import corstone300_installed, corstone320_installed
20+
from runner_utils import corstone300_installed, corstone320_installed, RunnerUtil
2121

2222

2323
def get_time_formatted_path(path: str, log_prefix: str) -> str:
@@ -163,14 +163,18 @@ def get_target_board(compile_spec: list[CompileSpec]) -> str | None:
163163

164164

165165
SkipIfNoCorstone300 = pytest.mark.skipif(
166-
not corstone300_installed(), reason="Did not find Corstone-300 FVP on path"
166+
not corstone300_installed()
167+
or not RunnerUtil.arm_executor_runner_exists("corstone-300"),
168+
reason="Did not find Corstone-300 FVP or executor_runner on path",
167169
)
168-
""" Marks a test as running on Ethos-U55 FVP, e.g. Corstone 300. Skips the test if this is not installed."""
170+
"""Skips a test if Corsone300 FVP is not installed, or if the executor runner is not built"""
169171

170172
SkipIfNoCorstone320 = pytest.mark.skipif(
171-
not corstone320_installed(), reason="Did not find Corstone-320 FVP on path"
173+
not corstone320_installed()
174+
or not RunnerUtil.arm_executor_runner_exists("corstone-320"),
175+
reason="Did not find Corstone-320 FVP or executor_runner on path",
172176
)
173-
""" Marks a test as running on Ethos-U85 FVP, e.g. Corstone 320. Skips the test if this is not installed."""
177+
"""Skips a test if Corsone320 FVP is not installed, or if the executor runner is not built."""
174178

175179

176180
def parametrize(
@@ -185,6 +189,7 @@ def parametrize(
185189
xfails = {}
186190

187191
def decorator_func(func):
192+
"""Test data is transformed from a dict of (id, data) pairs to a list of pytest params to work with the native pytests parametrize function"""
188193
pytest_testsuite = []
189194
for id, test_parameters in test_data.items():
190195
if id in xfails:

backends/arm/test/runner_utils.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,29 @@ def init_run(
246246
def set_timeout(self, timeout: int):
247247
self.timeout = timeout
248248

249+
@staticmethod
250+
def get_elf_path(target_board):
251+
elf_path = os.path.join(
252+
"cmake-out",
253+
f"arm_semihosting_executor_runner_{target_board}",
254+
"arm_executor_runner",
255+
)
256+
if not os.path.exists(elf_path):
257+
raise RuntimeError(
258+
f"Did not find build arm_executor_runner in path {elf_path}, run setup_testing.sh?"
259+
)
260+
else:
261+
return elf_path
262+
263+
@staticmethod
264+
def arm_executor_runner_exists(target_board):
265+
try:
266+
RunnerUtil.get_elf_path(target_board)
267+
except:
268+
return False
269+
else:
270+
return True
271+
249272
def run_corstone(
250273
self,
251274
inputs: Tuple[torch.Tensor],
@@ -272,14 +295,7 @@ def run_corstone(
272295
input_paths.append(
273296
os.path.join(self.intermediate_path, f"{name}.bin"),
274297
)
275-
elf_path = os.path.join(
276-
"cmake-out",
277-
f"arm_semihosting_executor_runner_{self.target_board}",
278-
"arm_executor_runner",
279-
)
280-
assert os.path.exists(
281-
elf_path
282-
), f"Did not find build arm_executor_runner in path {elf_path}, run setup_testing.sh?"
298+
elf_path = self.get_elf_path(self.target_board)
283299

284300
cmd_line = f"executor_runner -m {pte_path} -o {out_path}"
285301

backends/arm/test/tester/test_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BasePipelineMaker(Generic[T]):
2626
module: The module which the pipeline is applied to.
2727
test_data: Data used for quantizing and testing the module.
2828
aten_ops: Aten dialect ops expected to be found in the graph after export.
29-
exir_ops: Exir dialect ops expected to be found in the graph after to_edge, re
29+
exir_ops: Exir dialect ops expected to be found in the graph after to_edge.
3030
compile_spec: The compile spec used in the lowering process
3131
use_edge_to_transform_and_lower: Selects betweeen two possible routes for lowering the module:
3232
tester.to_edge_transform_and_lower()

0 commit comments

Comments
 (0)