From 4346d01ce9150dfff6c5b3a384773844e9f68d12 Mon Sep 17 00:00:00 2001 From: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:04:20 +0300 Subject: [PATCH 1/2] miri: integrate Bazel Miri tests in communication - update rules_rust to 0.68.2-score - update score_toolchains_rust to 0.9.1 - register the Ferrocene Miri toolchain for host builds - add Miri wrappers for the communication Rust tests - fix com-api-concept-test by adding the missing com_api dependency - add a top-level miri_tests suite with the targets that pass under Miri today - run the Miri suite in build_and_test_host after the Bazel test step - there are tests rely on native FFI size/helper functions, which Miri rejects as unsupported foreign calls - those won't be included Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> --- .bazelrc | 1 + .github/workflows/build_and_test_host.yml | 5 +++++ BUILD | 12 +++++++++++ MODULE.bazel | 4 ++-- .../impl/rust/com-api/com-api-concept/BUILD | 20 +++++++++++++++++-- .../rust/com-api/com-api-runtime-lola/BUILD | 8 +++++++- 6 files changed, 45 insertions(+), 5 deletions(-) diff --git a/.bazelrc b/.bazelrc index b8c89491d..4f7f70b21 100644 --- a/.bazelrc +++ b/.bazelrc @@ -26,6 +26,7 @@ common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False common --//score/mw/com/flags:tracing_library=@score_baselibs//score/analysis/tracing/generic_trace_library/stub_implementation common --extra_toolchains=@gcc_toolchain_x86_64//:cc_toolchain common --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu +common --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu_miri build --incompatible_strict_action_env test --test_output=errors build --experimental_retain_test_configuration_across_testonly #https://github.com/bazelbuild/bazel/issues/6842 diff --git a/.github/workflows/build_and_test_host.yml b/.github/workflows/build_and_test_host.yml index 76090232c..39ad55387 100644 --- a/.github/workflows/build_and_test_host.yml +++ b/.github/workflows/build_and_test_host.yml @@ -111,6 +111,11 @@ jobs: - name: Bazel test communication targets run: | bazel test ${{ matrix.config }} //... --build_tests_only + + - name: Bazel Miri tests + if: ${{ matrix.identifier == "" }} + run: | + bazel test //:miri_tests --test_output=errors - name: Bazel test integration as module run: | # for the beginning, we do this only with the default configuration diff --git a/BUILD b/BUILD index 5b55a2f3a..6190b509a 100644 --- a/BUILD +++ b/BUILD @@ -56,3 +56,15 @@ format_test( starlark = "@buildifier_prebuilt//:buildifier", workspace = "//:LICENSE", ) + +# Miri test suite +# Keep the CI suite to targets that run cleanly under Miri today. +test_suite( + name = "miri_tests", + testonly = True, + tests = [ + "//score/mw/com/impl/rust/com-api/com-api-concept:com-api-concept-macros-unit-tests_miri", + "//score/mw/com/impl/rust/com-api/com-api-concept:com-api-concept-test_miri", + "//score/mw/com/impl/rust/com-api/com-api-runtime-lola:com-api-runtime-lola-tests_miri", + ], +) diff --git a/MODULE.bazel b/MODULE.bazel index e7b2273c9..7318602e3 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -22,7 +22,7 @@ bazel_dep(name = "nlohmann_json", version = "3.11.3") bazel_dep(name = "platforms", version = "1.0.0") bazel_dep(name = "rules_cc", version = "0.1.5") bazel_dep(name = "rules_python", version = "1.5.1") -bazel_dep(name = "rules_rust", version = "0.68.1-score") +bazel_dep(name = "rules_rust", version = "0.68.2-score") bazel_dep(name = "score_baselibs", version = "0.2.6") bazel_dep(name = "score_baselibs_rust", version = "0.1.0") bazel_dep(name = "score_bazel_platforms", version = "0.1.2") @@ -160,7 +160,7 @@ llvm.toolchain( ) use_repo(llvm, "llvm_toolchain") -bazel_dep(name = "score_toolchains_rust", version = "0.8.0", dev_dependency = True) +bazel_dep(name = "score_toolchains_rust", version = "0.9.1", dev_dependency = True) gcc_ferrocene = use_extension( "@score_toolchains_rust//extensions:ferrocene_toolchain_ext.bzl", diff --git a/score/mw/com/impl/rust/com-api/com-api-concept/BUILD b/score/mw/com/impl/rust/com-api/com-api-concept/BUILD index 76f9b0d18..4725e4e6e 100644 --- a/score/mw/com/impl/rust/com-api/com-api-concept/BUILD +++ b/score/mw/com/impl/rust/com-api/com-api-concept/BUILD @@ -11,7 +11,7 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test") +load("@rules_rust//rust:defs.bzl", "miri_test", "rust_doc_test", "rust_library", "rust_test") rust_library( name = "com-api-concept", @@ -39,7 +39,10 @@ rust_test( name = "com-api-concept-test", crate = ":com-api-concept", tags = ["manual"], - deps = [":com-api-concept"], + deps = [ + ":com-api-concept", + "//score/mw/com/impl/rust/com-api/com-api", + ], ) rust_doc_test( @@ -60,3 +63,16 @@ rust_test( features = ["link_std_cpp_lib"], deps = ["//score/mw/com/impl/rust/com-api/com-api"], ) +miri_test( + name = "com-api-concept-test_miri", + crate = ":com-api-concept-test", + tags = ["manual"], + visibility = ["//visibility:public"], +) + +miri_test( + name = "com-api-concept-macros-unit-tests_miri", + crate = ":com-api-concept-macros-unit-tests", + tags = ["manual"], + visibility = ["//visibility:public"], +) diff --git a/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD b/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD index c35184833..f3b8709bf 100644 --- a/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD +++ b/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD @@ -11,7 +11,7 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test") +load("@rules_rust//rust:defs.bzl", "miri_test", "rust_doc_test", "rust_library", "rust_test") rust_library( name = "com-api-runtime-lola", @@ -46,3 +46,9 @@ rust_doc_test( crate = ":com-api-runtime-lola", deps = [":com-api-runtime-lola"], ) +miri_test( + name = "com-api-runtime-lola-tests_miri", + crate = ":com-api-runtime-lola-tests", + tags = ["manual"], + visibility = ["//visibility:public"], +) From 3eaed871b6174b932bd49ca430a79c490812d2a7 Mon Sep 17 00:00:00 2001 From: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> Date: Wed, 29 Apr 2026 09:21:49 +0300 Subject: [PATCH 2/2] miri: code review - keep Miri test visibility private to the root package instead of exposing it publicly Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> --- score/mw/com/impl/rust/com-api/com-api-concept/BUILD | 4 ++-- score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/score/mw/com/impl/rust/com-api/com-api-concept/BUILD b/score/mw/com/impl/rust/com-api/com-api-concept/BUILD index 4725e4e6e..fb2da08b3 100644 --- a/score/mw/com/impl/rust/com-api/com-api-concept/BUILD +++ b/score/mw/com/impl/rust/com-api/com-api-concept/BUILD @@ -67,12 +67,12 @@ miri_test( name = "com-api-concept-test_miri", crate = ":com-api-concept-test", tags = ["manual"], - visibility = ["//visibility:public"], + visibility = ["//:__pkg__"], ) miri_test( name = "com-api-concept-macros-unit-tests_miri", crate = ":com-api-concept-macros-unit-tests", tags = ["manual"], - visibility = ["//visibility:public"], + visibility = ["//:__pkg__"], ) diff --git a/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD b/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD index f3b8709bf..ae65b8cc0 100644 --- a/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD +++ b/score/mw/com/impl/rust/com-api/com-api-runtime-lola/BUILD @@ -50,5 +50,5 @@ miri_test( name = "com-api-runtime-lola-tests_miri", crate = ":com-api-runtime-lola-tests", tags = ["manual"], - visibility = ["//visibility:public"], + visibility = ["//:__pkg__"], )