mk: build with _GNU_SOURCE defined by default
[dpdk.git] / test / test / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 test_sources = files('commands.c',
5         'packet_burst_generator.c',
6         'test.c',
7         'test_acl.c',
8         'test_alarm.c',
9         'test_atomic.c',
10         'test_barrier.c',
11         'test_bpf.c',
12         'test_byteorder.c',
13         'test_cmdline.c',
14         'test_cmdline_cirbuf.c',
15         'test_cmdline_etheraddr.c',
16         'test_cmdline_ipaddr.c',
17         'test_cmdline_lib.c',
18         'test_cmdline_num.c',
19         'test_cmdline_portlist.c',
20         'test_cmdline_string.c',
21         'test_common.c',
22         'test_cpuflags.c',
23         'test_crc.c',
24         'test_cryptodev.c',
25         'test_cryptodev_asym.c',
26         'test_cryptodev_blockcipher.c',
27         'test_cycles.c',
28         'test_debug.c',
29         'test_distributor.c',
30         'test_distributor_perf.c',
31         'test_eal_flags.c',
32         'test_eal_fs.c',
33         'test_efd.c',
34         'test_efd_perf.c',
35         'test_errno.c',
36         'test_event_crypto_adapter.c',
37         'test_event_eth_rx_adapter.c',
38         'test_event_ring.c',
39         'test_event_eth_tx_adapter.c',
40         'test_event_timer_adapter.c',
41         'test_eventdev.c',
42         'test_func_reentrancy.c',
43         'test_flow_classify.c',
44         'test_hash.c',
45         'test_hash_functions.c',
46         'test_hash_multiwriter.c',
47         'test_hash_perf.c',
48         'test_hash_scaling.c',
49         'test_interrupts.c',
50         'test_kni.c',
51         'test_kvargs.c',
52         'test_link_bonding.c',
53         'test_link_bonding_mode4.c',
54         'test_logs.c',
55         'test_lpm.c',
56         'test_lpm6.c',
57         'test_lpm6_perf.c',
58         'test_lpm_perf.c',
59         'test_malloc.c',
60         'test_mbuf.c',
61         'test_member.c',
62         'test_member_perf.c',
63         'test_memcpy.c',
64         'test_memcpy_perf.c',
65         'test_memory.c',
66         'test_mempool.c',
67         'test_mempool_perf.c',
68         'test_memzone.c',
69         'test_meter.c',
70         'test_mp_secondary.c',
71         'test_per_lcore.c',
72         'test_pmd_perf.c',
73         'test_pmd_ring.c',
74         'test_pmd_ring_perf.c',
75         'test_power.c',
76         'test_power_acpi_cpufreq.c',
77         'test_power_kvm_vm.c',
78         'test_prefetch.c',
79         'test_reciprocal_division.c',
80         'test_reciprocal_division_perf.c',
81         'test_red.c',
82         'test_reorder.c',
83         'test_ring.c',
84         'test_ring_perf.c',
85         'test_rwlock.c',
86         'test_sched.c',
87         'test_service_cores.c',
88         'test_spinlock.c',
89         'test_string_fns.c',
90         'test_table.c',
91         'test_table_acl.c',
92         'test_table_combined.c',
93         'test_table_pipeline.c',
94         'test_table_ports.c',
95         'test_table_tables.c',
96         'test_tailq.c',
97         'test_thash.c',
98         'test_timer.c',
99         'test_timer_perf.c',
100         'test_timer_racecond.c',
101         'test_version.c',
102         'virtual_pmd.c'
103 )
104
105 test_deps = ['acl',
106         'bpf',
107         'cfgfile',
108         'cmdline',
109         'cryptodev',
110         'distributor',
111         'efd',
112         'ethdev',
113         'eventdev',
114         'flow_classify',
115         'hash',
116         'lpm',
117         'member',
118         'pipeline',
119         'port',
120         'reorder',
121         'ring',
122         'timer'
123 ]
124
125 test_names = [
126         'acl_autotest',
127         'alarm_autotest',
128         'atomic_autotest',
129         'barrier_autotest',
130         'byteorder_autotest',
131         'cmdline_autotest',
132         'common_autotest',
133         'cpuflags_autotest',
134         'crc_autotest',
135         'cryptodev_qat_autotest',
136         'cryptodev_aesni_mb_autotest',
137         'cryptodev_openssl_autotest',
138         'cryptodev_openssl_asym_autotest',
139         'cryptodev_aesni_gcm_autotest',
140         'cryptodev_null_autotest',
141         'cryptodev_sw_snow3g_autotest',
142         'cryptodev_sw_kasumi_autotest',
143         'cryptodev_sw_zuc_autotest',
144         'cryptodev_sw_armv8_autotest',
145         'cryptodev_sw_mvsam_autotest',
146         'cryptodev_dpaa2_sec_autotest',
147         'cryptodev_dpaa_sec_autotest',
148         'cryptodev_octeontx_autotest',
149         'cycles_autotest',
150         'debug_autotest',
151         'devargs_autotest',
152         'distributor_autotest',
153         'distributor_perf_autotest',
154         'eal_flags_autotest',
155         'eal_fs_autotest',
156         'efd_autotest',
157         'efd_perf_autotest',
158         'errno_autotest',
159         'event_crypto_adapter_autotest',
160         'event_eth_rx_adapter_autotest',
161         'event_eth_rx_intr_adapter_autotest',
162         'event_ring_autotest',
163         'event_eth_tx_adapter_autotest',
164         'event_timer_adapter_autotest',
165         'eventdev_common_autotest',
166         'eventdev_octeontx_autotest',
167         'eventdev_sw_autotest',
168         'external_mem_autotest',
169         'func_reentrancy_autotest',
170         'flow_classify_autotest',
171         'hash_scaling_autotest',
172         'hash_autotest',
173         'hash_functions_autotest',
174         'hash_multiwriter_autotest',
175         'hash_perf_autotest',
176         'interrupt_autotest',
177         'kni_autotest',
178         'kvargs_autotest',
179         'link_bonding_autotest',
180         'link_bonding_mode4_autotest',
181         'logs_autotest',
182         'lpm6_autotest',
183         'lpm6_perf_autotest',
184         'lpm_autotest',
185         'lpm_perf_autotest',
186         'malloc_autotest',
187         'mbuf_autotest',
188         'member_autotest',
189         'member_perf_autotest',
190         'memcpy_autotest',
191         'memcpy_perf_autotest',
192         'memory_autotest',
193         'mempool_autotest',
194         'mempool_perf_autotest',
195         'memzone_autotest',
196         'meter_autotest',
197         'multiprocess_autotest',
198         'per_lcore_autotest',
199         'pmd_perf_autotest',
200         'power_acpi_cpufreq_autotest',
201         'power_autotest',
202         'power_kvm_vm_autotest',
203         'prefetch_autotest',
204         'reciprocal_division',
205         'reciprocal_division_perf',
206         'red_all',
207         'red_autotest',
208         'red_perf',
209         'reorder_autotest',
210         'ring_autotest',
211         'ring_perf_autotest',
212         'ring_pmd_autotest',
213         'ring_pmd_perf_autotest',
214         'rwlock_autotest',
215         'sched_autotest',
216         'service_autotest',
217         'spinlock_autotest',
218         'string_autotest',
219         'table_autotest',
220         'tailq_autotest',
221         'thash_autotest',
222         'timer_autotest',
223         'timer_perf__autotest',
224         'timer_racecond_autotest',
225         'user_delay_us',
226         'version_autotest',
227 ]
228
229 if dpdk_conf.has('RTE_LIBRTE_PDUMP')
230         test_deps += 'pdump'
231 endif
232 if dpdk_conf.has('RTE_LIBRTE_I40E_PMD')
233         test_deps += 'pmd_i40e'
234 endif
235 if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
236         test_deps += 'pmd_ixgbe'
237 endif
238 if dpdk_conf.has('RTE_LIBRTE_BOND_PMD')
239         test_deps += 'pmd_bond'
240 endif
241 if dpdk_conf.has('RTE_LIBRTE_RING_PMD')
242         test_deps += 'pmd_ring'
243 endif
244 if dpdk_conf.has('RTE_LIBRTE_POWER')
245         test_deps += 'power'
246 endif
247 if dpdk_conf.has('RTE_LIBRTE_KNI')
248         test_deps += 'kni'
249 endif
250
251 cflags = machine_args
252 if cc.has_argument('-Wno-format-truncation')
253     cflags += '-Wno-format-truncation'
254 endif
255
256 # specify -D_GNU_SOURCE unconditionally
257 default_cflags += '-D_GNU_SOURCE'
258
259 test_dep_objs = []
260 compress_test_dep = dependency('zlib', required: false)
261 if compress_test_dep.found()
262         test_dep_objs += compress_test_dep
263         test_sources += 'test_compressdev.c'
264         test_deps += 'compressdev'
265         test_names += 'compressdev_autotest'
266 endif
267
268 foreach d:test_deps
269         def_lib = get_option('default_library')
270         test_dep_objs += get_variable(def_lib + '_rte_' + d)
271 endforeach
272 test_dep_objs += cc.find_library('execinfo', required: false)
273
274 link_libs = []
275 if get_option('default_library') == 'static'
276         link_libs = dpdk_drivers
277 endif
278
279 if get_option('tests')
280         dpdk_test = executable('dpdk-test',
281                 test_sources,
282                 link_whole: link_libs,
283                 dependencies: test_dep_objs,
284                 c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
285                 install_rpath: driver_install_path,
286                 install: false)
287
288         # some perf tests (eg: memcpy perf autotest)take very long
289         # to complete, so timeout to 10 minutes
290         timeout_seconds = 600
291
292         foreach t:test_names
293                 test(t, dpdk_test,
294                         env : ['DPDK_TEST='+t],
295                         timeout : timeout_seconds,
296                         is_parallel : false)
297         endforeach
298 endif