Skip to content

Commit 00f2572

Browse files
Arm backend: Remove unittest legacy solutions (#11146)
- Removes corstone_fvp pytest marks - Removes uses of --arm_run_corstoneFVP - Removes @expectedFailureOnFVP - Removes @SkipIfNoCorstone3*0 - Removes pre-push tests related to old tests - Set run_on_fvp=True and use_to_edge_transform_and_lower=True for relevant pipelines. - Updates unittests to work with run_on_fvp=True as default Signed-off-by: Adrian Lundell <[email protected]>
1 parent 4cf5c06 commit 00f2572

18 files changed

+57
-105
lines changed

backends/arm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ backends/arm/test/setup_testing.sh
101101
The you can run the tests with
102102

103103
```
104-
pytest -c /dev/null -v -n auto backends/arm/test --arm_run_corstoneFVP
104+
pytest -c /dev/null -v -n auto backends/arm/test
105105
```
106106

107107
## Passes

backends/arm/scripts/pre-push

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -181,31 +181,6 @@ for COMMIT in ${COMMITS}; do
181181
op_test_files=$(echo $commit_files | grep -oE 'backends/arm/test/ops/\S+')
182182
if [ "$op_test_files" ]; then
183183

184-
# TODO: These checks can be removed when all unittests are refactored.
185-
if grep -icq "SkipIfNoCorstone" $op_test_files; then
186-
echo -e "${ERROR} @SkipIfNoCorstone300/320 is deprecated;"\
187-
"please use XfailIfNoCorstone300/320 instead." >&2
188-
FAILED=1
189-
fi
190-
191-
if grep -icq "conftest.expectedFailureOnFVP" $op_test_files; then
192-
echo -e "${ERROR} @conftest.expectedFailureOnFVP is deprecated;"\
193-
"please use XfailIfCorstone300/320 instead." >&2
194-
FAILED=1
195-
fi
196-
197-
if grep -icq "unittest.TestCase" $op_test_files; then
198-
echo -e "${ERROR} Use of the Unittest test framework is deprecated;"\
199-
"please use Pytest instead." >&2
200-
FAILED=1
201-
fi
202-
203-
if grep -icq "on_fvp(" $op_test_files; then
204-
echo -e "${ERROR} All unittests should run on FVP if relevant,"\
205-
"on_fvp suffix can be excluded." >&2
206-
FAILED=1
207-
fi
208-
209184
# Check that the tested op and target is parsed correctly from the test name
210185
test_names=$(grep -h "def test_" $op_test_files | cut -d"(" -f1 | cut -d" " -f2)
211186
python ./backends/arm/scripts/parse_test_names.py $test_names

backends/arm/test/common.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -186,25 +186,6 @@ def get_u85_compile_spec_unbuilt(
186186
return compile_spec # type: ignore[return-value]
187187

188188

189-
SkipIfNoCorstone300 = pytest.mark.skipif(
190-
not corstone300_installed() or not arm_executor_runner_exists("corstone-300"),
191-
reason="Did not find Corstone-300 FVP or executor_runner on path",
192-
)
193-
"""
194-
TO BE DEPRECATED - Use XfailIfNoCorstone300 instead
195-
Skips a test if Corsone300 FVP is not installed, or if the executor runner is not built
196-
"""
197-
198-
SkipIfNoCorstone320 = pytest.mark.skipif(
199-
not corstone320_installed() or not arm_executor_runner_exists("corstone-320"),
200-
reason="Did not find Corstone-320 FVP or executor_runner on path",
201-
)
202-
"""
203-
TO BE DEPRECATED - Use XfailIfNoCorstone320 instead
204-
Skips a test if Corsone320 FVP is not installed, or if the executor runner is not built
205-
"""
206-
207-
208189
XfailIfNoCorstone300 = pytest.mark.xfail(
209190
condition=not (
210191
corstone300_installed() and arm_executor_runner_exists("corstone-300")

backends/arm/test/conftest.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import logging
77
import os
88
import random
9-
import shutil
109
import sys
1110
from typing import Any
1211

@@ -22,20 +21,6 @@
2221

2322
def pytest_configure(config):
2423
pytest._test_options = {} # type: ignore[attr-defined]
25-
pytest._test_options["corstone_fvp"] = False # type: ignore[attr-defined]
26-
27-
if (
28-
getattr(config.option, "arm_run_corstoneFVP", False)
29-
and config.option.arm_run_corstoneFVP
30-
):
31-
corstone300_exists = shutil.which("FVP_Corstone_SSE-300_Ethos-U55")
32-
corstone320_exists = shutil.which("FVP_Corstone_SSE-320")
33-
if not (corstone300_exists and corstone320_exists):
34-
raise RuntimeError(
35-
"Tests are run with --arm_run_corstoneFVP but corstone FVP is not installed."
36-
)
37-
# Only enable if we also have the TOSA reference model available.
38-
pytest._test_options["corstone_fvp"] = True # type: ignore[attr-defined]
3924

4025
if getattr(config.option, "llama_inputs", False) and config.option.llama_inputs:
4126
pytest._test_options["llama_inputs"] = config.option.llama_inputs # type: ignore[attr-defined]
@@ -135,18 +120,6 @@ def set_random_seed():
135120
# ==== End of Pytest fixtures =====
136121

137122

138-
# ==== Custom Pytest decorators =====
139-
140-
141-
def expectedFailureOnFVP(test_item):
142-
if is_option_enabled("corstone_fvp"):
143-
test_item.__unittest_expecting_failure__ = True
144-
return test_item
145-
146-
147-
# ==== End of Custom Pytest decorators =====
148-
149-
150123
def is_option_enabled(option: str, fail_if_not_enabled: bool = False) -> bool:
151124
"""
152125
Returns whether an option is successfully enabled, i.e. if the flag was

backends/arm/test/misc/test_debug_feats.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,7 @@ def forward(self, x):
212212
@common.parametrize("test_data", Add.inputs)
213213
def test_fail_dump_tosa_ops(caplog, test_data: input_t1):
214214
pipeline = EthosU55PipelineBI[input_t1](
215-
Add(),
216-
test_data,
217-
[],
218-
[],
219-
use_to_edge_transform_and_lower=True,
215+
Add(), test_data, [], [], use_to_edge_transform_and_lower=True, run_on_fvp=False
220216
)
221217
pipeline.dump_operator_distribution("to_edge_transform_and_lower")
222218
pipeline.run()

backends/arm/test/models/test_mobilenet_v2_arm.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
2-
# Copyright 2024-2025 Arm Limited and/or its affiliates.
32
# All rights reserved.
3+
# Copyright 2024-2025 Arm Limited and/or its affiliates.
44
#
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
@@ -53,7 +53,6 @@ def test_mv2_tosa_BI():
5353

5454

5555
@pytest.mark.slow
56-
@pytest.mark.corstone_fvp
5756
@common.XfailIfNoCorstone300
5857
def test_mv2_u55_BI():
5958
pipeline = EthosU55PipelineBI[input_t](
@@ -70,7 +69,6 @@ def test_mv2_u55_BI():
7069

7170

7271
@pytest.mark.slow
73-
@pytest.mark.corstone_fvp
7472
@common.XfailIfNoCorstone320
7573
def test_mv2_u85_BI():
7674
pipeline = EthosU85PipelineBI[input_t](

backends/arm/test/models/test_mobilenet_v3_arm.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def test_mv3_tosa_BI():
5353

5454

5555
@pytest.mark.slow
56-
@pytest.mark.corstone_fvp
5756
@common.XfailIfNoCorstone300
5857
def test_mv3_u55_BI():
5958
pipeline = EthosU55PipelineBI[input_t](
@@ -70,7 +69,6 @@ def test_mv3_u55_BI():
7069

7170

7271
@pytest.mark.slow
73-
@pytest.mark.corstone_fvp
7472
@common.XfailIfNoCorstone320
7573
def test_mv3_u85_BI():
7674
pipeline = EthosU85PipelineBI[input_t](

backends/arm/test/ops/test_alias_copy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def test_alias_tosa_BI(test_data: input_t1):
6464

6565

6666
@common.parametrize("test_data", AliasCopy.test_data)
67+
@common.XfailIfNoCorstone300
6768
def test_alias_u55_BI(test_data: input_t1):
6869
EthosU55PipelineBI[input_t1](
6970
AliasCopy(),
@@ -74,6 +75,7 @@ def test_alias_u55_BI(test_data: input_t1):
7475

7576

7677
@common.parametrize("test_data", AliasCopy.test_data)
78+
@common.XfailIfNoCorstone320
7779
def test_alias_u85_BI(test_data: input_t1):
7880
EthosU85PipelineBI[input_t1](
7981
AliasCopy(),

backends/arm/test/ops/test_arange.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_arange_start_step_tosa_BI(test_data: test_data_t):
9090

9191

9292
@common.parametrize("test_data", ArangeAdd.test_data)
93+
@common.XfailIfNoCorstone300
9394
def test_arange_start_step_u55_BI(test_data: test_data_t):
9495
input_data, init_data = test_data
9596
pipeline = EthosU55PipelineBI[input_t](
@@ -102,6 +103,7 @@ def test_arange_start_step_u55_BI(test_data: test_data_t):
102103

103104

104105
@common.parametrize("test_data", ArangeAdd.test_data)
106+
@common.XfailIfNoCorstone320
105107
def test_arange_start_step_u85_BI(test_data: test_data_t):
106108
input_data, init_data = test_data
107109
pipeline = EthosU85PipelineBI[input_t](

backends/arm/test/ops/test_eye.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_eye_tosa_BI(test_data: test_data_t):
7171

7272

7373
@common.parametrize("test_data", EyeAdd.test_data)
74+
@common.XfailIfNoCorstone300
7475
def test_eye_u55_BI(test_data: test_data_t):
7576
input_data, init_data = test_data
7677
pipeline = EthosU55PipelineBI[input_t](
@@ -84,6 +85,7 @@ def test_eye_u55_BI(test_data: test_data_t):
8485

8586

8687
@common.parametrize("test_data", EyeAdd.test_data)
88+
@common.XfailIfNoCorstone320
8789
def test_eye_u85_BI(test_data: test_data_t):
8890
input_data, init_data = test_data
8991
pipeline = EthosU85PipelineBI[input_t](

0 commit comments

Comments
 (0)