diff --git a/config/target_config.json b/config/target_config.json index 4a49147..b9f33f2 100644 --- a/config/target_config.json +++ b/config/target_config.json @@ -13,14 +13,6 @@ "qemu_num_cores": 2, "qemu_ram_size": "1G" }, - "safety_processor": { - "name": "S_CORE_ECU_QEMU_BRIDGE_NETWORK_SC", - "ip_address": "192.168.122.76", - "diagnostic_ip_address": "192.168.122.76", - "diagnostic_address": "0x90", - "serial_device": "", - "use_doip": true - }, "other_processors": {} }, "S_CORE_ECU_QEMU_PORT_FORWARDING": { @@ -37,14 +29,6 @@ "qemu_num_cores": 2, "qemu_ram_size": "1G" }, - "safety_processor": { - "name": "CORE_ECU_QEMU_PORT_FORWARDING_SC", - "ip_address": "localhost", - "diagnostic_ip_address": "localhost", - "diagnostic_address": "0x90", - "serial_device": "", - "use_doip": true - }, "other_processors": {} } } diff --git a/itf/core/base/base_plugin.py b/itf/core/base/base_plugin.py index fc304e5..92cf174 100644 --- a/itf/core/base/base_plugin.py +++ b/itf/core/base/base_plugin.py @@ -18,8 +18,6 @@ from itf.core.base.target.config import load_configuration, target_ecu_argparse from itf.core.base.os.operating_system import OperatingSystem from itf.core.base.target.qemu_target import qemu_target -from itf.core.base.target.qvp_target import qvp_target -from itf.core.base.target.hw_target import hw_target from itf.core.base.utils.exec_utils import pre_tests_phase, post_tests_phase from itf.core.utils import padder from itf.core.utils.bunch import Bunch @@ -56,9 +54,6 @@ def pytest_addoption(parser): parser.addoption("--qemu", action="store_true", help="Run tests with QEMU image") parser.addoption("--qemu_image", action="store", help="Path to a QEMU image") - parser.addoption("--qvp", action="store_true", help="Run tests with QVP") - parser.addoption("--hw", action="store_true", help="Run tests against connected HW") - @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_sessionstart(session): @@ -92,31 +87,12 @@ def target_fixture(target_config_fixture, test_config_fixture, request, dlt_conf multicast_ips=dlt_config.multicast_ips, binary_path=dlt_config.dlt_receive_path, ): - if test_config_fixture.qemu: - with qemu_target(target_config_fixture, test_config_fixture) as qemu: - try: - pre_tests_phase(qemu, target_config_fixture.ip_address, test_config_fixture, request) - yield qemu - finally: - post_tests_phase(qemu, test_config_fixture) - - elif test_config_fixture.qvp: - with qvp_target(target_config_fixture, test_config_fixture) as qvp: - try: - pre_tests_phase(qvp, target_config_fixture.ip_address, test_config_fixture, request) - yield qvp - finally: - post_tests_phase(qvp, test_config_fixture) - - elif test_config_fixture.hw: - with hw_target(target_config_fixture, test_config_fixture) as hardware: - try: - pre_tests_phase(hardware, target_config_fixture.ip_address, test_config_fixture, request) - yield hardware - finally: - post_tests_phase(hardware, test_config_fixture) - else: - raise RuntimeError("QEMU, QVP or HW not specified to use") + with qemu_target(target_config_fixture, test_config_fixture) as qemu: + try: + pre_tests_phase(qemu, target_config_fixture.ip_address, test_config_fixture, request) + yield qemu + finally: + post_tests_phase(qemu, test_config_fixture) def __make_test_config(config): @@ -126,8 +102,6 @@ def __make_test_config(config): os=config.getoption("os"), qemu=config.getoption("qemu"), qemu_image=config.getoption("qemu_image"), - qvp=config.getoption("qvp"), - hw=config.getoption("hw"), ) diff --git a/itf/core/base/target/BUILD b/itf/core/base/target/BUILD index 87f0032..0e87414 100644 --- a/itf/core/base/target/BUILD +++ b/itf/core/base/target/BUILD @@ -17,9 +17,7 @@ py_library( srcs = [ "__init__.py", "base_target.py", - "hw_target.py", "qemu_target.py", - "qvp_target.py", ], imports = ["."], visibility = ["//visibility:public"], diff --git a/itf/core/base/target/base_target.py b/itf/core/base/target/base_target.py index 818cb79..f99f4aa 100644 --- a/itf/core/base/target/base_target.py +++ b/itf/core/base/target/base_target.py @@ -13,7 +13,6 @@ import logging from itf.core.base.target.processors.target_processor import TargetProcessor -from itf.core.base.target.processors.safety_processor import TargetSafetyProcessor from itf.core.base.os.operating_system import OperatingSystem from itf.core.base.target.config.ecu import Ecu @@ -38,7 +37,6 @@ def __init__( self.__target_ecu = target_ecu self.__target_sut_os = target_sut_os self.__sut = None - self.__safety_core = None # Other processors for other_ecu in self.target_ecu.others: setattr(self, other_ecu.name.lower(), None) # Will be set when registering processors @@ -60,12 +58,6 @@ def register_processors(self, process=None, initialize_serial_device=True, initi ) self.__processors.append(self.sut) - self.__safety_core = TargetSafetyProcessor( - self.__target_ecu.sc, - OperatingSystem.UNSPECIFIED, - diagnostic_ip=self.__diagnostic_ip, - ) - for processor in self.target_ecu.others: other_processor = TargetProcessor(processor, OperatingSystem.UNSPECIFIED) self.__processors.append(other_processor) @@ -91,14 +83,6 @@ def sut(self): def sut(self, value): self.__sut = value - @property - def safety_core(self): - return self.__safety_core - - @safety_core.setter - def safety_core(self, value): - self.__safety_core = value - @property def processors(self): return self.__processors diff --git a/itf/core/base/target/config/BUILD b/itf/core/base/target/config/BUILD index a4fb786..4d21dbe 100644 --- a/itf/core/base/target/config/BUILD +++ b/itf/core/base/target/config/BUILD @@ -20,7 +20,6 @@ py_library( "config.py", "ecu.py", "performance_processor.py", - "safety_processor.py", ], imports = ["."], visibility = ["//visibility:public"], diff --git a/itf/core/base/target/config/__init__.py b/itf/core/base/target/config/__init__.py index de19f5c..7bbea6f 100644 --- a/itf/core/base/target/config/__init__.py +++ b/itf/core/base/target/config/__init__.py @@ -15,5 +15,4 @@ from .config import ECUS from .config import PERFORMANCE_PROCESSORS -from .config import SAFETY_PROCESSORS from .config import OTHER_PROCESSORS diff --git a/itf/core/base/target/config/config.py b/itf/core/base/target/config/config.py index 6daba3f..65c1af2 100644 --- a/itf/core/base/target/config/config.py +++ b/itf/core/base/target/config/config.py @@ -15,14 +15,12 @@ from itf.core.base.target.config.base_processor import BaseProcessor from itf.core.base.target.config.performance_processor import PerformanceProcessor -from itf.core.base.target.config.safety_processor import SafetyProcessor from itf.core.base.target.config.ecu import Ecu logger = logging.getLogger(__name__) PERFORMANCE_PROCESSORS = {} -SAFETY_PROCESSORS = {} OTHER_PROCESSORS = {} ECUS = {} @@ -55,20 +53,6 @@ def load_configuration(config_file: str): ) PERFORMANCE_PROCESSORS[perf_config["name"]] = performance_processor - safety_processor = None - if "safety_processor" in ecu_config: - safety_config = ecu_config.get("safety_processor") - safety_processor = SafetyProcessor( - name=safety_config["name"], - ip_address=safety_config["ip_address"], - diagnostic_ip_address=safety_config["diagnostic_ip_address"], - diagnostic_address=int(safety_config["diagnostic_address"], 16), - serial_device=safety_config["serial_device"], - use_doip=safety_config.get("use_doip", False), - params=safety_config.get("params", {}), - ) - SAFETY_PROCESSORS[safety_config["name"]] = safety_processor - other_processors = [] for other_name, other_config in ecu_config.get("other_processors", {}).items(): other_processor = BaseProcessor( @@ -86,7 +70,6 @@ def load_configuration(config_file: str): ECUS[ecu_name] = Ecu( name=ecu_name, sut=performance_processor, - sc=safety_processor, others=other_processors, ) diff --git a/itf/core/base/target/config/ecu.py b/itf/core/base/target/config/ecu.py index 9ecbaf9..d29d2ae 100644 --- a/itf/core/base/target/config/ecu.py +++ b/itf/core/base/target/config/ecu.py @@ -13,7 +13,6 @@ from typing import List from itf.core.base.target.config.base_processor import BaseProcessor from itf.core.base.target.config.performance_processor import PerformanceProcessor -from itf.core.base.target.config.safety_processor import SafetyProcessor class Ecu: @@ -22,19 +21,16 @@ def __init__( self, name: str, sut: PerformanceProcessor, - sc: SafetyProcessor, others: List[BaseProcessor] = [], ): """Initialize the Ecu class. :param str name: The name of the ECU. :param sut: The SUT (Software Under Test) processor. - :param sc: The Safety Controller processor. :param others: A list of other processors associated with the ECU. """ self.__name = name self.__sut = sut - self.__sc = sc self.__others = others @property @@ -45,10 +41,6 @@ def name(self): def sut(self): return self.__sut - @property - def sc(self): # pylint: disable=invalid-name - return self.__sc - @property def others(self): return self.__others diff --git a/itf/core/base/target/hw_target.py b/itf/core/base/target/hw_target.py deleted file mode 100644 index 00e6eac..0000000 --- a/itf/core/base/target/hw_target.py +++ /dev/null @@ -1,29 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* -from contextlib import contextmanager, nullcontext -from itf.core.base.target.base_target import Target - - -@contextmanager -def hw_target(target_config, test_config): - """Context manager for hardware target setup. - - Currently, only ITF tests against an already running hardware instance is supported. - """ - diagnostic_ip = None - - with nullcontext(): - target = Target(test_config.ecu, test_config.os, diagnostic_ip) - target.register_processors() - yield target - target.teardown() diff --git a/itf/core/base/target/processors/BUILD b/itf/core/base/target/processors/BUILD index b66529a..a3e765c 100644 --- a/itf/core/base/target/processors/BUILD +++ b/itf/core/base/target/processors/BUILD @@ -17,8 +17,6 @@ py_library( srcs = [ "__init__.py", "qemu_processor.py", - "qvp_processor.py", - "safety_processor.py", "target_processor.py", ], imports = ["."], diff --git a/itf/core/base/target/processors/qvp_processor.py b/itf/core/base/target/processors/qvp_processor.py deleted file mode 100644 index f0df876..0000000 --- a/itf/core/base/target/processors/qvp_processor.py +++ /dev/null @@ -1,27 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* -from itf.core.base.os.operating_system import OperatingSystem -from itf.core.base.target.config.base_processor import BaseProcessor -from itf.core.base.target.processors.target_processor import TargetProcessor - - -class TargetProcessorQVP(TargetProcessor): - def __init__(self, processor: BaseProcessor, os: OperatingSystem, process): - self._process = process - super().__init__(processor, os) - - def kill_process(self): - self._process.stop() - - def restart_process(self): - pass diff --git a/itf/core/base/target/qvp_target.py b/itf/core/base/target/qvp_target.py deleted file mode 100644 index 5a42a55..0000000 --- a/itf/core/base/target/qvp_target.py +++ /dev/null @@ -1,54 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* -import logging -from contextlib import contextmanager, nullcontext - -from itf.core.base.os.operating_system import OperatingSystem -from itf.core.base.target.base_target import Target -from itf.core.base.target.config.ecu import Ecu -from itf.core.base.target.processors.qvp_processor import TargetProcessorQVP -from itf.plugins.dlt.dlt_receive import DltReceive, Protocol - - -logger = logging.getLogger(__name__) - - -class TargetQvp(Target): - """Target for the QVP (QNX Virtual Platform).""" - - def __init__(self, target_ecu: Ecu, target_sut_os: OperatingSystem = OperatingSystem.QNX): - super().__init__(target_ecu, target_sut_os) - - # pylint: disable=unused-argument - def register_processors(self, process=None, initialize_serial_device=True, initialize_serial_logs=True): - self.sut = TargetProcessorQVP(self.target_ecu.sut, self.target_sut_os, process) - self.processors.append(self.sut) - - -@contextmanager -def qvp_target(target_config, test_config): - """Context manager for QVP target setup. - - Currently, only ITF tests against an already running QQVP instance is supported. - """ - with nullcontext() as qvp_process: - with DltReceive( - host_ip=dlt_config.host_ip, - multicast_ips=dlt_config.multicast_ips, - binary_path=dlt_config.dlt_receive_path, - target_ip=target_config.ip_address, - ): - target = TargetQvp(test_config.ecu, test_config.os) - target.register_processors(qvp_process) - yield target - target.teardown()