From a1d4ebaad203878412635ca51306b8eecc363ab6 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 02:57:54 +0200 Subject: [PATCH 01/10] [#349] Restructure feature declaration in bazel --- BUILD.bazel | 37 +++++++++++++++++++++++++++++++++++++ iceoryx2-cal/BUILD.bazel | 26 +------------------------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index d7958d452..6ec478cbf 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -12,6 +12,7 @@ package(default_visibility = ["//visibility:public"]) +load("@bazel_skylib//lib:selects.bzl", "selects") load("@bazel_skylib//rules:common_settings.bzl", "string_flag") exports_files([ @@ -22,6 +23,7 @@ exports_files([ # # Config & Platform support # + config_setting( name = "linux", constraint_values = ["@platforms//os:linux"], @@ -39,12 +41,43 @@ config_setting( flag_values = {"@bazel_tools//tools/cpp:compiler": "msvc-cl"}, ) +# +# Rust Feature Flags +# + string_flag( name = "feature_dev_permissions", build_setting_default = "auto", visibility = ["//visibility:public"], ) +config_setting( + name = "dev_permissions_auto", + flag_values = { + "//:feature_dev_permissions": "auto", + }, +) + +config_setting( + name = "dev_permissions_enabled", + flag_values = { + "//:feature_dev_permissions": "on", + }, +) + +# NOTE: while this seems superfluous, it is the pattern for cases where *_auto is on by default; +# therefore this target is introduced to keep all feature flags consistent +selects.config_setting_group( + name = "cfg_feature_dev_permissions", + match_any = [ + "//:dev_permissions_enabled", + ], +) + +# +# Alias +# + alias( name = "iceoryx2", actual = "//iceoryx2:iceoryx2", @@ -75,6 +108,10 @@ alias( visibility = ["//visibility:public"], ) +# +# all_srcs +# + filegroup( name = "all_srcs", srcs = glob([ diff --git a/iceoryx2-cal/BUILD.bazel b/iceoryx2-cal/BUILD.bazel index 1f4348cb5..4648ea3ab 100644 --- a/iceoryx2-cal/BUILD.bazel +++ b/iceoryx2-cal/BUILD.bazel @@ -12,7 +12,6 @@ package(default_visibility = ["//visibility:public"]) -load("@bazel_skylib//lib:selects.bzl", "selects") load("@rules_rust//rust:defs.bzl", "rust_library") filegroup( @@ -20,34 +19,11 @@ filegroup( srcs = glob(["**"]), ) -config_setting( - name = "dev_permissions_auto", - flag_values = { - "//:feature_dev_permissions": "auto", - }, -) - -config_setting( - name = "dev_permissions_enabled", - flag_values = { - "//:feature_dev_permissions": "on", - }, -) - -# NOTE: while this seems superfluous, it is the pattern for cases where *_auto is on by default; -# therefore this target is introduced to keep all feature flags consistent -selects.config_setting_group( - name = "cfg_feature_dev_permissions", - match_any = [ - ":dev_permissions_enabled", - ], -) - rust_library( name = "iceoryx2-cal", srcs = glob(["src/**/*.rs"]), crate_features = select({ - "cfg_feature_dev_permissions": [ + "//:cfg_feature_dev_permissions": [ "dev_permissions" ], "//conditions:default": [], From 45aed8a44ecdfb4aee1e6bc8fb59c8db06bb5e84 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 03:21:53 +0200 Subject: [PATCH 02/10] [#349] Add remaining Rust feature flags to bazel --- BUILD.bazel | 55 ++++++++++++++++++++++++++++++++-- doc/bazel/README.md | 2 ++ iceoryx2-bb/log/BUILD.bazel | 14 +++++++-- iceoryx2-bb/posix/BUILD.bazel | 1 - iceoryx2-pal/posix/BUILD.bazel | 1 - iceoryx2/BUILD.bazel | 17 ++++++++++- 6 files changed, 82 insertions(+), 8 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 6ec478cbf..c2b4ad9fe 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -50,21 +50,18 @@ string_flag( build_setting_default = "auto", visibility = ["//visibility:public"], ) - config_setting( name = "dev_permissions_auto", flag_values = { "//:feature_dev_permissions": "auto", }, ) - config_setting( name = "dev_permissions_enabled", flag_values = { "//:feature_dev_permissions": "on", }, ) - # NOTE: while this seems superfluous, it is the pattern for cases where *_auto is on by default; # therefore this target is introduced to keep all feature flags consistent selects.config_setting_group( @@ -74,6 +71,58 @@ selects.config_setting_group( ], ) +string_flag( + name = "feature_logger_log", + build_setting_default = "auto", + visibility = ["//visibility:public"], +) +config_setting( + name = "logger_log_auto", + flag_values = { + "//:feature_logger_log": "auto", + }, +) +config_setting( + name = "logger_log_enabled", + flag_values = { + "//:feature_logger_log": "on", + }, +) +# NOTE: while this seems superfluous, it is the pattern for cases where *_auto is on by default; +# therefore this target is introduced to keep all feature flags consistent +selects.config_setting_group( + name = "cfg_feature_logger_log", + match_any = [ + ":logger_log_enabled", + ], +) + +string_flag( + name = "feature_logger_tracing", + build_setting_default = "auto", + visibility = ["//visibility:public"], +) +config_setting( + name = "logger_tracing_auto", + flag_values = { + "//:feature_logger_tracing": "auto", + }, +) +config_setting( + name = "logger_tracing_enabled", + flag_values = { + "//:feature_logger_tracing": "on", + }, +) +# NOTE: while this seems superfluous, it is the pattern for cases where *_auto is on by default; +# therefore this target is introduced to keep all feature flags consistent +selects.config_setting_group( + name = "cfg_feature_logger_tracing", + match_any = [ + ":logger_tracing_enabled", + ], +) + # # Alias # diff --git a/doc/bazel/README.md b/doc/bazel/README.md index 3bc8ca75e..d2b4be9e9 100644 --- a/doc/bazel/README.md +++ b/doc/bazel/README.md @@ -241,6 +241,8 @@ build --@iceoryx2//:foo=on | Feature Flag | Valid Values | Crate Default | | ----------------------- | ---------------------------- | ------------------ | | dev_permissions | auto, on, off | auto == off | +| logger_log | auto, on, off | auto == off | +| logger_tracing | auto, on, off | auto == off | ## Instructions for iceoryx2 Developers diff --git a/iceoryx2-bb/log/BUILD.bazel b/iceoryx2-bb/log/BUILD.bazel index 3c452b0a4..063417b68 100644 --- a/iceoryx2-bb/log/BUILD.bazel +++ b/iceoryx2-bb/log/BUILD.bazel @@ -12,6 +12,7 @@ package(default_visibility = ["//visibility:public"]) +load("@bazel_skylib//lib:selects.bzl", "selects") load("@rules_rust//rust:defs.bzl", "rust_library") filegroup( @@ -22,10 +23,19 @@ filegroup( rust_library( name = "iceoryx2-bb-log", srcs = glob(["src/**/*.rs"]), + crate_features = select({ + "//:cfg_feature_logger_log": [ + "logger_log" + ], + "//conditions:default": [], + }) + select({ + "//:cfg_feature_logger_tracing": [ + "logger_tracing" + ], + "//conditions:default": [], + }), deps = [ "//iceoryx2-pal/concurrency-sync:iceoryx2-pal-concurrency-sync", "@crate_index//:termsize", ], ) - -# TODO: [349] add feature flags diff --git a/iceoryx2-bb/posix/BUILD.bazel b/iceoryx2-bb/posix/BUILD.bazel index a34d802e3..4aaf42e88 100644 --- a/iceoryx2-bb/posix/BUILD.bazel +++ b/iceoryx2-bb/posix/BUILD.bazel @@ -38,5 +38,4 @@ rust_library( ], ) -# TODO: [349] add feature flags # TODO: [349] add tests diff --git a/iceoryx2-pal/posix/BUILD.bazel b/iceoryx2-pal/posix/BUILD.bazel index 2024f9af5..6c14cc5ba 100644 --- a/iceoryx2-pal/posix/BUILD.bazel +++ b/iceoryx2-pal/posix/BUILD.bazel @@ -72,5 +72,4 @@ rust_library( }, ) -# TODO: [349] add feature flags # TODO: [349] add tests diff --git a/iceoryx2/BUILD.bazel b/iceoryx2/BUILD.bazel index f4e6dc9eb..050ca65ab 100644 --- a/iceoryx2/BUILD.bazel +++ b/iceoryx2/BUILD.bazel @@ -22,6 +22,22 @@ filegroup( rust_library( name = "iceoryx2", srcs = glob(["src/**/*.rs"]), + crate_features = select({ + "//:cfg_feature_dev_permissions": [ + "dev_permissions" + ], + "//conditions:default": [], + }) + select({ + "//:cfg_feature_logger_log": [ + "logger_log" + ], + "//conditions:default": [], + }) + select({ + "//:cfg_feature_logger_tracing": [ + "logger_tracing" + ], + "//conditions:default": [], + }), deps = [ "//iceoryx2-bb/container:iceoryx2-bb-container", "//iceoryx2-bb/elementary:iceoryx2-bb-elementary", @@ -44,5 +60,4 @@ rust_library( ], ) -# TODO: [349] add feature flags # TODO: [349] add tests From 92fbe3eb175d18373cc748bf6e2faeb03ef9d65c Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 03:22:03 +0200 Subject: [PATCH 03/10] [#349] Fix warning --- iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp b/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp index 20893257a..0d2ea2d3b 100644 --- a/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp @@ -665,7 +665,7 @@ constexpr auto from(iox2::LogLevel value) noex template <> constexpr auto from(int value) noexcept -> iox2::LogLevel { const auto variant = static_cast(value); - switch (value) { + switch (variant) { case iox2_log_level_e_TRACE: return iox2::LogLevel::Trace; case iox2_log_level_e_DEBUG: From 38ed730168273c34c72c96952fcebb7aa3509e2d Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 03:34:40 +0200 Subject: [PATCH 04/10] [#349] Re-enable bazel tests --- .github/workflows/build-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 09f119868..070c42b8a 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -480,7 +480,6 @@ jobs: run: bazel build //... - name: Run bazel test - if: false # TODO: [349] enable tests in bazel run: bazel test //... grcov: From cad5c29f3418820ea2daa87ae4010a9aec7ba2d0 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 22:04:59 +0200 Subject: [PATCH 05/10] [#349] Pin bazel CI to Ubuntu 24.04 to fix bazel issue --- .github/workflows/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 070c42b8a..a88ed389d 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -457,7 +457,7 @@ jobs: if: ${{ needs.changes.outputs.source-code == 'true' }} strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-24.04] toolchain: [stable] timeout-minutes: 60 runs-on: ${{ matrix.os }} From 5d5ed7730ed5ca422a5c8912d94530a489632765 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 22:43:57 +0200 Subject: [PATCH 06/10] [#349] Further limit targets for Cirrus CI --- .cirrus.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index d478c2f24..2f587d91a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -226,6 +226,8 @@ ubuntu_22_04_x64_stable_release_task: # Pipeline 4 ubuntu_22_04_aarch64_min_version_debug_task: + # TODO run only after merge on main branch + only_if: $CIRRUS_BRANCH == 'main' depends_on: preflight_check skip: "changesIncludeOnly('.github/**', '**.md')" <<: *IOX2_CONTAINER_UBUNTU_22_04_AARCH64 @@ -254,6 +256,8 @@ ubuntu_22_04_aarch64_beta_debug_task: # Pipeline 5 ubuntu_22_04_aarch64_stable_release_task: + # TODO run only after merge on main branch + only_if: $CIRRUS_BRANCH == 'main' depends_on: preflight_check skip: "changesIncludeOnly('.github/**', '**.md')" <<: *IOX2_CONTAINER_UBUNTU_22_04_AARCH64 @@ -268,6 +272,8 @@ ubuntu_22_04_aarch64_stable_release_task: # Pipeline 6 arch_linux_x64_stable_debug_task: + # TODO commented out due to limited CI time + only_if: false depends_on: preflight_check skip: "changesIncludeOnly('.github/**', '**.md')" <<: *IOX2_CONTAINER_ARCH_LINUX_X64 From f4691bdf4a6ee5dd997671040bde043e906314d4 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 22:53:24 +0200 Subject: [PATCH 07/10] [#349] Deactivate Cirrus Ci for now --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2f587d91a..17d22f901 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -134,7 +134,7 @@ iox2_freebsd_setup_template: &IOX2_FREEBSD_SETUP # Filter to run the CI only on the main branch or for pull request to the main branch # -only_if: ( $CIRRUS_BRANCH == 'main' || ($CIRRUS_PR != '' && $CIRRUS_BASE_BRANCH == 'main')) +only_if: false && ( $CIRRUS_BRANCH == 'main' || ($CIRRUS_PR != '' && $CIRRUS_BASE_BRANCH == 'main')) # # Global environment variables From 5159008e18acd40593b83dba4959e0d6796f4063 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 17 Oct 2024 23:58:49 +0200 Subject: [PATCH 08/10] [#349] Skip tests that panic on 'debug_assertion' if they are not active --- iceoryx2-bb/lock-free/tests/bitset_tests.rs | 1 + iceoryx2-bb/posix/tests/ipc_capable_trait_tests.rs | 3 +++ iceoryx2-bb/posix/tests/semaphore_tests.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/iceoryx2-bb/lock-free/tests/bitset_tests.rs b/iceoryx2-bb/lock-free/tests/bitset_tests.rs index e42112483..22195bae9 100644 --- a/iceoryx2-bb/lock-free/tests/bitset_tests.rs +++ b/iceoryx2-bb/lock-free/tests/bitset_tests.rs @@ -106,6 +106,7 @@ fn bit_set_set_single_bit_works() { #[test] #[should_panic] +#[cfg(debug_assertions)] fn bit_set_set_bit_outside_of_bitset_leads_to_panic() { const CAPACITY: usize = 1551; let sut = BitSet::new(CAPACITY); diff --git a/iceoryx2-bb/posix/tests/ipc_capable_trait_tests.rs b/iceoryx2-bb/posix/tests/ipc_capable_trait_tests.rs index 71f22e1ff..47bbcdc09 100644 --- a/iceoryx2-bb/posix/tests/ipc_capable_trait_tests.rs +++ b/iceoryx2-bb/posix/tests/ipc_capable_trait_tests.rs @@ -39,6 +39,7 @@ mod ipc_capable { #[test] #[should_panic] + #[cfg(debug_assertions)] fn creating_ipc_construct_from_uninitialized_handle_panics() { let sut_handle = Sut::Handle::new(); @@ -47,6 +48,7 @@ mod ipc_capable { #[test] #[should_panic] + #[cfg(debug_assertions)] fn creating_ipc_construct_from_process_local_handle_panics() { let sut_handle = Sut::Handle::new(); Sut::init_process_local_handle(&sut_handle); @@ -65,6 +67,7 @@ mod ipc_capable { #[test] #[should_panic] + #[cfg(debug_assertions)] fn init_handle_twice_panics() { let sut_handle = Sut::Handle::new(); Sut::init_process_local_handle(&sut_handle); diff --git a/iceoryx2-bb/posix/tests/semaphore_tests.rs b/iceoryx2-bb/posix/tests/semaphore_tests.rs index 2a7ac2b58..37ef626ec 100644 --- a/iceoryx2-bb/posix/tests/semaphore_tests.rs +++ b/iceoryx2-bb/posix/tests/semaphore_tests.rs @@ -425,6 +425,7 @@ fn unnamed_semaphore_multiple_ipc_semaphores_are_working() { #[test] #[should_panic] +#[cfg(debug_assertions)] fn unnamed_semaphore_acquire_uninitialized_ipc_handle_failes() { let handle = UnnamedSemaphoreHandle::new(); @@ -433,6 +434,7 @@ fn unnamed_semaphore_acquire_uninitialized_ipc_handle_failes() { #[test] #[should_panic] +#[cfg(debug_assertions)] fn unnamed_semaphore_acquiring_non_ipc_capable_handle_fails() { let handle = UnnamedSemaphoreHandle::new(); let _sut1 = UnnamedSemaphoreBuilder::new() From f2735b71f85489ad842f431bfd2045fa1de4baab Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 18 Oct 2024 00:20:22 +0200 Subject: [PATCH 09/10] [#349] Harmonize flags for build and test --- .cirrus.yml | 8 ++++---- .github/workflows/build-test.yml | 12 ++++++------ internal/scripts/ci_build_and_test_freebsd.sh | 4 ++-- internal/scripts/generate-cov-report.sh | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 17d22f901..4f7a2a157 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -81,14 +81,14 @@ iox2_common_build_debug_template: &IOX2_COMMON_BUILD_DEBUG iox2_common_build_and_test_debug_template: &IOX2_COMMON_BUILD_AND_TEST_DEBUG <<: *IOX2_COMMON_BUILD_DEBUG - test_script: cargo nextest run --workspace --no-fail-fast + test_script: cargo nextest run --workspace --all-targets --no-fail-fast iox2_common_build_release_template: &IOX2_COMMON_BUILD_RELEASE build_script: cargo build --release --workspace --all-targets iox2_common_build_and_test_no_doc_tests_release_template: &IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE <<: *IOX2_COMMON_BUILD_RELEASE - test_script: cargo nextest run --release --tests --workspace --no-fail-fast + test_script: cargo nextest run --release --tests --workspace --all-targets --no-fail-fast iox2_ffi_common_debug_template: &IOX2_FFI_COMMON_DEBUG ffi_script: @@ -140,8 +140,8 @@ only_if: false && ( $CIRRUS_BRANCH == 'main' || ($CIRRUS_PR != '' && $CIRRUS_BAS # Global environment variables # -env: - RUSTFLAGS: "-C debug-assertions" +# env: + # RUSTFLAGS: "-C debug-assertions" # # Preflight-Check with Ubuntu x86 stable debug diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index a88ed389d..26dfd683f 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -6,8 +6,8 @@ on: pull_request: branches: [ main, release* ] -env: - RUSTFLAGS: "-C debug-assertions" +# env: + # RUSTFLAGS: "-C debug-assertions" jobs: changes: @@ -208,7 +208,7 @@ jobs: run: cargo build --workspace --all-targets ${{ matrix.mode.arg }} --target i686-unknown-linux-gnu - name: Run cargo nextest - run: cargo nextest run --workspace --no-fail-fast ${{ matrix.mode.arg }} --target i686-unknown-linux-gnu + run: cargo nextest run --workspace --all-targets --no-fail-fast ${{ matrix.mode.arg }} --target i686-unknown-linux-gnu - name: Build language bindings run: | @@ -313,7 +313,7 @@ jobs: run: cargo build --workspace --all-targets ${{ matrix.mode.arg }} - name: Run cargo nextest - run: cargo nextest run --workspace --no-fail-fast ${{ matrix.mode.arg }} + run: cargo nextest run --workspace --all-targets --no-fail-fast ${{ matrix.mode.arg }} - name: Build iceoryx_hoofs on Windows if: ${{ matrix.os == 'windows-latest' }} @@ -401,7 +401,7 @@ jobs: run: cargo build --workspace --all-targets ${{ matrix.mode.arg }} - name: Run cargo nextest - run: cargo nextest run --workspace --no-fail-fast ${{ matrix.mode.arg }} + run: cargo nextest run --workspace --all-targets --no-fail-fast ${{ matrix.mode.arg }} ### TODO: does not work yet reliable on the GitHub CI, seems to end up in an infinite loop ### current alternative is a cirrus.yml aarch64 target @@ -427,7 +427,7 @@ jobs: # cargo fmt --all -- --check # cargo clippy -- -D warnings # cargo build --workspace --all-targets ${{ matrix.mode }} - # cargo test --workspace --no-fail-fast ${{ matrix.mode }} + # cargo test --workspace --all-targets --no-fail-fast ${{ matrix.mode }} freebsd: needs: [preflight-check, static-code-analysis] diff --git a/internal/scripts/ci_build_and_test_freebsd.sh b/internal/scripts/ci_build_and_test_freebsd.sh index 0f7cd5007..a787ecad0 100755 --- a/internal/scripts/ci_build_and_test_freebsd.sh +++ b/internal/scripts/ci_build_and_test_freebsd.sh @@ -54,7 +54,7 @@ cd $(git rev-parse --show-toplevel) export PATH=$PATH:$HOME/.cargo/bin export LIBCLANG_PATH=/usr/local/llvm15/lib/ rustup default $RUST_TOOLCHAIN -export RUSTFLAGS="-C debug-assertions" +# export RUSTFLAGS="-C debug-assertions" cargo fmt --all -- --check cargo clippy -- -D warnings @@ -68,7 +68,7 @@ echo "######################" echo "# Run cargo nextest #" echo "#####################" -cargo nextest run --workspace --no-fail-fast $RUST_BUILD_TYPE_FLAG +cargo nextest run --workspace --all-targets --no-fail-fast $RUST_BUILD_TYPE_FLAG echo "###########################################################" echo "# Clean the target directory to reduce memory usage on VM #" diff --git a/internal/scripts/generate-cov-report.sh b/internal/scripts/generate-cov-report.sh index f21717e0d..92d023c5d 100755 --- a/internal/scripts/generate-cov-report.sh +++ b/internal/scripts/generate-cov-report.sh @@ -44,7 +44,7 @@ cleanup() { } generate_profile() { - cargo test --workspace -- --test-threads=1 + cargo test --workspace --all-targets -- --test-threads=1 } merge_report() { From 97264ae0ab70efcdfb4ec5e20067476bd3af97df Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 18 Oct 2024 00:47:17 +0200 Subject: [PATCH 10/10] [#349] Add a FAQ_ICEORYX_DEVS.md --- FAQ_ICEORYX_DEVS.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 FAQ_ICEORYX_DEVS.md diff --git a/FAQ_ICEORYX_DEVS.md b/FAQ_ICEORYX_DEVS.md new file mode 100644 index 000000000..d9b6483ed --- /dev/null +++ b/FAQ_ICEORYX_DEVS.md @@ -0,0 +1,34 @@ +# Frequently Asked Questions - iceoryx Developer Edition + +## Tests marked with `#[should_panic]` attribute do not panic in release builds + +This usually happens when the panic is triggert via a `debug_assert` macro. +This macro is not active when the `-C debug-assertions` flag is not set, which +is the case for release builds. +To fix this problem, just add a `#[cfg(debug_assertions)]` to the test. + +```rs +#[test] +#[should_panic] +#[cfg(debug_assertions)] +fn accessing_uninitialized_foo_fails() { + // ... +} +``` + +## The bazel build fails with an error mentioning `crate_index`, `manifest` and `Cargo.toml` + +The error looks similar to this: + +```ascii +An error occurred during the fetch of repository 'crate_index' +... +Error computing the main repository mapping: no such package '@@crate_index//' +... +Error: Some manifests are not being tracked. Please add the following labels to the `manifests` key: { + "//iceoryx2-foo/bar:Cargo.toml", +} +``` + +It seems a new crate is added to the root `Cargo.toml` and bazel is complaining +that it is not added to the `WORKSPACE.bazel` file for the `crate_index` target.