aboutsummaryrefslogtreecommitdiff
path: root/tests/test_cli_command_validators.py
diff options
context:
space:
mode:
authorBenjamin Klimczak <benjamin.klimczak@arm.com>2023-02-02 14:02:05 +0000
committerBenjamin Klimczak <benjamin.klimczak@arm.com>2023-02-10 13:45:18 +0000
commit7a661257b6adad0c8f53e32b42ced56a1e7d952f (patch)
tree938ad8578c5b9edc0573e810ce64ce0a5bda3d8c /tests/test_cli_command_validators.py
parent50271dee0a84bfc481ce798184f07b5b0b4bc64d (diff)
downloadmlia-7a661257b6adad0c8f53e32b42ced56a1e7d952f.tar.gz
MLIA-769 Expand use of target/backend registries
- Use the target/backend registries to avoid hard-coded names. - Cache target profiles to avoid re-loading them Change-Id: I474b7c9ef23894e1d8a3ea06d13a37652054c62e
Diffstat (limited to 'tests/test_cli_command_validators.py')
-rw-r--r--tests/test_cli_command_validators.py57
1 files changed, 25 insertions, 32 deletions
diff --git a/tests/test_cli_command_validators.py b/tests/test_cli_command_validators.py
index cd048ee..29813f4 100644
--- a/tests/test_cli_command_validators.py
+++ b/tests/test_cli_command_validators.py
@@ -5,7 +5,6 @@ from __future__ import annotations
import argparse
from contextlib import ExitStack
-from unittest.mock import MagicMock
import pytest
@@ -93,72 +92,66 @@ def test_validate_check_target_profile(
@pytest.mark.parametrize(
- "input_target_profile, input_backends, throws_exception,"
- "exception_message, output_backends",
+ (
+ "input_target_profile",
+ "input_backends",
+ "throws_exception",
+ "exception_message",
+ "output_backends",
+ ),
[
[
"tosa",
- ["Vela"],
- True,
- "Vela backend not supported with target-profile tosa.",
+ ["tosa-checker"],
+ False,
None,
+ ["tosa-checker"],
],
[
"tosa",
- ["Corstone-300, Vela"],
+ ["Corstone-310"],
True,
- "Corstone-300, Vela backend not supported with target-profile tosa.",
+ "Backend Corstone-310 not supported with target-profile tosa.",
None,
],
[
"cortex-a",
- ["Corstone-310", "tosa-checker"],
- True,
- "Corstone-310, tosa-checker backend not supported "
- "with target-profile cortex-a.",
+ ["ArmNNTFLiteDelegate"],
+ False,
None,
+ ["ArmNNTFLiteDelegate"],
],
[
- "ethos-u55-256",
- ["tosa-checker", "Corstone-310"],
+ "cortex-a",
+ ["tosa-checker"],
True,
- "tosa-checker backend not supported with target-profile ethos-u55-256.",
+ "Backend tosa-checker not supported with target-profile cortex-a.",
None,
],
- ["tosa", None, False, None, ["tosa-checker"]],
- ["cortex-a", None, False, None, ["ArmNNTFLiteDelegate"]],
- ["tosa", ["tosa-checker"], False, None, ["tosa-checker"]],
- ["cortex-a", ["ArmNNTFLiteDelegate"], False, None, ["ArmNNTFLiteDelegate"]],
[
"ethos-u55-256",
- ["Vela", "Corstone-300"],
+ ["Vela", "Corstone-310"],
False,
None,
- ["Vela", "Corstone-300"],
+ ["Vela", "Corstone-310"],
],
[
- "ethos-u55-256",
- None,
- False,
+ "ethos-u65-256",
+ ["Vela", "Corstone-310", "tosa-checker"],
+ True,
+ "Backend tosa-checker not supported with target-profile ethos-u65-256.",
None,
- ["Vela", "Corstone-300"],
],
],
)
def test_validate_backend(
- monkeypatch: pytest.MonkeyPatch,
input_target_profile: str,
- input_backends: list[str] | None,
+ input_backends: list[str],
throws_exception: bool,
exception_message: str,
output_backends: list[str] | None,
) -> None:
"""Test backend validation with target-profiles and backends."""
- monkeypatch.setattr(
- "mlia.cli.config.get_available_backends",
- MagicMock(return_value=["Vela", "Corstone-300"]),
- )
-
exit_stack = ExitStack()
if throws_exception:
exit_stack.enter_context(