Debian Codegraph @

test/meson.build

raw
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2 #
3 # This file is part of libnvme.
4 # Copyright (c) 2021 Dell Inc.
5 #
6 # Authors: Martin Belanger <[email protected]>
7
8 # These tests all require interaction with a real NVMe device, so we don't
9 # define as meson unit-tests, and therefore get run as part of the 'test'
10 # target. However, they're available for developer use, when hardware is
11 # available.
12 main = executable(
13 'main-test',
14 ['test.c'],
15 dependencies: [libnvme_dep],
16 include_directories: [incdir, internal_incdir]
17 )
18
19 if cxx_available
20 cpp = executable(
21 'test-cpp',
22 ['cpp.cc'],
23 dependencies: libnvme_dep,
24 include_directories: [incdir, internal_incdir]
25 )
26
27 test('cpp-dump', cpp)
28
29 misc = executable(
30 'test-misc',
31 ['misc.cc'],
32 dependencies: libnvme_dep,
33 include_directories: [incdir, internal_incdir]
34 )
35 test('cpp-misc', misc)
36
37 endif
38
39 register = executable(
40 'test-register',
41 ['register.c'],
42 dependencies: libnvme_dep,
43 include_directories: [incdir, internal_incdir]
44 )
45
46 zns = executable(
47 'test-zns',
48 ['zns.c'],
49 dependencies: libnvme_dep,
50 include_directories: [incdir, internal_incdir]
51 )
52
53 mi = executable(
54 'test-mi',
55 ['mi.c', 'utils.c'],
56 dependencies: libnvme_mi_test_dep,
57 include_directories: [incdir, internal_incdir]
58 )
59
60 test('mi', mi)
61
62 mi_mctp = executable(
63 'test-mi-mctp',
64 ['mi-mctp.c', 'utils.c'],
65 dependencies: libnvme_mi_test_dep,
66 include_directories: [incdir, internal_incdir],
67 )
68
69 test('mi-mctp', mi_mctp)
70
71 uuid = executable(
72 'test-uuid',
73 ['uuid.c'],
74 dependencies: libnvme_dep,
75 include_directories: [incdir, internal_incdir]
76 )
77
78 test('uuid', uuid)
79
80 uriparser = executable(
81 'test-uriparser',
82 ['uriparser.c'],
83 dependencies: libnvme_dep,
84 include_directories: [incdir, internal_incdir]
85 )
86
87 test('uriparser', uriparser)
88
89 if conf.get('HAVE_NETDB')
90 mock_ifaddrs = library(
91 'mock-ifaddrs',
92 ['mock-ifaddrs.c', ],
93 )
94
95 # See comment in test/ioctl/meson.build explaining how LD_PRELOAD is used
96 mock_ifaddrs_env = environment()
97 mock_ifaddrs_env.append('LD_PRELOAD', mock_ifaddrs.full_path())
98 mock_ifaddrs_env.set('ASAN_OPTIONS', 'verify_asan_link_order=0')
99
100 tree = executable(
101 'tree',
102 ['tree.c'],
103 dependencies: libnvme_dep,
104 include_directories: [incdir, internal_incdir],
105 link_with: mock_ifaddrs,
106 )
107
108 test('tree', tree, env: mock_ifaddrs_env)
109
110 test_util = executable(
111 'test-util',
112 ['test-util.c'],
113 include_directories: [incdir, internal_incdir]
114 )
115 test('util', test_util)
116 endif
117
118 psk = executable(
119 'test-psk',
120 ['psk.c'],
121 dependencies: libnvme_dep,
122 include_directories: [incdir, internal_incdir]
123 )
124
125 test('psk', psk)
126
127 subdir('ioctl')
128 subdir('nbft')
129
130 if json_c_dep.found()
131 subdir('sysfs')
132 subdir('config')
133 endif
134
135 if openssl_dep.found()
136 hkdf_add1 = executable(
137 'hkdf_add1',
138 ['hkdf_add1.c'],
139 dependencies: openssl_dep,
140 )
141 endif