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,031 changes: 455 additions & 576 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions bazel_common/score_modules_target_sw.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
bazel_dep(name = "score_baselibs")
git_override(
module_name = "score_baselibs",
commit = "cab36dd7de92c282f67e78e88032e08585803528",
commit = "ac3eb431b05ec37a5c346a6230c62e35dfbd8884",
remote = "https://github.com/eclipse-score/baselibs.git",
)

Expand All @@ -44,7 +44,7 @@ git_override(
bazel_dep(name = "score_persistency")
git_override(
module_name = "score_persistency",
commit = "4d1fa1ae3c55d27d0f1e863b8cdf59a148651c5d",
commit = "3f674b1218f1669d33b6af92d2bd01b83241ec03",
remote = "https://github.com/eclipse-score/persistency.git",
)

Expand Down Expand Up @@ -72,7 +72,12 @@ git_override(
bazel_dep(name = "score_logging")
git_override(
module_name = "score_logging",
commit = "0e9187f79a9935ca192779234b82f9d00dc4e335",
commit = "9faad72199cbc2259b1fe4d712c5c769cdfd954e",
patch_strip = 1,
patches = [
"//patches/logging:001-logging-example-visibility.patch",
"//patches/logging:002-rules-pkg-dependency.patch",
],
remote = "https://github.com/eclipse-score/logging.git",
)

Expand Down
43 changes: 43 additions & 0 deletions feature_integration_tests/itf/test_remote_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,46 @@ def test_remote_logging(datarouter_running, dlt_config):
assert message_count > 1, (
f"Expected atleast one DLT message with app_id: {APP_ID} and context_id: {CTX_ID}, but got {message_count}"
)


# DLT message identifiers for the Logging App
LOGGING_APP_ID = "EXA"
LOGGING_CTX_ID = "DFLT"

_LOGGINGAPP_START_CMD = "cd /showcases/data/logging/logging_app/etc && nohup /showcases/bin/logging_app &"


def test_logging_app_logs_forwarded_to_dlt(datarouter_running, target, dlt_config):
"""Verifies that Logging App logs are forwarded to DLT."""

with DltWindow(
protocol=Protocol.UDP,
host_ip=dlt_config.host_ip,
multicast_ips=dlt_config.multicast_ips,
print_to_stdout=True,
binary_path=dlt_config.dlt_receive_path,
) as window:
logger.info("Starting logging_app...")
exit_code, out = target.execute(_LOGGINGAPP_START_CMD)

logger.info("logging_app start exit_code=%s", exit_code)
logger.info(out.decode(errors="replace"))

assert exit_code == 0, "Failed to start logging_app"

time.sleep(CAPTURE_DURATION_SECONDS)

record = window.record(filters=[(LOGGING_APP_ID, LOGGING_CTX_ID)])
messages = record.find(query=dict(apid=LOGGING_APP_ID, ctid=LOGGING_CTX_ID))

logger.debug(
"Found %d messages with app_id=%s, context_id=%s",
len(messages),
LOGGING_APP_ID,
LOGGING_CTX_ID,
)

assert len(messages) > 0, (
f"Expected at least one DLT message with app_id={LOGGING_APP_ID} "
f"and context_id={LOGGING_CTX_ID}, but got {len(messages)}"
)
10 changes: 7 additions & 3 deletions known_good.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"target_sw": {
"score_baselibs": {
"repo": "https://github.com/eclipse-score/baselibs.git",
"hash": "cab36dd7de92c282f67e78e88032e08585803528",
"hash": "ac3eb431b05ec37a5c346a6230c62e35dfbd8884",
"metadata": {
"extra_test_config": [
"@score_baselibs//score/json:base_library=nlohmann",
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"score_persistency": {
"repo": "https://github.com/eclipse-score/persistency.git",
"hash": "4d1fa1ae3c55d27d0f1e863b8cdf59a148651c5d",
"hash": "3f674b1218f1669d33b6af92d2bd01b83241ec03",
"metadata": {
"extra_test_config": [
"@score_baselibs_rust//src/log:safety_level=qm",
Expand Down Expand Up @@ -97,8 +97,12 @@
},
"score_logging": {
"repo": "https://github.com/eclipse-score/logging.git",
"hash": "0e9187f79a9935ca192779234b82f9d00dc4e335",
"hash": "9faad72199cbc2259b1fe4d712c5c769cdfd954e",
"bazel_patches": [
"//patches/logging:001-logging-example-visibility.patch",
"//patches/logging:002-rules-pkg-dependency.patch"],
"metadata": {
"code_root_path": "//score/mw/...",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Score/datarouter and other coding folders (if any) from logging cannot be skipped from code root path

"extra_test_config": [
"@score_logging//score/datarouter/build_configuration_flags:persistent_logging=False",
"@score_logging//score/datarouter/build_configuration_flags:persistent_config_feature_enabled=False",
Expand Down
38 changes: 38 additions & 0 deletions patches/logging/001-logging-example-visibility.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/score/test/component/dlt_generator_app/BUILD b/score/test/component/dlt_generator_app/BUILD
index 9736cac..a60ebd6 100644
--- a/score/test/component/dlt_generator_app/BUILD
+++ b/score/test/component/dlt_generator_app/BUILD
@@ -29,9 +29,14 @@ load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
cc_binary(
name = "dlt_generator",
srcs = ["dlt_generator.cpp"],
+ visibility = ["//visibility:public"],
deps = ["//score/mw/log"],
)

+exports_files([
+ "etc/logging.json",
+])
+
pkg_tar(
name = "dlt_generator_bin_pkg",
srcs = [":dlt_generator"],
diff --git a/score/test/component/logging_app/BUILD b/score/test/component/logging_app/BUILD
index de63c65..f9f3346 100644
--- a/score/test/component/logging_app/BUILD
+++ b/score/test/component/logging_app/BUILD
@@ -29,9 +29,14 @@ load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
cc_binary(
name = "logging_app",
srcs = ["logging_app.cpp"],
+ visibility = ["//visibility:public"],
deps = ["//score/mw/log"],
)

+exports_files([
+ "etc/logging.json",
+])
+
pkg_tar(
name = "logging_app_bin_pkg",
srcs = [":logging_app"],
13 changes: 13 additions & 0 deletions patches/logging/002-rules-pkg-dependency.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/MODULE.bazel b/MODULE.bazel

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.

the patch file name and the patch (intent) does not match.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

index 5eed2f9..06fb222 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -47,7 +47,7 @@ bazel_dep(name = "score_itf", version = "0.4.0", dev_dependency = True)

# OCI / Docker image rules for integration tests
bazel_dep(name = "rules_oci", version = "2.2.7", dev_dependency = True)
-bazel_dep(name = "rules_pkg", version = "1.2.0", dev_dependency = True)

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.

Instead why not load it in reference_integration directly? IS the dep not allowed in ref_integration?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without the patch, the build fails with a rules_pkg visibility error. Adding rules_pkg to the root MODULE.bazel results in a duplicate bazel_dep error.

+bazel_dep(name = "rules_pkg", version = "1.2.0")

# QNX image filesystem rules for QNX integration tests
bazel_dep(name = "score_rules_imagefs", version = "0.0.1", dev_dependency = True)
Empty file added patches/logging/BUILD
Empty file.
2 changes: 1 addition & 1 deletion rust_coverage/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ rust_coverage_report(
"linux-x86_64",
"ferrocene-coverage",
],
query = 'kind("rust_test", @score_logging//score/...) -@score_logging//score/datarouter/test/ut/ut_logging:dltprotocolUT -@score_logging//score/datarouter/test/ut/ut_logging:persistentLogConfigUT -@score_logging//score/datarouter/test/ut/ut_logging:socketserverConfigUT -@score_logging//score/datarouter/test/ut/ut_logging:socketserverUT -@score_logging//score/mw/log/legacy_non_verbose_api:unit_test',
query = 'kind("rust_test", @score_logging//score/mw/...) -@score_logging//score/datarouter/test/ut/ut_logging:dltprotocolUT -@score_logging//score/datarouter/test/ut/ut_logging:persistentLogConfigUT -@score_logging//score/datarouter/test/ut/ut_logging:socketserverConfigUT -@score_logging//score/datarouter/test/ut/ut_logging:socketserverUT -@score_logging//score/mw/log/legacy_non_verbose_api:unit_test',
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions showcases/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ score_pkg_bundle(
other_package_files = [
"//showcases/standalone:comm_pkg_files",
"//showcases/standalone:kyron_pkg_files",
"//showcases/standalone:logging_pkg_files",
"//showcases/standalone:time_pkg_files",
"//showcases/orchestration_persistency:orch_per_pkg_files",
"//showcases/simple_lifecycle:simple_lifecycle_pkg_files",
Expand Down
7 changes: 7 additions & 0 deletions showcases/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Logging App Demo

This Logging App demonstrates logging using mw::log with all log levels and configured backends (kConsole|kRemote|kFile) enabled.

For remote (DLT) logging, please refer to the following documentation:

[Remote logging](https://github.com/eclipse-score/logging/blob/main/score/datarouter/doc/guideline/dlt_capture_demo.md)
16 changes: 16 additions & 0 deletions showcases/standalone/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ score_pkg_bundle(
],
package_dir = "standalone",
)

score_pkg_bundle(
name = "logging",
bins = [
"@score_logging//score/test/component/logging_app:logging_app",
"@score_logging//score/test/component/dlt_generator_app:dlt_generator",
],
config_data = [
"//showcases/standalone:logging.score.json",
],
custom_layout = {
"@score_logging//score/test/component/logging_app:etc/logging.json": "logging_app/etc/logging.json",
"@score_logging//score/test/component/dlt_generator_app:etc/logging.json": "dlt_generator/etc/logging.json",
},
package_dir = "standalone",
)
27 changes: 27 additions & 0 deletions showcases/standalone/logging.score.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "LoggingApp Demo",
"description": "A Logging app that demonstrates logging with mw::log with kConsole|kRemote|kFile config.",
"apps": [
{
"path": "/bin/sh",
"args": [
"-c",
"cd /usr/bin/datarouter && ./datarouter --no_adaptive_runtime >/dev/null 2>&1 &"
],
"env": {}
},
{
"path": "/showcases/bin/logging_app",
"args": [],
"env": {},
"dir": "/showcases/data/logging/logging_app/etc"
},

{
"path": "/showcases/bin/dlt_generator",
"args": [],
"env": {},
"dir": "/showcases/data/logging/dlt_generator/etc"
}
]
}
Loading