app/pdump: support multi-core capture
[dpdk.git] / app / 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         'sample_packet_forward.c',
7         'test.c',
8         'test_acl.c',
9         'test_alarm.c',
10         'test_atomic.c',
11         'test_barrier.c',
12         'test_bitratestats.c',
13         'test_bpf.c',
14         'test_byteorder.c',
15         'test_cmdline.c',
16         'test_cmdline_cirbuf.c',
17         'test_cmdline_etheraddr.c',
18         'test_cmdline_ipaddr.c',
19         'test_cmdline_lib.c',
20         'test_cmdline_num.c',
21         'test_cmdline_portlist.c',
22         'test_cmdline_string.c',
23         'test_common.c',
24         'test_cpuflags.c',
25         'test_crc.c',
26         'test_cryptodev.c',
27         'test_cryptodev_asym.c',
28         'test_cryptodev_blockcipher.c',
29         'test_cycles.c',
30         'test_debug.c',
31         'test_distributor.c',
32         'test_distributor_perf.c',
33         'test_eal_flags.c',
34         'test_eal_fs.c',
35         'test_efd.c',
36         'test_efd_perf.c',
37         'test_errno.c',
38         'test_event_crypto_adapter.c',
39         'test_event_eth_rx_adapter.c',
40         'test_event_ring.c',
41         'test_event_eth_tx_adapter.c',
42         'test_event_timer_adapter.c',
43         'test_eventdev.c',
44         'test_external_mem.c',
45         'test_fbarray.c',
46         'test_func_reentrancy.c',
47         'test_flow_classify.c',
48         'test_hash.c',
49         'test_hash_functions.c',
50         'test_hash_multiwriter.c',
51         'test_hash_readwrite.c',
52         'test_hash_perf.c',
53         'test_hash_readwrite_lf.c',
54         'test_interrupts.c',
55         'test_ipsec.c',
56         'test_kni.c',
57         'test_kvargs.c',
58         'test_latencystats.c',
59         'test_link_bonding.c',
60         'test_link_bonding_mode4.c',
61         'test_logs.c',
62         'test_lpm.c',
63         'test_lpm6.c',
64         'test_lpm6_perf.c',
65         'test_lpm_perf.c',
66         'test_malloc.c',
67         'test_mbuf.c',
68         'test_member.c',
69         'test_member_perf.c',
70         'test_memcpy.c',
71         'test_memcpy_perf.c',
72         'test_memory.c',
73         'test_mempool.c',
74         'test_mempool_perf.c',
75         'test_memzone.c',
76         'test_meter.c',
77         'test_metrics.c',
78         'test_mp_secondary.c',
79         'test_pdump.c',
80         'test_per_lcore.c',
81         'test_pmd_perf.c',
82         'test_pmd_ring.c',
83         'test_pmd_ring_perf.c',
84         'test_power.c',
85         'test_power_acpi_cpufreq.c',
86         'test_power_kvm_vm.c',
87         'test_prefetch.c',
88         'test_reciprocal_division.c',
89         'test_reciprocal_division_perf.c',
90         'test_red.c',
91         'test_reorder.c',
92         'test_ring.c',
93         'test_ring_perf.c',
94         'test_rwlock.c',
95         'test_sched.c',
96         'test_service_cores.c',
97         'test_spinlock.c',
98         'test_stack.c',
99         'test_stack_perf.c',
100         'test_string_fns.c',
101         'test_table.c',
102         'test_table_acl.c',
103         'test_table_combined.c',
104         'test_table_pipeline.c',
105         'test_table_ports.c',
106         'test_table_tables.c',
107         'test_tailq.c',
108         'test_thash.c',
109         'test_timer.c',
110         'test_timer_perf.c',
111         'test_timer_racecond.c',
112         'test_timer_secondary.c',
113         'test_ticketlock.c',
114         'test_version.c',
115         'virtual_pmd.c'
116 )
117
118 test_deps = ['acl',
119         'bitratestats',
120         'bpf',
121         'cfgfile',
122         'cmdline',
123         'cryptodev',
124         'distributor',
125         'efd',
126         'ethdev',
127         'eventdev',
128         'flow_classify',
129         'hash',
130         'ipsec',
131         'latencystats',
132         'lpm',
133         'member',
134         'metrics',
135         'pipeline',
136         'port',
137         'reorder',
138         'ring',
139         'stack',
140         'timer'
141 ]
142
143 # All test cases in fast_parallel_test_names list are parallel
144 fast_parallel_test_names = [
145         'acl_autotest',
146         'alarm_autotest',
147         'atomic_autotest',
148         'byteorder_autotest',
149         'cmdline_autotest',
150         'common_autotest',
151         'cpuflags_autotest',
152         'cycles_autotest',
153         'debug_autotest',
154         'eal_flags_autotest',
155         'eal_fs_autotest',
156         'errno_autotest',
157         'event_ring_autotest',
158         'func_reentrancy_autotest',
159         'flow_classify_autotest',
160         'hash_autotest',
161         'interrupt_autotest',
162         'logs_autotest',
163         'lpm_autotest',
164         'lpm6_autotest',
165         'malloc_autotest',
166         'mbuf_autotest',
167         'memcpy_autotest',
168         'memory_autotest',
169         'mempool_autotest',
170         'memzone_autotest',
171         'meter_autotest',
172         'multiprocess_autotest',
173         'per_lcore_autotest',
174         'prefetch_autotest',
175         'red_autotest',
176         'ring_autotest',
177         'ring_pmd_autotest',
178         'rwlock_autotest',
179         'sched_autotest',
180         'spinlock_autotest',
181         'stack_autotest',
182         'stack_nb_autotest',
183         'string_autotest',
184         'table_autotest',
185         'tailq_autotest',
186         'timer_autotest',
187         'user_delay_us',
188         'version_autotest',
189 ]
190
191 # All test cases in fast_non_parallel_test_names list are non-parallel
192 fast_non_parallel_test_names = [
193         'bitratestats_autotest',
194         'cryptodev_sw_armv8_autotest',
195         'crc_autotest',
196         'cryptodev_openssl_asym_autotest',
197         'cryptodev_sw_mvsam_autotest',
198         'delay_us_sleep_autotest',
199         'devargs_autotest',
200         'distributor_autotest',
201         'eventdev_common_autotest',
202         'eventdev_octeontx_autotest',
203         'eventdev_sw_autotest',
204         'fbarray_autotest',
205         'hash_readwrite_autotest',
206         'hash_readwrite_lf_autotest',
207         'hash_scaling_autotest',
208         'ipsec_autotest',
209         'kni_autotest',
210         'kvargs_autotest',
211         'latencystats_autotest',
212         'member_autotest',
213         'metrics_autotest',
214         'pdump_autotest',
215         'power_acpi_cpufreq_autotest',
216         'power_autotest',
217         'power_kvm_vm_autotest',
218         'reorder_autotest',
219         'service_autotest',
220         'thash_autotest',
221 ]
222
223 # All test cases in perf_test_names list are non-parallel
224 perf_test_names = [
225         'ring_perf_autotest',
226         'mempool_perf_autotest',
227         'memcpy_perf_autotest',
228         'hash_perf_autotest',
229         'timer_perf_autotest',
230         'reciprocal_division',
231         'reciprocal_division_perf',
232         'lpm_perf_autotest',
233         'red_all',
234         'barrier_autotest',
235         'hash_multiwriter_autotest',
236         'timer_racecond_autotest',
237         'efd_autotest',
238         'hash_functions_autotest',
239         'eventdev_selftest_sw',
240         'member_perf_autotest',
241         'efd_perf_autotest',
242         'lpm6_perf_autotest',
243         'red_perf',
244         'distributor_perf_autotest',
245         'ring_pmd_perf_autotest',
246         'pmd_perf_autotest',
247         'stack_perf_autotest',
248         'stack_nb_perf_autotest',
249 ]
250
251 # All test cases in driver_test_names list are non-parallel
252 driver_test_names = [
253         'link_bonding_autotest',
254         'link_bonding_mode4_autotest',
255         'link_bonding_rssconf_autotest',
256         'cryptodev_sw_mrvl_autotest',
257         'cryptodev_dpaa2_sec_autotest',
258         'cryptodev_dpaa_sec_autotest',
259         'cryptodev_qat_autotest',
260         'cryptodev_aesni_mb_autotest',
261         'cryptodev_openssl_autotest',
262         'cryptodev_scheduler_autotest',
263         'cryptodev_aesni_gcm_autotest',
264         'cryptodev_null_autotest',
265         'cryptodev_sw_snow3g_autotest',
266         'cryptodev_sw_kasumi_autotest',
267         'cryptodev_sw_zuc_autotest',
268 ]
269
270 # All test cases in dump_test_names list are non-parallel
271 dump_test_names = [
272         'dump_struct_sizes',
273         'dump_mempool',
274         'dump_malloc_stats',
275         'dump_devargs',
276         'dump_log_types',
277         'dump_ring',
278         'dump_physmem',
279         'dump_memzone',
280 ]
281
282 if dpdk_conf.has('RTE_LIBRTE_PDUMP')
283         test_deps += 'pdump'
284 endif
285 if dpdk_conf.has('RTE_LIBRTE_I40E_PMD')
286         test_deps += 'pmd_i40e'
287 endif
288 if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
289         test_deps += 'pmd_ixgbe'
290 endif
291 if dpdk_conf.has('RTE_LIBRTE_BOND_PMD')
292         test_deps += 'pmd_bond'
293 endif
294 if dpdk_conf.has('RTE_LIBRTE_RING_PMD')
295         test_deps += 'pmd_ring'
296 endif
297 if dpdk_conf.has('RTE_LIBRTE_POWER')
298         test_deps += 'power'
299 endif
300 if dpdk_conf.has('RTE_LIBRTE_KNI')
301         test_deps += 'kni'
302 endif
303
304 cflags = machine_args
305 if cc.has_argument('-Wno-format-truncation')
306     cflags += '-Wno-format-truncation'
307 endif
308
309 # specify -D_GNU_SOURCE unconditionally
310 cflags += '-D_GNU_SOURCE'
311
312 test_dep_objs = []
313 if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV')
314         compress_test_dep = dependency('zlib', required: false)
315         if compress_test_dep.found()
316                 test_dep_objs += compress_test_dep
317                 test_sources += 'test_compressdev.c'
318                 test_deps += 'compressdev'
319                 fast_non_parallel_test_names += 'compressdev_autotest'
320         endif
321 endif
322
323 foreach d:test_deps
324         def_lib = get_option('default_library')
325         test_dep_objs += get_variable(def_lib + '_rte_' + d)
326 endforeach
327 test_dep_objs += cc.find_library('execinfo', required: false)
328
329 link_libs = []
330 if get_option('default_library') == 'static'
331         link_libs = dpdk_drivers
332 endif
333
334 if get_option('tests')
335         dpdk_test = executable('dpdk-test',
336                 test_sources,
337                 link_whole: link_libs,
338                 dependencies: test_dep_objs,
339                 c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
340                 install_rpath: driver_install_path,
341                 install: false)
342
343         # some perf tests (eg: memcpy perf autotest)take very long
344         # to complete, so timeout to 10 minutes
345         timeout_seconds = 600
346         timeout_seconds_fast = 10
347
348         # Retrieve the number of CPU cores, defaulting to 4.
349         num_cores = '0-3'
350         if host_machine.system() == 'linux'
351                 num_cores = run_command('cat',
352                                         '/sys/devices/system/cpu/present'
353                                        ).stdout().strip()
354         elif host_machine.system() == 'freebsd'
355                 snum_cores = run_command('/sbin/sysctl', '-n',
356                                          'hw.ncpu').stdout().strip()
357                 inum_cores = snum_cores.to_int() - 1
358                 num_cores = '0-@0@'.format(inum_cores)
359         endif
360
361         num_cores_arg = '-l ' + num_cores
362
363         test_args = [num_cores_arg, '-n 4']
364         foreach arg : fast_parallel_test_names
365                 if host_machine.system() == 'linux'
366                         test(arg, dpdk_test,
367                                   env : ['DPDK_TEST=' + arg],
368                                   args : test_args +
369                                          ['--file-prefix=@0@'.format(arg)],
370                         timeout : timeout_seconds_fast,
371                         suite : 'fast-tests')
372                 else
373                         test(arg, dpdk_test,
374                                 env : ['DPDK_TEST=' + arg],
375                                 args : test_args,
376                         timeout : timeout_seconds_fast,
377                         suite : 'fast-tests')
378                 endif
379         endforeach
380
381         foreach arg : fast_non_parallel_test_names
382                 test(arg, dpdk_test,
383                         env : ['DPDK_TEST=' + arg],
384                         args : test_args,
385                         timeout : timeout_seconds_fast,
386                         is_parallel : false,
387                         suite : 'fast-tests')
388         endforeach
389
390         foreach arg : perf_test_names
391                 test(arg, dpdk_test,
392                 env : ['DPDK_TEST=' + arg],
393                 args : test_args,
394                 timeout : timeout_seconds,
395                 is_parallel : false,
396                 suite : 'perf-tests')
397         endforeach
398
399         foreach arg : driver_test_names
400                 test(arg, dpdk_test,
401                         env : ['DPDK_TEST=' + arg],
402                         args : test_args,
403                         timeout : timeout_seconds,
404                         is_parallel : false,
405                         suite : 'driver-tests')
406         endforeach
407
408         foreach arg : dump_test_names
409                 test(arg, dpdk_test,
410                         env : ['DPDK_TEST=' + arg],
411                         args : test_args,
412                         timeout : timeout_seconds,
413                         is_parallel : false,
414                         suite : 'debug-tests')
415         endforeach
416 endif