Skip to content

Commit befa671

Browse files
committed
[Backend Tester] Add flow-specific skipped tests, skip argmin/max on Core ML due to native crashes
ghstack-source-id: 36fbd8a ghstack-comment-id: 3257282474 Pull-Request: #13992
1 parent 950420c commit befa671

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

backends/test/suite/flow.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
from dataclasses import dataclass
3+
from dataclasses import dataclass, field
44
from typing import Callable
55

66
from executorch.backends.test.harness import Tester
@@ -35,6 +35,12 @@ class TestFlow:
3535
is_delegated: bool = True
3636
""" Indicates whether the flow is expected to generate CALL_DELEGATE nodes. """
3737

38+
skip_patterns: list[str] = field(default_factory=lambda: [])
39+
""" Tests with names containing any substrings in this list are skipped. """
40+
41+
def should_skip_test(self, test_name: str) -> bool:
42+
return any(pattern in test_name for pattern in self.skip_patterns)
43+
3844

3945
def all_flows() -> dict[str, TestFlow]:
4046
flows = []

backends/test/suite/flows/coreml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _create_coreml_flow(
1919
CoreMLTester, minimum_deployment_target=minimum_deployment_target
2020
),
2121
quantize=quantize,
22+
skip_patterns=["test_argmin", "test_argmax"],
2223
)
2324

2425

backends/test/suite/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def wrapped_test(self):
5252
"use_dynamic_shapes": use_dynamic_shapes,
5353
}
5454
with TestContext(test_name, test_func.__name__, flow.name, params):
55+
if flow.should_skip_test(test_name):
56+
raise unittest.SkipTest(f"Skipping test due to matching flow {flow.name} skip patterns")
57+
5558
test_func(self, flow, dtype, use_dynamic_shapes)
5659

5760
wrapped_test._name = test_func.__name__ # type: ignore

backends/test/suite/operators/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def _make_wrapped_test(
9797
):
9898
def wrapped_test(self):
9999
with TestContext(test_name, test_base_name, flow.name, params):
100+
if flow.should_skip_test(test_name):
101+
raise unittest.SkipTest(f"Skipping test due to matching flow {flow.name} skip patterns")
102+
100103
test_kwargs = copy.copy(params) or {}
101104
test_kwargs["flow"] = flow
102105

0 commit comments

Comments
 (0)