Skip to content

Commit 9c2a586

Browse files
authored
Merge pull request #16 from eclipse-score/ankr_add_scrample_app
add simple itf test for scrample application
2 parents 91e5475 + 334203a commit 9c2a586

File tree

7 files changed

+301
-50
lines changed

7 files changed

+301
-50
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env python3
2+
3+
# *******************************************************************************
4+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
5+
#
6+
# See the NOTICE file(s) distributed with this work for additional
7+
# information regarding copyright ownership.
8+
#
9+
# This program and the accompanying materials are made available under the
10+
# terms of the Apache License Version 2.0 which is available at
11+
# https://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# SPDX-License-Identifier: Apache-2.0
14+
# *******************************************************************************
15+
16+
import http.cookiejar
17+
import json
18+
import netrc
19+
import os
20+
import sys
21+
import urllib.parse
22+
import urllib.request
23+
24+
25+
def eprint(*args, **kwargs):
26+
print(*args, file=sys.stderr, **kwargs)
27+
28+
29+
if __name__ == "__main__":
30+
data = json.load(sys.stdin)
31+
32+
if "qnx.com" not in data["uri"]:
33+
eprint("Unsupported domain")
34+
sys.exit(1)
35+
36+
if "SCORE_QNX_USER" in os.environ and "SCORE_QNX_PASSWORD" in os.environ:
37+
login = os.environ["SCORE_QNX_USER"]
38+
password = os.environ["SCORE_QNX_PASSWORD"]
39+
else:
40+
try:
41+
nrc = netrc.netrc()
42+
auth = nrc.authenticators("qnx.com")
43+
if auth:
44+
login, _, password = auth
45+
else:
46+
raise Exception("No credential found for QNX")
47+
except Exception as excp:
48+
eprint(excp)
49+
eprint("Failed getting credentials from .netrc")
50+
sys.exit(1)
51+
52+
data = urllib.parse.urlencode(
53+
{"userlogin": login, "password": password, "UseCookie": "1"}
54+
)
55+
data = data.encode("ascii")
56+
57+
cookie_jar = http.cookiejar.CookieJar()
58+
cookie_processor = urllib.request.HTTPCookieProcessor(cookie_jar)
59+
opener = urllib.request.build_opener(cookie_processor)
60+
urllib.request.install_opener(opener)
61+
62+
r = urllib.request.urlopen("https://www.qnx.com/account/login.html", data)
63+
if r.status != 200:
64+
eprint("Failed to login to QNX")
65+
sys.exit(1)
66+
67+
cookies = {c.name: c.value for c in list(cookie_jar)}
68+
if not "myQNX" in cookies:
69+
eprint("Failed to get myQNX cookie from login page")
70+
sys.exit(1)
71+
72+
myQNX = cookies["myQNX"]
73+
print(
74+
json.dumps(
75+
{
76+
"headers": {
77+
"Cookie": [f"myQNX={myQNX}"],
78+
}
79+
}
80+
)
81+
)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
14+
name: Test reference integration
15+
on:
16+
pull_request:
17+
types: [opened, reopened, synchronize]
18+
merge_group:
19+
types: [checks_requested]
20+
21+
permissions:
22+
contents: write
23+
24+
jobs:
25+
test_reference_integration:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/[email protected]
30+
- name: Setup Bazel
31+
uses: bazel-contrib/[email protected]
32+
- name: Setup QNX License
33+
env:
34+
SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }}
35+
run: |
36+
mkdir -p /opt/score_qnx/license
37+
echo "${SCORE_QNX_LICENSE}" | base64 --decode > /opt/score_qnx/license/licenses
38+
- name: Install qemu
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y qemu-system
42+
- name: Enable KVM group perms
43+
run: |
44+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
45+
sudo udevadm control --reload-rules
46+
sudo udevadm trigger --name-match=kvm
47+
- name: Bazel execute itf qnx_qemu tests
48+
env:
49+
SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }}
50+
SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }}
51+
run: |
52+
cd qnx_qemu
53+
bazel test --config=qemu-integration --test_output=streamed --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \
54+
//:test_ssh_qemu \
55+
//:test_scrample_qemu \
56+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
14+
# Workflow configuration for S-CORE CI - Release Check
15+
# This workflow runs Bazel build and test when triggered by tag creation.
16+
17+
name: Test reference integration
18+
on:
19+
push:
20+
tags:
21+
- 'v*' # Triggers on version tags like v1.0.0
22+
- 'release-*' # Triggers on release tags like release-1.0.0
23+
24+
permissions:
25+
contents: write
26+
27+
jobs:
28+
test_target:
29+
runs-on: ubuntu-22.04
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/[email protected]
33+
- name: Setup Bazel
34+
uses: bazel-contrib/[email protected]
35+
- name: Setup QNX License
36+
env:
37+
SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }}
38+
run: |
39+
mkdir -p /opt/score_qnx/license
40+
echo "${SCORE_QNX_LICENSE}" | base64 --decode > /opt/score_qnx/license/licenses
41+
- name: Install qemu
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y qemu-system
45+
- name: Enable KVM group perms
46+
run: |
47+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
48+
sudo udevadm control --reload-rules
49+
sudo udevadm trigger --name-match=kvm
50+
- name: Bazel execute itf qnx_qemu tests
51+
env:
52+
SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }}
53+
SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }}
54+
run: |
55+
cd qnx_qemu
56+
bazel test --config=qemu-integration --test_output=streamed --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \
57+
//:test_ssh_qemu \
58+
//:test_scrample_qemu \
59+
release_verification:
60+
runs-on: ubuntu-latest
61+
needs: [test_target]
62+
if: always() && (needs.test_target.result == 'failure')
63+
steps:
64+
- name: Remove release and tag (if exists)
65+
uses: nikhilbadyal/[email protected]
66+
with:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
RELEASE_PATTERN: ${{ github.ref_name }}

qnx_qemu/BUILD

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,22 @@ py_itf_test(
9595
"target_config.json",
9696
],
9797
)
98+
99+
py_itf_test(
100+
name = "test_scrample_qemu",
101+
srcs = [
102+
"test/itf/test_scrample.py",
103+
],
104+
args = [
105+
"--target_config=$(location target_config.json)",
106+
"--ecu=s_core_ecu_qemu",
107+
"--qemu_image=$(location //build:init)",
108+
],
109+
plugins = [
110+
"itf.plugins.base.base_plugin",
111+
],
112+
data = [
113+
"//build:init",
114+
"target_config.json",
115+
],
116+
)

qnx_qemu/MODULE.bazel

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,11 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313
module(
14-
name = "score_toolchains_qnx_tests",
14+
name = "score_ri_qnx_qemu",
1515
version = "0.0.1",
1616
compatibility_level = 0,
1717
)
1818

19-
bazel_dep(name = "score_toolchains_qnx", version = "0.0.2")
20-
git_override(
21-
module_name = "score_toolchains_qnx",
22-
commit = "faa88ee7b26c82b23127b4493f140c15df4c7b8d",
23-
remote = "https://github.com/eclipse-score/toolchains_qnx.git",
24-
)
25-
26-
27-
toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx")
28-
toolchains_qnx.sdp(
29-
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
30-
strip_prefix = "installation",
31-
url = "https://www.qnx.com/download/download/79858/installation.tgz",
32-
)
33-
use_repo(toolchains_qnx, "toolchains_qnx_sdp")
34-
use_repo(toolchains_qnx, "toolchains_qnx_qcc")
35-
use_repo(toolchains_qnx, "toolchains_qnx_ifs")
36-
37-
register_toolchains("@toolchains_qnx_qcc//:qcc_x86_64")
38-
register_toolchains("@toolchains_qnx_ifs//:ifs_x86_64")
39-
4019
###############################################################################
4120
#
4221
# Shell dependency
@@ -63,35 +42,53 @@ use_repo(python)
6342

6443
###############################################################################
6544
#
66-
# LLVM Toolchains
45+
# GCC Toolchains
6746
#
6847
###############################################################################
69-
bazel_dep(name = "toolchains_llvm", version = "1.2.0")
48+
# Configure the host toolchain.
49+
bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency=True)
50+
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency=True)
51+
gcc.toolchain(
52+
url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz",
53+
sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600",
54+
strip_prefix = "x86_64-unknown-linux-gnu",
55+
)
56+
gcc.extra_features(
57+
features = [
58+
"minimal_warnings",
59+
"treat_warnings_as_errors",
60+
],
61+
)
62+
gcc.warning_flags(
63+
minimal_warnings = ["-Wall", "-Wno-error=deprecated-declarations", "-Wno-error=narrowing"],
64+
strict_warnings = ["-Wextra", "-Wpedantic"],
65+
)
66+
use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
7067

71-
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
72-
llvm.toolchain(
73-
cxx_standard = {"": "c++17"},
74-
llvm_version = "19.1.0",
68+
register_toolchains("@gcc_toolchain//:all")
69+
70+
# Configure target toolchain for QNX build.
71+
bazel_dep(name = "score_toolchains_qnx", version = "0.0.3")
72+
toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx")
73+
toolchains_qnx.sdp(
74+
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
75+
strip_prefix = "installation",
76+
url = "https://www.qnx.com/download/download/79858/installation.tgz",
7577
)
76-
use_repo(llvm, "llvm_toolchain")
77-
use_repo(llvm, "llvm_toolchain_llvm")
78+
use_repo(toolchains_qnx, "toolchains_qnx_sdp")
79+
use_repo(toolchains_qnx, "toolchains_qnx_qcc")
80+
use_repo(toolchains_qnx, "toolchains_qnx_ifs")
7881

79-
register_toolchains("@llvm_toolchain//:all")
82+
register_toolchains("@toolchains_qnx_qcc//:qcc_x86_64")
83+
register_toolchains("@toolchains_qnx_ifs//:ifs_x86_64")
8084

8185
###############################################################################
8286
#
83-
# C++ rules
87+
# Other dependencies
8488
#
8589
###############################################################################
8690
bazel_dep(name = "rules_cc", version = "0.1.1")
87-
88-
###############################################################################
89-
#
90-
# ITF dependency
91-
#
92-
###############################################################################
9391
bazel_dep(name = "score_itf", version = "0.1.0")
94-
9592
bazel_dep(name = "score_baselibs", version = "0.1.3")
9693

9794
bazel_dep(name = "score_communication", version = "0.0.1")
@@ -100,16 +97,13 @@ git_override(
10097
commit = "2d0d067b064a6e27d115f382bc938a30d44f08e7",
10198
remote = "https://github.com/eclipse-score/communication.git",
10299
)
103-
104100
bazel_dep(name = "scrample", version = "0.0.1")
105101
git_override(
106102
module_name = "scrample",
107103
commit = "a56570127abc583ad6127f27bae31ae3643b2eb9",
108104
remote = "https://github.com/eclipse-score/scrample.git",
109105
)
110106

111-
112-
113107
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
114108
archive_override(
115109
module_name = "rules_boost",

qnx_qemu/configs/network_setup_dhcp.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,7 @@ MAX_RETRIES=10 # 10 retries * 3 seconds = 30 seconds tot
4141

4242
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
4343
# Get current IP address for vtnet0
44-
45-
# It can happen that dhcpcd at the beggining assigns an APIPA address (169.254.x.x)
46-
# Wait for the correct IP assignment
47-
IP_ADDR_TO_CHECK=$(ifconfig vtnet0 | grep 'inet ' | awk '{print $2}')
48-
if ! echo "$IP_ADDR_TO_CHECK" | grep -q "^169\.254"; then
49-
IP_ADDR=$IP_ADDR_TO_CHECK
50-
fi
44+
IP_ADDR=$(ifconfig vtnet0 | grep 'inet ' | awk '{print $2}')
5145

5246
if [ -n "$IP_ADDR" ] && [ "$IP_ADDR" != "0.0.0.0" ]; then
5347
echo "---> DHCP successful! Acquired IP"
@@ -95,4 +89,4 @@ fi
9589
# Configure system network settings
9690
sysctl -w net.inet.icmp.bmcastecho=1 > /dev/null # Enable ICMP broadcast echo (responds to broadcast pings)
9791

98-
echo "---> Network configuration completed"
92+
echo "---> Network configuration completed"

0 commit comments

Comments
 (0)