Skip to content
Closed
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
18 changes: 18 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,38 @@ common:x86_64-qnx --config=_toolchain_common
common:x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix
common:x86_64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800
common:x86_64-qnx --repo_env=TARGET_ARCH=x86_64
common:x86_64-qnx --sandbox_writable_path=/var
common:x86_64-qnx --action_env=QNX_TARGET_ARCH=x86_64
common:x86_64-qnx --spawn_strategy=local

common:aarch64-qnx --config=_toolchain_common
common:aarch64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix
common:aarch64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800
common:aarch64-qnx --repo_env=TARGET_ARCH=aarch64
common:aarch64-qnx --sandbox_writable_path=/var/tmp
common:aarch64-qnx --action_env=QNX_TARGET_ARCH=aarch64le
common:aarch64-qnx --spawn_strategy=local

common --credential_helper=*.qnx.com=%workspace%/.github/tools/qnx_credential_helper.py

common --action_env=QNXLM_LICENSE_FILE="6287@rb-lic-qnxlm.de.bosch.com" #to be removed


test --test_output=errors
build --incompatible_strict_action_env

common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
common --registry=https://bcr.bazel.build

# ============================================================================
# Integration Test Framework Configuration
# ============================================================================

build:qemu-linux --run_under=@score_itf//scripts:run_under_qemu
build:qemu-linux --test_arg="--qemu"
build:qemu-linux --test_arg="--os=linux"


# ============================================================================
# Feature Flags & S-CORE Configuration
# ============================================================================
Expand Down
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/eclipse-score/devcontainer:latest

# this basically allows QNX license to be checked for the authorized user inside the container .
# it cannot be done at runtime with for ex "sudo sed -i 's/^vscode:/<ntusername>:/' /etc/passwd" because docker will complain about "vscode" user not existing at next startup
ARG USERNAME=invalidusername

# RENAME 'vscode' -> ${USERNAME}
RUN usermod -l ${USERNAME} vscode \
&& groupmod -n ${USERNAME} vscode \
&& usermod -d /home/${USERNAME} -m ${USERNAME}

# GRANT SUDO , is someone using sudo in devcontainer ?
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}
55 changes: 55 additions & 0 deletions .github/workflows/build_and_test_qemu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# *******************************************************************************
# Copyright (c) 2024 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
# *******************************************************************************

# Workflow configuration for S-CORE CI - Bazel Build & Test module
# This workflow runs Bazel build and test when triggered by specific pull request events.

name: Build & Test module (with qnx toolchain)
on:
pull_request:
types: [opened, reopened, synchronize]
merge_group:
types: [checks_requested]
jobs:
build_and_test_host:
# Starting with Ubuntu 24.04 apparmor breaks Bazels linux-sandbox: https://github.com/bazelbuild/bazel/issues/24081
runs-on: ubuntu-22.04
steps:
- name: Clean up disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo docker image prune --all --force
sudo docker builder prune -a
- name: Create Bazel output base directory
run: |
sudo mkdir -p /mnt/.bazel
sudo chown -R $USER:$USER /mnt/.bazel
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.15.0
with:
output-base: /mnt/.bazel
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true
# Cache external/
external-cache: true
- name: Checkout repository
uses: actions/checkout@v4.2.2
- run: df -h
- name: Bazel build targets
run: bazel test //tests/UT:test_ut --test_output=all --config=x86_64-qnx
- run: df -h
if: always()
38 changes: 37 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,25 @@ use_repo(pip, "someip_pip")
bazel_dep(name = "googletest", version = "1.17.0", dev_dependency = True)
bazel_dep(name = "google_benchmark", version = "1.9.4", dev_dependency = True)

bazel_dep(name = "score_itf", version = "0.1.0")
git_override(
module_name = "score_itf",
commit = "e994cb6", # Main branch with simplified QEMU plugin
patch_strip = 1,
patches = ["//third_party:score_itf_oci_conflict.patch"],
remote = "https://github.com/eclipse-score/itf.git",
)

# ============================================================================
# Build System Rules
# ============================================================================
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "rules_rust", version = "0.63.0")
bazel_dep(name = "rules_pkg", version = "1.1.0")

# Required by score_toolchains_qnx qnx_ifs rule for tar extraction
bazel_dep(name = "tar.bzl", version = "0.7.0")

# Platforms: Standard constraint values and platform definitions
# Required for select() expressions that use @platforms//cpu:* and @platforms//os:*
bazel_dep(name = "platforms", version = "1.0.0")
Expand Down Expand Up @@ -119,6 +131,7 @@ gcc.toolchain(
use_default_package = True,
version = "12.2.0",
)

gcc.toolchain(
name = "score_qcc_aarch64_toolchain",
sdp_version = "8.0.0",
Expand All @@ -140,8 +153,31 @@ register_toolchains(
"@score_gcc_aarch64_toolchain//:all",
"@score_qcc_x86_64_toolchain//:all",
"@score_qcc_aarch64_toolchain//:all",
"@toolchains_qnx_ifs//:all",
dev_dependency = True,
"@score_toolchains_qnx+//toolchains/fs/ifs:all",
)

# ============================================================================
# QNX IFS Image Toolchain (for building QEMU filesystem images via mkifs)
# ============================================================================
bazel_dep(name = "score_toolchains_qnx", version = "0.0.7", dev_dependency = True)

toolchains_qnx = use_extension(
"@score_toolchains_qnx//:extensions.bzl",
"toolchains_qnx",
dev_dependency = True,
)
toolchains_qnx.sdp(
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
strip_prefix = "installation",
url = "https://www.qnx.com/download/download/79858/installation.tgz",
)
use_repo(toolchains_qnx, "toolchains_qnx_ifs")
# register_toolchains(
# "@toolchains_qnx_ifs//:ifs_x86_64",
# dev_dependency = True,
# )

# ============================================================================
# LLVM C/C++ Toolchain Configuration
Expand Down Expand Up @@ -263,7 +299,7 @@ http_archive(
build_file = "@//:third_party/vsomeip.BUILD.bazel",
integrity = "sha256-hMjkJs3fQ14MVtpwupfno/UbK+rxV+1zih9632bO5Sk=",
patch_strip = 1,
patches = ["//:third_party/vsomeip-qnx8.patch"],
patches = ["//:third_party/vsomeip_qnx8.patch"],
strip_prefix = "vsomeip-3.6.1",
urls = [
"https://github.com/COVESA/vsomeip/archive/refs/tags/3.6.1.tar.gz",
Expand Down
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# SOME/IP Gateway

The gateway is divided into a gateway daemon (gatewayd) which contains the network-independent logic (payload serialization, etc.) and the SOME/IP daemon (someipd) which binds to the concrete SOME/IP stack.
Expand Down Expand Up @@ -41,39 +40,32 @@ bazel run //examples/car_window_sim:car_window_controller
If you type `open` or `close` the command will be sent via network.


### Dockerized integration test POC
### QEMU x86_64 - based integration test and unit tests

For integration tests, a docker based approach was taken.
As a proof of concept `docker compose` can be used to build, setup and run the containers.
In the future a pytest based setup can be implemented to orchestrate the containers.
For integration tests where the communication between two QEMU instances is required, a custom implementation is used to start and manage the QEMU instances within the test logic. This is because ITF does not support starting multiple QEMU instances in parallel yet.

Build the docker containers:
For the QEMU QNX x864 image to run on host please run the script deployment/qemu/setup_bridge.sh with sudo privileges to setup the required network bridge and tap interfaces.
It is stronly recommended to run all tests with `--nocache_test_results` which is the best way on development cycles to ensure you are always running the latest version of the tests and not accidentally running cached results.

Unit tests are defined by the bazel `test_ut` target:
```sh
docker compose --project-directory tests/integration/docker_setup/ build
bazel test //tests/UT:test_ut --test_output=all --config=x86_64-qnx
```

Start up the containers:

For Integration tests Host to QEMU communication:
```sh
docker compose --project-directory tests/integration/docker_setup/ up
bazel test //tests/integration:test_qemu_network_single --test_output=all --config=x86_64-qnx
```

Those containers are pre-configured (IP adresses, multicast route, ...).
The someipd-1 container already starts up the `gatewayd` and the `someipd`.

In Wireshark the network traffic can be seen by capturing on `any` with `ip.addr== 192.168.87.2 || ip.addr ==192.168.87.3`.

On the client side, start up the `sample_client` in another shell:

For integration tests QEMU to QEMU communication (dual instance test):
```sh
docker exec -it --env VSOMEIP_CONFIGURATION=/home/source/tests/integration/sample_client/vsomeip.json docker_setup-client-1 /home/source/bazel-bin/tests/integration/sample_client/sample_client
bazel test //tests/integration:test_qemu_network_dual --test_output=all --config=x86_64-qnx
```

Finally start the benchmark on the someipd-1 container in a third shell:
For integration tests SOMEIP Service Discovery:

```sh
docker exec -it docker_setup-someipd-1 /home/source/bazel-bin/tests/performance_benchmarks/ipc_benchmarks
bazel test //tests/integration:test_someip_sd --test_output=all --config=x86_64-qnx
```


Expand Down
Loading
Loading