Commit 98688cd
Martin Belanger
test: add unit tests for static helpers in fabrics.c
Adds libnvme/test/test-fabrics.c, which tests the static helper
functions in src/nvme/fabrics.c without modifying any production source.
The technique is to define 'static' to nothing and then #include the
source file directly. This exposes all translation-unit-local symbols
in the test binary. No #ifdef UNIT_TEST guards or visibility changes
are needed — the production files are left completely untouched.
Functions covered:
strchomp, hostid_from_hostnqn, __add_bool_argument,
__add_hex_argument, __add_int_argument,
__add_int_or_minus_one_argument, __add_argument,
inet4_pton, inet_pton_with_scope, traddr_is_hostname, unescape_uri
The test is gated on want_fabrics in meson.build, matching the
conditional that guards the uriparser test above it.
Signed-off-by: Martin Belanger <[email protected]>1 parent 17a4f8c commit 98688cd
2 files changed
Lines changed: 563 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
130 | 142 | | |
131 | 143 | | |
132 | 144 | | |
| |||
0 commit comments