Skip to content

Commit 960c1bc

Browse files
committed
test: add header include test
Add a simple test which ensures that all headers are self contained and don't have an undocumented dependency. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 747030b commit 960c1bc

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

libnvme/test/meson.build

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,30 @@ if openssl_dep.found()
176176
dependencies: openssl_dep,
177177
)
178178
endif
179+
180+
foreach hdr : [
181+
'fabrics',
182+
'filters',
183+
'ioctl',
184+
'linux',
185+
'log',
186+
'mi',
187+
'nbft',
188+
'tree',
189+
'types',
190+
'util',
191+
]
192+
hdr_conf = configuration_data()
193+
hdr_conf.set('HDR', hdr)
194+
src = configure_file(
195+
input: 'test-header.c.in',
196+
output: 'test-header-' + hdr + '.c',
197+
configuration: hdr_conf,
198+
)
199+
exe = executable(
200+
'test-header-' + hdr,
201+
src,
202+
dependencies: [libnvme_dep],
203+
)
204+
test('libnvme - header/' + hdr, exe)
205+
endforeach

libnvme/test/test-header.c.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: LGPL-2.1-or-later
2+
/*
3+
* Verify that <nvme/@[email protected]> is self-sufficient: it can be included
4+
* as the very first (and only) header without any prior includes.
5+
*/
6+
#include <nvme/@[email protected]>
7+
8+
int main(void)
9+
{
10+
return 0;
11+
}

0 commit comments

Comments
 (0)