diff --git a/integration/.bazelrc b/integration/.bazelrc index f03197f6ef..debc134e3c 100644 --- a/integration/.bazelrc +++ b/integration/.bazelrc @@ -36,6 +36,7 @@ build:linux-x86_64 --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0- build:eb-aarch64 --config=_common build:eb-aarch64 --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13 +build:eb-aarch64 --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_linux_gnu build:eb-aarch64 --platforms=@score_toolchains_gcc//platforms:aarch64-linux build:eb-aarch64 --spawn_strategy=local diff --git a/integration/bazel_common/score_basic_tools.MODULE.bazel b/integration/bazel_common/score_basic_tools.MODULE.bazel index ee685dcfbb..0443960b61 100644 --- a/integration/bazel_common/score_basic_tools.MODULE.bazel +++ b/integration/bazel_common/score_basic_tools.MODULE.bazel @@ -6,7 +6,7 @@ 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", + commit = "e153184db91e0644c8f10e6206d18f2665aed6c4", ) diff --git a/integration/bazel_common/score_gcc_toolchains.MODULE.bazel b/integration/bazel_common/score_gcc_toolchains.MODULE.bazel index 5dca055929..c6c0cefe0a 100644 --- a/integration/bazel_common/score_gcc_toolchains.MODULE.bazel +++ b/integration/bazel_common/score_gcc_toolchains.MODULE.bazel @@ -64,7 +64,6 @@ git_override( 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") @@ -83,4 +82,4 @@ 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_rust_toolchains.MODULE.bazel b/integration/bazel_common/score_rust_toolchains.MODULE.bazel index 4ade3bd300..119fe55630 100644 --- a/integration/bazel_common/score_rust_toolchains.MODULE.bazel +++ b/integration/bazel_common/score_rust_toolchains.MODULE.bazel @@ -1,7 +1,7 @@ bazel_dep(name = "rules_rust", version = "0.61.0") -bazel_dep(name = "score_toolchains_rust", version = "0.4.0", dev_dependency = True) +bazel_dep(name = "score_toolchains_rust", version = "0.7.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/integration/images/ebclfsa_aarch64/BUILD b/integration/images/ebclfsa_aarch64/BUILD index df35a19965..62105fb396 100644 --- a/integration/images/ebclfsa_aarch64/BUILD +++ b/integration/images/ebclfsa_aarch64/BUILD @@ -9,5 +9,24 @@ # 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 = "//images/ebclfsa_aarch64/build:fastdev-image", + visibility = ["//visibility:public"], +) + +sh_binary( + name = "run", + srcs = ["//runners/qemu_ebclfsa_aarch64/scripts:run_qemu.sh"], + env = {"RUNFILES_LIB_DEBUG": "1"}, + args = [ + "$(locations :image)", + ], + data = [ + ":image", + ], + use_bash_launcher = True, +) diff --git a/integration/images/ebclfsa_aarch64/build/BUILD b/integration/images/ebclfsa_aarch64/build/BUILD new file mode 100644 index 0000000000..9100d0bb3e --- /dev/null +++ b/integration/images/ebclfsa_aarch64/build/BUILD @@ -0,0 +1,80 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +filegroup( + name = "scripts", + srcs = [ + "//integration/images/ebclfsa_aarch64/persistency_integration/scripts:startup.sh", + ], + visibility = ["//visibility:private"], +) + +filegroup( + name = "configs", + srcs = [ + "//integration/images/ebclfsa_aarch64/scrample_integration/etc:logging.json", + "//integration/images/ebclfsa_aarch64/scrample_integration/etc:mw_com_config.json", + ], + visibility = ["//visibility:private"], +) + +genrule( + name = "fetch-fastdev-archive", + srcs = [], + outs = ["fastdev-archive.tgz"], + cmd = "wget -O $@ https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/download/0.5.0-beta/fastdev-ubuntu-ebcl-deb-qemu-arm64.tgz" +) + +genrule( + name = "extract-fastdev-image", + srcs = [":fetch-fastdev-archive"], + outs = [ + "ebcl-qemuarm64/fastdev-ubuntu-ebclfsa-ebcl-qemuarm64.wic", + "ebcl-qemuarm64/fastdev-ubuntu-ebclfsa-ebcl-qemuarm64-vmlinux" + ], + cmd = "tar xzf $(location :fetch-fastdev-archive) -C $(RULEDIR) && chmod +w $(RULEDIR)/ebcl-qemuarm64/fastdev-ubuntu-ebclfsa-ebcl-qemuarm64.wic && ls -lah $(RULEDIR)/ebcl-qemuarm64/fastdev-ubuntu-ebclfsa-ebcl-qemuarm64.wic > /tmp/foo", + visibility = [ + "//visibility:public", + ], +) + +genrule( + name = "fastdev-image", + srcs = [ + "//showcases:showcases_all", + #"@score_persistency//tests/test_scenarios/cpp:test_scenarios", + "//feature_integration_tests/configs:etc_configs", + ":extract-fastdev-image", + "cpp_tests_persistency.sh", + "etc/mw_com_config.json", + "etc/logging.json", + "run_qemu.sh", + ], + cmd = " \ + mkdir -p $(RULEDIR)/ebcl-qemuarm64-deployed &&\ + cp $(RULEDIR)/ebcl-qemuarm64/* $(RULEDIR)/ebcl-qemuarm64-deployed/ &&\ + $(location run_qemu.sh) $(RULEDIR)/ebcl-qemuarm64-deployed -pidfile $(RULEDIR)/qemu.pid > $(RULEDIR)/qemu_deployment.log &\ + sleep 30 ; \ + sshpass -p linux scp -o StrictHostKeyChecking=no -P 2222 $(location cpp_tests_persistency.sh) root@localhost:/usr/bin/ &&\ + sshpass -p linux scp -o StrictHostKeyChecking=no -P 2222 $(location etc/mw_com_config.json) root@localhost:/etc/ &&\ + sshpass -p linux scp -o StrictHostKeyChecking=no -P 2222 $(location etc/logging.json) root@localhost:/etc/ &&\ + sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost sync &&\ + sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true \ + sleep 5 \ + ", + outs = [ + "ebcl-qemuarm64-deployed/fastdev-ubuntu-ebclfsa-ebcl-qemuarm64.wic", + "ebcl-qemuarm64-deployed/fastdev-ubuntu-ebclfsa-ebcl-qemuarm64-vmlinux", + "qemu_deployment.log", + ], +) diff --git a/integration/images/ebclfsa_aarch64/persistency_integration/scripts/cpp_tests_persistency.sh b/integration/images/ebclfsa_aarch64/build/cpp_tests_persistency.sh similarity index 100% rename from integration/images/ebclfsa_aarch64/persistency_integration/scripts/cpp_tests_persistency.sh rename to integration/images/ebclfsa_aarch64/build/cpp_tests_persistency.sh diff --git a/integration/images/ebclfsa_aarch64/scrample_integration/etc/logging.json b/integration/images/ebclfsa_aarch64/build/etc/logging.json similarity index 100% rename from integration/images/ebclfsa_aarch64/scrample_integration/etc/logging.json rename to integration/images/ebclfsa_aarch64/build/etc/logging.json diff --git a/integration/images/ebclfsa_aarch64/scrample_integration/etc/mw_com_config.json b/integration/images/ebclfsa_aarch64/build/etc/mw_com_config.json similarity index 100% rename from integration/images/ebclfsa_aarch64/scrample_integration/etc/mw_com_config.json rename to integration/images/ebclfsa_aarch64/build/etc/mw_com_config.json diff --git a/integration/images/ebclfsa_aarch64/scrample_integration/run_qemu.sh b/integration/images/ebclfsa_aarch64/build/run_qemu.sh similarity index 100% rename from integration/images/ebclfsa_aarch64/scrample_integration/run_qemu.sh rename to integration/images/ebclfsa_aarch64/build/run_qemu.sh diff --git a/integration/images/ebclfsa_aarch64/persistency_integration/scripts/BUILD b/integration/images/ebclfsa_aarch64/persistency_integration/scripts/BUILD new file mode 100644 index 0000000000..e69de29bb2 diff --git a/integration/runners/qemu_ebclfsa_aarch64/BUILD b/integration/runners/qemu_ebclfsa_aarch64/BUILD new file mode 100644 index 0000000000..52ddaba0f2 --- /dev/null +++ b/integration/runners/qemu_ebclfsa_aarch64/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_ebclfsa_aarch64/scripts/BUILD b/integration/runners/qemu_ebclfsa_aarch64/scripts/BUILD new file mode 100644 index 0000000000..1ba1d2b847 --- /dev/null +++ b/integration/runners/qemu_ebclfsa_aarch64/scripts/BUILD @@ -0,0 +1 @@ +exports_files(["run_qemu.sh"]) \ No newline at end of file diff --git a/integration/runners/qemu_ebclfsa_aarch64/scripts/run_qemu.sh b/integration/runners/qemu_ebclfsa_aarch64/scripts/run_qemu.sh new file mode 100755 index 0000000000..267d5502d9 --- /dev/null +++ b/integration/runners/qemu_ebclfsa_aarch64/scripts/run_qemu.sh @@ -0,0 +1,61 @@ +#!/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 +# ******************************************************************************* + +# # --- begin runfiles.bash initialization v3 --- +# # Copy-pasted from the Bazel Bash runfiles library v3. +# set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash +# # shellcheck disable=SC1090 +# source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ +# source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ +# source "$0.runfiles/$f" 2>/dev/null || \ +# source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ +# source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ +# { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# # --- end runfiles.bash initialization v3 --- + +set -euox pipefail + +#BASEFOLDER=$1 + +echo "Image: ${2}" +echo "Kernel: ${1}" + +IMAGE="$(rlocation _main/$2)" +KERNEL="$(rlocation _main/$1)" + +echo "Image: ${IMAGE}" +echo "Kernel: ${KERNEL}" + +# Make the image file writable, as QEMU needs to write to it. +find -L "$(dirname "${IMAGE}")" -samefile "${IMAGE}" -exec chmod +w {} \; + +MACHINE="virt,virtualization=true,gic-version=3" +CPU="cortex-a53" +SMP="8" +MEM="4G" +KERNEL_ARGS=("-append" "root=/dev/vda1 sdk_enable lisa_syscall_whitelist=2026 rw sharedmem.enable_sharedmem=0 init=/usr/bin/ebclfsa-cflinit") +DISK_ARGS="-device virtio-blk-device,drive=vd0 -drive if=none,format=raw,file=${IMAGE},id=vd0" +NETWORK_ARGS="-netdev user,id=net0,net=192.168.7.0/24,dhcpstart=192.168.7.2,dns=192.168.7.3,host=192.168.7.5,hostfwd=tcp::2222-:22,hostfwd=tcp::3333-:3333 -device virtio-net-device,netdev=net0 " + +if ! command -v qemu-system-aarch64 > /dev/null; then + echo "Please install qemu-system-aarch64" + exit 1 +fi + +echo "pwd=$(pwd)" + +qemu-system-aarch64 -m "${MEM}" -machine "${MACHINE}" -cpu "${CPU}" \ + -smp "${SMP}" -kernel "${KERNEL}" "${KERNEL_ARGS[@]}" ${DISK_ARGS} \ + ${NETWORK_ARGS} -nographic -pidfile qemu.pid > qemu_upload.log < /dev/null diff --git a/integration/score_starter b/integration/score_starter index 88cd23f03d..10617044dd 100755 --- a/integration/score_starter +++ b/integration/score_starter @@ -11,7 +11,7 @@ import argparse 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", + ("Run Elektrobit corbos Linux for Safety Applications 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"),