+
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
5 changes: 4 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ exports_files([
py_library(
name = "itf",
srcs = [
"itf/plugins/docker.py",
"//itf/plugins:docker",
],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"//itf/plugins/dlt",
],
)

test_suite(
Expand Down
26 changes: 26 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,29 @@ git_override(
commit = "b5dfbc12754d6698c36d0aaad46183e730dac85c",
remote = "https://github.com/ltekieli/rules_lint.git",
)

################################################################################
#
# Load DLT dependencies
#
################################################################################
git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "dlt_daemon",
branch = "master",
build_file = "//deps: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,
)
File renamed without changes.
12 changes: 12 additions & 0 deletions bazel/rules/as_host/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# *******************************************************************************
# 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
# *******************************************************************************
45 changes: 45 additions & 0 deletions bazel/rules/as_host/rule.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# *******************************************************************************
# 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
# *******************************************************************************

"""
Implements a rule to run generators in host cfg
With this host configuration, generators need to be run only once even if the corresponding results
are built with different bazel configs
"""

def _as_host_impl(ctx):
providers = [
OutputGroupInfo,
CcInfo,
]

output = [
ctx.attr.src[provider]
for provider in providers
if provider in ctx.attr.src
]

if DefaultInfo in ctx.attr.src:
output = output + [DefaultInfo(files = ctx.attr.src[DefaultInfo].files, runfiles = ctx.attr.src[DefaultInfo].data_runfiles)]

return output

as_host = rule(
implementation = _as_host_impl,
attrs = {
"src": attr.label(
allow_files = True,
cfg = "exec",
),
},
)
12 changes: 12 additions & 0 deletions deps/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# *******************************************************************************
# 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
# *******************************************************************************
92 changes: 92 additions & 0 deletions deps/dlt_daemon.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# *******************************************************************************
# 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
# *******************************************************************************
filegroup(
name = "fg_dlt_headers",
srcs = glob([
"include/**/*.h",
]),
)

filegroup(
name = "fg_dlt_receive_SRCS",
srcs = ["src/console/dlt-receive.c"],
)

cc_library(
name = "dlt_headers",
hdrs = [":fg_dlt_headers"],
features = ["third_party_warnings"],
includes = ["include"],
)

cc_library(
name = "dlt-library",
srcs = glob(
[
"src/shared/**/*.c",
"src/shared/**/*.h",
"src/lib/**/*.c",
"src/lib/**/*.h",
"include/**/*.h",
],
) + [
"src/daemon/dlt-daemon_cfg.h",
],
hdrs = [":fg_dlt_headers"],
copts = [
"-pthread",
],
defines = [
"_GNU_SOURCE",
],
features = ["third_party_warnings"],
includes = [
"include",
"include/dlt",
"src/daemon",
"src/lib",
"src/shared",
],
linkopts = [
"-pthread",
"-lrt",
],
deps = [
":dlt_headers",
],
alwayslink = True,
)

cc_binary(
name = "libdlt.so",
features = ["third_party_warnings"],
linkshared = True,
visibility = ["//visibility:public"],
deps = [
":dlt-library",
],
)

cc_binary(
name = "dlt-receive",
srcs = [":fg_dlt_receive_SRCS"],
features = [
"treat_warnings_as_errors",
"strict_warnings",
"additional_warnings",
],
visibility = ["//visibility:public"],
deps = [
":dlt-library",
],
)
19 changes: 19 additions & 0 deletions deps/python_dlt.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# *******************************************************************************
# 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
# *******************************************************************************
py_library(
name = "python_dlt",
srcs = glob(["dlt/**/*.py"]),
imports = ["./dlt"],
tags = ["manual"],
visibility = ["//visibility:public"],
)
5 changes: 5 additions & 0 deletions itf/plugins/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filegroup(
name = "docker",
srcs = ["docker.py"],
visibility = ["//visibility:public"],
)
8 changes: 4 additions & 4 deletions itf/plugins/base/base_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from itf.plugins.base.target.hw_target import hw_target
from itf.plugins.base.test.utils import pre_tests_phase, post_tests_phase
from itf.plugins.utils import padder
from itf.plugins.xtf_common.bunch import Bunch
from itf.plugins.utils.bunch import Bunch


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -83,23 +83,23 @@ def target_fixture(target_config_fixture, test_config_fixture, request):
logger.info(f"Starting tests on host: {socket.gethostname()}")

if test_config_fixture.qemu:
with qemu_target(test_config_fixture) as 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(test_config_fixture) as 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(test_config_fixture) as hardware:
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
Expand Down
2 changes: 1 addition & 1 deletion itf/plugins/base/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
import pytest
from itf.plugins.xtf_common.bunch import Bunch
from itf.plugins.utils.bunch import Bunch

TEST_CONFIG_KEY = pytest.StashKey[Bunch]()
TARGET_CONFIG_KEY = pytest.StashKey[Bunch]()
2 changes: 1 addition & 1 deletion itf/plugins/base/os/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
# pylint: disable=invalid-name
from itf.plugins.xtf_common.bunch import Bunch
from itf.plugins.utils.bunch import Bunch


DIAGNOSTICS_COMMON = {
Expand Down
16 changes: 11 additions & 5 deletions itf/plugins/base/target/hw_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,27 @@

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


logger = logging.getLogger(__name__)


@contextmanager
def hw_target(test_config):
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()
with DltReceive(
target_ip=target_config.ip_address,
protocol=Protocol.UDP,
binary_path="./itf/plugins/dlt/dlt-receive",
):
target = Target(test_config.ecu, test_config.os, diagnostic_ip)
target.register_processors()
yield target
target.teardown()
19 changes: 13 additions & 6 deletions itf/plugins/base/target/qemu_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from itf.plugins.base.target.base_target import Target
from itf.plugins.base.target.config.ecu import Ecu
from itf.plugins.base.target.processors.qemu_processor import TargetProcessorQemu
from itf.plugins.dlt.dlt_receive import DltReceive, Protocol


class TargetQemu(Target):
Expand All @@ -24,19 +25,25 @@ class TargetQemu(Target):
def __init__(self, target_ecu: Ecu, target_sut_os: OperatingSystem = OperatingSystem.LINUX):
super().__init__(target_ecu, target_sut_os)

def register_processors(self, process=None, initialize_serial_device=True, initialize_serial_logs=True): # pylint: disable=unused-argument
# pylint: disable=unused-argument
def register_processors(self, process=None, initialize_serial_device=True, initialize_serial_logs=True):
self.sut = TargetProcessorQemu(self.target_ecu.sut, self.target_sut_os, process)
self.processors.append(self.sut)


@contextmanager
def qemu_target(test_config):
def qemu_target(target_config, test_config):
"""Context manager for QEMU target setup.

Currently, only ITF tests against an already running Qemu instance is supported.
"""
with nullcontext() as qemu_process:
target = TargetQemu(test_config.ecu, test_config.os)
target.register_processors(qemu_process)
yield target
target.teardown()
with DltReceive(
target_ip=target_config.ip_address,
protocol=Protocol.UDP,
binary_path="./itf/plugins/dlt/dlt-receive",
):
target = TargetQemu(test_config.ecu, test_config.os)
target.register_processors(qemu_process)
yield target
target.teardown()
17 changes: 12 additions & 5 deletions itf/plugins/base/target/qvp_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from itf.plugins.base.target.base_target import Target
from itf.plugins.base.target.config.ecu import Ecu
from itf.plugins.base.target.processors.qvp_processor import TargetProcessorQVP
from itf.plugins.dlt.dlt_receive import DltReceive, Protocol


logger = logging.getLogger(__name__)

Expand All @@ -34,13 +36,18 @@ def register_processors(self, process=None, initialize_serial_device=True, initi


@contextmanager
def qvp_target(test_config):
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:
target = TargetQvp(test_config.ecu, test_config.os)
target.register_processors(qvp_process)
yield target
target.teardown()
with DltReceive(
target_ip=target_config.ip_address,
protocol=Protocol.UDP,
binary_path="./itf/plugins/dlt/dlt-receive",
):
target = TargetQvp(test_config.ecu, test_config.os)
target.register_processors(qvp_process)
yield target
target.teardown()
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载