Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ copyright_checker(
srcs = [
".github",
"bazel",
"deps",
"examples",
"itf",
"scripts",
"test",
"third_party",
"tools",
"//:BUILD",
"//:MODULE.bazel",
Expand Down
14 changes: 1 addition & 13 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,6 @@ git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "g
git_repository(
name = "dlt_daemon",
branch = "master",
build_file = "//deps:dlt_daemon.BUILD",
build_file = "//third_party/dlt:dlt_daemon.BUILD",
remote = "https://github.com/draganbjedov/dlt-daemon.git",
)

PYTHON_DLT_VERSION = "2.18.10.1"

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "python_dlt",
build_file = "//deps:python_dlt.BUILD",
sha256 = "cae256ac791d06c4e6e4665dc938e497a7de5784bf6a1244667572953990f324",
strip_prefix = "python-dlt-%s" % PYTHON_DLT_VERSION,
url = "https://github.com/bmwcarit/python-dlt/archive/refs/tags/v%s.tar.gz" % PYTHON_DLT_VERSION,
)
45 changes: 0 additions & 45 deletions bazel/rules/build_as_host.bzl

This file was deleted.

10 changes: 0 additions & 10 deletions config/target_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
"serial_device": "",
"network_interfaces": [],
"ecu_name": "s_core_ecu_qemu_bridge_network_pp",
"data_router_config": {
"vlan_address": "192.168.122.1",
"multicast_addresses": [
"239.255.42.99"
]
},
"qemu_num_cores": 2,
"qemu_ram_size": "1G"
},
Expand All @@ -40,10 +34,6 @@
"serial_device": "",
"network_interfaces": [],
"ecu_name": "s_core_ecu_qemu_port_forwarding_pp",
"data_router_config": {
"vlan_address": "127.0.0.1",
"multicast_addresses": []
},
"qemu_num_cores": 2,
"qemu_ram_size": "1G"
},
Expand Down
4 changes: 3 additions & 1 deletion examples/examples/itf/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@score_itf//:defs.bzl", "py_itf_test")
load("@score_itf//itf/plugins:plugins.bzl", "base", "docker")
load("@score_itf//itf/plugins:plugins.bzl", "base", "dlt", "docker")

py_itf_test(
name = "test_docker",
Expand Down Expand Up @@ -43,6 +43,7 @@ py_itf_test(
],
plugins = [
base,
dlt,
],
)

Expand All @@ -61,5 +62,6 @@ py_itf_test(
],
plugins = [
base,
dlt,
],
)
67 changes: 34 additions & 33 deletions itf/core/base/base_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from itf.core.utils import padder
from itf.core.utils.bunch import Bunch

from itf.plugins.dlt.dlt_receive import DltReceive, Protocol


logger = logging.getLogger(__name__)

Expand All @@ -35,12 +37,6 @@ def pytest_addoption(parser):
default="config/target_config.json",
help="Path to json file with target configurations.",
)
# Internally provided in py_itf_test macro
parser.addoption(
"--dlt_receive_path",
action="store",
help="Path to dlt-receive binary",
)
parser.addoption(
"--ecu",
action="store",
Expand Down Expand Up @@ -86,35 +82,41 @@ def target_config_fixture(request):


@pytest.fixture(scope="session")
def target_fixture(target_config_fixture, test_config_fixture, request):
def target_fixture(target_config_fixture, test_config_fixture, request, dlt_config):
logger.info("Starting target_fixture in base_plugin.py ...")
logger.info(f"Starting tests on host: {socket.gethostname()}")

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 DltReceive(
protocol=Protocol.UDP,
host_ip=dlt_config.host_ip,
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")


def __make_test_config(config):
Expand All @@ -126,7 +128,6 @@ def __make_test_config(config):
qemu_image=config.getoption("qemu_image"),
qvp=config.getoption("qvp"),
hw=config.getoption("hw"),
dlt_receive_path=config.getoption("dlt_receive_path"),
)


Expand Down
2 changes: 1 addition & 1 deletion itf/core/base/target/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ py_library(
"//itf/core/base/os",
"//itf/core/base/target/config",
"//itf/core/base/target/processors",
"//itf/core/dlt",
"//itf/core/qemu",
"//itf/plugins/dlt",
],
)
1 change: 0 additions & 1 deletion itf/core/base/target/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def load_configuration(config_file: str):
serial_device=perf_config["serial_device"],
network_interfaces=perf_config["network_interfaces"],
ecu_name=perf_config["ecu_name"],
data_router_config=perf_config["data_router_config"],
qemu_num_cores=perf_config["qemu_num_cores"],
qemu_ram_size=perf_config["qemu_ram_size"],
params=perf_config.get("params", {}),
Expand Down
20 changes: 4 additions & 16 deletions itf/core/base/target/hw_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
import logging

from contextlib import contextmanager, nullcontext
from itf.core.base.target.base_target import Target
from itf.core.dlt.dlt_receive import DltReceive, Protocol


logger = logging.getLogger(__name__)


@contextmanager
Expand All @@ -29,13 +23,7 @@ def hw_target(target_config, test_config):
diagnostic_ip = None

with nullcontext():
with DltReceive(
target_ip=target_config.ip_address,
protocol=Protocol.UDP,
data_router_config=target_config.data_router_config,
binary_path=test_config.dlt_receive_path,
):
target = Target(test_config.ecu, test_config.os, diagnostic_ip)
target.register_processors()
yield target
target.teardown()
target = Target(test_config.ecu, test_config.os, diagnostic_ip)
target.register_processors()
yield target
target.teardown()
15 changes: 4 additions & 11 deletions itf/core/base/target/qemu_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from itf.core.base.target.base_target import Target
from itf.core.base.target.config.ecu import Ecu
from itf.core.base.target.processors.qemu_processor import TargetProcessorQemu
from itf.core.dlt.dlt_receive import DltReceive, Protocol
from itf.core.qemu.qemu_process import QemuProcess as Qemu


Expand All @@ -41,13 +40,7 @@ def qemu_target(target_config, test_config):
with Qemu(
target_config.qemu_image_path, None, target_config.qemu_ram_size, target_config.qemu_num_cores
) if target_config.qemu_image_path else nullcontext() as qemu_process:
with DltReceive(
target_ip=target_config.ip_address,
protocol=Protocol.UDP,
data_router_config=target_config.data_router_config,
binary_path=test_config.dlt_receive_path,
):
target = TargetQemu(test_config.ecu, test_config.os)
target.register_processors(qemu_process)
yield target
target.teardown()
target = TargetQemu(test_config.ecu, test_config.os)
target.register_processors(qemu_process)
yield target
target.teardown()
8 changes: 4 additions & 4 deletions itf/core/base/target/qvp_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
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.core.dlt.dlt_receive import DltReceive, Protocol
from itf.plugins.dlt.dlt_receive import DltReceive, Protocol


logger = logging.getLogger(__name__)
Expand All @@ -43,10 +43,10 @@ def qvp_target(target_config, test_config):
"""
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,
protocol=Protocol.UDP,
data_router_config=target_config.data_router_config,
binary_path=test_config.dlt_receive_path,
):
target = TargetQvp(test_config.ecu, test_config.os)
target.register_processors(qvp_process)
Expand Down
62 changes: 0 additions & 62 deletions itf/core/dlt/BUILD

This file was deleted.

Loading