Commit 92248c1
committed
RDMA: provide kernel-symbol stub so RDMA_Transporter-t links in CI
`RDMA_Transporter-t` is registered via `NDB_ADD_TEST` in
`storage/ndb/src/common/transporter/CMakeLists.txt`. The target
returns silently from the macro when `WITH_UNIT_TESTS=OFF`, but
the option defaults to ON whenever `WITHOUT_SERVER=OFF` (see
`CMakeLists.txt:843-849`), which is the standard configure
RonDB CI uses for a release build. Under that combination the
test executable is created, and the link step has been failing
since the target was first added:
storage/ndb/src/common/transporter/CMakeFiles/
RDMA_Transporter-t.dir/build.make:130:
undefined reference to
`copy(unsigned int*&, SectionSegmentPool&,
SegmentedSectionPtr const&)'
Root cause is independent of the RDMA-side code. `Packer.cpp`
(part of the `ndbtransport` convenience library that the test
binary links against) emits an unconditional explicit
instantiation:
template void Packer::pack<Packer::SegmentedSectionArg>(
Uint32 *theData, SegmentedSectionArg section) const;
That instantiation references the free function
bool copy(unsigned int *&, SectionSegmentPool &,
SegmentedSectionPtr const &);
whose definition lives on the kernel side of the build,
alongside the `SegmentSubPool` / `SegmentedSectionPtr`
implementations. None of the libraries the test depends on
(`ndbtransport`, `ndbmgmapi`, `ndbgeneral`, `ndbportlib`,
`${NDB_RDMA_LIBRARIES}`, `mytap`) define the symbol, so the
linker cannot resolve it. Whether or not the call path is
reachable at runtime is irrelevant -- the explicit template
instantiation forces emission of the reference at compile
time.
The standalone harness `build_scripts/build_and_test_rdma_
transporter.sh` already works around the same issue by
generating a tiny stub source on the fly and linking it
into a hand-built test binary. This change bakes the same
stub into the regular CMake build so the
`WITH_UNIT_TESTS=ON` CI path can link `RDMA_Transporter-t`
without dragging in any kernel-side libraries.
Changes
-------
`storage/ndb/src/common/transporter/RDMA_Transporter_test_stubs.cpp`
(new file)
- Defines `bool copy(unsigned int *&, SectionSegmentPool &,
SegmentedSectionPtr const &)` as an abort-stub. The wire-format
TAP cases exercised by the test executable touch only the
pure helpers `encode_msg_header` /
`validate_msg_header` and small in-anonymous-namespace
routines; none of those paths invoke
`Packer::pack<SegmentedSectionArg>`, so the stub is never
reached at runtime. If a future test addition does hit it
the abort produces a clear diagnostic identifying the stub
by name. Opaque forward declarations of
`SectionSegmentPool` / `SegmentedSectionPtr` keep the file
free of kernel-side header dependencies.
`storage/ndb/src/common/transporter/CMakeLists.txt`
- Adds `RDMA_Transporter_test_stubs.cpp` as a second source
file to the existing `NDB_ADD_TEST(RDMA_Transporter-t ...)`
block. The stub is compiled per-target only -- it does not
enter the `ndbtransport` convenience library and so cannot
leak into any non-test code path. A comment block above the
`NDB_ADD_TEST` call documents why the companion source
exists.
Verification
------------
Built with the exact configure command from the original bug
report:
cmake -S . -B build-lab \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_NDB_RDMA=ON \
-DWITHOUT_SERVER=OFF \
-DWITH_NDBCLUSTER_STORAGE_ENGINE=ON \
-DCMAKE_INSTALL_PREFIX=/opt/rondb-24.10-rdma-port
cmake --build build-lab --target RDMA_Transporter-t
Result: `RDMA_Transporter-t` builds and links cleanly.
Running the binary:
1..1
ok 1 - RDMA_Transporter
The standalone harness
`build_scripts/build_and_test_rdma_transporter.sh` is
unchanged; it still works because its hand-built link line
already includes its own runtime-generated stub, and the new
in-tree companion source is gated on the regular CMake
`NDB_ADD_TEST` target.
No runtime behaviour changes. The production `ndbtransport`
library is byte-identical; only the standalone test binary
gains the additional translation unit.1 parent 7c38fe7 commit 92248c1
2 files changed
Lines changed: 94 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
63 | 75 | | |
64 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
65 | 79 | | |
66 | 80 | | |
67 | 81 | | |
Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
0 commit comments