Skip to content

Commit 22a9af1

Browse files
authored
Run persistency tests also in EBcLfSA (#35)
* Run persistency tests also in EBcLfSA This adds building and running of cpp_tests_persistency with the same scenario used in QNX. * Mention the additional application in README * fix test log upload pattern
1 parent b8a1e1f commit 22a9af1

File tree

10 files changed

+175
-24
lines changed

10 files changed

+175
-24
lines changed

.github/workflows/build_and_test_ebclfsa.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ jobs:
3131
uses: actions/checkout@v4
3232

3333
- name: Build for EB corbos Linux for Safety Applications and run tests
34-
run: bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:run
34+
run: |
35+
bazel build --config=aarch64-ebclfsa //scrample_integration:run
36+
bazel build --config=aarch64-ebclfsa //persistency_integration:run
3537
working-directory: ./ebclfsa
3638

3739
- name: Upload test logs
3840
uses: actions/upload-artifact@v5
3941
with:
4042
name: test-logs
41-
path: ebclfsa/bazel-bin/scrample_integration/*.log
43+
path: |
44+
ebclfsa/bazel-bin/scrample_integration/*.log
45+
ebclfsa/bazel-bin/persistency_integration/*.log

ebclfsa/.bazelrc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
common --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False
2-
common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
3-
common --@score_baselibs//score/json:base_library=nlohmann
4-
common --@score_communication//score/mw/com/flags:tracing_library=stub
5-
61
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
72
common --registry=https://bcr.bazel.build
83

9-
common --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13
10-
build:aarch64 --platforms=@score_toolchains_gcc//platforms:aarch64-linux
4+
build:_common --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False
5+
build:_common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
6+
build:_common --@score_baselibs//score/json:base_library=nlohmann
7+
build:_common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False
8+
build:_common --@score_communication//score/mw/com/flags:tracing_library=stub
9+
build:_common --cxxopt=-Wno-error=mismatched-new-delete
10+
11+
build:aarch64-ebclfsa --config=_common
12+
build:aarch64-ebclfsa --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13
13+
build:aarch64-ebclfsa --platforms=@score_toolchains_gcc//platforms:aarch64-linux
14+
build:aarch64-ebclfsa --spawn_strategy=local

ebclfsa/MODULE.bazel

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ bazel_dep(name = "score_toolchains_gcc", dev_dependency=True)
2525
git_override( # Elektrobit corbos Linux for Safety Applications needs a specific toolchain
2626
module_name = "score_toolchains_gcc",
2727
remote = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc.git",
28-
tag = "0.5.0-alpha", # commit sha: fb009e490b9b8f28805d587f50d0bf6d885f3414
28+
#tag = "0.5.0-alpha", # commit sha: fb009e490b9b8f28805d587f50d0bf6d885f3414
29+
commit = "605020d7a95b7fb128944495e45449eb07fedc01",
2930
)
3031
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency=True)
3132
gcc.toolchain(
@@ -49,6 +50,12 @@ gcc.warning_flags(
4950

5051
use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
5152

53+
bazel_dep(name = "score_docs_as_code", version = "2.0.1") # part of 0.5.0-alpha release
54+
single_version_override(
55+
module_name = "score_docs_as_code",
56+
version = "2.0.1",
57+
)
58+
5259
bazel_dep(name = "score_baselibs")
5360
single_version_override(
5461
module_name = "score_baselibs",
@@ -60,6 +67,7 @@ single_version_override(
6067
)
6168
bazel_dep(name = "score_communication", version = "0.1.1") # part of 0.5.0-alpha release
6269
bazel_dep(name = "score_scrample", version = "0.1.0") # part of 0.5.0-alpha release
70+
bazel_dep(name = "score_persistency", version = "0.2.1") # part of 0.5.0-alpha release
6371

6472
# git_override is not forwarded by bazel_dep, so we need to redefine it here
6573
git_override(

ebclfsa/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ However, please understand that we cannot advise you about possible costs in you
2424
> - Copy and paste the following command into the terminal and hit "Enter":
2525
>
2626
> ```bash
27-
> cd ./ebclfsa && bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:run
27+
> cd ./ebclfsa && bazel build --config=aarch64-ebclfsa //scrample_integration:run
2828
> ```
2929
>
3030
> This will build and run the example.
@@ -229,7 +229,7 @@ The demo SDK integrates the [S-CORE toolchain with two extensions](https://githu
229229
### Bazel Rules for the Example Applications
230230
231231
The example extends the [`scrample` example](https://github.com/eclipse-score/scrample) of S-CORE with the application setup and the toolchain extensions described above.
232-
With those changes, the toolchain can be used via `bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:<target>`.
232+
With those changes, the toolchain can be used via `bazel build --config=aarch64-ebclfsa //scrample_integration:<target>`.
233233
234234
> [!IMPORTANT]
235235
> Building inside a sandbox is currently not possible.
@@ -253,7 +253,7 @@ The following sections introduce some of the rules mentioned above.
253253
The `run` target provides an easy entry point, to build, post-process, deploy, run and stop the example:
254254
255255
```bash
256-
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:run
256+
bazel build --config=aarch64-ebclfsa //scrample_integration:run
257257
```
258258
259259
This command will take a while to finish, since it performs some downloads and starts the fast-dev image.
@@ -322,7 +322,7 @@ SDK:handler_do_el0_svc_pre: syscall __NR_clone3 (435) is not allowed
322322
Building all components of the example application can be performed with the `hi_app` rule.
323323
324324
```bash
325-
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:hi_app
325+
bazel build --config=aarch64-ebclfsa //scrample_integration:hi_app
326326
```
327327
328328
Due the dependencies towards `:scrample_sil` and `:scrample_sil_wrapper` this will build all required binaries.
@@ -333,7 +333,7 @@ Including the LI `scrample` binary, a temporary `scrample_sil_wrapper` binary as
333333
The easiest way to setup the fast-dev image, is to use the `fastdev-image` rule.
334334
335335
```bash
336-
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:fastdev-image
336+
bazel build --config=aarch64-ebclfsa //scrample_integration:fastdev-image
337337
```
338338
339339
This will first download the image via the `fetch-fastdev-archive` rule and cache the archive.
@@ -362,7 +362,7 @@ ssh -p 2222 root@localhost
362362
For deploying the example application to the image, the `upload` rule is available, which will start the image based on the content of `bazel-bin/scrample_integration/deb-qemuarm64/` and deploy all needed files via `scp`.
363363
364364
```bash
365-
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:upload
365+
bazel build --config=aarch64-ebclfsa //scrample_integration:upload
366366
```
367367
368368
Since the deployment step will change the stored disk image, the `upload` rule stores its output in `bazel-bin/scrample_integration/deb-qemuarm64-modified/`.
@@ -392,4 +392,7 @@ crinit-ctl poweroff
392392
393393
## Further notes
394394
395-
The toolchain and librares are provided for demonstration and prototyping purposes without further qualification.
395+
* The toolchain and librares are provided for demonstration and prototyping purposes without further qualification.
396+
* A second test case for S-CORE persistency is also integrated. You can run it via
397+
`bazel build --config=aarch64-ebclfsa //persistency_integration:run`
398+
However, this is not integrated as HI application to avoid the additional complexity of the required wrapper.
Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
diff --git a/MODULE.bazel b/MODULE.bazel
2-
index a302a84..7917e2b 100644
2+
index 16776ba..683c131 100644
33
--- a/MODULE.bazel
44
+++ b/MODULE.bazel
5-
@@ -60,7 +60,7 @@ deb = use_repo_rule("@download_utils//download/deb:defs.bzl", "download_deb")
5+
@@ -70,7 +70,7 @@ deb = use_repo_rule("@download_utils//download/deb:defs.bzl", "download_deb")
66
deb(
77
name = "acl-deb",
88
build = "//third_party/acl:acl.BUILD",
99
- urls = ["https://archive.ubuntu.com/ubuntu/pool/main/a/acl/libacl1-dev_2.2.52-3build1_amd64.deb"],
10-
+ urls = ["https://ports.ubuntu.com/pool/main/a/acl/libacl1-dev_2.2.52-3build1_arm64.deb"],
10+
+ urls = ["https://launchpadlibrarian.net/581258948/libacl1-dev_2.3.1-1_arm64.deb"],
1111
visibility = ["//visibility:public"],
1212
)
13-
13+
14+
diff --git a/third_party/acl/acl.BUILD b/third_party/acl/acl.BUILD
15+
index 718726c..710befd 100644
16+
--- a/third_party/acl/acl.BUILD
17+
+++ b/third_party/acl/acl.BUILD
18+
@@ -1,7 +1,7 @@
19+
cc_library(
20+
name = "acl",
21+
srcs = [
22+
- "usr/lib/libacl.a",
23+
+ "usr/lib/aarch64-linux-gnu/libacl.a",
24+
],
25+
hdrs = [
26+
"usr/include/acl/libacl.h",
27+
@@ -9,4 +9,4 @@ cc_library(
28+
],
29+
includes = ["usr/include/"],
30+
visibility = ["//visibility:public"],
31+
-)
32+
+)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")
14+
15+
genrule(
16+
name = "fetch-fastdev-archive",
17+
srcs = [],
18+
outs = ["fastdev-archive.tgz"],
19+
cmd = "wget -O $@ https://github.com/Elektrobit/eclipse-score_toolchains_gcc/releases/download/0.5.0-alpha/fastdev-ubuntu-ebcl-deb-qemu-arm64.tgz"
20+
)
21+
22+
genrule(
23+
name = "fastdev-image",
24+
srcs = [":fetch-fastdev-archive"],
25+
outs = [
26+
"deb-qemuarm64/fastdev-ubuntu-ebcl-deb-qemuarm64.wic",
27+
"deb-qemuarm64/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
28+
],
29+
cmd = "tar xzf $(location :fetch-fastdev-archive) -C $(RULEDIR)",
30+
)
31+
32+
genrule(
33+
name = "upload",
34+
srcs = [
35+
"@score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios",
36+
":fastdev-image",
37+
"scripts/cpp_tests_persistency.sh",
38+
"run_qemu.sh",
39+
],
40+
cmd = " \
41+
mkdir -p $(RULEDIR)/deb-qemuarm64-modified &&\
42+
cp $(RULEDIR)/deb-qemuarm64/* $(RULEDIR)/deb-qemuarm64-modified/ &&\
43+
$(location run_qemu.sh) $(RULEDIR)/deb-qemuarm64-modified -pidfile $(RULEDIR)/qemu.pid > $(RULEDIR)/qemu_upload.log &\
44+
sleep 30 ; \
45+
sshpass -p linux scp -o StrictHostKeyChecking=no -P 2222 $(location @score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios) root@localhost:/usr/bin/cpp_tests_persistency &&\
46+
sshpass -p linux scp -o StrictHostKeyChecking=no -P 2222 $(location scripts/cpp_tests_persistency.sh) root@localhost:/usr/bin/cpp_tests_persistency.sh &&\
47+
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost sync &&\
48+
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true \
49+
sleep 5 \
50+
",
51+
outs = [
52+
"qemu_upload.log",
53+
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64.wic",
54+
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
55+
],
56+
)
57+
58+
genrule(
59+
name = "run",
60+
srcs = [
61+
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64.wic",
62+
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux",
63+
"run_qemu.sh"
64+
],
65+
cmd = " \
66+
$(location run_qemu.sh) $(RULEDIR)/deb-qemuarm64-modified -pidfile $(RULEDIR)/qemu.pid > $(RULEDIR)/qemu_run.log &\
67+
sleep 10 ; \
68+
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost cpp_tests_persistency.sh > $(RULEDIR)/ssh_persistency_test_scenarios_run.log && \
69+
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true \
70+
sleep 5 \
71+
",
72+
outs = [
73+
"qemu_run.log",
74+
"ssh_persistency_test_scenarios_run.log",
75+
],
76+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
set -xu
4+
5+
if [ -z "$1" ]; then
6+
echo "Usage: $0 <basefolder>"
7+
exit 1
8+
fi
9+
BASEFOLDER=$1
10+
IMAGE="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64.wic"
11+
KERNEL="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
12+
if [ ! -d "${BASEFOLDER}" ] || [ ! -f "${IMAGE}" ] || [ ! -f "${KERNEL}" ] ; then
13+
echo "Run \"bazel build --config=aarch64-ebclfsa //persistency_integration:fastdev-image\" first to fetch the image"
14+
fi
15+
16+
MACHINE="virt,virtualization=true,gic-version=3"
17+
CPU="cortex-a53"
18+
SMP="8"
19+
MEM="4G"
20+
KERNEL_ARGS=("-append" "root=/dev/vda1 sdk_enable lisa_syscall_whitelist=2026 rw sharedmem.enable_sharedmem=0 init=/usr/bin/ebclfsa-cflinit")
21+
DISK_ARGS="-device virtio-blk-device,drive=vd0 -drive if=none,format=raw,file=${IMAGE},id=vd0"
22+
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 "
23+
24+
if ! command -v qemu-system-aarch64 > /dev/null; then
25+
echo "Please install qemu-system-aarch64"
26+
exit 1
27+
fi
28+
29+
chmod +w ${IMAGE}
30+
31+
exec qemu-system-aarch64 -m "${MEM}" -machine "${MACHINE}" -cpu "${CPU}" \
32+
-smp "${SMP}" -kernel "${KERNEL}" "${KERNEL_ARGS[@]}" ${DISK_ARGS} \
33+
${NETWORK_ARGS} -nographic ${@:2}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# Script to run C++ persistency tests inside the QEMU environment
3+
# Wrapper due to quoting issues when calling directly from Bazel
4+
cpp_tests_persistency --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'

ebclfsa/scrample_integration/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ genrule(
107107
cmd = " \
108108
$(location run_qemu.sh) $(RULEDIR)/deb-qemuarm64-modified -pidfile $(RULEDIR)/qemu.pid > $(RULEDIR)/qemu_run.log &\
109109
sleep 10 ; \
110-
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost scrample -n 10 -m send -t 200 -s /etc/mw_com_config.json > $(RULEDIR)/ssh_run.log && \
110+
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost scrample -n 10 -m send -t 200 -s /etc/mw_com_config.json > $(RULEDIR)/ssh_scrample_run.log && \
111111
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true \
112112
sleep 5 \
113113
",
114114
outs = [
115115
"qemu_run.log",
116-
"ssh_run.log",
116+
"ssh_scrample_run.log",
117117
],
118118
)

ebclfsa/scrample_integration/run_qemu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ BASEFOLDER=$1
1010
IMAGE="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64.wic"
1111
KERNEL="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
1212
if [ ! -d "${BASEFOLDER}" ] || [ ! -f "${IMAGE}" ] || [ ! -f "${KERNEL}" ] ; then
13-
echo "Run \"bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:fastdev-image\" first to fetch the image"
13+
echo "Run \"bazel build --config=aarch64-ebclfsa //scrample_integration:fastdev-image\" first to fetch the image"
1414
fi
1515

1616
MACHINE="virt,virtualization=true,gic-version=3"

0 commit comments

Comments
 (0)