diff --git a/.github/workflows/build_and_test_autosd.yml b/.github/workflows/build_and_test_autosd.yml index 656e549449..46b1d47087 100644 --- a/.github/workflows/build_and_test_autosd.yml +++ b/.github/workflows/build_and_test_autosd.yml @@ -11,23 +11,22 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -name: Build and Test AutoSD +name: AutoSD - Build & Test on: pull_request: + types: [opened, reopened, synchronize] paths: - - 'autosd/**' - push: - branches: - - main - release: - types: [created] - workflow_dispatch: + - 'integration/**' + merge_group: + types: [checks_requested] + paths: + - 'integration/**' jobs: build: - name: build-and-test-autosd + name: x86_64 runs-on: ubuntu-latest steps: @@ -44,18 +43,18 @@ jobs: - name: Build Lola Demo run: | - bazel build --config=bl-x86_64-linux-autosd //:lola-demo - working-directory: ./autosd + bazel build --config=autosd-x86_64 //images/autosd_x86_64:lola-demo + working-directory: ./integration - name: Copy RPMs run: | set -e - mkdir -p ./build/rpms - cp bazel-out/k8-fastbuild/bin/lola-demo-1.0.0-1.x86_64.rpm ./build/rpms - cp bazel-out/k8-fastbuild/bin/lola-demo-1.0.0-1.src.rpm ./build/rpms - createrepo_c ./build/rpms/ - ls -l ./build/rpms/ - working-directory: ./autosd + mkdir -p ./images/autosd_x86_64/build/rpms + cp bazel-out/k8-fastbuild/bin/images/autosd_x86_64/lola-demo-1.0.0-1.x86_64.rpm ./images/autosd_x86_64/build/rpms + cp bazel-out/k8-fastbuild/bin/images/autosd_x86_64/lola-demo-1.0.0-1.src.rpm ./images/autosd_x86_64/build/rpms + createrepo_c ./images/autosd_x86_64/build/rpms/ + ls -l ./images/autosd_x86_64/build/rpms/ + working-directory: ./integration - name: Install AIB Tools run: | @@ -64,7 +63,7 @@ jobs: curl -o automotive-image-runner "https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/raw/main/automotive-image-runner" chmod +x automotive-image-runner - working-directory: ./autosd/build + working-directory: ./integration/images/autosd_x86_64/build - name: Build lola-demo.aib.yml run: | @@ -79,7 +78,7 @@ jobs: disk.qcow2 sudo chown $(id -u) disk.qcow2 - working-directory: ./autosd/build + working-directory: ./integration/images/autosd_x86_64/build - name: Enable KVM group perms run: | @@ -97,8 +96,8 @@ jobs: sleep 10 sshcmd 'bluechictl start agent-qm lola-ipc-sub.service' sleep 5 - sshcmd '/usr/bin/lola-ipc-test' - working-directory: ./autosd/build + # sshcmd '/usr/bin/lola-ipc-test' Disabled until correct exmaples deployed + working-directory: ./integration/images/autosd_x86_64/build env: SSH_PASSWORD: password @@ -106,4 +105,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: autosd10-score-reference_integration-x86_64.qcow2 - path: autosd/build/disk.qcow2 + path: integration/images/autosd_x86_64/build/disk.qcow2 diff --git a/.github/workflows/build_and_test_ebclfsa.yml b/.github/workflows/build_and_test_ebclfsa.yml index f7159ed20a..1d644ab69d 100644 --- a/.github/workflows/build_and_test_ebclfsa.yml +++ b/.github/workflows/build_and_test_ebclfsa.yml @@ -11,23 +11,21 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -name: Build for and Test on EB corbos Linux for Safety Applications +name: EB Corbos Linux for Safety Applications - Build & Test on: pull_request: + types: [opened, reopened, synchronize] paths: - - "ebclfsa/**" - - ".github/workflows/build_and_test_ebclfsa.yml" - push: - branches: - - main - release: - types: [created] - workflow_dispatch: + - 'integration/**' + merge_group: + types: [checks_requested] + paths: + - 'integration/**' jobs: build: - name: build-and-test-ebclfsa + name: aarch64 runs-on: ubuntu-latest container: image: ghcr.io/eclipse-score/devcontainer:v1.1.0 @@ -38,9 +36,8 @@ jobs: - name: Build for EB corbos Linux for Safety Applications and run tests run: | - bazel build --config=aarch64-ebclfsa //scrample_integration:run - bazel build --config=aarch64-ebclfsa //persistency_integration:run - working-directory: ./ebclfsa + bazel build --config=eb-aarch64 //images/ebclfsa_aarch64/scrample_integration:run + working-directory: ./integration - name: Upload test logs uses: actions/upload-artifact@v5 @@ -48,4 +45,3 @@ jobs: name: test-logs path: | ebclfsa/bazel-bin/scrample_integration/*.log - ebclfsa/bazel-bin/persistency_integration/*.log diff --git a/.github/workflows/build_and_test_on_every_pr.yml b/.github/workflows/build_and_test_on_every_pr.yml deleted file mode 100644 index 9cb19b46d5..0000000000 --- a/.github/workflows/build_and_test_on_every_pr.yml +++ /dev/null @@ -1,56 +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 -# ******************************************************************************* - -name: Test reference integration -on: - pull_request: - types: [opened, reopened, synchronize] - merge_group: - types: [checks_requested] - -permissions: - contents: write - -jobs: - test_reference_integration: - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4.2.2 - - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.9.1 - - name: Setup QNX License - env: - SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }} - run: | - mkdir -p /opt/score_qnx/license - echo "${SCORE_QNX_LICENSE}" | base64 --decode > /opt/score_qnx/license/licenses - - name: Install qemu - run: | - sudo apt-get update - sudo apt-get install -y qemu-system - - name: Enable KVM group perms - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - name: Bazel execute showcase examples - run: | - set -e - bazel build --config x86_64-linux //feature_showcase:all_examples - while read -r target; do - bazel run --config x86_64-linux "$target" - done < ci/showcase_targets_run.txt - - name: Feature Integration Tests - run: | - bazel test --config x86_64-linux //feature_integration_tests/test_cases:fit diff --git a/.github/workflows/build_and_test_qnx.yml b/.github/workflows/build_and_test_qnx.yml new file mode 100644 index 0000000000..a26add8f6f --- /dev/null +++ b/.github/workflows/build_and_test_qnx.yml @@ -0,0 +1,69 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* + +name: QNX8 - Build & Test +on: + pull_request: + types: [opened, reopened, synchronize] + paths: + - 'integration/**' + merge_group: + types: [checks_requested] + paths: + - 'integration/**' + +jobs: + qnx-build-x86_64: + name: x86_64 + runs-on: ${{ vars.REPO_RUNNER_LABELS && fromJSON(vars.REPO_RUNNER_LABELS) || 'ubuntu-latest' }} + environment: ${{ inputs.environment-name }} + permissions: + contents: read + pull-requests: read + + steps: + - name: Checkout repository (Handle all events) + uses: actions/checkout@v4.2.2 + with: + ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + + - name: Setup Bazel with shared caching + uses: bazel-contrib/setup-bazel@0.18.0 + with: + disk-cache: ${{ inputs.bazel-disk-cache }} + repository-cache: true + bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} + + - name: Prepare QNX license + env: + SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }} + run: | + set -euo pipefail + + LICENSE_DIR="/opt/score_qnx/license" + sudo mkdir -p "${LICENSE_DIR}" + echo "${SCORE_QNX_LICENSE}" | base64 --decode | sudo tee "${LICENSE_DIR}/licenses" >/dev/null + + - name: Build with QNX toolchain + env: + SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }} + SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }} + run: | + bazel build --config qnx-x86_64 //images/qnx_x86_64:image + working-directory: ./integration + + - name: Cleanup QNX license + if: always() + run: sudo rm -rf /opt/score_qnx \ No newline at end of file diff --git a/.github/workflows/test_integration.yml b/.github/workflows/test_integration.yml index f1e67e95ab..57bc156a9d 100644 --- a/.github/workflows/test_integration.yml +++ b/.github/workflows/test_integration.yml @@ -23,6 +23,7 @@ on: # - cron: '30 2 * * *' # Every night at 02:30 UTC on main branch jobs: integration_test: + if: false # Disable job as now latest greatest main loop does not work uses: ./.github/workflows/reusable_smoke-test.yml secrets: inherit with: diff --git a/MODULE.bazel b/MODULE.bazel index ec3c107dd4..74ca244810 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -33,15 +33,6 @@ python.toolchain( ) use_repo(python) -pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) -pip.parse( - hub_name = "pip_score_venv_test", - python_version = PYTHON_VERSION, - requirements_lock = "//feature_integration_tests/test_cases:requirements.txt.lock", -) - -use_repo(pip, "pip_score_venv_test") - # Special imports for certain modules # communication module dependencies diff --git a/README.md b/README.md index 796e2e3855..ad093657bb 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,43 @@ The reference integration workspace serves as a single Bazel build environment t - Test toolchain and platform support (Linux, QNX, LLVM/GCC) - Prepare for release validation workflows + +## Structure of integration folder + +Intention for each folder is described below + +### bazel_common +Used to keep a common bazel functionalities for `images` like: +- toolchain setups +- common tooling deps +- common S-CORE modules deps +- common `.bzl` extensions needed to streamline images + + +### showcases +Used to keep `S-CORE` wide **showcases** implementation to showcase S-CORE in certain deployments (images). Contains: +- proxy target bundling all `standalone` examples from all `S-CORE` repos to deploy then as single bazel target into image +- implementation of certain **showcases** that shall be deployed into images + +#### cli + +Contains a CLI tool to be used on runner that is showcasing the S-CORE functionality. It will provide superior user experience and will guide user to run examples. +How to use it in Your image, look [here](./integration/showcases/cli/README.md) + +### images +Used to keep concrete `images` for given target platform as bazel modules. Each platform shall have it's own folder with name `{platform}_{arch}` ie. `qnx_aarch64`. + +This `images` shall: + - deploy all `showcases` into image so they can be run inside + - other specific code for given `image` + +### runners +Used to keep thin logic ro reuse `runners` between images, like docker runner etc. + + + + + ## Docs To generate a full documentation of all integrated modules, run: diff --git a/autosd/.bazelrc b/autosd/.bazelrc deleted file mode 100644 index 94e9876fed..0000000000 --- a/autosd/.bazelrc +++ /dev/null @@ -1,71 +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 -# ******************************************************************************* - -common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ -common --registry=https://bcr.bazel.build - - -# Flags needed by score_baselibs and communication modules. -# Do not add more! -build --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False -build --@score_baselibs//score/mw/log/flags:KRemote_Logging=False -build --@score_baselibs//score/json:base_library=nlohmann -build --@score_communication//score/mw/com/flags:tracing_library=stub - -# stop legacy behavior of creating __init__.py files -build --incompatible_default_to_explicit_init_py -build --incompatible_strict_action_env -build --experimental_retain_test_configuration_across_testonly #https://github.com/bazelbuild/bazel/issues/6842 - -test --test_tag_filters=-manual -test --test_output=errors - -build:_bl_common --host_platform=@score_bazel_platforms//:x86_64-linux - -# This config is for internal module usage ONLY. -build:bl-x86_64-linux --config=_bl_common -build:bl-x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux -build:bl-x86_64-linux --extra_toolchains=@gcc_toolchain//:host_gcc_12 - -# This config is for internal module usage ONLY. -build:bl-x86_64-qnx --config=_bl_common -build:bl-x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx -build:bl-x86_64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64 - -# This config is for internal module usage ONLY. -# build --incompatible_enable_cc_toolchain_resolution -build:bl-x86_64-linux-autosd --config=_bl_common -build:bl-x86_64-linux-autosd --platforms=@score_bazel_platforms//:x86_64-linux -build:bl-x86_64-linux-autosd --extra_toolchains=@autosd_10_gcc_repo//:gcc_toolchain_linux_x86_64 -build:bl-x86_64-linux-autosd --force_pic - -# This config is for internal module usage ONLY. -test:bl-x86_64-linux --config=_bl_common -test:bl-x86_64-linux --build_tests_only -test:bl-x86_64-linux --test_tag_filters=-manual -test:bl-x86_64-linux --test_output=errors - - -# config from communication .bazelrc file -# unshare /dev/shm and /tmp -test --sandbox_tmpfs_path=/dev/shm -test --sandbox_tmpfs_path=/tmp - -# Java -build --java_language_version=17 -build --tool_java_language_version=17 -build --java_runtime_version=remotejdk_17 -build --tool_java_runtime_version=remotejdk_17 - -# user specific overrides (like proxy settings) -try-import %workspace%/user.bazelrc diff --git a/autosd/MODULE.bazel b/autosd/MODULE.bazel deleted file mode 100644 index 1ea1e1e142..0000000000 --- a/autosd/MODULE.bazel +++ /dev/null @@ -1,70 +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 -# ******************************************************************************* -module( - name = "os_autosd_reference_integration", - version = "0.0.1", -) - -include("//:score_modules.MODULE.bazel") -include("//:score_toolchains.MODULE.bazel") - -## Python -bazel_dep(name = "rules_python", version = "1.4.1") - -PYTHON_VERSION = "3.12" - -python = use_extension("@rules_python//python/extensions:python.bzl", "python") -python.toolchain( - configure_coverage_tool = True, - is_default = True, - python_version = PYTHON_VERSION, -) -use_repo(python) - -pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) -pip.parse( - hub_name = "pip_score_venv_test", - python_version = PYTHON_VERSION, - requirements_lock = "//feature_integration_tests/python_test_cases:requirements.txt.lock", -) -use_repo(pip, "pip_score_venv_test") - -# communication module dependencies -# archive_override are not forwarded by bazel_dep, so we need to redefine it here -bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost") -archive_override( - module_name = "rules_boost", - strip_prefix = "rules_boost-master", - urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"], -) - -# git_override are not forwarded by bazel_dep, so we need to redefine it here -bazel_dep(name = "trlc") -git_override( - module_name = "trlc", - commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release - remote = "https://github.com/bmw-software-engineering/trlc.git", -) - -# imports for the feature showcase module -bazel_dep(name = "rules_rust", version = "0.61.0") -bazel_dep(name = "score_itf", version = "0.1.0") -bazel_dep(name = "score_crates", version = "0.0.4") - -# RPM packaging support -bazel_dep(name = "rules_rpm", version = "0.1.0") -git_override( - module_name = "rules_rpm", - branch = "main", - remote = "https://github.com/bilelmoussaoui/bazel-rpm.git", -) diff --git a/autosd/patches/communication/0001-example-visibility.patch b/autosd/patches/communication/0001-example-visibility.patch deleted file mode 100644 index 8040c2872b..0000000000 --- a/autosd/patches/communication/0001-example-visibility.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff --git a/score/mw/com/example/ipc_bridge/BUILD b/score/mw/com/example/ipc_bridge/BUILD -index 2c364e1..f797762 100644 ---- a/score/mw/com/example/ipc_bridge/BUILD -+++ b/score/mw/com/example/ipc_bridge/BUILD -@@ -29,6 +29,7 @@ cc_binary( - "@score_baselibs//score/language/futurecpp", - "@score_baselibs//score/mw/log", - ], -+ visibility = ["//visibility:public"] - ) - - cc_library( -@@ -45,6 +46,7 @@ cc_library( - "//score/mw/com", - "@score_baselibs//score/mw/log", - ], -+ visibility = ["//visibility:public"] - ) - - cc_library( -@@ -60,6 +62,7 @@ cc_library( - "//score/mw/com", - "@score_baselibs//score/language/futurecpp", - ], -+ visibility = ["//visibility:public"] - ) - - rust_library( -@@ -70,6 +73,7 @@ rust_library( - "//score/mw/com/impl/rust:mw_com", - "@crate_index//:libc", - ], -+ visibility = ["//visibility:public"] - ) - - rust_binary( -@@ -84,6 +88,7 @@ rust_binary( - "@crate_index//:clap", - "@crate_index//:futures", - ], -+ visibility = ["//visibility:public"] - ) - - cc_library( -@@ -94,4 +99,10 @@ cc_library( - ":datatype", - "//score/mw/com/impl/rust:bridge_macros", - ], -+ visibility = ["//visibility:public"] -+) -+ -+exports_files( -+ ["etc/mw_com_config.json", "etc/logging.json"], -+ visibility = ["//visibility:public"] - ) diff --git a/autosd/score_modules.MODULE.bazel b/autosd/score_modules.MODULE.bazel deleted file mode 100644 index 22a726be63..0000000000 --- a/autosd/score_modules.MODULE.bazel +++ /dev/null @@ -1,94 +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 -# ******************************************************************************* - -bazel_dep(name = "score_baselibs") -single_version_override( - module_name = "score_baselibs", - version = "0.1.3", - patches = [ - "//patches/baselibs:0001-RH-exception-header.patch", - "//patches/baselibs:0002-RH-algorithm-header.patch", - ], - patch_strip = 1, -) - -bazel_dep(name = "score_communication") -single_version_override( - module_name = "score_communication", - version = "0.1.0", - patches = [ - "patches/communication/0001-example-visibility.patch", - ], - patch_strip = 1 -) - -bazel_dep(name = "score_persistency") -single_version_override( - module_name = "score_persistency", - version = "0.2.1", -) - -bazel_dep(name = "score_orchestrator") -single_version_override( - module_name = "score_orchestrator", - version = "0.0.3", -) - -bazel_dep(name = "score_tooling") -single_version_override( - module_name = "score_tooling", - version = "1.0.2", -) - -bazel_dep(name = "score_platform") -single_version_override( - module_name = "score_platform", - version = "0.5.0", -) - -bazel_dep(name = "score_bazel_platforms") -single_version_override( - module_name = "score_bazel_platforms", - version = "0.0.2", -) - -bazel_dep(name = "score_test_scenarios") -single_version_override( - module_name = "score_test_scenarios", - version = "0.3.0", -) - -bazel_dep(name = "score_docs_as_code") -single_version_override( - module_name = "score_docs_as_code", - version = "2.2.0", -) - -bazel_dep(name = "score_process") -single_version_override( - module_name = "score_process", - version = "1.3.2", -) - -bazel_dep(name = "score_feo", version = "1.0.2") -single_version_override( - module_name = "score_feo", - version = "1.0.2", -) - -bazel_dep(name = "score_kyron") -git_override( - module_name = "score_kyron", - remote = "https://github.com/eclipse-score/kyron.git", - commit = "c5837ac6612a5ebf91cd016775f2d3ee85ed6892", -) diff --git a/autosd/score_toolchains.MODULE.bazel b/autosd/score_toolchains.MODULE.bazel deleted file mode 100644 index a2aecce635..0000000000 --- a/autosd/score_toolchains.MODULE.bazel +++ /dev/null @@ -1,33 +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 -# ******************************************************************************* -bazel_dep(name = "os_autosd_toolchain", version = "0.0.1") -# override with git -git_override( - module_name = "os_autosd_toolchain", - remote = "https://github.com/odra/inc_os_autosd.git", - branch = "repo-new-structure", - strip_prefix = "toolchain" - -) -autosd_10_gcc = use_extension("@os_autosd_toolchain//autosd_10_gcc:extensions.bzl", "autosd_10_gcc_extension") -use_repo(autosd_10_gcc, "autosd_10_gcc_repo") -register_toolchains("@autosd_10_gcc_repo//:gcc_toolchain_linux_x86_64") - -autosd_9_gcc = use_extension("@os_autosd_toolchain//autosd_9_gcc:extensions.bzl", "autosd_9_gcc_extension") -use_repo(autosd_9_gcc, "autosd_9_gcc_repo") -register_toolchains("@autosd_9_gcc_repo//:gcc_toolchain_linux_x86_64") - -# Register the RPM toolchain -rpm_toolchain = use_extension("@rules_rpm//toolchains:extensions.bzl", "rpm_toolchain") -use_repo(rpm_toolchain, "rpm_toolchain") -register_toolchains("@rules_rpm//toolchains:linux_x86_64") diff --git a/ebclfsa/.bazelrc b/ebclfsa/.bazelrc deleted file mode 100644 index c9589ef9ce..0000000000 --- a/ebclfsa/.bazelrc +++ /dev/null @@ -1,14 +0,0 @@ -common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ -common --registry=https://bcr.bazel.build - -build:_common --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False -build:_common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False -build:_common --@score_baselibs//score/json:base_library=nlohmann -build:_common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False -build:_common --@score_communication//score/mw/com/flags:tracing_library=stub -build:_common --cxxopt=-Wno-error=mismatched-new-delete - -build:aarch64-ebclfsa --config=_common -build:aarch64-ebclfsa --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13 -build:aarch64-ebclfsa --platforms=@score_toolchains_gcc//platforms:aarch64-linux -build:aarch64-ebclfsa --spawn_strategy=local diff --git a/ebclfsa/.bazelversion b/ebclfsa/.bazelversion deleted file mode 100644 index 6da4de57dc..0000000000 --- a/ebclfsa/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -8.4.1 diff --git a/ebclfsa/MODULE.bazel b/ebclfsa/MODULE.bazel deleted file mode 100644 index 04b66a5975..0000000000 --- a/ebclfsa/MODULE.bazel +++ /dev/null @@ -1,69 +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 -# ******************************************************************************* - -"EB corbos Linux for Safety Applications - S-CORE Reference Integration" - -module( - name = "reference_integration_ebclfsa", - version = "0.1.0", - compatibility_level = 0, -) - -bazel_dep(name = "rules_cc", version = "0.2.1") - -bazel_dep(name = "score_toolchains_gcc", dev_dependency=True) -git_override( # Elektrobit corbos Linux for Safety Applications needs a specific toolchain - module_name = "score_toolchains_gcc", - remote = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc.git", - tag = "0.5.0-beta" # corresponds to git sha 158921ffd9aabef41a2a03bca5baeaa9f4aa9d33 -) -gcc = use_extension("@score_toolchains_gcc//extensions:gcc.bzl", "gcc", dev_dependency=True) -gcc.toolchain( - url = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/download/0.5.0-beta/fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64.tar.gz", - sha256 = "05b57bbc8d99d46df6b57f774c39a5a2664964ea7eb94147cbece08508c1f121", - strip_prefix = "fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64", -) -use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc") - -bazel_dep(name = "score_docs_as_code", version = "2.2.0") # part of 0.5.0-beta release -single_version_override( - module_name = "score_docs_as_code", - version = "2.2.0", -) - -bazel_dep(name = "score_baselibs") -single_version_override( - module_name = "score_baselibs", - version = "0.2.2", # part of 0.5.0-beta release - patch_strip = 1, - patches = [ - "//patches:fix_hard_coded_amd64.patch", - ], -) -bazel_dep(name = "score_communication", version = "0.1.2") # part of 0.5.0-beta release -bazel_dep(name = "score_scrample", version = "0.1.0") # part of 0.5.0-beta release -bazel_dep(name = "score_persistency", version = "0.2.2") # part of 0.5.0-beta release - -# git_override is not forwarded by bazel_dep, so we need to redefine it here -git_override( - module_name = "trlc", - remote = "https://github.com/bmw-software-engineering/trlc.git", - commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release -) - -# archive_override is not forwarded by bazel_dep, so we need to redefine it here -archive_override( - module_name = "rules_boost", - urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"], - strip_prefix = "rules_boost-master", -) diff --git a/feature_showcase/BUILD b/feature_showcase/BUILD deleted file mode 100644 index 6844e029a7..0000000000 --- a/feature_showcase/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -filegroup( - name = "all_examples", - srcs = [ - "//feature_showcase/rust:kyron_example", - "//feature_showcase/rust:orch_per_example", - ], -) - - - -genrule( - name = "build_all", - srcs = [ - "//feature_showcase/rust:kyron_example", - "//feature_showcase/rust:orch_per_example", - ], - outs = ["done.txt"], - cmd = "echo built > $@", -) \ No newline at end of file diff --git a/integration/.bazelrc b/integration/.bazelrc new file mode 100644 index 0000000000..f03197f6ef --- /dev/null +++ b/integration/.bazelrc @@ -0,0 +1,47 @@ +common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ +common --registry=https://bcr.bazel.build +common --credential_helper=*.qnx.com=%workspace%/scripts/qnx_credential_helper.py +common --credential_helper_timeout="60s" + +build:_common --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False +build:_common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False +build:_common --@score_baselibs//score/json:base_library=nlohmann +build:_common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False +build:_common --@score_communication//score/mw/com/flags:tracing_library=stub +build:_common --cxxopt=-Wno-error=mismatched-new-delete +build:_common --host_platform=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix +build:_common --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu +build:_common --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix + +build:qnx-x86_64 --config=_common +build:qnx-x86_64 --noexperimental_merged_skyframe_analysis_execution +build:qnx-x86_64 --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 +build:qnx-x86_64 --incompatible_enable_cc_toolchain_resolution +build:qnx-x86_64 --incompatible_strict_action_env +build:qnx-x86_64 --sandbox_writable_path=/var/tmp +build:qnx-x86_64 --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix +build:qnx-x86_64 --extra_toolchains=@score_qcc_x86_64_toolchain//:x86_64-qnx-sdp_8.0.0-posix +build:qnx-x86_64 --extra_toolchains=@toolchains_qnx_ifs//:ifs_x86_64 +build:qnx-x86_64 --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800 + +build:itf-qnx-x86_64 --config=qnx-x86_64 +build:itf-qnx-x86_64 --run_under=@score_itf//scripts:run_under_qemu +build:itf-qnx-x86_64 --test_arg="--qemu" +build:itf-qnx-x86_64 --test_arg="--os=qnx" + + +build:linux-x86_64 --config=_common +build:linux-x86_64 --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix +build:linux-x86_64 --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix + +build:eb-aarch64 --config=_common +build:eb-aarch64 --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13 +build:eb-aarch64 --platforms=@score_toolchains_gcc//platforms:aarch64-linux +build:eb-aarch64 --spawn_strategy=local + + +build:autosd-x86_64 --config=_common +build:autosd-x86_64 --platforms=@score_bazel_platforms//:x86_64-linux +build:autosd-x86_64 --force_pic +build:autosd-x86_64 --extra_toolchains=@autosd_10_gcc_repo//:gcc_toolchain_linux_x86_64 +build:autosd-x86_64 --extra_toolchains=@rules_rpm//toolchains:linux_x86_64 diff --git a/integration/.bazelversion b/integration/.bazelversion new file mode 100644 index 0000000000..e7fdef7e2e --- /dev/null +++ b/integration/.bazelversion @@ -0,0 +1 @@ +8.4.2 diff --git a/autosd/patches/BUILD b/integration/BUILD similarity index 100% rename from autosd/patches/BUILD rename to integration/BUILD diff --git a/integration/MODULE.bazel b/integration/MODULE.bazel new file mode 100644 index 0000000000..3725e8e71e --- /dev/null +++ b/integration/MODULE.bazel @@ -0,0 +1,70 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +module( + name = "score_ref_int_qnx_x86_64", + version = "0.0.1", + compatibility_level = 0, +) + +# Include common modules +include("//bazel_common:score_basic_tools.MODULE.bazel") + +# GCC toolchains +include ("//bazel_common:score_gcc_toolchains.MODULE.bazel") # WIP: Not used yet as have problems with IFS toolchain + +# GCC toolchains +include ("//bazel_common:score_qnx_toolchains.MODULE.bazel") # WIP: Not used yet as have problems with IFS toolchain + +# Rust toolchains +include ("//bazel_common:score_rust_toolchains.MODULE.bazel") + +# Python support +include("//bazel_common:score_python.MODULE.bazel") + +# Score modules +include("//bazel_common:score_modules.MODULE.bazel") + +bazel_dep(name = "score_itf", version = "0.1.0") + +bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost") +archive_override( + module_name = "rules_boost", + urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"], + strip_prefix = "rules_boost-master", +) + +# TRLC dependency for requirements traceability +bazel_dep(name = "trlc", version = "0.0.0") +git_override( + module_name = "trlc", + commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release + remote = "https://github.com/bmw-software-engineering/trlc.git", +) + +git_override( + module_name = "score_toolchains_qnx", + commit = "aa94b4fb566b989d1a00395c810df2cf254a0cec", + remote = "https://github.com/qorix-group/toolchains_qnx.git", +) + + +# Currently required for ifs tooling +bazel_dep(name = "score_toolchains_qnx", version = "0.0.3") +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_sdp") +use_repo(toolchains_qnx, "toolchains_qnx_ifs") diff --git a/integration/README.md b/integration/README.md new file mode 100644 index 0000000000..d9cd398267 --- /dev/null +++ b/integration/README.md @@ -0,0 +1,5 @@ +# Integration directory + +## Get started + +Simply run `./score_starter` and select which integration You want to run. Once running, You will be guided by our welcome cli to run selected examples. \ No newline at end of file diff --git a/autosd/patches/baselibs/BUILD b/integration/bazel_common/BUILD similarity index 100% rename from autosd/patches/baselibs/BUILD rename to integration/bazel_common/BUILD diff --git a/integration/bazel_common/bundlers.bzl b/integration/bazel_common/bundlers.bzl new file mode 100644 index 0000000000..4f769c18d2 --- /dev/null +++ b/integration/bazel_common/bundlers.bzl @@ -0,0 +1,89 @@ +load("@rules_pkg//pkg:pkg.bzl", "pkg_tar") +load("@rules_pkg//pkg:mappings.bzl", "pkg_files") + + +def score_pkg_bundle(name, bins, config_data= None, package_dir = None, other_package_files = []): + """ + Creates a reusable bundle by chaining Bazel packaging rules: + - Collects binaries and config files into a pkg_files target, renaming them into subdirectories. + - Packs them into a tar archive using pkg_tar, optionally with additional package files and a custom package directory. + - Extracts the tar archive using a custom untar rule. + Why: + - Group related binaries and config files into a single package for distribution or deployment. + - Group files from multiple targets into one package so deploying them into image is easy, consistent and same for each image. + Args: + name: Base name for all generated targets. + bins: List of binary file labels to include in the bundle (placed in 'bin/'). + config_data: Optional list of config file labels to include (placed in 'configs/'). + package_dir: Optional directory path for the package root inside the tar archive. + other_package_files: Optional list of additional `NAME_pkg_files` to include in the tar archive that was created by other `score_pkg_bundle` targets. + + """ + + all_files_name = name + "_pkg_files" + bundle_name = name + "_pkg_tar" + all_cfg = name + "_configs" + untar_name = name + + rename_dict = {} + for s in bins: + rename_dict[s] = "bin/" + Label(s).name + + if config_data != None: + for s in config_data: + rename_dict[s] = "configs/" + Label(s).name + + config_data_arr = [] + if config_data != None: + config_data_arr = config_data + + # Step 1: pkg_files + pkg_files( + name = all_files_name, + srcs = bins + config_data_arr, + renames = rename_dict, + visibility = ["//visibility:public"], + ) + + # Step 2: pkg_tar + pkg_tar( + name = bundle_name, + srcs = [":" + all_files_name] + other_package_files, + strip_prefix = "/", + package_dir = package_dir, + visibility = ["//visibility:public"], + ) + + # Step 3: untar + untar( + name = untar_name, + src = ":" + bundle_name, + visibility = ["//visibility:public"], + ) + + # Return the main targets + return { + "all_files": ":" + all_files_name, + "tar": ":" + bundle_name, + "tree": ":" + untar_name, + } + + +def _untar_impl(ctx): + out = ctx.actions.declare_directory(ctx.label.name) + + ctx.actions.run( + inputs = [ctx.file.src], + outputs = [out], + executable = "tar", + arguments = ["-xf", ctx.file.src.path, "-C", out.path], + ) + + return [DefaultInfo(files = depset([out]))] + +untar = rule( + implementation = _untar_impl, + attrs = { + "src": attr.label(allow_single_file = True), + }, +) \ No newline at end of file diff --git a/integration/bazel_common/score_basic_tools.MODULE.bazel b/integration/bazel_common/score_basic_tools.MODULE.bazel new file mode 100644 index 0000000000..ee685dcfbb --- /dev/null +++ b/integration/bazel_common/score_basic_tools.MODULE.bazel @@ -0,0 +1,18 @@ +bazel_dep(name = "rules_shell", version = "0.6.0") +bazel_dep(name = "rules_cc", version = "0.1.1") +bazel_dep(name = "rules_pkg", version = "1.2.0") +bazel_dep(name = "score_bazel_platforms", version = "0.0.4") +bazel_dep(name = "score_crates", version = "0.0.6") +git_override( + module_name = "score_crates", + remote = "https://github.com/eclipse-score/score-crates.git", + commit = "ff8f312cd8ac221ff7562496c7f4d6b9b5c8ebb9", +) + + +bazel_dep(name = "rules_rpm", version = "0.1.0") +git_override( + module_name = "rules_rpm", + branch = "main", + remote = "https://github.com/bilelmoussaoui/bazel-rpm.git", +) diff --git a/integration/bazel_common/score_gcc_toolchains.MODULE.bazel b/integration/bazel_common/score_gcc_toolchains.MODULE.bazel new file mode 100644 index 0000000000..5dca055929 --- /dev/null +++ b/integration/bazel_common/score_gcc_toolchains.MODULE.bazel @@ -0,0 +1,86 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* + + +bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.2") +gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True) + +gcc.toolchain( + name = "score_gcc_x86_64_toolchain", + target_cpu = "x86_64", + target_os = "linux", + use_default_package = True, + version = "12.2.0", +) + +# This is how new gcc more or less shall be registered: TBD by EB +# gcc.sdp( +# name = "fastdev_sdk", +# url = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/download/0.5.0-beta/fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64.tar.gz", +# strip_prefix = "fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64", +# sha256 = "05b57bbc8d99d46df6b57f774c39a5a2664964ea7eb94147cbece08508c1f121", +# build_file = "//ebclfsa_aarch64/toolchain:gcc.BUILD", +# ) +# gcc.toolchain( +# name = "score_ebclfsa_aarch64_toolchain", +# sdp_to_link = "fastdev_sdk", +# target_os = "linux", +# target_cpu = "aarch64", +# version = "12.2.0", +# extra_link_flags = [ +# "-lpthread", +# ] +# ) + +# Workaround until above is fixed +bazel_dep(name = "score_toolchains_gcc", dev_dependency=True) +git_override( # Elektrobit corbos Linux for Safety Applications needs a specific toolchain + module_name = "score_toolchains_gcc", + remote = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc.git", + tag = "0.5.0-beta" # corresponds to git sha 158921ffd9aabef41a2a03bca5baeaa9f4aa9d33 +) +eb = use_extension("@score_toolchains_gcc//extensions:gcc.bzl", "gcc", dev_dependency=True) +eb.toolchain( + url = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/download/0.5.0-beta/fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64.tar.gz", + sha256 = "05b57bbc8d99d46df6b57f774c39a5a2664964ea7eb94147cbece08508c1f121", + strip_prefix = "fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64", +) + + +bazel_dep(name = "os_autosd_toolchain", version = "0.0.1") +# override with git +git_override( + module_name = "os_autosd_toolchain", + remote = "https://github.com/odra/inc_os_autosd.git", + branch = "repo-new-structure", + strip_prefix = "toolchain" + +) +autosd_10_gcc = use_extension("@os_autosd_toolchain//autosd_10_gcc:extensions.bzl", "autosd_10_gcc_extension") +use_repo(autosd_10_gcc, "autosd_10_gcc_repo") + + +autosd_9_gcc = use_extension("@os_autosd_toolchain//autosd_9_gcc:extensions.bzl", "autosd_9_gcc_extension") +use_repo(autosd_9_gcc, "autosd_9_gcc_repo") + + +# Register the RPM toolchain +rpm_toolchain = use_extension("@rules_rpm//toolchains:extensions.bzl", "rpm_toolchain") +use_repo(rpm_toolchain, "rpm_toolchain") + + +use_repo(eb, "gcc_toolchain", "gcc_toolchain_gcc") +use_repo( + gcc, + "score_gcc_x86_64_toolchain", +) \ No newline at end of file diff --git a/integration/bazel_common/score_modules.MODULE.bazel b/integration/bazel_common/score_modules.MODULE.bazel new file mode 100644 index 0000000000..9b58a3d23d --- /dev/null +++ b/integration/bazel_common/score_modules.MODULE.bazel @@ -0,0 +1,35 @@ +bazel_dep(name = "score_baselibs", version = "0.1.3") +bazel_dep(name = "score_communication", version = "0.1.1",) # EB needs 0.1.2 but others does not work with it +bazel_dep(name = "score_persistency", version = "0.2.1") +bazel_dep(name = "score_scrample", version = "0.1.0") +bazel_dep(name = "score_orchestrator") +git_override( + module_name = "score_orchestrator", + remote = "https://github.com/eclipse-score/orchestrator.git", + commit = "18e136c34750c5db707f27f917d52efc7541e087", +) + +bazel_dep(name = "score_kyron") +git_override( + module_name = "score_kyron", + remote = "https://github.com/eclipse-score/kyron.git", + commit = "ed312bdc6a50abc73f97b8c7e2ad4726fed06e81", +) + +git_override( + module_name = "score_persistency", + remote = "https://github.com/eclipse-score/persistency.git", + commit = "0037034bf853e5f955f028fab54ed319fb0441c3", +) + + +single_version_override( + module_name = "score_baselibs", + version = "0.1.3", + patch_strip = 1, + patches = [ + "//patches/baselibs:003-acl-fixes-for-aarch64.patch", + "//patches/baselibs:0001-RH-exception-header.patch", + "//patches/baselibs:0002-RH-algorithm-header.patch", + ], +) \ No newline at end of file diff --git a/integration/bazel_common/score_python.MODULE.bazel b/integration/bazel_common/score_python.MODULE.bazel new file mode 100644 index 0000000000..7a8c265621 --- /dev/null +++ b/integration/bazel_common/score_python.MODULE.bazel @@ -0,0 +1,12 @@ + +bazel_dep(name = "rules_python", version = "1.0.0") + +PYTHON_VERSION = "3.12" + +python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python.toolchain( + configure_coverage_tool = True, + is_default = True, + python_version = PYTHON_VERSION, +) +use_repo(python) \ No newline at end of file diff --git a/integration/bazel_common/score_qnx_toolchains.MODULE.bazel b/integration/bazel_common/score_qnx_toolchains.MODULE.bazel new file mode 100644 index 0000000000..4ff05dd7a0 --- /dev/null +++ b/integration/bazel_common/score_qnx_toolchains.MODULE.bazel @@ -0,0 +1,25 @@ + +qcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True) + +qcc.toolchain( + name = "score_qcc_aarch64_toolchain", + sdp_version = "8.0.0", + target_cpu = "aarch64", + target_os = "qnx", + use_default_package = True, + version = "12.2.0", +) + +qcc.toolchain( + name = "score_qcc_x86_64_toolchain", + sdp_version = "8.0.0", + target_cpu = "x86_64", + target_os = "qnx", + use_default_package = True, + version = "12.2.0", +) +use_repo( + qcc, + "score_qcc_aarch64_toolchain", + "score_qcc_x86_64_toolchain", +) diff --git a/integration/bazel_common/score_rust_toolchains.MODULE.bazel b/integration/bazel_common/score_rust_toolchains.MODULE.bazel new file mode 100644 index 0000000000..4ade3bd300 --- /dev/null +++ b/integration/bazel_common/score_rust_toolchains.MODULE.bazel @@ -0,0 +1,7 @@ +bazel_dep(name = "rules_rust", version = "0.61.0") +bazel_dep(name = "score_toolchains_rust", version = "0.4.0", dev_dependency = True) +git_override( + module_name = "rules_rust", + remote = "https://github.com/pawelrutkaq/rules_rust.git", # To be fixed once rule_rust is in score bazel registry + commit = "293337fd6402ec3dfbeb8f2d589f38ad9124dadd", +) \ No newline at end of file diff --git a/ebclfsa/patches/BUILD b/integration/feature_integration_tests/BUILD similarity index 100% rename from ebclfsa/patches/BUILD rename to integration/feature_integration_tests/BUILD diff --git a/feature_integration_tests/README.md b/integration/feature_integration_tests/README.md similarity index 100% rename from feature_integration_tests/README.md rename to integration/feature_integration_tests/README.md diff --git a/qnx_qemu/scrample_integration/BUILD b/integration/feature_integration_tests/configs/BUILD similarity index 92% rename from qnx_qemu/scrample_integration/BUILD rename to integration/feature_integration_tests/configs/BUILD index 765f9898c5..49587392d5 100644 --- a/qnx_qemu/scrample_integration/BUILD +++ b/integration/feature_integration_tests/configs/BUILD @@ -10,7 +10,11 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* - +exports_files( + [ + "qemu_target_config.json", + ], +) exports_files([ "etc/logging.json", @@ -24,4 +28,4 @@ filegroup( "etc/mw_com_config.json", ], visibility = ["//visibility:public"], -) \ No newline at end of file +) diff --git a/ebclfsa/scrample_integration/etc/logging.json b/integration/feature_integration_tests/configs/etc/logging.json similarity index 100% rename from ebclfsa/scrample_integration/etc/logging.json rename to integration/feature_integration_tests/configs/etc/logging.json diff --git a/ebclfsa/scrample_integration/etc/mw_com_config.json b/integration/feature_integration_tests/configs/etc/mw_com_config.json similarity index 100% rename from ebclfsa/scrample_integration/etc/mw_com_config.json rename to integration/feature_integration_tests/configs/etc/mw_com_config.json diff --git a/qnx_qemu/target_config.json b/integration/feature_integration_tests/configs/qemu_target_config.json similarity index 100% rename from qnx_qemu/target_config.json rename to integration/feature_integration_tests/configs/qemu_target_config.json diff --git a/integration/feature_integration_tests/itf/BUILD b/integration/feature_integration_tests/itf/BUILD new file mode 100644 index 0000000000..c757563a0f --- /dev/null +++ b/integration/feature_integration_tests/itf/BUILD @@ -0,0 +1,7 @@ +exports_files( + [ + "test_ssh.py", + "test_scrample.py", + "test_persistency.py", + ], +) \ No newline at end of file diff --git a/qnx_qemu/test/itf/test_persistency.py b/integration/feature_integration_tests/itf/test_persistency.py similarity index 100% rename from qnx_qemu/test/itf/test_persistency.py rename to integration/feature_integration_tests/itf/test_persistency.py diff --git a/qnx_qemu/test/itf/test_scrample.py b/integration/feature_integration_tests/itf/test_scrample.py similarity index 73% rename from qnx_qemu/test/itf/test_scrample.py rename to integration/feature_integration_tests/itf/test_scrample.py index e9533f6645..5acf1d9ef0 100644 --- a/qnx_qemu/test/itf/test_scrample.py +++ b/integration/feature_integration_tests/itf/test_scrample.py @@ -10,30 +10,31 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -from itf.plugins.com.ping import ping -from itf.plugins.com.ssh import execute_command_output import logging +from itf.plugins.com.ssh import execute_command_output + logger = logging.getLogger(__name__) def test_scrample_app_is_deployed(target_fixture): with target_fixture.sut.ssh() as ssh: - exit_code, stdout, stderr = execute_command_output( - ssh, "test -f scrample" - ) + exit_code, stdout, stderr = execute_command_output(ssh, "test -f scrample") assert exit_code == 0, "SSH command failed" def test_scrample_app_is_running(target_fixture): with target_fixture.sut.ssh() as ssh: exit_code, stdout, stderr = execute_command_output( - ssh, "./scrample -n 10 -t 100 -m send & ./scrample -n 5 -t 100 -m recv", - timeout = 30, max_exec_time = 180, - logger_in = logger, verbose = True, + ssh, + "./scrample -n 10 -t 100 -m send & ./scrample -n 5 -t 100 -m recv", + timeout=30, + max_exec_time=180, + logger_in=logger, + verbose=True, ) - logger.info (stdout) - logger.info (stderr) + logger.info(stdout) + logger.info(stderr) assert exit_code == 0, "SSH command failed" diff --git a/qnx_qemu/test/itf/test_ssh.py b/integration/feature_integration_tests/itf/test_ssh.py similarity index 100% rename from qnx_qemu/test/itf/test_ssh.py rename to integration/feature_integration_tests/itf/test_ssh.py diff --git a/feature_integration_tests/test_cases/BUILD b/integration/feature_integration_tests/test_cases/BUILD similarity index 100% rename from feature_integration_tests/test_cases/BUILD rename to integration/feature_integration_tests/test_cases/BUILD diff --git a/feature_integration_tests/test_cases/conftest.py b/integration/feature_integration_tests/test_cases/conftest.py similarity index 100% rename from feature_integration_tests/test_cases/conftest.py rename to integration/feature_integration_tests/test_cases/conftest.py diff --git a/feature_integration_tests/test_cases/fit_scenario.py b/integration/feature_integration_tests/test_cases/fit_scenario.py similarity index 100% rename from feature_integration_tests/test_cases/fit_scenario.py rename to integration/feature_integration_tests/test_cases/fit_scenario.py diff --git a/feature_integration_tests/test_cases/pytest.ini b/integration/feature_integration_tests/test_cases/pytest.ini similarity index 100% rename from feature_integration_tests/test_cases/pytest.ini rename to integration/feature_integration_tests/test_cases/pytest.ini diff --git a/feature_integration_tests/test_cases/requirements.txt b/integration/feature_integration_tests/test_cases/requirements.txt similarity index 100% rename from feature_integration_tests/test_cases/requirements.txt rename to integration/feature_integration_tests/test_cases/requirements.txt diff --git a/feature_integration_tests/test_cases/requirements.txt.lock b/integration/feature_integration_tests/test_cases/requirements.txt.lock similarity index 100% rename from feature_integration_tests/test_cases/requirements.txt.lock rename to integration/feature_integration_tests/test_cases/requirements.txt.lock diff --git a/feature_integration_tests/test_cases/test_properties.py b/integration/feature_integration_tests/test_cases/test_properties.py similarity index 100% rename from feature_integration_tests/test_cases/test_properties.py rename to integration/feature_integration_tests/test_cases/test_properties.py diff --git a/feature_integration_tests/test_cases/tests/basic/test_orchestration_with_persistency.py b/integration/feature_integration_tests/test_cases/tests/basic/test_orchestration_with_persistency.py similarity index 100% rename from feature_integration_tests/test_cases/tests/basic/test_orchestration_with_persistency.py rename to integration/feature_integration_tests/test_cases/tests/basic/test_orchestration_with_persistency.py diff --git a/feature_integration_tests/test_cases/tests/persistency/test_multiple_kvs_per_app.py b/integration/feature_integration_tests/test_cases/tests/persistency/test_multiple_kvs_per_app.py similarity index 100% rename from feature_integration_tests/test_cases/tests/persistency/test_multiple_kvs_per_app.py rename to integration/feature_integration_tests/test_cases/tests/persistency/test_multiple_kvs_per_app.py diff --git a/feature_integration_tests/test_scenarios/rust/BUILD b/integration/feature_integration_tests/test_scenarios/rust/BUILD similarity index 100% rename from feature_integration_tests/test_scenarios/rust/BUILD rename to integration/feature_integration_tests/test_scenarios/rust/BUILD diff --git a/feature_integration_tests/test_scenarios/rust/src/internals/kyron/mod.rs b/integration/feature_integration_tests/test_scenarios/rust/src/internals/kyron/mod.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/internals/kyron/mod.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/internals/kyron/mod.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/internals/kyron/runtime_helper.rs b/integration/feature_integration_tests/test_scenarios/rust/src/internals/kyron/runtime_helper.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/internals/kyron/runtime_helper.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/internals/kyron/runtime_helper.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/internals/mod.rs b/integration/feature_integration_tests/test_scenarios/rust/src/internals/mod.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/internals/mod.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/internals/mod.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_instance.rs b/integration/feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_instance.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_instance.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_instance.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_parameters.rs b/integration/feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_parameters.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_parameters.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/internals/persistency/kvs_parameters.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/internals/persistency/mod.rs b/integration/feature_integration_tests/test_scenarios/rust/src/internals/persistency/mod.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/internals/persistency/mod.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/internals/persistency/mod.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/main.rs b/integration/feature_integration_tests/test_scenarios/rust/src/main.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/main.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/main.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/scenarios/basic/mod.rs b/integration/feature_integration_tests/test_scenarios/rust/src/scenarios/basic/mod.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/scenarios/basic/mod.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/scenarios/basic/mod.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/scenarios/basic/orchestration_with_persistency.rs b/integration/feature_integration_tests/test_scenarios/rust/src/scenarios/basic/orchestration_with_persistency.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/scenarios/basic/orchestration_with_persistency.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/scenarios/basic/orchestration_with_persistency.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/scenarios/mod.rs b/integration/feature_integration_tests/test_scenarios/rust/src/scenarios/mod.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/scenarios/mod.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/scenarios/mod.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/mod.rs b/integration/feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/mod.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/mod.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/mod.rs diff --git a/feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/multiple_kvs_per_app.rs b/integration/feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/multiple_kvs_per_app.rs similarity index 100% rename from feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/multiple_kvs_per_app.rs rename to integration/feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/multiple_kvs_per_app.rs diff --git a/autosd/BUILD.bazel b/integration/images/autosd_x86_64/BUILD.bazel similarity index 71% rename from autosd/BUILD.bazel rename to integration/images/autosd_x86_64/BUILD.bazel index 43453c4640..82e9bd66d0 100644 --- a/autosd/BUILD.bazel +++ b/integration/images/autosd_x86_64/BUILD.bazel @@ -12,21 +12,23 @@ # ******************************************************************************* load("@rules_rpm//rpm:defs.bzl", "rpm_package") +# TODO: Shall use targets from use-cases +# Bring back files once we cleanup scrample integration soon rpm_package( name = "lola-demo", binaries = [ - "@score_communication//score/mw/com/example/ipc_bridge:ipc_bridge_cpp", + "@score_scrample//src:scrample", ], config_dir = "/etc/lola", - data = [ - "@score_communication//score/mw/com/example/ipc_bridge:etc/mw_com_config.json", - ], + # data = [ + # "@score_communication//score/mw/com/example/ipc_bridge:etc/mw_com_config.json", + # ], data_dir = "/usr/share/lola/examples", description = "LOLA middleware communication libraries for development including core communication, configuration components, and example client/server binaries for testing", - libraries = [ - "@score_communication//score/mw/com:com", - "@score_communication//score/mw/com:config_schema", - ], + # libraries = [ + # "@score_communication//score/mw/com:com", + # "@score_communication//score/mw/com:config_schema", + # ], summary = "LOLA Demo", version = "1.0.0", ) diff --git a/autosd/build/.gitignore b/integration/images/autosd_x86_64/build/.gitignore similarity index 100% rename from autosd/build/.gitignore rename to integration/images/autosd_x86_64/build/.gitignore diff --git a/autosd/build/README.md b/integration/images/autosd_x86_64/build/README.md similarity index 100% rename from autosd/build/README.md rename to integration/images/autosd_x86_64/build/README.md diff --git a/autosd/build/files/bluechi-agent-main.conf b/integration/images/autosd_x86_64/build/files/bluechi-agent-main.conf similarity index 100% rename from autosd/build/files/bluechi-agent-main.conf rename to integration/images/autosd_x86_64/build/files/bluechi-agent-main.conf diff --git a/autosd/build/files/bluechi-agent-qm.conf b/integration/images/autosd_x86_64/build/files/bluechi-agent-qm.conf similarity index 100% rename from autosd/build/files/bluechi-agent-qm.conf rename to integration/images/autosd_x86_64/build/files/bluechi-agent-qm.conf diff --git a/autosd/build/files/bluechi-controller.conf b/integration/images/autosd_x86_64/build/files/bluechi-controller.conf similarity index 100% rename from autosd/build/files/bluechi-controller.conf rename to integration/images/autosd_x86_64/build/files/bluechi-controller.conf diff --git a/autosd/build/files/lola-ipc-pub.service b/integration/images/autosd_x86_64/build/files/lola-ipc-pub.service similarity index 100% rename from autosd/build/files/lola-ipc-pub.service rename to integration/images/autosd_x86_64/build/files/lola-ipc-pub.service diff --git a/autosd/build/files/lola-ipc-sub.service b/integration/images/autosd_x86_64/build/files/lola-ipc-sub.service similarity index 100% rename from autosd/build/files/lola-ipc-sub.service rename to integration/images/autosd_x86_64/build/files/lola-ipc-sub.service diff --git a/autosd/build/files/lola-ipc-test b/integration/images/autosd_x86_64/build/files/lola-ipc-test similarity index 100% rename from autosd/build/files/lola-ipc-test rename to integration/images/autosd_x86_64/build/files/lola-ipc-test diff --git a/autosd/build/files/lola-ipc-test.service b/integration/images/autosd_x86_64/build/files/lola-ipc-test.service similarity index 100% rename from autosd/build/files/lola-ipc-test.service rename to integration/images/autosd_x86_64/build/files/lola-ipc-test.service diff --git a/autosd/build/image.aib.yml b/integration/images/autosd_x86_64/build/image.aib.yml similarity index 100% rename from autosd/build/image.aib.yml rename to integration/images/autosd_x86_64/build/image.aib.yml diff --git a/autosd/build/scripts/run_qemu b/integration/images/autosd_x86_64/build/scripts/run_qemu similarity index 100% rename from autosd/build/scripts/run_qemu rename to integration/images/autosd_x86_64/build/scripts/run_qemu diff --git a/autosd/build/vars-devel.yml b/integration/images/autosd_x86_64/build/vars-devel.yml similarity index 100% rename from autosd/build/vars-devel.yml rename to integration/images/autosd_x86_64/build/vars-devel.yml diff --git a/autosd/build/vars.yml b/integration/images/autosd_x86_64/build/vars.yml similarity index 100% rename from autosd/build/vars.yml rename to integration/images/autosd_x86_64/build/vars.yml diff --git a/ebclfsa/BUILD b/integration/images/ebclfsa_aarch64/BUILD similarity index 100% rename from ebclfsa/BUILD rename to integration/images/ebclfsa_aarch64/BUILD diff --git a/ebclfsa/README.md b/integration/images/ebclfsa_aarch64/README.md similarity index 99% rename from ebclfsa/README.md rename to integration/images/ebclfsa_aarch64/README.md index 992639072e..a7b6fa45dc 100644 --- a/ebclfsa/README.md +++ b/integration/images/ebclfsa_aarch64/README.md @@ -224,7 +224,7 @@ The demo SDK integrates the [S-CORE toolchain with two extensions](https://githu - Additional tooling for AArch64 cross-building. - Additional tool `lisa-elf-enabler`: It marks an ELF header of an application in a way that Linux for Safety Applications detects it as an HI application. - The tool is available to Bazel via `@gcc_toolchain_gcc//:elf-enabler`. + The tool is available to Bazel via `@eb_toolchain_gcc//:elf-enabler`. ### Bazel Rules for the Example Applications diff --git a/ebclfsa/docs/system_setup.drawio.png b/integration/images/ebclfsa_aarch64/docs/system_setup.drawio.png similarity index 100% rename from ebclfsa/docs/system_setup.drawio.png rename to integration/images/ebclfsa_aarch64/docs/system_setup.drawio.png diff --git a/ebclfsa/persistency_integration/BUILD b/integration/images/ebclfsa_aarch64/persistency_integration/BUILD similarity index 100% rename from ebclfsa/persistency_integration/BUILD rename to integration/images/ebclfsa_aarch64/persistency_integration/BUILD diff --git a/ebclfsa/persistency_integration/run_qemu.sh b/integration/images/ebclfsa_aarch64/persistency_integration/run_qemu.sh similarity index 100% rename from ebclfsa/persistency_integration/run_qemu.sh rename to integration/images/ebclfsa_aarch64/persistency_integration/run_qemu.sh diff --git a/ebclfsa/persistency_integration/scripts/cpp_tests_persistency.sh b/integration/images/ebclfsa_aarch64/persistency_integration/scripts/cpp_tests_persistency.sh similarity index 100% rename from ebclfsa/persistency_integration/scripts/cpp_tests_persistency.sh rename to integration/images/ebclfsa_aarch64/persistency_integration/scripts/cpp_tests_persistency.sh diff --git a/ebclfsa/scrample_integration/BUILD b/integration/images/ebclfsa_aarch64/scrample_integration/BUILD similarity index 98% rename from ebclfsa/scrample_integration/BUILD rename to integration/images/ebclfsa_aarch64/scrample_integration/BUILD index a8393c3dda..84fe2cfa9f 100644 --- a/ebclfsa/scrample_integration/BUILD +++ b/integration/images/ebclfsa_aarch64/scrample_integration/BUILD @@ -13,7 +13,7 @@ load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES") genrule( - name = "scrample_sil", + name = "scrample_sil_r", srcs = ["@score_scrample//src:scrample"], outs = ["scrample_sil"], cmd = "cp $(SRCS) $@ && \ @@ -27,7 +27,7 @@ genrule( name = "hi_app", srcs = [ ":scrample_sil_wrapper", - ":scrample_sil" + ":scrample_sil_r" ], outs = ["hi_app"], cmd = "cp $(location :scrample_sil_wrapper) $@ && \ diff --git a/qnx_qemu/scrample_integration/etc/logging.json b/integration/images/ebclfsa_aarch64/scrample_integration/etc/logging.json similarity index 100% rename from qnx_qemu/scrample_integration/etc/logging.json rename to integration/images/ebclfsa_aarch64/scrample_integration/etc/logging.json diff --git a/qnx_qemu/scrample_integration/etc/mw_com_config.json b/integration/images/ebclfsa_aarch64/scrample_integration/etc/mw_com_config.json similarity index 100% rename from qnx_qemu/scrample_integration/etc/mw_com_config.json rename to integration/images/ebclfsa_aarch64/scrample_integration/etc/mw_com_config.json diff --git a/ebclfsa/scrample_integration/run_qemu.sh b/integration/images/ebclfsa_aarch64/scrample_integration/run_qemu.sh similarity index 100% rename from ebclfsa/scrample_integration/run_qemu.sh rename to integration/images/ebclfsa_aarch64/scrample_integration/run_qemu.sh diff --git a/ebclfsa/scrample_integration/src/main.cc b/integration/images/ebclfsa_aarch64/scrample_integration/src/main.cc similarity index 100% rename from ebclfsa/scrample_integration/src/main.cc rename to integration/images/ebclfsa_aarch64/scrample_integration/src/main.cc diff --git a/integration/images/linux_x86_64/BUILD b/integration/images/linux_x86_64/BUILD new file mode 100644 index 0000000000..89f762468c --- /dev/null +++ b/integration/images/linux_x86_64/BUILD @@ -0,0 +1,30 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") + +alias( + name = "image", + actual = "//showcases:showcases_all", + visibility = ["//visibility:public"], +) + +sh_binary( + name = "run", + srcs = ["//runners/docker_x86_64/scripts:run_docker.sh"], + args = [ + "$(location :image)", + ], + data = [ + ":image", + ], +) \ No newline at end of file diff --git a/integration/images/qnx_x86_64/BUILD b/integration/images/qnx_x86_64/BUILD new file mode 100644 index 0000000000..2ae1748607 --- /dev/null +++ b/integration/images/qnx_x86_64/BUILD @@ -0,0 +1,93 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") +load("@score_itf//:defs.bzl", "py_itf_test") + +alias( + name = "image", + actual = "//images/qnx_x86_64/build:init", + visibility = ["//visibility:public"], +) + +sh_binary( + name = "run", + srcs = ["//runners/qemu_x86_64/scripts:run_qemu.sh"], + args = [ + "$(location @toolchains_qnx_sdp//:host_dir)", + "$(location :image)", + ], + data = [ + ":image", + "@toolchains_qnx_sdp//:host_all", + "@toolchains_qnx_sdp//:host_dir", + ], +) + +# For now we keep this not in /feature_integration_tests but locally within images + +py_itf_test( + name = "test_ssh", + srcs = [ + "//feature_integration_tests/itf:test_ssh.py", + ], + args = [ + "--target_config=$(location //feature_integration_tests/configs:qemu_target_config.json)", + "--ecu=s_core_ecu_qemu", + "--qemu_image=$(location :image)", + ], + plugins = [ + "itf.plugins.base.base_plugin", + ], + data = [ + ":image", + "//feature_integration_tests/configs:qemu_target_config.json", + ], +) + +py_itf_test( + name = "test_scrample", + srcs = [ + "//feature_integration_tests/itf:test_scrample.py", + ], + args = [ + "--target_config=$(location //feature_integration_tests/configs:qemu_target_config.json)", + "--ecu=s_core_ecu_qemu", + "--qemu_image=$(location :image)", + ], + plugins = [ + "itf.plugins.base.base_plugin", + ], + data = [ + ":image", + "//feature_integration_tests/configs:qemu_target_config.json", + ], +) + +py_itf_test( + name = "test_persistency", + srcs = [ + "//feature_integration_tests/itf:test_persistency.py", + ], + args = [ + "--target_config=$(location //feature_integration_tests/configs:qemu_target_config.json)", + "--ecu=s_core_ecu_qemu", + "--qemu_image=$(location :image)", + ], + plugins = [ + "itf.plugins.base.base_plugin", + ], + data = [ + ":image", + "//feature_integration_tests/configs:qemu_target_config.json", + ], +) diff --git a/integration/images/qnx_x86_64/build/BUILD b/integration/images/qnx_x86_64/build/BUILD new file mode 100644 index 0000000000..1ec2e2d81b --- /dev/null +++ b/integration/images/qnx_x86_64/build/BUILD @@ -0,0 +1,72 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* + +load("@score_toolchains_qnx//rules/fs:ifs.bzl", "qnx_ifs") + +filegroup( + name = "scripts", + srcs = [ + "//images/qnx_x86_64/configs:startup.sh", + ], + visibility = ["//visibility:private"], +) + +filegroup( + name = "configs", + srcs = [ + "//images/qnx_x86_64/configs:pci_server.cfg", + "//images/qnx_x86_64/configs:pci_hw.cfg", + "//images/qnx_x86_64/configs:qcrypto.conf", + "//images/qnx_x86_64/configs:passwd", + "//images/qnx_x86_64/configs:group", + "//images/qnx_x86_64/configs:sshd_config", + "//images/qnx_x86_64/configs:ssh_host_rsa_key", + "//images/qnx_x86_64/configs:ssh_host_rsa_key.pub", + "//images/qnx_x86_64/configs:hostname", + "//images/qnx_x86_64/configs:network_setup.sh", + "//images/qnx_x86_64/configs:network_capture.sh", + "//images/qnx_x86_64/configs:profile", + "//images/qnx_x86_64/configs:dhcpcd.conf", + "//images/qnx_x86_64/configs:network_setup_dhcp.sh", + ], + visibility = ["//visibility:private"], +) + +qnx_ifs( + name = "init", + build_file = "init.build", + srcs = [ + ":system.build", + ":system_dir", + ":scripts", + ":configs", + "//showcases:showcases_all", + "//feature_integration_tests/configs:etc_configs", + "@score_persistency//tests/test_scenarios/cpp:test_scenarios", + ], + ext_repo_maping = { + "BUNDLE_PATH": "$(location //showcases:showcases_all)" + }, + visibility = [ + "//visibility:public", + ], +) + +filegroup( + name = "system_dir", + srcs = [ + "system.build", + "init.build", + ], +) + diff --git a/qnx_qemu/build/init.build b/integration/images/qnx_x86_64/build/init.build similarity index 98% rename from qnx_qemu/build/init.build rename to integration/images/qnx_x86_64/build/init.build index 815de328ec..bbec098e03 100644 --- a/qnx_qemu/build/init.build +++ b/integration/images/qnx_x86_64/build/init.build @@ -96,4 +96,4 @@ devb-eide # Block device driver for IDE/SATA hard drive # Required for mounting QNX6 file systems from disk partitions -[+include] build/system.build +[+include] ${MAIN_BUILD_FILE_DIR}/system.build # Include additional system build configurations diff --git a/qnx_qemu/build/system.build b/integration/images/qnx_x86_64/build/system.build similarity index 88% rename from qnx_qemu/build/system.build rename to integration/images/qnx_x86_64/build/system.build index baab76a47f..4e7bc1a12f 100644 --- a/qnx_qemu/build/system.build +++ b/integration/images/qnx_x86_64/build/system.build @@ -239,10 +239,10 @@ pci/pci_debug2.so # Enhanced PCI debugging support ### SCRIPTS ### ############################################# # System startup and initialization scripts -[perms=700] /etc/startup.sh = configs/startup.sh # Main system startup script -[perms=700] /etc/network_setup.sh = configs/network_setup.sh # Network configuration script -[perms=700] /etc/network_setup_dhcp.sh = configs/network_setup_dhcp.sh # Network configuration script -[perms=755] /etc/network_capture = configs/network_capture.sh # Network packet capture utility +[perms=700] /etc/startup.sh = ${MAIN_BUILD_FILE_DIR}/../configs/startup.sh # Main system startup script +[perms=700] /etc/network_setup.sh = ${MAIN_BUILD_FILE_DIR}/../configs/network_setup.sh # Network configuration script +[perms=700] /etc/network_setup_dhcp.sh = ${MAIN_BUILD_FILE_DIR}/../configs/network_setup_dhcp.sh # Network configuration script +[perms=755] /etc/network_capture = ${MAIN_BUILD_FILE_DIR}/../configs/network_capture.sh # Network packet capture utility ############################################# @@ -251,33 +251,39 @@ pci/pci_debug2.so # Enhanced PCI debugging support # This section defines critical configuration files that control system # behavior, hardware access, security policies, and user environment setup. -[perms=0444] pci_server.cfg = configs/pci_server.cfg # PCI server configuration -[perms=0444] pci_hw.cfg = configs/pci_hw.cfg # PCI hardware configuration -[perms=0444] qcrypto.conf = configs/qcrypto.conf # QNX cryptographic library configuration +[perms=0444] pci_server.cfg = ${MAIN_BUILD_FILE_DIR}/../configs/pci_server.cfg # PCI server configuration +[perms=0444] pci_hw.cfg = ${MAIN_BUILD_FILE_DIR}/../configs/pci_hw.cfg # PCI hardware configuration +[perms=0444] qcrypto.conf = ${MAIN_BUILD_FILE_DIR}/../configs/qcrypto.conf # QNX cryptographic library configuration -# System hostname configuration -/etc/hostname = configs/hostname # System hostname definition file -/etc/profile = configs/profile +# System hostname configuration +/etc/hostname = ${MAIN_BUILD_FILE_DIR}/../configs/hostname # System hostname definition file +/etc/profile = ${MAIN_BUILD_FILE_DIR}/../configs/profile # System user and group databases -/etc/passwd = configs/passwd # User account database with login information -/etc/group = configs/group # Group membership database +/etc/passwd = ${MAIN_BUILD_FILE_DIR}/../configs/passwd # User account database with login information +/etc/group = ${MAIN_BUILD_FILE_DIR}/../configs/group # Group membership database ############################################# ### SSH CONFIGURATION ### ############################################# # SSH server configuration (no static host keys - generated at runtime) -[perms=444] /var/ssh/sshd_config = configs/sshd_config # SSH daemon configuration file +[perms=444] /var/ssh/sshd_config = ${MAIN_BUILD_FILE_DIR}/../configs/sshd_config # SSH daemon configuration file -[uid=0 gid=0 perms=400] /var/ssh/ssh_host_rsa_key = configs/ssh_host_rsa_key # SSH server private key -[uid=0 gid=0 perms=400] /var/ssh/ssh_host_rsa_key.pub = configs/ssh_host_rsa_key.pub # SSH server public key +[uid=0 gid=0 perms=400] /var/ssh/ssh_host_rsa_key = ${MAIN_BUILD_FILE_DIR}/../configs/ssh_host_rsa_key # SSH server private key +[uid=0 gid=0 perms=400] /var/ssh/ssh_host_rsa_key.pub = ${MAIN_BUILD_FILE_DIR}/../configs/ssh_host_rsa_key.pub # SSH server public key # DHCP client configuration -[perms=644] /etc/dhcpcd.conf = configs/dhcpcd.conf # DHCP client configuration file +[perms=644] /etc/dhcpcd.conf = ${MAIN_BUILD_FILE_DIR}/../configs/dhcpcd.conf # DHCP client configuration file -[perms=777] /etc/logging.json = scrample_integration/etc/logging.json # DHCP client configuration file -[perms=777] /etc/mw_com_config.json = scrample_integration/etc/mw_com_config.json # DHCP client configuration file +# Communication configuration files +[perms=777] /etc/logging.json = ${MAIN_BUILD_FILE_DIR}/../../../feature_integration_tests/configs/etc/logging.json +[perms=777] /etc/mw_com_config.json = ${MAIN_BUILD_FILE_DIR}/../../../feature_integration_tests/configs/etc/mw_com_config.json +# Executable files from external repositories [perms=777] /scrample = ${SCRAMPLE_PATH} [perms=777] /cpp_tests_persistency = ${CPP_TEST_SCENARIOS_PATH} + +# Common showcases bundle +[perms=777] /showcases = ${BUNDLE_PATH} + diff --git a/qnx_qemu/configs/BUILD b/integration/images/qnx_x86_64/configs/BUILD similarity index 100% rename from qnx_qemu/configs/BUILD rename to integration/images/qnx_x86_64/configs/BUILD diff --git a/qnx_qemu/configs/dhcpcd.conf b/integration/images/qnx_x86_64/configs/dhcpcd.conf similarity index 100% rename from qnx_qemu/configs/dhcpcd.conf rename to integration/images/qnx_x86_64/configs/dhcpcd.conf diff --git a/qnx_qemu/configs/group b/integration/images/qnx_x86_64/configs/group similarity index 100% rename from qnx_qemu/configs/group rename to integration/images/qnx_x86_64/configs/group diff --git a/qnx_qemu/configs/hostname b/integration/images/qnx_x86_64/configs/hostname similarity index 100% rename from qnx_qemu/configs/hostname rename to integration/images/qnx_x86_64/configs/hostname diff --git a/qnx_qemu/configs/network_capture.sh b/integration/images/qnx_x86_64/configs/network_capture.sh similarity index 100% rename from qnx_qemu/configs/network_capture.sh rename to integration/images/qnx_x86_64/configs/network_capture.sh diff --git a/qnx_qemu/configs/network_setup.sh b/integration/images/qnx_x86_64/configs/network_setup.sh similarity index 100% rename from qnx_qemu/configs/network_setup.sh rename to integration/images/qnx_x86_64/configs/network_setup.sh diff --git a/qnx_qemu/configs/network_setup_dhcp.sh b/integration/images/qnx_x86_64/configs/network_setup_dhcp.sh similarity index 100% rename from qnx_qemu/configs/network_setup_dhcp.sh rename to integration/images/qnx_x86_64/configs/network_setup_dhcp.sh diff --git a/qnx_qemu/configs/passwd b/integration/images/qnx_x86_64/configs/passwd similarity index 100% rename from qnx_qemu/configs/passwd rename to integration/images/qnx_x86_64/configs/passwd diff --git a/qnx_qemu/configs/pci_hw.cfg b/integration/images/qnx_x86_64/configs/pci_hw.cfg similarity index 100% rename from qnx_qemu/configs/pci_hw.cfg rename to integration/images/qnx_x86_64/configs/pci_hw.cfg diff --git a/qnx_qemu/configs/pci_server.cfg b/integration/images/qnx_x86_64/configs/pci_server.cfg similarity index 100% rename from qnx_qemu/configs/pci_server.cfg rename to integration/images/qnx_x86_64/configs/pci_server.cfg diff --git a/qnx_qemu/configs/profile b/integration/images/qnx_x86_64/configs/profile similarity index 100% rename from qnx_qemu/configs/profile rename to integration/images/qnx_x86_64/configs/profile diff --git a/qnx_qemu/configs/qcrypto.conf b/integration/images/qnx_x86_64/configs/qcrypto.conf similarity index 100% rename from qnx_qemu/configs/qcrypto.conf rename to integration/images/qnx_x86_64/configs/qcrypto.conf diff --git a/qnx_qemu/configs/ssh_host_rsa_key b/integration/images/qnx_x86_64/configs/ssh_host_rsa_key similarity index 100% rename from qnx_qemu/configs/ssh_host_rsa_key rename to integration/images/qnx_x86_64/configs/ssh_host_rsa_key diff --git a/qnx_qemu/configs/ssh_host_rsa_key.pub b/integration/images/qnx_x86_64/configs/ssh_host_rsa_key.pub similarity index 100% rename from qnx_qemu/configs/ssh_host_rsa_key.pub rename to integration/images/qnx_x86_64/configs/ssh_host_rsa_key.pub diff --git a/qnx_qemu/configs/sshd_config b/integration/images/qnx_x86_64/configs/sshd_config similarity index 100% rename from qnx_qemu/configs/sshd_config rename to integration/images/qnx_x86_64/configs/sshd_config diff --git a/qnx_qemu/configs/startup.sh b/integration/images/qnx_x86_64/configs/startup.sh similarity index 97% rename from qnx_qemu/configs/startup.sh rename to integration/images/qnx_x86_64/configs/startup.sh index ce9a5c1b5e..2637825264 100644 --- a/qnx_qemu/configs/startup.sh +++ b/integration/images/qnx_x86_64/configs/startup.sh @@ -82,3 +82,4 @@ mkdir -p /tmp_ram/tmp_discovery ln -sP /tmp_ram/tmp_discovery /tmp_discovery /proc/boot/sshd -f /var/ssh/sshd_config # Start SSH daemon with specified configuration file +/showcases/bin/cli # Start the CLI application from the mounted showcases directory \ No newline at end of file diff --git a/autosd/patches/baselibs/0001-RH-exception-header.patch b/integration/patches/baselibs/0001-RH-exception-header.patch similarity index 100% rename from autosd/patches/baselibs/0001-RH-exception-header.patch rename to integration/patches/baselibs/0001-RH-exception-header.patch diff --git a/autosd/patches/baselibs/0002-RH-algorithm-header.patch b/integration/patches/baselibs/0002-RH-algorithm-header.patch similarity index 100% rename from autosd/patches/baselibs/0002-RH-algorithm-header.patch rename to integration/patches/baselibs/0002-RH-algorithm-header.patch diff --git a/integration/patches/baselibs/003-acl-fixes-for-aarch64.patch b/integration/patches/baselibs/003-acl-fixes-for-aarch64.patch new file mode 100644 index 0000000000..95ea478477 --- /dev/null +++ b/integration/patches/baselibs/003-acl-fixes-for-aarch64.patch @@ -0,0 +1,65 @@ +From 37a6329193e94d93fef91fc184e95e9a8b67a98b Mon Sep 17 00:00:00 2001 +From: Pawel Rutka +Date: Mon, 9 Feb 2026 14:51:53 +0100 +Subject: [PATCH] T + +Signed-off-by: Pawel Rutka +--- + MODULE.bazel | 7 +++++++ + third_party/acl/BUILD | 6 +++++- + third_party/acl/acl.BUILD | 7 ++++--- + 3 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/MODULE.bazel b/MODULE.bazel +index f7991cb..b78d618 100644 +--- a/MODULE.bazel ++++ b/MODULE.bazel +@@ -64,6 +64,13 @@ deb( + visibility = ["//visibility:public"], + ) + ++deb( ++ name = "acl-deb-aarch64", ++ build = "//third_party/acl:acl.BUILD", ++ urls = ["https://launchpadlibrarian.net/581258948/libacl1-dev_2.3.1-1_arm64.deb"], ++ visibility = ["//visibility:public"], ++) ++ + deb( + name = "valgrind-deb", + build = "//third_party/valgrind:valgrind.BUILD", +diff --git a/third_party/acl/BUILD b/third_party/acl/BUILD +index dfcac1e..c76bee3 100644 +--- a/third_party/acl/BUILD ++++ b/third_party/acl/BUILD +@@ -1,5 +1,9 @@ + alias( + name = "acl", +- actual = "@acl-deb//:acl", ++ actual = select({ ++ "@platforms//cpu:aarch64": "@acl-deb-aarch64//:acl", ++ "//conditions:default": "@acl-deb//:acl", ++ }), + visibility = ["//visibility:public"], + ) ++ +diff --git a/third_party/acl/acl.BUILD b/third_party/acl/acl.BUILD +index 2163068..d86c7f7 100644 +--- a/third_party/acl/acl.BUILD ++++ b/third_party/acl/acl.BUILD +@@ -1,8 +1,9 @@ + cc_library( + name = "acl", +- srcs = [ +- "usr/lib/libacl.a", +- ], ++ srcs = select({ ++ "@platforms//cpu:aarch64": ["usr/lib/aarch64-linux-gnu/libacl.a"], ++ "//conditions:default": ["usr/lib/libacl.a"], ++ }), + hdrs = [ + "usr/include/acl/libacl.h", + "usr/include/sys/acl.h", +-- +2.43.0 + diff --git a/integration/patches/baselibs/BUILD b/integration/patches/baselibs/BUILD new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ebclfsa/patches/fix_hard_coded_amd64.patch b/integration/patches/baselibs/fix_hard_coded_amd64.patch similarity index 100% rename from ebclfsa/patches/fix_hard_coded_amd64.patch rename to integration/patches/baselibs/fix_hard_coded_amd64.patch diff --git a/integration/runners/docker_x86_64/BUILD b/integration/runners/docker_x86_64/BUILD new file mode 100644 index 0000000000..17a9a3cbca --- /dev/null +++ b/integration/runners/docker_x86_64/BUILD @@ -0,0 +1,24 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") + +# sh_binary( +# name = "docker_x86_64", +# srcs = ["scripts/run_docker.sh"], +# args = [ +# "$(location //linux_x86_64:image)", +# ], +# data = [ +# "//linux_x86_64:image", +# ], +# ) diff --git a/integration/runners/docker_x86_64/scripts/BUILD b/integration/runners/docker_x86_64/scripts/BUILD new file mode 100644 index 0000000000..6e17fd110a --- /dev/null +++ b/integration/runners/docker_x86_64/scripts/BUILD @@ -0,0 +1 @@ +exports_files(["run_docker.sh"]) \ No newline at end of file diff --git a/integration/runners/docker_x86_64/scripts/run_docker.sh b/integration/runners/docker_x86_64/scripts/run_docker.sh new file mode 100755 index 0000000000..a553a0e620 --- /dev/null +++ b/integration/runners/docker_x86_64/scripts/run_docker.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# ******************************************************************************* +# 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 +# ******************************************************************************* + +set -euo pipefail + +OVERLAY_TREE=$1 +OVERLAY_ABS_PATH=$(realpath ${OVERLAY_TREE}) +echo "Starting docker with overlay image: ${OVERLAY_ABS_PATH}" +docker run --rm -it \ + -v "${OVERLAY_ABS_PATH}:/showcases" \ + ubuntu:22.04 \ + /showcases/bin/cli \ No newline at end of file diff --git a/integration/runners/qemu_x86_64/BUILD b/integration/runners/qemu_x86_64/BUILD new file mode 100644 index 0000000000..52ddaba0f2 --- /dev/null +++ b/integration/runners/qemu_x86_64/BUILD @@ -0,0 +1,29 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") +load("@score_itf//:defs.bzl", "py_itf_test") + + +# sh_binary( +# name = "qemu_x86_64", +# srcs = ["scripts/run_qemu.sh"], +# args = [ +# "$(location @toolchains_qnx_sdp//:host_dir)", +# "$(location //:image)", +# ], +# data = [ +# "//:image", +# "@toolchains_qnx_sdp//:host_all", +# "@toolchains_qnx_sdp//:host_dir", +# ], +# ) diff --git a/integration/runners/qemu_x86_64/scripts/BUILD b/integration/runners/qemu_x86_64/scripts/BUILD new file mode 100644 index 0000000000..1ba1d2b847 --- /dev/null +++ b/integration/runners/qemu_x86_64/scripts/BUILD @@ -0,0 +1 @@ +exports_files(["run_qemu.sh"]) \ No newline at end of file diff --git a/qnx_qemu/scripts/qnx_wireshark.sh b/integration/runners/qemu_x86_64/scripts/qnx_wireshark.sh similarity index 100% rename from qnx_qemu/scripts/qnx_wireshark.sh rename to integration/runners/qemu_x86_64/scripts/qnx_wireshark.sh diff --git a/qnx_qemu/scripts/run_qemu.sh b/integration/runners/qemu_x86_64/scripts/run_qemu.sh similarity index 95% rename from qnx_qemu/scripts/run_qemu.sh rename to integration/runners/qemu_x86_64/scripts/run_qemu.sh index a23f117b53..9f741d3c01 100755 --- a/qnx_qemu/scripts/run_qemu.sh +++ b/integration/runners/qemu_x86_64/scripts/run_qemu.sh @@ -18,10 +18,9 @@ set -euo pipefail QNX_HOST=$1 IFS_IMAGE=$2 - +echo "Starting QEMU with IFS image: ${IFS_IMAGE}" qemu-system-x86_64 \ -smp 2 \ - --enable-kvm \ -cpu Cascadelake-Server-v5 \ -m 1G \ -pidfile /tmp/qemu.pid \ diff --git a/qnx_qemu/scripts/run_qemu_portforward.sh b/integration/runners/qemu_x86_64/scripts/run_qemu_portforward.sh similarity index 100% rename from qnx_qemu/scripts/run_qemu_portforward.sh rename to integration/runners/qemu_x86_64/scripts/run_qemu_portforward.sh diff --git a/integration/score_starter b/integration/score_starter new file mode 100755 index 0000000000..88cd23f03d --- /dev/null +++ b/integration/score_starter @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +import os +import sys +import termios +import tty +import subprocess +import argparse + +# ================== CONFIG ================== +# Each entry: (description, command, name) +mEntries = [ + ("Run QNX x86_64 QEMU", "bazel run --config qnx-x86_64 //images/qnx_x86_64:run", "qnx-x86_64"), + ("Run Linux x86_64 Docker", "bazel run --config linux-x86_64 //images/linux_x86_64:run", "linux-x86_64"), + ("Run Elektrobit Corbos aarch64 QEMU", + "bazel build --config eb-aarch64 //images/ebclfsa_aarch64/scrample_integration:run", "eb-aarch64"), + ("Build Autosd x86_64 RPM", + "bazel build --config autosd-x86_64 //images/autosd_x86_64:lola-demo", "autosd-x86_64"), + ("Exit", "exit 0", "exit"), +] + +# ================== INTERNAL ================== +mSelected = 0 +mCount = len(mEntries) + + +def clear(): + os.system("clear") + + +def draw_menu(): + clear() + print("Use ↑ ↓ to navigate, Enter to run, q to quit\n") + for i, (desc, _, _) in enumerate(mEntries): + if i == mSelected: + # inverse video + print(f" \033[7m {desc} \033[0m") + else: + print(f" {desc}") + + +def run_entry(entry): + desc, cmd, _ = entry + clear() + print(f"▶ {desc}\n") + + if cmd.startswith("exit"): + sys.exit(0) + + # Run command in user's shell + result = subprocess.call(cmd, shell=True) + sys.exit(result) + + +def read_key(): + fd = sys.stdin.fileno() + old = termios.tcgetattr(fd) + try: + tty.setraw(fd) + ch1 = sys.stdin.read(1) + if ch1 == "\x1b": + ch2 = sys.stdin.read(1) + ch3 = sys.stdin.read(1) + return ch1 + ch2 + ch3 + return ch1 + finally: + termios.tcsetattr(fd, termios.TCSADRAIN, old) + + +def interactive_loop(): + global mSelected + while True: + draw_menu() + key = read_key() + + if key == "\x1b[A": # Up + mSelected = (mSelected - 1) % mCount + elif key == "\x1b[B": # Down + mSelected = (mSelected + 1) % mCount + elif key in ("\r", "\n"): # Enter + run_entry(mEntries[mSelected]) + elif key == "q": + sys.exit(0) + + +# ================== MAIN ================== +def main(): + parser = argparse.ArgumentParser( + description="Interactive build/run menu script", + epilog="Use -r NAME to run a specific entry directly." + ) + parser.add_argument( + "-r", "--run", + help="Run a specific menu entry by name", + choices=[name for _, _, name in mEntries] + ) + + args = parser.parse_args() + + if args.run: + # Find the entry by name and run it + entry = next((e for e in mEntries if e[2] == args.run), None) + if entry is None: + print(f"Unknown entry: {args.run}") + sys.exit(1) + run_entry(entry) + else: + interactive_loop() + + +if __name__ == "__main__": + main() diff --git a/integration/scripts/qnx_credential_helper.py b/integration/scripts/qnx_credential_helper.py new file mode 120000 index 0000000000..6b0b73f578 --- /dev/null +++ b/integration/scripts/qnx_credential_helper.py @@ -0,0 +1 @@ +../../.github/tools/qnx_credential_helper.py \ No newline at end of file diff --git a/integration/showcases/BUILD b/integration/showcases/BUILD new file mode 100644 index 0000000000..3c85d9bee0 --- /dev/null +++ b/integration/showcases/BUILD @@ -0,0 +1,23 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +load("//bazel_common:bundlers.bzl", "score_pkg_bundle") + +score_pkg_bundle( + name = "showcases_all", + # package_dir = "", + bins = ["//showcases/cli" ], + other_package_files = ["//showcases/standalone:standalone_pkg_files", "//showcases/kyron:kyron_pkg_files", "//showcases/orchestration_persistency:orch_per_pkg_files"], + +) + + diff --git a/integration/showcases/cli/BUILD b/integration/showcases/cli/BUILD new file mode 100644 index 0000000000..d94be0f295 --- /dev/null +++ b/integration/showcases/cli/BUILD @@ -0,0 +1,26 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* + +load("@rules_rust//rust:defs.bzl", "rust_binary") + +rust_binary( + name = "cli", + srcs = ["main.rs"], + deps = [ + "@score_crates//:cliclack", + "@score_crates//:serde", + "@score_crates//:serde_json", + "@score_crates//:anyhow", + ], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/integration/showcases/cli/README.md b/integration/showcases/cli/README.md new file mode 100644 index 0000000000..2ce3b2696d --- /dev/null +++ b/integration/showcases/cli/README.md @@ -0,0 +1,27 @@ +# CLI + +CLI written in rust to provide user experience in runners. + +## Abilities + +### Auto detect examples + +When run, it will auto detect all examples in image and provide to user `multiselect` choice to run examples. +To make this work each example shall deploy configuration file `name.score.json` which below layout. + +```json +{ + "name": "Name of example", + "description": "Extensive description", + "path": "exec_path", + "args": [ + // args to be used when running + ], + "env": { + // env to be used when running + } +} + +``` + +You can customize where to look for examples using env `SCORE_CLI_INIT_DIR`. \ No newline at end of file diff --git a/integration/showcases/cli/main.rs b/integration/showcases/cli/main.rs new file mode 100644 index 0000000000..22aae6d615 --- /dev/null +++ b/integration/showcases/cli/main.rs @@ -0,0 +1,140 @@ +use anyhow::{Context, Result}; +use serde::Deserialize; +use std::{ + collections::HashMap, + env, fs, + path::Path, + process::Command, +}; + +use cliclack::{clear_screen, intro, multiselect, outro, confirm}; + +#[derive(Debug, Deserialize)] +struct ScoreConfig { + name: String, + description: String, + path: String, + args: Vec, + env: HashMap, +} + +fn print_banner() { + let color_code = "\x1b[38;5;99m"; + let reset_code = "\x1b[0m"; + + let banner = r#" + ███████╗ ██████╗ ██████╗ ██████╗ ███████╗ + ██╔════╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝ + ███████╗█████╗██║ ██║ ██║██████╔╝█████╗ + ╚════██║╚════╝██║ ██║ ██║██╔══██╗██╔══╝ + ███████║ ╚██████╗╚██████╔╝██║ ██║███████╗ + ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ +"#; + + println!("{}{}{}", color_code, banner, reset_code); +} + +fn pause_for_enter() -> Result<()> { + confirm("Press Enter to select examples to run...") + .initial_value(true) + .interact()?; + Ok(()) +} + +fn main() -> Result<()> { + print_banner(); + intro("WELCOME TO SHOWCASE ENTRYPOINT")?; + pause_for_enter()?; + + clear_screen()?; + + let root_dir = env::var("SCORE_CLI_INIT_DIR") + .unwrap_or_else(|_| "/showcases".to_string()); + + let mut configs = Vec::new(); + visit_dir(Path::new(&root_dir), &mut configs)?; + + if configs.is_empty() { + anyhow::bail!("No *.score.json files found under {}", root_dir); + } + + // Create options for multiselect + let options: Vec<(usize, String, String)> = configs + .iter() + .enumerate() + .map(|(i, c)| (i, c.name.clone(), c.description.clone())) + .collect(); + + let selected: Vec = multiselect("Select examples to run:") + .items(&options) + .interact()?; + + if selected.is_empty() { + outro("No examples selected. Goodbye!")?; + return Ok(()); + } + + for index in selected { + run_score(&configs[index])?; + } + + outro("All done!")?; + + Ok(()) +} + +fn visit_dir(dir: &Path, configs: &mut Vec) -> Result<()> { + for entry in fs::read_dir(dir) + .with_context(|| format!("Failed to read directory {:?}", dir))? + { + let entry = entry?; + let path = entry.path(); + + if path.is_symlink() { + continue; + } + + if path.is_dir() { + visit_dir(&path, configs)?; + continue; + } + + if is_score_file(&path) { + let content = fs::read_to_string(&path) + .with_context(|| format!("Failed reading {:?}", path))?; + let config: ScoreConfig = serde_json::from_str(&content) + .with_context(|| format!("Invalid JSON in {:?}", path))?; + configs.push(config); + } + } + Ok(()) +} + +fn is_score_file(path: &Path) -> bool { + path.file_name() + .and_then(|n| n.to_str()) + .map(|n| n.ends_with(".score.json")) + .unwrap_or(false) +} + +fn run_score(config: &ScoreConfig) -> Result<()> { + println!("▶ Running: {}", config.name); + + let mut cmd = Command::new(&config.path); + cmd.args(&config.args); + cmd.envs(&config.env); + + let status = cmd + .status() + .with_context(|| format!("Failed to execute {}", config.path))?; + + if !status.success() { + anyhow::bail!( + "Command `{}` exited with status {}", + config.path, + status + ); + } + + Ok(()) +} \ No newline at end of file diff --git a/integration/showcases/kyron/BUILD b/integration/showcases/kyron/BUILD new file mode 100644 index 0000000000..8cf41fc43e --- /dev/null +++ b/integration/showcases/kyron/BUILD @@ -0,0 +1,20 @@ +load("@rules_rust//rust:defs.bzl", "rust_binary") +load("//bazel_common:bundlers.bzl", "score_pkg_bundle") + +rust_binary( + name = "kyron_example", + srcs = ["main.rs"], + deps = [ + "@score_kyron//src/kyron:libkyron", + "@score_kyron//src/kyron-foundation:libkyron_foundation", + "@score_crates//:tracing_subscriber", + ], + visibility = ["//visibility:public"], +) + + +score_pkg_bundle( + name = "kyron", + bins = [":kyron_example"], + config_data = ["//showcases/kyron:kyron.score.json"], +) diff --git a/integration/showcases/kyron/kyron.score.json b/integration/showcases/kyron/kyron.score.json new file mode 100644 index 0000000000..f076b2a451 --- /dev/null +++ b/integration/showcases/kyron/kyron.score.json @@ -0,0 +1,9 @@ +{ + "name": "Kyron example", + "description": "Example for channel communication using safe async runtime - Kyron", + "path": "/showcases/bin/kyron_example", + "args": [ + ], + "env": { + } +} \ No newline at end of file diff --git a/feature_showcase/rust/kyron/main.rs b/integration/showcases/kyron/main.rs similarity index 100% rename from feature_showcase/rust/kyron/main.rs rename to integration/showcases/kyron/main.rs diff --git a/feature_showcase/rust/BUILD b/integration/showcases/orchestration_persistency/BUILD similarity index 74% rename from feature_showcase/rust/BUILD rename to integration/showcases/orchestration_persistency/BUILD index e1e4566ab0..16abb3ed3e 100644 --- a/feature_showcase/rust/BUILD +++ b/integration/showcases/orchestration_persistency/BUILD @@ -12,21 +12,11 @@ # ******************************************************************************* load("@rules_rust//rust:defs.bzl", "rust_binary") - -rust_binary( - name = "kyron_example", - srcs = glob(["kyron/**/*.rs"]), - deps = [ - "@score_kyron//src/kyron:libkyron", - "@score_kyron//src/kyron-foundation:libkyron_foundation", - "@score_crates//:tracing_subscriber", - ], - visibility = ["//visibility:public"], -) +load("//bazel_common:bundlers.bzl", "score_pkg_bundle") rust_binary( name = "orch_per_example", - srcs = glob(["orchestration_persistency/**/*.rs"]), + srcs = ["main.rs"], deps = [ "@score_kyron//src/kyron:libkyron", "@score_kyron//src/kyron-foundation:libkyron_foundation", @@ -36,3 +26,10 @@ rust_binary( ], visibility = ["//visibility:public"], ) + +score_pkg_bundle( + name = "orch_per", + bins = [":orch_per_example"], + config_data = ["//showcases/orchestration_persistency:orch_per.score.json"], +) + diff --git a/feature_showcase/rust/orchestration_persistency/main.rs b/integration/showcases/orchestration_persistency/main.rs similarity index 100% rename from feature_showcase/rust/orchestration_persistency/main.rs rename to integration/showcases/orchestration_persistency/main.rs diff --git a/integration/showcases/orchestration_persistency/orch_per.score.json b/integration/showcases/orchestration_persistency/orch_per.score.json new file mode 100644 index 0000000000..587af7cc86 --- /dev/null +++ b/integration/showcases/orchestration_persistency/orch_per.score.json @@ -0,0 +1,9 @@ +{ + "name": "Orchestration persistency - Kyron example", + "description": "Example for running orchestration graph with Kyron runtime and saving the state to disk", + "path": "/showcases/bin/orch_per_example", + "args": [ + ], + "env": { + } +} \ No newline at end of file diff --git a/integration/showcases/standalone/BUILD b/integration/showcases/standalone/BUILD new file mode 100644 index 0000000000..5b4746fb26 --- /dev/null +++ b/integration/showcases/standalone/BUILD @@ -0,0 +1,8 @@ +load("//bazel_common:bundlers.bzl", "score_pkg_bundle") + + +score_pkg_bundle( + name = "standalone", + package_dir = "standalone", + bins = ["@score_scrample//src:scrample"], +) diff --git a/qnx_qemu/.bazelrc b/qnx_qemu/.bazelrc deleted file mode 100644 index f5f02ea756..0000000000 --- a/qnx_qemu/.bazelrc +++ /dev/null @@ -1,22 +0,0 @@ -common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ -common --registry=https://bcr.bazel.build - -build:_common --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False -build:_common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False -build:_common --@score_baselibs//score/json:base_library=nlohmann -build:_common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False -build:_common --@score_communication//score/mw/com/flags:tracing_library=stub -build:_common --cxxopt=-Wno-error=mismatched-new-delete - -build:x86_64-qnx --config=_common -build:x86_64-qnx --noexperimental_merged_skyframe_analysis_execution -build:x86_64-qnx --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 -build:x86_64-qnx --incompatible_enable_cc_toolchain_resolution -build:x86_64-qnx --incompatible_strict_action_env -build:x86_64-qnx --platforms=@score_toolchains_qnx//platforms:x86_64-qnx -build:x86_64-qnx --sandbox_writable_path=/var/tmp - -build:qemu-integration --config=x86_64-qnx -build:qemu-integration --run_under=@score_itf//scripts:run_under_qemu -build:qemu-integration --test_arg="--qemu" -build:qemu-integration --test_arg="--os=qnx" diff --git a/qnx_qemu/.bazelversion b/qnx_qemu/.bazelversion deleted file mode 100644 index 8104cabd36..0000000000 --- a/qnx_qemu/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -8.1.0 diff --git a/qnx_qemu/BUILD b/qnx_qemu/BUILD deleted file mode 100644 index 0ee32b983b..0000000000 --- a/qnx_qemu/BUILD +++ /dev/null @@ -1,135 +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 -# ******************************************************************************* -load("@rules_shell//shell:sh_binary.bzl", "sh_binary") -load("@score_itf//:defs.bzl", "py_itf_test") - - -sh_binary( - name = "run_qemu", - srcs = ["scripts/run_qemu.sh"], - args = [ - "$(location @toolchains_qnx_sdp//:host_dir)", - "$(location //build:init)", - ], - data = [ - "//build:init", - "@toolchains_qnx_sdp//:host_all", - "@toolchains_qnx_sdp//:host_dir", - ], -) - -sh_binary( - name = "run_qemu_portforward", - srcs = ["scripts/run_qemu_portforward.sh"], - args = [ - "$(location @toolchains_qnx_sdp//:host_dir)", - "$(location //build:init)", - ], - data = [ - "//build:init", - "@toolchains_qnx_sdp//:host_all", - "@toolchains_qnx_sdp//:host_dir", - ], -) - - -sh_binary( - name = "test_qemu_bridge", - srcs = ["test/test_qnx_qemu_bridge.sh"], - args = [ - "$(location @toolchains_qnx_sdp//:host_dir)", - "$(location //build:init)", - "--timeout=90", - "--ssh-port=2222", - "--boot-wait=15", - ], - data = [ - "//build:init", - "@toolchains_qnx_sdp//:host_all", - "@toolchains_qnx_sdp//:host_dir", - ], -) - -sh_binary( - name = "test_qemu_portforward", - srcs = ["test/test_qnx_qemu_portforward.sh"], - args = [ - "$(location @toolchains_qnx_sdp//:host_dir)", - "$(location //build:init)", - "--timeout=90", - "--ssh-port=2222", - "--boot-wait=15", - ], - data = [ - "//build:init", - "@toolchains_qnx_sdp//:host_all", - "@toolchains_qnx_sdp//:host_dir", - ], -) - -py_itf_test( - name = "test_ssh_qemu", - srcs = [ - "test/itf/test_ssh.py", - ], - args = [ - "--target_config=$(location target_config.json)", - "--ecu=s_core_ecu_qemu", - "--qemu_image=$(location //build:init)", - ], - plugins = [ - "itf.plugins.base.base_plugin", - ], - data = [ - "//build:init", - "target_config.json", - ], -) - -py_itf_test( - name = "test_scrample_qemu", - srcs = [ - "test/itf/test_scrample.py", - ], - args = [ - "--target_config=$(location target_config.json)", - "--ecu=s_core_ecu_qemu", - "--qemu_image=$(location //build:init)", - ], - plugins = [ - "itf.plugins.base.base_plugin", - ], - data = [ - "//build:init", - "target_config.json", - ], -) - -py_itf_test( - name = "test_persistency_qemu", - srcs = [ - "test/itf/test_persistency.py", - ], - args = [ - "--target_config=$(location target_config.json)", - "--ecu=s_core_ecu_qemu", - "--qemu_image=$(location //build:init)", - ], - plugins = [ - "itf.plugins.base.base_plugin", - ], - data = [ - "//build:init", - "target_config.json", - ], -) diff --git a/qnx_qemu/MODULE.bazel b/qnx_qemu/MODULE.bazel deleted file mode 100644 index 5fa697079b..0000000000 --- a/qnx_qemu/MODULE.bazel +++ /dev/null @@ -1,113 +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 -# ******************************************************************************* -module( - name = "score_ri_qnx_qemu", - version = "0.0.1", - compatibility_level = 0, -) - -############################################################################### -# -# Shell dependency -# -############################################################################### -bazel_dep(name = "rules_shell", version = "0.6.0") - -############################################################################### -# -# Python version -# -############################################################################### -bazel_dep(name = "rules_python", version = "1.0.0") - -PYTHON_VERSION = "3.12" - -python = use_extension("@rules_python//python/extensions:python.bzl", "python") -python.toolchain( - configure_coverage_tool = True, - is_default = True, - python_version = PYTHON_VERSION, -) -use_repo(python) - -############################################################################### -# -# GCC Toolchains -# -############################################################################### -# Configure the host toolchain. -bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency=True) -gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency=True) -gcc.toolchain( - url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz", - sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600", - strip_prefix = "x86_64-unknown-linux-gnu", -) -gcc.extra_features( - features = [ - "minimal_warnings", - "treat_warnings_as_errors", - ], -) -gcc.warning_flags( - minimal_warnings = ["-Wall", "-Wno-error=deprecated-declarations", "-Wno-error=narrowing"], - strict_warnings = ["-Wextra", "-Wpedantic"], -) -use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc") - -register_toolchains("@gcc_toolchain//:all") - -# Configure target toolchain for QNX build. -bazel_dep(name = "score_toolchains_qnx", version = "0.0.3") -toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx") -toolchains_qnx.sdp( - sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63", - strip_prefix = "installation", - url = "https://www.qnx.com/download/download/79858/installation.tgz", -) -use_repo(toolchains_qnx, "toolchains_qnx_sdp") -use_repo(toolchains_qnx, "toolchains_qnx_qcc") -use_repo(toolchains_qnx, "toolchains_qnx_ifs") - -register_toolchains("@toolchains_qnx_qcc//:qcc_x86_64") -register_toolchains("@toolchains_qnx_ifs//:ifs_x86_64") - -############################################################################### -# -# Other dependencies -# -############################################################################### -bazel_dep(name = "rules_cc", version = "0.1.1") -bazel_dep(name = "score_itf", version = "0.1.0") -bazel_dep(name = "score_baselibs", version = "0.1.3") - -bazel_dep(name = "score_communication", version = "0.1.1") - -bazel_dep(name = "score_scrample", version = "0.1.0") - -bazel_dep(name = "score_persistency", version = "0.2.1") - -bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost") -archive_override( - module_name = "rules_boost", - urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"], - strip_prefix = "rules_boost-master", -) - -# TRLC dependency for requirements traceability -bazel_dep(name = "trlc", version = "0.0.0") -git_override( - module_name = "trlc", - commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release - remote = "https://github.com/bmw-software-engineering/trlc.git", -) \ No newline at end of file diff --git a/qnx_qemu/README.md b/qnx_qemu/README.md deleted file mode 100644 index 39a7e8d273..0000000000 --- a/qnx_qemu/README.md +++ /dev/null @@ -1,1029 +0,0 @@ -# QNX QEMU x86 Minimal Image - -## Overview - -This project provides a minimal QNX 8.0 image designed to run on x86_64 QEMU virtual machines. It's specifically configured for the Eclipse SCORE (Safety Critical Object-Oriented Real-time Embedded) project, offering a lightweight yet functional QNX environment suitable for development, testing, and demonstration purposes. - -## Quick Start Guide - -### 1. Prerequisites - -Before starting, ensure the following tools are available on your Linux host: - -- **Bazel** -- **QEMU** (with `qemu-bridge-helper` installed at `/usr/lib/qemu/qemu-bridge-helper`) -- Valid **QNX SDP 8.0 license** from . See this YT video for more info - -### 2. Installation/ Configuration - -- **Clone the integration & toolchain repos** - -```bash -git clone https://github.com/eclipse-score/reference_integration.git -git clone https://github.com/eclipse-score/toolchains_qnx.git -cd reference_integration/qnx_qemu -``` - -Toolchain repo contains the Bazel rules and credential helper used to download and register the QNX SDP toolchain. - -- **Provide QNX download credentials** - -You can pass credentials via environment variables. - -```bash -export SCORE_QNX_USER="" -export SCORE_QNX_PASSWORD="" -``` - -- **Download QNX Software Center for Linux** - -**Using GUI:** - -Download **QNX Software Center 2.0.4 Build 202501021438 - Linux Hosts** from the [QNX Software Center page](https://www.qnx.com/download/group.html?programid=29178), then install it. - -**Using CLI:** - -URL to installer must be determined manually: - -- Go to [QNX page] and log in using "SIGN IN". - -- Go to [QNX Software Center page]. - -- Scroll down and click the link labeled `QNX Software Center Build - Linux Hosts`. - -- Right-click "Download Now" button and copy the installer URL. - -- Verify installer checksum after download! - -```bash -# Create directory. -mkdir ~/.qnx -# Log-in and download installer. -curl -v --cookie-jar ~/.qnx/myqnxcookies.auth --form "userlogin=$SCORE_QNX_USER" --form "password=$SCORE_QNX_PASSWORD" https://www.qnx.com/account/login.html -o login_response.html -curl -v -L --cookie ~/.qnx/myqnxcookies.auth installer_URL > qnx-setup-lin.run -# Verify checksum. -sha256sum qnx-setup-lin.run -# Make the installer executable. -chmod +x ./qnx-setup-lin.run -# Run installer. -~/qnx-setup-lin.run force-override disable-auto-start agree-to-license-terms ~/qnxinstall -``` - -- **Download QNX SDP 8.0** - -**Using GUI:** - -Using **QNX Software Center - Linux Hosts** we previously installed , install **QNX Software Development Platform 8.0**. - -**Using CLI:** - -```bash -cd ~/qnxinstall/qnxsoftwarecenter -./qnxsoftwarecenter_clt -syncLicenseKeys -myqnx.user="$SCORE_QNX_USER" -myqnx.password="$SCORE_QNX_PASSWORD" -addLicenseKey license_key -listLicenseKeys -./qnxsoftwarecenter_clt -mirrorBaseline="qnx800" -myqnx.user="$SCORE_QNX_USER" -myqnx.password="$SCORE_QNX_PASSWORD" -./qnxsoftwarecenter_clt -cleanInstall -destination ~/qnx800 -installBaseline com.qnx.qnx800 -myqnx.user="$SCORE_QNX_USER" -myqnx.password="$SCORE_QNX_PASSWORD" -cd - > /dev/null -``` - -This contains the toolchains and `license` folder required for activation. -check this QNX link for more info - -- **Source SDP environment** - -```bash -source ~/qnx800/qnxsdp-env.sh -#The commands below confirm the environment was sourced successfully. -echo "$QNX_HOST" "$QNX_TARGET" -``` - -- **Register QNX license** - -```bash -sudo mkdir -p /opt/score_qnx/license -sudo cp ~/.qnx/license/licenses /opt/score_qnx/license/licenses -sudo chmod 644 /opt/score_qnx/license/licenses -``` - -OR we can use symbolic linking - -```bash -sudo install -d -m 755 /opt/score_qnx/license -LIC_SRC="$(readlink -f "$HOME/.qnx/license/licenses")" -sudo ln -sfn "$LIC_SRC" /opt/score_qnx/license/licenses -chmod 644 "$LIC_SRC" -``` - -- **Configure QEMU networking** - -to allow QEMU bridge helper to create TAP devices and to make sure **TUN** is available: - -Give qemu-bridge-helper the required capabilities. - -Make sure that bridge virbr0 is installed for successful QEMU startup - -```bash -sudo apt update -sudo apt install -y libvirt-daemon-system qemu-kvm -sudo systemctl enable --now libvirtd -sudo virsh net-define /usr/share/libvirt/networks/default.xml || true -sudo virsh net-autostart default -sudo virsh net-start default -``` - -Create /etc/qemu if it doesn’t exist. - -```bash -sudo install -d -m 755 /etc/qemu -echo "allow virbr0" | sudo tee /etc/qemu/bridge.conf -``` - -On Debian/Ubuntu (most common path): - -```bash -sudo setcap cap_net_admin,cap_net_raw+ep /usr/lib/qemu/qemu-bridge-helper -``` - -Verify: - -```bash -getcap /usr/lib/qemu/qemu-bridge-helper -# or -getcap /usr/libexec/qemu-bridge-helper -``` - -You should see: - -```bash -/usr/lib/qemu/qemu-bridge-helper = cap_net_admin,cap_net_raw+ep -``` - -Enable TUN device - -Make sure the TUN kernel module is loaded: - -```bash -sudo modprobe tun -``` - -Check that the device exists: - -```bash -ls -l /dev/net/tun -``` - -If successful, you’ll see: - -```bash -crw-rw-rw- 1 root root 10, 200 ... /dev/net/tun -``` - -### 3. Build & run the QNX image on qemu - -Run Bazel with the credential helper: - -```bash -bazel build --config=x86_64-qnx \ - --credential_helper=*.qnx.com=$(pwd)/../toolchains_qnx/tools/qnx_credential_helper.py \ - //build:init -``` - -- First run downloads ~1.6 GiB of QNX SDP - -- Resulting IFS: `bazel-bin/build/init.ifs` - -at this stage Build shall succeed. - -- **Run QNX in QEMU** - -verify bridge virbr0 is up and running - -```bash -ip link show virbr0 -``` - -- QEMU can use KVM for near-native performance. The wrapper below auto-enables **KVM** when available and falls back to **TCG** with a visible warning if /dev/kvm isn’t accessible - -```bash -sudo tee /usr/local/bin/qemu-system-x86_64 >/dev/null <<'EOF' -#!/usr/bin/env bash -# Smart QEMU shim: auto-enable KVM when possible; warn & fall back otherwise. -set -euo pipefail -REAL="${QEMU_BIN:-/usr/bin/qemu-system-x86_64}" - -have_kvm() { - [[ -e /dev/kvm && -r /dev/kvm && -w /dev/kvm ]] || return 1 - [[ -d /sys/module/kvm ]] && { [[ -d /sys/module/kvm_intel || -d /sys/module/kvm_amd ]] ; } || true -} - -args=("$@") -want_kvm=false -for a in "${args[@]}"; do - [[ "$a" == "--enable-kvm" ]] && want_kvm=true -done - -if have_kvm; then - $want_kvm || args+=(--enable-kvm) -else - # Strip any --enable-kvm and warn - filtered=() - for a in "${args[@]}"; do - [[ "$a" == "--enable-kvm" ]] && continue - filtered+=("$a") - done - args=("${filtered[@]}") - echo "Warning: KVM not available: /dev/kvm missing or not accessible; using software emulation (TCG)." >&2 - sleep 2 # fixed 2s pause so the warning is visible -fi - -exec "$REAL" "${args[@]}" -EOF -``` - -make the script executable - -```bash -sudo chmod +x /usr/local/bin/qemu-system-x86_64 -``` - -Tip: ensure /usr/local/bin comes before /usr/bin so the wrapper is used: - -```bash -export PATH=/usr/local/bin:$PATH -hash -r -``` - -- Run QEMU - -```bash -bazel run --config=x86_64-qnx //:run_qemu -``` - -## Features - -### Core System Components - -- **QNX 8.0 Neutrino RTOS** - Real-time operating system with SMP support -- **x86_64 Architecture** - Optimized for modern 64-bit Intel/AMD processors -- **Multiboot Support** - Compatible with GRUB and other multiboot loaders -- **56MB Image Size** - Compact footprint while maintaining essential functionality -- **Host: Ubuntu 24.04** - Developed and tested on Ubuntu 24.04 as host machine - -### Networking Capabilities - -- **VirtIO Network Driver** - High-performance virtualized networking -- **Bridge Networking** - Direct network access with configurable IP -- **Port Forwarding** - Alternative NAT-based networking mode -- **SSH Server** - Remote access with passwordless authentication -- **DHCP Client** - Automatic IP configuration with dhcpcd -- **Network Packet Capture** - tcpdump integration with Wireshark support -- **ICMP Support** - Ping connectivity for network testing -- **SFTP Server** - Secure file transfer capabilities - -### Development Tools - -- **Toybox Utilities** - Comprehensive set of Unix command-line tools -- **Shell Environment** - Korn shell (ksh) with standard Unix tools -- **SSH Client/Server** - Full SSH stack for remote development -- **OpenSSL** - Cryptographic libraries and tools -- **File System Support** - QNX6 and DOS file systems - -### Storage and I/O - -- **RAM Disk** - 10MB temporary storage with 512KB cache -- **IDE/SATA Support** - Block device access for persistent storage -- **Serial Console** - 115200 baud serial interface for debugging -- **PCI Hardware Support** - Comprehensive PCI device management - -### Security Features - -- **User Management** - Root and regular user accounts -- **SSH Key Authentication** - RSA host keys pre-configured -- **File Permissions** - Standard Unix-style permissions -- **Chroot Environment** - SSH privilege separation - -## Directory Structure - -```text -qnx_qemu/ -├── README.md # This documentation file -├── BUILD # Bazel build configuration with multiple run targets -├── MODULE.bazel # Bazel module configuration -├── .bazelrc # Bazel configuration file -│ -├── build/ # Image build definitions -│ ├── BUILD # Build targets for QNX image creation -│ ├── init.build # IFS (Image FileSystem) definition -│ └── system.build # System content definition (libraries, tools, configs) -│ -├── configs/ # Configuration files and scripts -│ ├── BUILD # Build configuration for config files -│ ├── startup.sh # Main system startup script -│ ├── network_setup.sh # Standard network configuration -│ ├── network_setup_dhcp.sh # DHCP-based network configuration -│ ├── network_capture.sh # Network packet capture utility -│ ├── dhcpcd.conf # DHCP client configuration -│ ├── sshd_config # SSH daemon configuration (passwordless) -│ ├── ssh_host_rsa_key # SSH server private key -│ ├── ssh_host_rsa_key.pub # SSH server public key -│ ├── pci_server.cfg # PCI bus server configuration -│ ├── pci_hw.cfg # PCI hardware configuration -│ ├── qcrypto.conf # Cryptographic library configuration -│ ├── passwd # User account database -│ ├── group # Group membership database -│ ├── hostname # System hostname definition -│ └── profile # Shell environment configuration -│ -├── scripts/ # Utility scripts -│ ├── run_qemu.sh # QEMU launcher with bridge networking -│ ├── run_qemu_portforward.sh # QEMU launcher with port forwarding -│ └── qnx_wireshark.sh # Wireshark integration for network analysis -│ -└── test/ # Testing framework - ├── test_qnx_qemu_bridge.sh # Bridge networking integration tests - └── test_qnx_qemu_portforward.sh # Port forwarding integration tests -``` - -### Key Files Explained - -- **`init.build`** - Defines the bootable image structure, kernel parameters, and essential boot-time utilities -- **`system.build`** - Specifies all system libraries, tools, and configuration files for the running system -- **`startup.sh`** - Orchestrates system service initialization (logging, PCI, networking, SSH) -- **`network_setup.sh`** - Configures network interfaces with static IP addressing -- **`network_setup_dhcp.sh`** - Configures network interfaces with DHCP -- **`network_capture.sh`** - Network packet capture tool with Wireshark integration -- **`run_qemu.sh`** - Launches QEMU with bridge networking for direct IP access -- **`run_qemu_portforward.sh`** - Launches QEMU with port forwarding (NAT networking) -- **`qnx_wireshark.sh`** - Host-side script for Wireshark network analysis integration -- **`test_qnx_qemu_bridge.sh`** - Automated testing for bridge networking mode -- **`test_qnx_qemu_portforward.sh`** - Automated testing for port forwarding mode - -## Building the Image - -### Prerequisites - -- Bazel build system -- QNX SDP (Software Development Platform) toolchain -- Linux host system with KVM support - -### Build Commands - -```bash -# Build the QNX image -bazel build --config=x86_64-qnx //build:init - -# Build and run QEMU with bridge networking -bazel run --config=x86_64-qnx //:run_qemu - -# Build and run QEMU with port forwarding -bazel run --config=x86_64-qnx //:run_qemu_portforward - -# Run integration tests for bridge networking -bazel run --config=x86_64-qnx //:test_qemu_bridge - -# Run integration tests for port forwarding -bazel run --config=x86_64-qnx //:test_qemu_portforward - -# Run ITF tests for ssh -bazel test --config=qemu-integration //:test_ssh_qemu --test_output=streamed -``` - -In order to provide credentials for qnx.com pass to bazel command: - -```bash ---credential_helper=*.qnx.com=/tools/qnx_credential_helper.py -``` - -See more in [toolchains_qnx README](https://github.com/eclipse-score/toolchains_qnx?tab=readme-ov-file#using-pre-packaged-qnx-80-sdp). - -## Running the System - -### Using Bazel (Recommended) - -#### Bridge Networking Mode - -```bash -# Start the QNX system with bridge networking (direct IP access) -bazel run --config=x86_64-qnx //:run_qemu -``` - -This mode provides: - -- Direct IP access to QNX system -- Ping connectivity from host -- SSH access via direct IP e.g.: `ssh root@192.168.122.100` - -#### Port Forwarding Mode - -```bash -# Start the QNX system with port forwarding (NAT networking) -bazel run --config=x86_64-qnx //:run_qemu_portforward -``` - -This mode provides: - -- SSH access via port forwarding: `ssh -p 2222 root@localhost` -- HTTP port forwarding: `localhost:8080` → `guest:80` -- HTTPS port forwarding: `localhost:8443` → `guest:443` -- Packet capture port: `localhost:9999` → `guest:9999` - -### Manual QEMU Execution - -#### Bridge Networking - -```bash -qemu-system-x86_64 \ - -smp 2 \ - --enable-kvm \ - -cpu Cascadelake-Server-v5 \ - -m 1G \ - -nographic \ - -kernel path/to/ifs_image \ - -serial mon:stdio \ - -object rng-random,filename=/dev/urandom,id=rng0 \ - -netdev bridge,id=net0,br=virbr0 \ - -device virtio-net-pci,netdev=net0 \ - -device virtio-rng-pci,rng=rng0 -``` - -#### Port Forwarding - -```bash -qemu-system-x86_64 \ - -smp 2 \ - --enable-kvm \ - -cpu Cascadelake-Server-v5 \ - -m 1G \ - -nographic \ - -kernel path/to/ifs_image \ - -serial mon:stdio \ - -object rng-random,filename=/dev/urandom,id=rng0 \ - -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::8080-:80,hostfwd=tcp::8443-:443,hostfwd=tcp::9999-:9999 \ - -device virtio-net-pci,netdev=net0 \ - -device virtio-rng-pci,rng=rng0 -``` - -### QEMU Parameters Explained - -- **`-smp 2`** - Enable 2 CPU cores for SMP support -- **`--enable-kvm`** - Use hardware virtualization for better performance -- **`-cpu Cascadelake-Server-v5`** - Emulate modern Intel CPU features for older Ubuntu versions change that to `-cpu host` in case of errors -- **`-m 1G`** - Allocate 1GB of RAM -- **`-nographic`** - Disable graphical display (console-only) -- **`-netdev bridge`** - Connect to host bridge network for direct IP access -- **`-device virtio-net-pci`** - Use VirtIO network driver for optimal performance -- **`-device virtio-rng-pci`** - Provide hardware random number generation - -## Network Configuration - -### Default Network Settings - -#### Bridge Network Configuration - -- **IP Address**: DHCP client for QNX SDP 8.0 is dhcpcd. It also provides the IPv4 Link Local addressing and IPv6 Router Solicitation functionality that was previously provided by autoipd -- **Subnet Mask**: `255.255.255.0` -- **Network Interface**: `vtnet0` (VirtIO network) -- **SSH Port**: `22` - -#### Port Forward Network Configuration - -- **IP Address**: `10.0.2.15` (QEMU user networking) -- **Subnet Mask**: `255.255.255.0` -- **Network Interface**: `vtnet0` (VirtIO network) -- **SSH Port**: `22` (forwarded to host port `2222`) - -### Changing the IP Address - -To modify the default IP address, edit the network configuration: - -1. **Edit network setup script**: - - ```bash - vim configs/network_setup.sh - ``` - -2. **Example on modify the IP configuration line**: - - ```bash - # Change this line to your desired IP - ifconfig vtnet0 192.168.122.100 netmask 255.255.255.0 - - # Example: Change to 192.168.1.50 - ifconfig vtnet0 192.168.1.50 netmask 255.255.255.0 - ``` - -3. **Update test script IP** (if using tests): - - ```bash - vim test/test_qnx_qemu_bridge.sh - ``` - - Change the default IP in the bridge test script: - - ```bash - QNX_IP=${QNX_IP:-192.168.1.50} # Update default IP - ``` - -4. **Rebuild the image**: - - ```bash - bazel build --config=x86_64-qnx //build:init - ``` - -### Network Bridge Setup (Host) - -For direct IP access, ensure your host has a bridge network configured: - -```bash -# Create bridge (if not exists) -sudo ip link add name virbr0 type bridge -sudo ip link set virbr0 up -sudo ip addr add 192.168.122.1/24 dev virbr0 - -# Enable IP forwarding -echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward -``` - -In case of failed to parse default acl file /etc/qemu/bridge.conf' - -1. Check acl of `/etc/qemu/bridge.conf` -2. If file does not exist; create that file and add the following line in it -`allow virbr0` -3. Run qemu with Sudo as debug option in case of failure with acl - -In case of error "Operation not permitted" for `qemu-bridge-helper` run - -```bash -sudo chmod u+s /usr/lib/qemu/qemu-bridge-helper -``` - -## User Accounts and Access - -### Available Users - -| Username | UID | GID | Home Directory | Shell | Password | -|----------|-----|-----|----------------|-------|----------| -| root | 0 | 0 | / | /bin/sh | None (passwordless) | -| qnxuser | 1000 | 1000 | / | /bin/sh | None (passwordless) | -| sshd | 15 | 6 | / | /bin/false | N/A (service account) | - -### SSH Access - -The system is configured for passwordless SSH access: - -#### SSH via Bridge Network - -```bash -# Connect via bridge network (DHCP or fallback IP) -ssh root@192.168.122.100 # If using fallback IP -# OR check actual DHCP-assigned IP first: -# ssh root@ - -# Connect as regular user -ssh qnxuser@192.168.122.100 # If using fallback IP -``` - -#### SSH via Port Forwarding - -```bash -# Connect via port forwarding (recommended for NAT networking) -ssh -p 2222 root@localhost - -# Connect as regular user via port forwarding -ssh -p 2222 qnxuser@localhost -``` - -**Note**: No password is required. The system accepts empty passwords for simplicity in development environments. - -## Testing - -### Automated Test Suite - -The project includes comprehensive test suites for both networking modes that validate: - -- System boot and initialization -- Network connectivity (ping tests for bridge mode) -- SSH server functionality -- System service status -- File system operations -- Network-specific features - -### Running Tests - -#### Bridge Networking Tests - -```bash -# Run bridge networking test suite -bazel run --config=x86_64-qnx //:test_qemu_bridge - -# Run with custom parameters -bazel run --config=x86_64-qnx //:test_qemu_bridge -- --timeout=120 --boot-wait=20 --qnx-ip=192.168.1.50 -``` - -#### Port Forwarding Tests - -```bash -# Run port forwarding test suite -bazel run --config=x86_64-qnx //:test_qemu_portforward - -# Run with custom parameters -bazel run --config=x86_64-qnx //:test_qemu_portforward -- --timeout=120 --boot-wait=20 -``` - -### Test Script Options - -#### Bridge Networking Test Options - -```bash -./test_qnx_qemu_bridge.sh [options] - -Options: - --timeout=N Boot timeout in seconds (default: 120) - --ssh-port=N SSH port for testing (default: 2222) - --ssh-user=USER SSH user for testing (default: root) - --boot-wait=N Additional wait after boot (default: 15) - --qnx-ip=IP QNX system IP for ping test (default: 192.168.122.100) - --no-ssh Skip SSH connectivity test - --no-ping Skip ping connectivity test - --help Show help message -``` - -#### Port Forwarding Test Options - -```bash -./test_qnx_qemu_portforward.sh [options] - -Options: - --timeout=N Boot timeout in seconds (default: 120) - --ssh-port=N SSH port for testing (default: 2222) - --ssh-user=USER SSH user for testing (default: root) - --boot-wait=N Additional wait after boot (default: 15) - --no-ssh Skip SSH connectivity test - --help Show help message - -Note: Port forwarding mode does not support ping tests due to NAT networking. -``` - -### Expected Test Output - -```text -============================================================ -QNX QEMU Integration Test -============================================================ -QNX Host: /path/to/qnx/host -IFS Image: /path/to/ifs/image -Timeout: 90s -QNX IP: 192.168.122.100 -SSH Port: 2222 -SSH User: root -Ping Test: Enabled -Boot Wait: 15s - -1. Starting QEMU with bridge networking... -✓ QEMU started (PID: 12345) -✓ Bridge networking: 192.168.122.100 (for ping test) -✓ SSH port forwarding: localhost:2222 -> guest:22 - -2. Waiting for boot completion (timeout: 90s)... -Waiting for hostname confirmation: 'Hostname set to: Qnx_S-core' -✓ Boot completion detected: Found hostname confirmation -✓ System fully booted and hostname configured - -3. Waiting for system stabilization (15s)... -✓ Stabilization wait completed - -4. Testing ping connectivity to QNX system... -Testing ping to 192.168.122.100... -✓ Ping test successful - QNX system is reachable at 192.168.122.100 -Ping statistics: -PING 192.168.122.100 (192.168.122.100) 56(84) bytes of data. -64 bytes from 192.168.122.100: icmp_seq=1 ttl=64 time=0.234 ms -64 bytes from 192.168.122.100: icmp_seq=2 ttl=64 time=0.187 ms -64 bytes from 192.168.122.100: icmp_seq=3 ttl=64 time=0.198 ms - -5. Testing system functionality... -✓ QEMU process is still running -✓ Found system indicator: qnx -✓ Found system indicator: Welcome -✓ Found system indicator: startup -✓ System functionality indicators found (3) - -6. Testing SSH connectivity... -Testing SSH port connectivity on localhost:2222... -✓ SSH port 2222 is open on localhost -Testing direct SSH connection to QNX system... -Attempting SSH connection to root@192.168.122.100... -✓ SSH connection to 192.168.122.100 successful -✓ Checked /tmp/hostname contents - -7. Final system status... -✓ QEMU process is running (PID: 12345) - -Recent system output: ----------------------------------------- ----> Starting sshd -Hostname set to: Qnx_S-core -# ----------------------------------------- - -============================================================ -✓ ALL TESTS PASSED -QNX QEMU integration is working correctly! -QEMU is running on PID: 12345 -QNX system IP: 192.168.122.100 (pingable) -SSH port forwarding: localhost:2222 -> guest:22 -============================================================ -``` - -### Test Failure Scenarios - -If tests fail, check: - -1. **Boot Timeout**: Increase `--timeout` value -2. **Network Issues**: Verify bridge setup and IP configuration -3. **SSH Problems**: Check SSH daemon startup and port forwarding -4. **Host Permissions**: Ensure user can access KVM and bridge networking - -## System Capabilities - -### Available Commands - -The system includes a comprehensive set of Unix-like utilities through Toybox: - -**File Operations**: `ls`, `cp`, `mv`, `rm`, `cat`, `grep`, `find`, `chmod`, `chown` -**Text Processing**: `awk`, `sed`, `sort`, `cut`, `tr`, `wc`, `head`, `tail` -**System Info**: `ps` (pidin), `uname`, `whoami`, `id`, `hostname` -**Network Tools**: `ifconfig`, `ssh`, `scp`, `ping` (through system), `tcpdump` -**Network Analysis**: `network_capture` - Packet capture with Wireshark integration -**Compression**: `gzip`, `gunzip`, `tar`, `bzip2` -**Development**: `openssl`, `hexdump`, `od`, `strings` - -### System Services - -- **System Logger** (`slogger2`) - Centralized logging with 4KB buffer -- **PCI Server** - Hardware device management -- **SSH Daemon** - Remote access service -- **File System Event Manager** - File change notifications -- **Message Queues** - POSIX IPC support -- **Random Number Generator** - Entropy service -- **Network Stack** - TCP/IP with VirtIO drivers - -### File Systems - -- **Root File System** - Image File System (IFS) in memory -- **QNX6 File System** - On RAM disk (`/tmp_ram`) -- **DOS File System** - For compatibility -- **Pseudo File Systems** - `/proc`, `/dev`, `/tmp` - -## Network Trace Collection - -### Network Analysis Overview - -The QNX system includes comprehensive network packet capture capabilities with Wireshark integration. This enables real-time analysis of network traffic for debugging, security analysis, and performance monitoring. - -### Packet Capture Methods - -#### 1. Direct Capture on QNX System - -Access the QNX system and use the built-in capture tool: - -```bash -# SSH into QNX system -ssh -p 2222 root@localhost - -# Start packet capture (saves to file) -network_capture start - -# Capture with filter (e.g., SSH traffic only) -network_capture start "tcp port 22" - -# Check capture status -network_capture status - -# List captured files -network_capture list - -# Stop capture -network_capture stop -``` - -#### 2. Real-time Streaming to Wireshark - -Stream packets directly to Wireshark running on the host system: - -```bash -# On QNX system: Start packet streaming -network_capture stream - -# On host system: Launch Wireshark with remote capture -# Method 1: Use integration script (recommended) -./scripts/qnx_wireshark.sh wireshark - -# Method 2: Manual Wireshark configuration -# 1. Open Wireshark -# 2. Go to Capture -> Options -> Manage Interfaces -# 3. Add remote interface: TCP@localhost:9999 -# 4. Start capture -``` - -### Host Integration Script - -The `scripts/qnx_wireshark.sh` script provides seamless integration: - -```bash -# Launch Wireshark with live QNX capture -./scripts/qnx_wireshark.sh wireshark - -# Start streaming (manual Wireshark setup) -./scripts/qnx_wireshark.sh stream - -# Download saved capture files -./scripts/qnx_wireshark.sh list -./scripts/qnx_wireshark.sh download capture_20250129_143022.pcap - -# Check QNX capture status -./scripts/qnx_wireshark.sh status - -# Stop all captures -./scripts/qnx_wireshark.sh stop -``` - -### Network Filtering Examples - -Common packet filters for targeted analysis: - -```bash -# SSH traffic analysis -network_capture start "tcp port 22" - -# ICMP/ping analysis -network_capture start "icmp" - -# All TCP traffic -network_capture start "tcp" - -# Traffic to/from gateway -network_capture start "host 10.0.2.2" - -# HTTP/HTTPS traffic -network_capture start "tcp port 80 or tcp port 443" - -# DNS queries -network_capture start "udp port 53" -``` - -### Port Forwarding Configuration - -The system is configured with port forwarding for network analysis: - -- **SSH**: `localhost:2222` → `guest:22` -- **HTTP**: `localhost:8080` → `guest:80` -- **HTTPS**: `localhost:8443` → `guest:443` -- **Packet Stream**: `localhost:9999` → `guest:9999` - -### Wireshark Analysis Workflow - -1. **Start QNX System**: - - ```bash - bazel run --config=x86_64-qnx //:run_qemu_portforward - ``` - -2. **Launch Live Capture**: - - ```bash - ./scripts/qnx_wireshark.sh wireshark "tcp" - ``` - -3. **Generate Traffic**: - - - SSH connections: `ssh -p 2222 root@localhost` - - Network tests: `ping` from within QNX - - Application traffic through port forwarding - -4. **Analyze in Wireshark**: - - Real-time packet inspection - - Protocol analysis - - Network performance metrics - - Security analysis - -### Saved Capture Analysis - -For offline analysis of saved captures: - -```bash -# List available captures -./scripts/qnx_wireshark.sh list - -# Download specific capture -./scripts/qnx_wireshark.sh download capture_20250129_143022.pcap - -# Open in Wireshark -wireshark capture_20250129_143022.pcap -``` - -### Troubleshooting Network Capture - -**Connection Issues**: - -- Verify SSH connectivity: `ssh -p 2222 root@localhost` -- Check port forwarding: `netstat -tlnp | grep 9999` -- Ensure QNX system is running: `./scripts/qnx_wireshark.sh status` - -**Wireshark Integration**: - -- Install Wireshark: `sudo apt install wireshark` (Ubuntu/Debian) -- Add user to wireshark group: `sudo usermod -a -G wireshark $USER` -- Verify remote capture support in Wireshark - -**Packet Loss**: - -- Reduce capture load with specific filters -- Use file-based capture for high-throughput analysis -- Monitor system resources on QNX - -### Network Security Considerations - -- Packet captures may contain sensitive data -- Use filters to limit captured data scope -- Secure transfer of capture files from QNX system -- Regular cleanup of capture files in `/tmp_ram/var/capture` - -## Troubleshooting - -### Common Issues - -1. **System Won't Boot** - - Check QNX SDP toolchain installation - - Verify image file permissions - - Ensure KVM is available and accessible - -2. **Network Connectivity Issues** - - Verify bridge network configuration on host - - Check IP address conflicts - - Ensure firewall allows bridge traffic - -3. **SSH Connection Refused** - - Wait for full system boot (look for "Hostname set to: Qnx_S-core") - - Check SSH daemon startup in console output - - Verify port forwarding configuration - -4. **Performance Issues** - - Enable KVM acceleration (`--enable-kvm`) - - Increase memory allocation (`-m 2G`) - - Use VirtIO drivers for I/O - -### Debug Information - -- **Boot Messages**: Monitor serial console for startup progress -- **System Logs**: Use `slog2info` within the system -- **Process List**: Use `pidin` to see running processes -- **Network Status**: Use `ifconfig` to check interface configuration - -### Host Requirements - -- **Linux Distribution**: Ubuntu 20.04+ or equivalent -- **Virtualization**: KVM support enabled -- **Memory**: Minimum 4GB host RAM (1GB allocated to guest) -- **Network**: Bridge networking capability -- **Privileges**: Access to `/dev/kvm` and bridge creation - -## Development and Customization - -### Adding New Software - -1. **Edit system.build**: Add new binaries and libraries -2. **Update dependencies**: Include required shared libraries -3. **Rebuild image**: `bazel build --config=x86_64-qnx //build:init` - -### Modifying Services - -1. **Edit startup.sh**: Modify service startup sequence -2. **Add configuration files**: Place in `configs/` directory -3. **Update BUILD file**: Include new configuration files - -### Security Considerations - -This image is configured for development convenience with: - -- Passwordless SSH access -- Root login enabled -- Relaxed security policies - -For production use, implement: - -- Strong authentication mechanisms -- User privilege restrictions -- Network access controls -- Audit logging - -## Contributing - -This project is part of the Eclipse SCORE initiative. Contributions should follow Eclipse Foundation guidelines and maintain compatibility with the SCORE architecture. - -## License - -This project is licensed under the Apache License 2.0. See the LICENSE file for details. - ---- - -**Eclipse SCORE** - Safety Critical Object-Oriented Real-time Embedded Systems diff --git a/qnx_qemu/build/BUILD b/qnx_qemu/build/BUILD deleted file mode 100644 index 077d30e0e9..0000000000 --- a/qnx_qemu/build/BUILD +++ /dev/null @@ -1,63 +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 -# ******************************************************************************* - -load("@score_toolchains_qnx//rules/fs:ifs.bzl", "qnx_ifs") - -filegroup( - name = "scripts", - srcs = [ - "//configs:startup.sh", - ], - visibility = ["//visibility:private"], -) - -filegroup( - name = "configs", - srcs = [ - "//configs:pci_server.cfg", - "//configs:pci_hw.cfg", - "//configs:qcrypto.conf", - "//configs:passwd", - "//configs:group", - "//configs:sshd_config", - "//configs:ssh_host_rsa_key", - "//configs:ssh_host_rsa_key.pub", - "//configs:hostname", - "//configs:network_setup.sh", - "//configs:network_capture.sh", - "//configs:profile", - "//configs:dhcpcd.conf", - "//configs:network_setup_dhcp.sh", - ], - visibility = ["//visibility:private"], -) - -qnx_ifs( - name = "init", - build_file = "init.build", - srcs = [ - "system.build", - ":scripts", - ":configs", - "@score_scrample//src:scrample", - "//scrample_integration:etc_configs", - "@score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios", - ], - ext_repo_maping = { - "SCRAMPLE_PATH": "$(location @score_scrample//src:scrample)", - "CPP_TEST_SCENARIOS_PATH": "$(location @score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios)", - }, - visibility = [ - "//:__pkg__" - ], -) diff --git a/qnx_qemu/test/test_qnx_qemu_bridge.sh b/qnx_qemu/test/test_qnx_qemu_bridge.sh deleted file mode 100755 index f7b8468fd0..0000000000 --- a/qnx_qemu/test/test_qnx_qemu_bridge.sh +++ /dev/null @@ -1,509 +0,0 @@ -#!/bin/bash - -# ******************************************************************************* -# 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 -# ******************************************************************************* - -set -euo pipefail - -# QNX QEMU Bridge Network Test Script -# Tests QNX QEMU image with bridge networking and fixed IP - -# Default configuration -TIMEOUT=${TIMEOUT:-120} -SSH_PORT=${SSH_PORT:-2222} -SSH_USER=${SSH_USER:-root} -BOOT_WAIT=${BOOT_WAIT:-15} -QNX_IP=${QNX_IP:-192.168.122.100} -QNX_HOST="" -IFS_IMAGE="" - -# Parse command line arguments -usage() { - echo "Usage: $0 [options]" - echo "Options:" - echo " --timeout=N Boot timeout in seconds (default: 120)" - echo " --ssh-port=N SSH port for testing (default: 2222)" - echo " --ssh-user=USER SSH user for testing (default: root)" - echo " --boot-wait=N Additional wait after boot (default: 15)" - echo " --qnx-ip=IP QNX system IP for ping test (default: 192.168.122.100)" - echo " --no-ssh Skip SSH connectivity test" - echo " --no-ping Skip ping connectivity test" - echo " --help Show this help" - echo "" - echo "Note: This test uses bridge networking with fixed IP" - exit 1 -} - -# Parse arguments -TEST_SSH=true -TEST_PING=true -while [[ $# -gt 0 ]]; do - case $1 in - --timeout=*) - TIMEOUT="${1#*=}" - shift - ;; - --ssh-port=*) - SSH_PORT="${1#*=}" - shift - ;; - --ssh-user=*) - SSH_USER="${1#*=}" - shift - ;; - --boot-wait=*) - BOOT_WAIT="${1#*=}" - shift - ;; - --qnx-ip=*) - QNX_IP="${1#*=}" - shift - ;; - --no-ssh) - TEST_SSH=false - shift - ;; - --no-ping) - TEST_PING=false - shift - ;; - --help) - usage - ;; - -*) - echo "Unknown option: $1" - usage - ;; - *) - if [ -z "$QNX_HOST" ]; then - QNX_HOST="$1" - elif [ -z "$IFS_IMAGE" ]; then - IFS_IMAGE="$1" - else - echo "Too many arguments" - usage - fi - shift - ;; - esac -done - -# Validate required arguments -if [ -z "$QNX_HOST" ] || [ -z "$IFS_IMAGE" ]; then - echo "Error: Missing required arguments" - usage -fi - -# Validate files exist -if [ ! -d "$QNX_HOST" ]; then - echo "Error: QNX host directory not found: $QNX_HOST" - exit 1 -fi - -if [ ! -f "$IFS_IMAGE" ]; then - echo "Error: IFS image not found: $IFS_IMAGE" - exit 1 -fi - -# Global variables -QEMU_PID="" -OUTPUT_LOG="/tmp/qnx_qemu_bridge_test_$$.log" - -echo "============================================================" -echo "QNX QEMU Bridge Network Test" -echo "============================================================" -echo "QNX Host: $QNX_HOST" -echo "IFS Image: $IFS_IMAGE" -echo "Timeout: ${TIMEOUT}s" -echo "QNX IP: $QNX_IP (bridge network)" -if [ "$TEST_SSH" = true ]; then - echo "SSH Test: Enabled (direct connection)" - echo "SSH User: $SSH_USER" -else - echo "SSH Test: Disabled" -fi -if [ "$TEST_PING" = true ]; then - echo "Ping Test: Enabled" -else - echo "Ping Test: Disabled" -fi -echo "Boot Wait: ${BOOT_WAIT}s" -echo "Network Mode: Bridge (virbr0)" -echo "" - -# Cleanup function -cleanup() { - echo "" - echo "Cleaning up..." - - # Kill QEMU process - if [ -n "$QEMU_PID" ] && kill -0 "$QEMU_PID" 2>/dev/null; then - echo "Terminating QEMU process (PID: $QEMU_PID)" - kill "$QEMU_PID" 2>/dev/null || true - sleep 3 - if kill -0 "$QEMU_PID" 2>/dev/null; then - echo "Force killing QEMU process" - kill -9 "$QEMU_PID" 2>/dev/null || true - fi - fi - - # Clean up files - rm -f "/tmp/qemu.pid" "$OUTPUT_LOG" 2>/dev/null || true - - echo "Cleanup completed" -} - -# Set trap for cleanup -trap cleanup EXIT INT TERM - -# Function to start QEMU with bridge networking -start_qemu() { - echo "1. Starting QEMU with bridge networking..." - - # Start QEMU in background with bridge networking only (no port forwarding) - qemu-system-x86_64 \ - -smp 2 \ - --enable-kvm \ - -cpu Cascadelake-Server-v5 \ - -m 1G \ - -pidfile /tmp/qemu.pid \ - -nographic \ - -kernel "$IFS_IMAGE" \ - -serial mon:stdio \ - -object rng-random,filename=/dev/urandom,id=rng0 \ - -device virtio-rng-pci,rng=rng0 \ - -netdev bridge,id=net0,br=virbr0 \ - -device virtio-net-pci,netdev=net0 \ - > "$OUTPUT_LOG" 2>&1 & - - QEMU_PID=$! - echo "✓ QEMU started (PID: $QEMU_PID)" - echo "✓ Bridge networking enabled (DHCP with fallback: $QNX_IP)" - echo "✓ Direct network access via bridge interface" -} - -# Function to wait for boot completion -wait_for_boot() { - echo "" - echo "2. Waiting for boot completion (timeout: ${TIMEOUT}s)..." - - local start_time=$(date +%s) - local boot_complete=false - - # Look specifically for hostname confirmation message - local hostname_pattern="Hostname set to: Qnx_S-core" - - echo "Waiting for hostname confirmation: '$hostname_pattern'" - - while [ $(($(date +%s) - start_time)) -lt "$TIMEOUT" ]; do - # Check if QEMU process is still running - if ! kill -0 "$QEMU_PID" 2>/dev/null; then - echo "✗ QEMU process terminated unexpectedly" - echo "Last output:" - tail -20 "$OUTPUT_LOG" 2>/dev/null || echo "No output available" - return 1 - fi - - # Check for hostname confirmation message - if grep -q "$hostname_pattern" "$OUTPUT_LOG" 2>/dev/null; then - echo "✓ Boot completion detected: Found hostname confirmation" - boot_complete=true - break - fi - - # Show progress every 10 seconds - local elapsed=$(($(date +%s) - start_time)) - if [ $((elapsed % 10)) -eq 0 ] && [ $elapsed -gt 0 ]; then - echo " ... still waiting (${elapsed}s elapsed)" - fi - - sleep 2 - done - - if [ "$boot_complete" = true ]; then - echo "✓ System fully booted and hostname configured" - return 0 - else - echo "✗ Boot timeout reached - hostname confirmation not found" - echo "Recent QEMU output:" - echo "----------------------------------------" - tail -20 "$OUTPUT_LOG" 2>/dev/null || echo "No output available" - echo "----------------------------------------" - return 1 - fi -} - -# Function to wait additional time for system stabilization -wait_for_stabilization() { - if [ "$BOOT_WAIT" -gt 0 ]; then - echo "" - echo "3. Waiting for system stabilization (${BOOT_WAIT}s)..." - sleep "$BOOT_WAIT" - echo "✓ Stabilization wait completed" - fi -} - -# Function to detect actual QNX IP address -detect_qnx_ip() { - echo "" - echo "4. Detecting QNX system IP address..." - - local detected_ip="" - local dhcp_status="" - - # Try to get DHCP status from the system - local dhcp_pattern="DHCP_SUCCESS\|DHCP_FAILED_STATIC_FALLBACK" - local dhcp_wait=30 - local dhcp_start=$(date +%s) - - echo "Waiting for network configuration to complete..." - - while [ $(($(date +%s) - dhcp_start)) -lt "$dhcp_wait" ]; do - if grep -q "$dhcp_pattern" "$OUTPUT_LOG" 2>/dev/null; then - dhcp_status=$(grep "$dhcp_pattern" "$OUTPUT_LOG" | tail -1) - echo "✓ Network configuration detected: $dhcp_status" - break - fi - sleep 2 - echo " ... waiting for network setup" - done - - # Try to extract IP from DHCP status in logs - local ip_pattern="IP address set to: [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" - if grep -q "$ip_pattern" "$OUTPUT_LOG" 2>/dev/null; then - detected_ip=$(grep "$ip_pattern" "$OUTPUT_LOG" | tail -1 | sed 's/.*IP address set to: \([0-9.]*\).*/\1/') - if [ -n "$detected_ip" ] && [ "$detected_ip" != "0.0.0.0" ]; then - echo "✓ Detected QNX IP address from logs: $detected_ip" - QNX_IP="$detected_ip" - return 0 - fi - fi - - # If we couldn't detect IP from logs, use the fallback IP - echo "⚠ Could not detect actual IP from logs, using fallback: $QNX_IP" - echo " (System may be using DHCP or static fallback)" - - return 0 -} - -# Function to test ping connectivity -test_ping_connectivity() { - if [ "$TEST_PING" != true ]; then - echo "" - echo "5. Ping test skipped (disabled)" - return 0 - fi - - echo "" - echo "5. Testing ping connectivity to QNX system..." - - # Test ping connectivity to the QNX system - echo "Testing ping to $QNX_IP..." - - if command -v ping >/dev/null 2>&1; then - # Try ping with different approaches (some systems use different flags) - local ping_success=false - - # Try standard ping (3 packets) - if ping -c 3 -W 5 "$QNX_IP" >/dev/null 2>&1; then - ping_success=true - elif ping -c 3 -w 5 "$QNX_IP" >/dev/null 2>&1; then - ping_success=true - fi - - if [ "$ping_success" = true ]; then - echo "✓ Ping test successful - QNX system is reachable at $QNX_IP" - - # Show ping statistics - echo "Ping statistics:" - ping -c 3 "$QNX_IP" 2>/dev/null || echo " (statistics not available)" - else - echo "✗ Ping test failed - QNX system not reachable at $QNX_IP" - echo "This could indicate:" - echo " - Bridge networking not properly configured" - echo " - QNX network setup failed or still in progress" - echo " - Host firewall blocking ICMP" - echo " - IP address detection was incorrect" - return 1 - fi - else - echo "⚠ Ping command not available, skipping ping test" - fi - - return 0 -} - -# Function to test system functionality -test_system_functionality() { - echo "" - echo "6. Testing system functionality..." - - # Check if QEMU is still running - if ! kill -0 "$QEMU_PID" 2>/dev/null; then - echo "✗ QEMU process is not running" - return 1 - fi - echo "✓ QEMU process is still running" - - # Check for system indicators in output - local system_indicators=( - "qnx" - "Welcome" - "shell" - "startup" - ) - - local found_indicators=0 - for indicator in "${system_indicators[@]}"; do - if grep -i -q "$indicator" "$OUTPUT_LOG" 2>/dev/null; then - echo "✓ Found system indicator: $indicator" - ((found_indicators++)) - fi - done - - if [ "$found_indicators" -gt 0 ]; then - echo "✓ System functionality indicators found ($found_indicators)" - return 0 - else - echo "✗ No system functionality indicators found" - return 1 - fi -} - -# Function to test SSH connectivity -test_ssh_connectivity() { - if [ "$TEST_SSH" != true ]; then - echo "" - echo "7. SSH test skipped (disabled)" - return 0 - fi - - echo "" - echo "7. Testing SSH connectivity..." - - # Test direct SSH connection to QNX system IP without key authentication - echo "Testing direct SSH connection to QNX system..." - if command -v ssh >/dev/null 2>&1; then - echo "Attempting SSH connection to $SSH_USER@$QNX_IP..." - - # Try SSH connection with password authentication (no keys, empty password) - if timeout 15 ssh -o ConnectTimeout=10 \ - -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null \ - -o PreferredAuthentications=password \ - -o PubkeyAuthentication=no \ - -o PasswordAuthentication=yes \ - -o BatchMode=yes \ - "$SSH_USER@$QNX_IP" \ - "echo 'SSH connection successful'; hostname 2>/dev/null || echo 'hostname command not available'; ifconfig vtnet0 2>/dev/null | grep 'inet ' || echo 'Network info not available'" 2>/dev/null; then - echo "✓ SSH connection to $QNX_IP successful" - echo "✓ Executed remote commands successfully" - else - echo "✗ SSH connection to $QNX_IP failed" - echo "This could indicate:" - echo " - SSH daemon not yet started" - echo " - Network connectivity issues" - echo " - SSH authentication problems" - echo " - Firewall blocking SSH port" - return 1 - fi - else - echo "⚠ SSH client not available, skipping SSH connection test" - fi - - return 0 -} - -# Function to show final system status -show_system_status() { - echo "" - echo "8. Final system status..." - - if kill -0 "$QEMU_PID" 2>/dev/null; then - echo "✓ QEMU process is running (PID: $QEMU_PID)" - else - echo "✗ QEMU process is not running" - fi - - echo "" - echo "Recent system output:" - echo "----------------------------------------" - tail -15 "$OUTPUT_LOG" 2>/dev/null || echo "No output available" - echo "----------------------------------------" -} - -# Main execution -main() { - local all_tests_passed=true - - # Start QEMU - if ! start_qemu; then - echo "✗ Failed to start QEMU" - return 1 - fi - - # Wait for boot - if ! wait_for_boot; then - echo "✗ Boot test failed" - all_tests_passed=false - fi - - # Wait for stabilization - wait_for_stabilization - - # Detect actual QNX IP address - if ! detect_qnx_ip; then - echo "✗ IP detection failed" - all_tests_passed=false - fi - - # Test ping connectivity - if ! test_ping_connectivity; then - echo "✗ Ping connectivity test failed" - all_tests_passed=false - fi - - # Test system functionality - if ! test_system_functionality; then - echo "✗ System functionality test failed" - all_tests_passed=false - fi - - # Test SSH connectivity - if ! test_ssh_connectivity; then - echo "✗ SSH connectivity test failed" - all_tests_passed=false - fi - - # Show final status - show_system_status - - # Results - echo "" - echo "============================================================" - if [ "$all_tests_passed" = true ]; then - echo "✓ ALL TESTS PASSED" - echo "QNX QEMU bridge network integration is working correctly!" - echo "QEMU is running on PID: $QEMU_PID" - echo "QNX system IP: $QNX_IP (detected via bridge networking)" - echo "SSH access: ssh $SSH_USER@$QNX_IP (direct bridge connection)" - return 0 - else - echo "✗ SOME TESTS FAILED" - echo "Check the output above for details." - return 1 - fi -} - -# Run main function -main "$@" diff --git a/qnx_qemu/test/test_qnx_qemu_portforward.sh b/qnx_qemu/test/test_qnx_qemu_portforward.sh deleted file mode 100755 index 5309ae808f..0000000000 --- a/qnx_qemu/test/test_qnx_qemu_portforward.sh +++ /dev/null @@ -1,406 +0,0 @@ -#!/bin/bash -# ******************************************************************************* -# 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 -# ******************************************************************************* - -set -euo pipefail - -# QNX QEMU Port Forwarding Test Script -# Tests QNX QEMU image with port forwarding (NAT networking) - -# Default configuration -TIMEOUT=${TIMEOUT:-120} -SSH_PORT=${SSH_PORT:-2222} -SSH_USER=${SSH_USER:-root} -BOOT_WAIT=${BOOT_WAIT:-15} -QNX_HOST="" -IFS_IMAGE="" - -# Parse command line arguments -usage() { - echo "Usage: $0 [options]" - echo "Options:" - echo " --timeout=N Boot timeout in seconds (default: 120)" - echo " --ssh-port=N SSH port for testing (default: 2222)" - echo " --ssh-user=USER SSH user for testing (default: root)" - echo " --boot-wait=N Additional wait after boot (default: 15)" - echo " --no-ssh Skip SSH connectivity test" - echo " --help Show this help" - echo "" - echo "Note: This test uses port forwarding (NAT networking) - no ping test available" - exit 1 -} - -# Parse arguments -TEST_SSH=true -while [[ $# -gt 0 ]]; do - case $1 in - --timeout=*) - TIMEOUT="${1#*=}" - shift - ;; - --ssh-port=*) - SSH_PORT="${1#*=}" - shift - ;; - --ssh-user=*) - SSH_USER="${1#*=}" - shift - ;; - --boot-wait=*) - BOOT_WAIT="${1#*=}" - shift - ;; - --no-ssh) - TEST_SSH=false - shift - ;; - --help) - usage - ;; - -*) - echo "Unknown option: $1" - usage - ;; - *) - if [ -z "$QNX_HOST" ]; then - QNX_HOST="$1" - elif [ -z "$IFS_IMAGE" ]; then - IFS_IMAGE="$1" - else - echo "Too many arguments" - usage - fi - shift - ;; - esac -done - -# Validate required arguments -if [ -z "$QNX_HOST" ] || [ -z "$IFS_IMAGE" ]; then - echo "Error: Missing required arguments" - usage -fi - -# Validate files exist -if [ ! -d "$QNX_HOST" ]; then - echo "Error: QNX host directory not found: $QNX_HOST" - exit 1 -fi - -if [ ! -f "$IFS_IMAGE" ]; then - echo "Error: IFS image not found: $IFS_IMAGE" - exit 1 -fi - -# Global variables -QEMU_PID="" -OUTPUT_LOG="/tmp/qnx_qemu_portforward_test_$$.log" - -echo "============================================================" -echo "QNX QEMU Port Forwarding Test" -echo "============================================================" -echo "QNX Host: $QNX_HOST" -echo "IFS Image: $IFS_IMAGE" -echo "Timeout: ${TIMEOUT}s" -echo "SSH Port: $SSH_PORT (forwarded from localhost)" -echo "SSH User: $SSH_USER" -if [ "$TEST_SSH" = true ]; then - echo "SSH Test: Enabled" -else - echo "SSH Test: Disabled" -fi -echo "Boot Wait: ${BOOT_WAIT}s" -echo "Network Mode: Port Forwarding (NAT)" -echo "" - -# Cleanup function -cleanup() { - echo "" - echo "Cleaning up..." - - # Kill QEMU process - if [ -n "$QEMU_PID" ] && kill -0 "$QEMU_PID" 2>/dev/null; then - echo "Terminating QEMU process (PID: $QEMU_PID)" - kill "$QEMU_PID" 2>/dev/null || true - sleep 3 - if kill -0 "$QEMU_PID" 2>/dev/null; then - echo "Force killing QEMU process" - kill -9 "$QEMU_PID" 2>/dev/null || true - fi - fi - - # Clean up files - rm -f "/tmp/qemu.pid" "$OUTPUT_LOG" 2>/dev/null || true - - echo "Cleanup completed" -} - -# Set trap for cleanup -trap cleanup EXIT INT TERM - -# Function to start QEMU with port forwarding -start_qemu() { - echo "1. Starting QEMU with port forwarding..." - - # Start QEMU in background with port forwarding (NAT networking) - qemu-system-x86_64 \ - -smp 2 \ - --enable-kvm \ - -cpu Cascadelake-Server-v5 \ - -m 1G \ - -pidfile /tmp/qemu.pid \ - -nographic \ - -kernel "$IFS_IMAGE" \ - -serial mon:stdio \ - -object rng-random,filename=/dev/urandom,id=rng0 \ - -device virtio-rng-pci,rng=rng0 \ - -netdev user,id=net0,hostfwd=tcp::${SSH_PORT}-:22,hostfwd=tcp::8080-:80,hostfwd=tcp::8443-:443,hostfwd=tcp::9999-:9999 \ - -device virtio-net-pci,netdev=net0 \ - > "$OUTPUT_LOG" 2>&1 & - - QEMU_PID=$! - echo "✓ QEMU started (PID: $QEMU_PID)" - echo "✓ Port forwarding: SSH($SSH_PORT->22), HTTP(8080->80), HTTPS(8443->443), Capture(9999->9999)" - echo "✓ Guest uses NAT networking (10.0.2.x subnet)" -} - -# Function to wait for boot completion -wait_for_boot() { - echo "" - echo "2. Waiting for boot completion (timeout: ${TIMEOUT}s)..." - - local start_time=$(date +%s) - local boot_complete=false - - # Look specifically for hostname confirmation message - local hostname_pattern="Hostname set to: Qnx_S-core" - - echo "Waiting for hostname confirmation: '$hostname_pattern'" - - while [ $(($(date +%s) - start_time)) -lt "$TIMEOUT" ]; do - # Check if QEMU process is still running - if ! kill -0 "$QEMU_PID" 2>/dev/null; then - echo "✗ QEMU process terminated unexpectedly" - echo "Last output:" - tail -20 "$OUTPUT_LOG" 2>/dev/null || echo "No output available" - return 1 - fi - - # Check for hostname confirmation message - if grep -q "$hostname_pattern" "$OUTPUT_LOG" 2>/dev/null; then - echo "✓ Boot completion detected: Found hostname confirmation" - boot_complete=true - break - fi - - # Show progress every 10 seconds - local elapsed=$(($(date +%s) - start_time)) - if [ $((elapsed % 10)) -eq 0 ] && [ $elapsed -gt 0 ]; then - echo " ... still waiting (${elapsed}s elapsed)" - fi - - sleep 2 - done - - if [ "$boot_complete" = true ]; then - echo "✓ System fully booted and hostname configured" - return 0 - else - echo "✗ Boot timeout reached - hostname confirmation not found" - echo "Recent QEMU output:" - echo "----------------------------------------" - tail -20 "$OUTPUT_LOG" 2>/dev/null || echo "No output available" - echo "----------------------------------------" - return 1 - fi -} - -# Function to wait additional time for system stabilization -wait_for_stabilization() { - if [ "$BOOT_WAIT" -gt 0 ]; then - echo "" - echo "3. Waiting for system stabilization (${BOOT_WAIT}s)..." - sleep "$BOOT_WAIT" - echo "✓ Stabilization wait completed" - fi -} - -# Function to test system functionality -test_system_functionality() { - echo "" - echo "4. Testing system functionality..." - - # Check if QEMU is still running - if ! kill -0 "$QEMU_PID" 2>/dev/null; then - echo "✗ QEMU process is not running" - return 1 - fi - echo "✓ QEMU process is still running" - - # Check for system indicators in output - local system_indicators=( - "qnx" - "Welcome" - "shell" - "startup" - ) - - local found_indicators=0 - for indicator in "${system_indicators[@]}"; do - if grep -i -q "$indicator" "$OUTPUT_LOG" 2>/dev/null; then - echo "✓ Found system indicator: $indicator" - ((found_indicators++)) - fi - done - - if [ "$found_indicators" -gt 0 ]; then - echo "✓ System functionality indicators found ($found_indicators)" - return 0 - else - echo "✗ No system functionality indicators found" - return 1 - fi -} - -# Function to test SSH connectivity -test_ssh_connectivity() { - if [ "$TEST_SSH" != true ]; then - echo "" - echo "5. SSH test skipped (disabled)" - return 0 - fi - - echo "" - echo "5. Testing SSH connectivity via port forwarding..." - - # Test if SSH port is open on localhost (port forwarding) - echo "Testing SSH port connectivity on localhost:$SSH_PORT..." - if command -v nc >/dev/null 2>&1; then - if nc -z -w5 localhost "$SSH_PORT"; then - echo "✓ SSH port $SSH_PORT is open on localhost" - else - echo "✗ SSH port $SSH_PORT is not accessible on localhost" - return 1 - fi - elif command -v telnet >/dev/null 2>&1; then - if timeout 5 telnet localhost "$SSH_PORT" /dev/null 2>&1; then - echo "✓ SSH port $SSH_PORT is open on localhost" - else - echo "✗ SSH port $SSH_PORT is not accessible on localhost" - return 1 - fi - else - echo "⚠ No network testing tools available (nc or telnet)" - echo "Skipping port connectivity test" - fi - - # Test SSH connection via port forwarding - echo "Testing SSH connection via port forwarding..." - if command -v ssh >/dev/null 2>&1; then - echo "Attempting SSH connection to $SSH_USER@localhost:$SSH_PORT..." - - # Try SSH connection with password authentication (no keys, empty password) - if timeout 15 ssh -o ConnectTimeout=10 \ - -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null \ - -o PreferredAuthentications=password \ - -o PubkeyAuthentication=no \ - -o PasswordAuthentication=yes \ - -o BatchMode=yes \ - -p "$SSH_PORT" \ - "$SSH_USER@localhost" \ - "echo 'SSH connection successful via port forwarding'; hostname 2>/dev/null || echo 'hostname command not available'; ifconfig vtnet0 2>/dev/null | grep 'inet ' || echo 'Network info not available'" 2>/dev/null; then - echo "✓ SSH connection via port forwarding successful" - echo "✓ Retrieved system information from guest" - else - echo "✗ SSH connection via port forwarding failed" - return 1 - fi - else - echo "⚠ SSH client not available, skipping SSH connection test" - fi - - return 0 -} - -# Function to show final system status -show_system_status() { - echo "" - echo "6. Final system status..." - - if kill -0 "$QEMU_PID" 2>/dev/null; then - echo "✓ QEMU process is running (PID: $QEMU_PID)" - else - echo "✗ QEMU process is not running" - fi - - echo "" - echo "Recent system output:" - echo "----------------------------------------" - tail -15 "$OUTPUT_LOG" 2>/dev/null || echo "No output available" - echo "----------------------------------------" -} - -# Main execution -main() { - local all_tests_passed=true - - # Start QEMU - if ! start_qemu; then - echo "✗ Failed to start QEMU" - return 1 - fi - - # Wait for boot - if ! wait_for_boot; then - echo "✗ Boot test failed" - all_tests_passed=false - fi - - # Wait for stabilization - wait_for_stabilization - - # Test system functionality - if ! test_system_functionality; then - echo "✗ System functionality test failed" - all_tests_passed=false - fi - - # Test SSH connectivity - if ! test_ssh_connectivity; then - echo "✗ SSH connectivity test failed" - all_tests_passed=false - fi - - # Show final status - show_system_status - - # Results - echo "" - echo "============================================================" - if [ "$all_tests_passed" = true ]; then - echo "✓ ALL TESTS PASSED" - echo "QNX QEMU port forwarding integration is working correctly!" - echo "QEMU is running on PID: $QEMU_PID" - echo "SSH access: ssh -p $SSH_PORT $SSH_USER@localhost" - echo "Network mode: Port forwarding (NAT) - guest uses 10.0.2.x subnet" - return 0 - else - echo "✗ SOME TESTS FAILED" - echo "Check the output above for details." - return 1 - fi -} - -# Run main function -main "$@" diff --git a/score_modules.MODULE.bazel b/score_modules.MODULE.bazel index 93a4fb3c0b..47c2b5a11a 100644 --- a/score_modules.MODULE.bazel +++ b/score_modules.MODULE.bazel @@ -11,14 +11,14 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -# Generated from known_good.json at 2026-01-26T16:26:12+00:00Z +# Generated from known_good.json at 2026-01-26T11:01:36+00:00Z # Do not edit manually - use scripts/known_good/update_module_from_known_good.py bazel_dep(name = "score_baselibs") git_override( module_name = "score_baselibs", remote = "https://github.com/eclipse-score/baselibs.git", - commit = "efc061359d159244a9bd31a6f1dc74f9246c07b6", + commit = "fe74ff32f2cb8b2c99af019e7907ad9486e70b09", ) bazel_dep(name = "score_communication") @@ -39,7 +39,7 @@ bazel_dep(name = "score_persistency") git_override( module_name = "score_persistency", remote = "https://github.com/eclipse-score/persistency.git", - commit = "0037034bf853e5f955f028fab54ed319fb0441c3", + commit = "69356def0bd731fda9aedc8c65336d8c2ca499da", ) bazel_dep(name = "score_orchestrator") @@ -67,14 +67,14 @@ bazel_dep(name = "score_tooling") git_override( module_name = "score_tooling", remote = "https://github.com/eclipse-score/tooling.git", - commit = "8894fe5440436a8c6d9e214c97b18d619c7f7eac", + commit = "fe54d6aa717eb695298a4f0ca938f19e7fd18051", ) bazel_dep(name = "score_platform") git_override( module_name = "score_platform", remote = "https://github.com/eclipse-score/score.git", - commit = "a853a294f3fda8d40fde3ac76f60bd03fcdc6a4a", + commit = "6ef2b8c740eb538d9b9b44fabd3dea5e0a888da6", ) bazel_dep(name = "score_bazel_platforms") @@ -95,7 +95,7 @@ bazel_dep(name = "score_docs_as_code") git_override( module_name = "score_docs_as_code", remote = "https://github.com/eclipse-score/docs-as-code.git", - commit = "f784d4370240cc0eafce779e5c317f6bf8988fb2", + commit = "e8622001d597ebc12244f006dde2e0a58c203ef0", ) bazel_dep(name = "score_process")