Skip to content

Commit e3c0fc1

Browse files
authored
ScatteredBuffer::IFragmentsObserver (#440)
- Fix unit tests broken by recent changes at CETL (`std::bad_alloc` at `VariableLengthArray`).
1 parent c26d86e commit e3c0fc1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+428
-162
lines changed

.clang-tidy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Checks: >-
1212
performance-*,
1313
portability-*,
1414
readability-*,
15+
-boost-use-ranges,
1516
-clang-analyzer-core.uninitialized.Assign,
1617
-cppcoreguidelines-avoid-const-or-ref-data-members,
1718
-cppcoreguidelines-use-default-member-init,
@@ -22,7 +23,9 @@ Checks: >-
2223
-modernize-type-traits,
2324
-modernize-use-constraints,
2425
-modernize-use-default-member-init,
26+
-modernize-use-designated-initializers,
2527
-modernize-use-nodiscard,
28+
-modernize-use-ranges,
2629
-readability-avoid-const-params-in-decls,
2730
-readability-identifier-length,
2831
-*-use-trailing-return-type,

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "linux development environment for libcyphal",
3-
"image": "ghcr.io/opencyphal/toolshed:ts22.4.10",
3+
"image": "ghcr.io/opencyphal/toolshed:ts24.4.3",
44
"customizations": {
55
"vscode": {
66
"extensions": [

.github/workflows/sonar.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
contains(github.ref, '/issue/') ||
1616
(github.event_name == 'pull_request')
1717
runs-on: ubuntu-latest
18-
container: ghcr.io/opencyphal/toolshed:ts22.4.10
18+
container: ghcr.io/opencyphal/toolshed:ts24.4.3
1919
steps:
2020
- uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2323
- name: get nunavut
24-
run: >
25-
pip install git+https://github.com/OpenCyphal/[email protected]
24+
run: |
25+
pip install --break-system-packages git+https://github.com/OpenCyphal/[email protected]
2626
- name: Install sonar-scanner and build-wrapper
2727
uses: SonarSource/sonarcloud-github-c-cpp@v2
2828
- name: Run tests

.github/workflows/tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
contains(github.ref, '/issue/') ||
1717
(github.event_name == 'pull_request')
1818
runs-on: ubuntu-latest
19-
container: ghcr.io/opencyphal/toolshed:ts22.4.10
19+
container: ghcr.io/opencyphal/toolshed:ts24.4.3
2020
steps:
2121
- uses: actions/checkout@v4
2222
- name: Cache ext modules
@@ -29,8 +29,8 @@ jobs:
2929
key: ${{ runner.os }}-${{ hashFiles('cmake/modules/*.cmake') }}
3030
- name: get nunavut
3131
# TODO: setup a venv, cache, and distribute to the other jobs.
32-
run: >
33-
pip install git+https://github.com/OpenCyphal/[email protected]
32+
run: |
33+
pip install --break-system-packages git+https://github.com/OpenCyphal/[email protected]
3434
- name: configure
3535
run: >
3636
./build-tools/bin/verify.py
@@ -47,7 +47,7 @@ jobs:
4747
contains(github.ref, '/issue/') ||
4848
(github.event_name == 'pull_request')
4949
runs-on: ubuntu-latest
50-
container: ghcr.io/opencyphal/toolshed:ts22.4.10
50+
container: ghcr.io/opencyphal/toolshed:ts24.4.3
5151
needs: [warmup]
5252
strategy:
5353
matrix:
@@ -69,8 +69,8 @@ jobs:
6969
path: external
7070
key: ${{ runner.os }}-${{ hashFiles('cmake/modules/*.cmake') }}
7171
- name: get nunavut
72-
run: >
73-
pip install git+https://github.com/OpenCyphal/[email protected]
72+
run: |
73+
pip install --break-system-packages git+https://github.com/OpenCyphal/[email protected]
7474
- name: run tests
7575
env:
7676
GTEST_COLOR: yes
@@ -101,7 +101,7 @@ jobs:
101101
contains(github.ref, '/issue/') ||
102102
(github.event_name == 'pull_request')
103103
runs-on: ubuntu-latest
104-
container: ghcr.io/opencyphal/toolshed:ts22.4.10
104+
container: ghcr.io/opencyphal/toolshed:ts24.4.3
105105
needs: [warmup]
106106
steps:
107107
- uses: actions/checkout@v4
@@ -114,8 +114,8 @@ jobs:
114114
path: external
115115
key: ${{ runner.os }}-${{ hashFiles('cmake/modules/*.cmake') }}
116116
- name: get nunavut
117-
run: >
118-
pip install git+https://github.com/OpenCyphal/[email protected]
117+
run: |
118+
pip install --break-system-packages git+https://github.com/OpenCyphal/[email protected]
119119
- name: doc-gen
120120
run: >
121121
./build-tools/bin/verify.py

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ and manually run it.
147147

148148
### TLDR
149149
```
150-
docker pull ghcr.io/opencyphal/toolshed:ts22.4.10
150+
docker pull ghcr.io/opencyphal/toolshed:ts24.4.3
151151
git clone {this repo}
152152
cd {this repo}
153-
docker run --rm -it -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts22.4.10
153+
docker run --rm -it -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts24.4.3
154154
mkdir build
155155
cd build
156156
cmake ..
@@ -200,7 +200,7 @@ To ensure that the formatting matches the expectations of the CI suite,
200200
invoke Clang-Format of the correct version from the container (be sure to use the correct image tag):
201201

202202
```
203-
docker run --rm -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts22.4.10 ./build-tools/bin/verify.py build-danger-danger-repo-clang-format-in-place
203+
docker run --rm -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts24.4.3 ./build-tools/bin/verify.py build-danger-danger-repo-clang-format-in-place
204204
```
205205

206206
### `issue/*` and hashtag-based CI triggering

docs/examples/1_presentation/example_1_presentation_0_hello_raw_pubsub_udp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ TEST_F(Example_1_Presentation_0_HelloRawPubSub_Udp, main)
151151
const TimePoint msg_deadline = arg.approx_now + 1s;
152152
constexpr cetl::span<const char> message{"Hello, World!"};
153153
//
154-
const std::array<const cetl::span<const cetl::byte>, 1> payload_fragments{
155-
cetl::span<const cetl::byte>{reinterpret_cast<const cetl::byte*>(message.data()), // NOLINT
154+
const std::array<const PayloadFragment, 1> payload_fragments{
155+
PayloadFragment{reinterpret_cast<const cetl::byte*>(message.data()), // NOLINT
156156
message.size()}};
157157
EXPECT_THAT(raw_publisher.publish(msg_deadline, payload_fragments), testing::Eq(cetl::nullopt));
158158
});

docs/examples/1_presentation/example_1_presentation_2_heartbeat_getinfo_udp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ TEST_F(Example_1_Presentation_2_Heartbeat_GetInfo_Udp, main)
176176

177177
// Bring up 'GetInfo' server.
178178
//
179-
using GetInfo_1_0 = uavcan::node::GetInfo_1_0;
179+
using uavcan::node::GetInfo_1_0;
180180
const std::string node_name{"org.opencyphal.Ex_1_Pres_2_HB_GetInfo_UDP"};
181181
std::copy_n(node_name.begin(), std::min(node_name.size(), 50UL), std::back_inserter(state.get_info_response.name));
182182
//

docs/examples/1_presentation/example_1_presentation_3_hb_getinfo_ping_linux_can.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ TEST_F(Example_1_Presentation_3_HB_GetInfo_Ping_Can, main)
424424

425425
// 7. Bring up 'GetInfo' server.
426426
//
427-
using GetInfo_1_0 = uavcan::node::GetInfo_1_0;
428-
uavcan::node::GetInfo_1_0::Response get_info_response{{&mr_}};
427+
using uavcan::node::GetInfo_1_0;
428+
GetInfo_1_0::Response get_info_response{{&mr_}};
429429
get_info_response.protocol_version.major = 1;
430430
const std::string node_name{"org.opencyphal.Ex_1_Pres_3_HB_GetInfo_Ping_CAN"};
431431
std::copy_n(node_name.begin(), std::min(node_name.size(), 50UL), std::back_inserter(get_info_response.name));

docs/examples/platform/node_helpers.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ struct NodeHelpers
7070
const TxMetadata& metadata)
7171
{
7272
using traits = typename T::_traits_;
73+
using libcyphal::transport::PayloadFragment;
74+
7375
std::array<std::uint8_t, traits::SerializationBufferSizeBytes> buffer{};
7476

7577
const auto data_size = serialize(value, buffer).value();
7678

7779
// NOLINTNEXTLINE
78-
const cetl::span<const cetl::byte> fragment{reinterpret_cast<cetl::byte*>(buffer.data()), data_size};
79-
const std::array<const cetl::span<const cetl::byte>, 1> payload{fragment};
80+
const PayloadFragment fragment{reinterpret_cast<cetl::byte*>(buffer.data()), data_size};
81+
const std::array<const PayloadFragment, 1> payload{fragment};
8082

8183
return tx_session.send(metadata, payload);
8284
}

include/libcyphal/common/cavl/cavl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ class Node // NOSONAR cpp:S1448
8181
using DerivedType = Derived;
8282

8383
// Tree nodes cannot be copied for obvious reasons.
84-
Node(const Node&) = delete;
84+
Node(const Node&) = delete; // NOLINT bugprone-crtp-constructor-accessibility
8585
auto operator=(const Node&) -> Node& = delete;
8686

8787
// Tree nodes can be moved. We update the pointers in the adjacent nodes to keep the tree valid,
8888
// as well as root node pointer if needed (see `moveFrom`). This operation is constant time.
89-
Node(Node&& other) noexcept
89+
Node(Node&& other) noexcept // NOLINT bugprone-crtp-constructor-accessibility
9090
{
9191
moveFrom(other);
9292
}
@@ -102,7 +102,7 @@ class Node // NOSONAR cpp:S1448
102102
}
103103

104104
protected:
105-
Node() = default;
105+
Node() = default; // NOLINT bugprone-crtp-constructor-accessibility
106106
~Node() = default;
107107

108108
/// Accessors for advanced tree introspection. Not needed for typical usage.

0 commit comments

Comments
 (0)