Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ build:time-arm64-linux --extra_toolchains=@score_gcc_aarch64_toolchain//:aarch64
build:time-x86_64-qnx --config=time_shared
build:time-x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix
build:time-x86_64-qnx --extra_toolchains=@score_qcc_x86_64_toolchain//:x86_64-qnx-sdp_8.0.0
build:time-x86_64-qnx --extra_toolchains=@score_qnx_x86_64_ifs_toolchain//:ifs-x86_64-qnx-sdp_8.0.0

# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:arm64 and OS:QNX
Expand Down
53 changes: 53 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use_repo(
"score_gcc_x86_64_toolchain",
"score_qcc_aarch64_toolchain",
"score_qcc_x86_64_toolchain",
"score_qcc_x86_64_toolchain_pkg",
)

## Custom Module Loading
Expand Down Expand Up @@ -212,3 +213,55 @@ pip.parse(
requirements_lock = "//third_party/codeql:requirements_lock.txt",
)
use_repo(pip, "codeql_coding_standards_pip_hub")
## Integration Test Framework dependencies

bazel_dep(name = "score_itf", version = "0.2.0", dev_dependency = True)
git_override(
module_name = "score_itf",
commit = "98118b1fcd6c53244fb276e2c7668faaf15d2e10", # tag v0.4.0
remote = "https://github.com/eclipse-score/itf.git",
)

bazel_dep(name = "bazel_skylib", version = "1.9.0", dev_dependency = True)
bazel_dep(name = "rules_pkg", version = "1.2.0", dev_dependency = True)
bazel_dep(name = "rules_oci", version = "2.2.7", dev_dependency = True)

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
oci.pull(
name = "ubuntu_24_04",
digest = "sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30",
image = "ubuntu",
platforms = ["linux/amd64"],
tag = "24.04",
)
use_repo(oci, "ubuntu_24_04", "ubuntu_24_04_linux_amd64")

bazel_dep(name = "score_rules_imagefs", version = "0.0.3", dev_dependency = True)

imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True)
imagefs.toolchain(
name = "score_qnx_x86_64_ifs_toolchain",
sdp_to_import = "@score_qcc_x86_64_toolchain_pkg",
# imagefs extension does not remap 8.0.4 -> 8.0.0 for platform constraints,
# so use "8.0.0" here to match the only available sdp_version constraint
# value in @score_bazel_platforms. The actual SDP binary version comes
# from sdp_to_import (8.0.4).
sdp_version = "8.0.0",
target_cpu = "x86_64",
target_os = "qnx",
type = "ifs",
)
use_repo(imagefs, "score_qnx_x86_64_ifs_toolchain")

## JSON Schema validation (build-time lint)

bazel_dep(name = "nlohmann_json", version = "3.11.3", dev_dependency = True)

http_archive(
name = "json_schema_validator",
build_file = "//third_party/json_schema_validator:json_schema_validator.BUILD",
dev_dependency = True,
integrity = "sha256-g/YdgRL0heDT8ectUWELo5JLF5kmqDdq7zwDh3D68gI=",
strip_prefix = "json-schema-validator-2.1.0",
urls = ["https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.1.0.tar.gz"],
)
46 changes: 46 additions & 0 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions bazel/tools/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# *******************************************************************************
# Copyright (c) 2026 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
# *******************************************************************************
57 changes: 57 additions & 0 deletions bazel/tools/json_schema_validator.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""
Creates "validate_json_schema_test" test rule which validates the input "json" file against its "schema"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"""

visibility(["//..."])

def _impl(ctx):
script = """
readonly expected_failure={expected_failure}
'{validator}' '{schema}' < '{json}'
readonly ret=$?
if test "$expected_failure" = true && test "$ret" -ne 0; then
exit 0
elif test "$expected_failure" = false && test "$ret" -eq 0; then
exit 0
fi
echo "Test Failed: Json validator performed json validation of '{json}' against '{schema}' schema with exit code $ret, meanwhile rule attribute 'expected_failure' is equal to '{expected_failure}'.
This means in case expected_failure=false then expected exit code should be zero (valid json). Otherwise, if expected_failure=true then exit code is non-zero (invalid json).
Note: by default expected_failure is false."
exit 1
""".format(
validator = ctx.attr._validator.files_to_run.executable.short_path,
schema = ctx.file.schema.short_path,
json = ctx.file.json.short_path,
expected_failure = "true" if ctx.attr.expected_failure else "false",
)

ctx.actions.write(
output = ctx.outputs.executable,
content = script,
)

# To ensure the files needed by the script are available, put them in the runfiles
runfiles = ctx.runfiles(files = [ctx.file._validator, ctx.file.json, ctx.file.schema])
return [DefaultInfo(runfiles = runfiles)]

validate_json_schema_test = rule(
implementation = _impl,
attrs = {
"expected_failure": attr.bool(default = False),
"json": attr.label(
allow_single_file = True,
mandatory = True,
),
"schema": attr.label(
allow_single_file = True,
mandatory = True,
),
"_validator": attr.label(
default = Label("@json_schema_validator"),
allow_single_file = True,
executable = True,
cfg = "exec",
),
},
test = True,
)
16 changes: 16 additions & 0 deletions score/time_slave/config/qnx/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# *******************************************************************************
# Copyright (c) 2026 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
# *******************************************************************************

package(default_visibility = ["//visibility:public"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the default public visibility is a good idea. we should know, which of targets are public and which are not


exports_files(["time_slave_qnx_config.json"])
18 changes: 18 additions & 0 deletions score/time_slave/config/qnx/time_slave_qnx_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"iface_name": "emac0",
"domain_number": 0,
"pdelay_req_interval_ms": 1000,
"pdelay_warmup_ms": 2000,
"sync_timeout_ms": 3300,
"jump_future_threshold_ns": 500000000,
"shm_path": "/gptp_shmem",
"phc": {
"enabled": true,
"device": "emac0",
"step_threshold_ns": 100000000
},
"qnx": {
"bpf_device_prefix": "/dev/bpf",
"see_sent": true
}
}
21 changes: 21 additions & 0 deletions score/time_slave/docs/manuals/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
..
# *******************************************************************************
# Copyright (c) 2026 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
# *******************************************************************************

Manuals
=======

.. toctree::
:maxdepth: 1

qnx_setup
Loading
Loading