xref: /dpdk/app/test/meson.build (revision e887ebb6)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2017 Intel Corporation
3
4test_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_ticketlock.c',
113	'test_version.c',
114	'virtual_pmd.c'
115)
116
117test_deps = ['acl',
118	'bitratestats',
119	'bpf',
120	'cfgfile',
121	'cmdline',
122	'cryptodev',
123	'distributor',
124	'efd',
125	'ethdev',
126	'eventdev',
127	'flow_classify',
128	'hash',
129	'ipsec',
130	'latencystats',
131	'lpm',
132	'member',
133	'metrics',
134	'pipeline',
135	'port',
136	'reorder',
137	'ring',
138	'stack',
139	'timer'
140]
141
142# All test cases in fast_parallel_test_names list are parallel
143fast_parallel_test_names = [
144        'acl_autotest',
145        'alarm_autotest',
146        'atomic_autotest',
147        'byteorder_autotest',
148        'cmdline_autotest',
149        'common_autotest',
150        'cpuflags_autotest',
151        'cycles_autotest',
152        'debug_autotest',
153        'eal_flags_autotest',
154        'eal_fs_autotest',
155        'errno_autotest',
156        'event_ring_autotest',
157        'func_reentrancy_autotest',
158        'flow_classify_autotest',
159        'hash_autotest',
160        'interrupt_autotest',
161        'logs_autotest',
162        'lpm_autotest',
163        'lpm6_autotest',
164        'malloc_autotest',
165        'mbuf_autotest',
166        'memcpy_autotest',
167        'memory_autotest',
168        'mempool_autotest',
169        'memzone_autotest',
170        'meter_autotest',
171        'multiprocess_autotest',
172        'per_lcore_autotest',
173        'prefetch_autotest',
174        'red_autotest',
175        'ring_autotest',
176        'ring_pmd_autotest',
177        'rwlock_autotest',
178        'sched_autotest',
179        'spinlock_autotest',
180        'stack_autotest',
181        'stack_nb_autotest',
182        'string_autotest',
183        'table_autotest',
184        'tailq_autotest',
185        'timer_autotest',
186        'user_delay_us',
187        'version_autotest',
188]
189
190# All test cases in fast_non_parallel_test_names list are non-parallel
191fast_non_parallel_test_names = [
192        'bitratestats_autotest',
193        'cryptodev_sw_armv8_autotest',
194        'crc_autotest',
195        'cryptodev_openssl_asym_autotest',
196        'cryptodev_sw_mvsam_autotest',
197        'delay_us_sleep_autotest',
198        'devargs_autotest',
199        'distributor_autotest',
200        'eventdev_common_autotest',
201        'eventdev_octeontx_autotest',
202        'eventdev_sw_autotest',
203        'fbarray_autotest',
204        'hash_readwrite_autotest',
205        'hash_readwrite_lf_autotest',
206        'hash_scaling_autotest',
207        'ipsec_autotest',
208        'kni_autotest',
209        'kvargs_autotest',
210        'latencystats_autotest',
211        'member_autotest',
212        'metrics_autotest',
213        'pdump_autotest',
214        'power_acpi_cpufreq_autotest',
215        'power_autotest',
216        'power_kvm_vm_autotest',
217        'reorder_autotest',
218        'service_autotest',
219        'thash_autotest',
220]
221
222# All test cases in perf_test_names list are non-parallel
223perf_test_names = [
224        'ring_perf_autotest',
225        'mempool_perf_autotest',
226        'memcpy_perf_autotest',
227        'hash_perf_autotest',
228        'timer_perf_autotest',
229        'reciprocal_division',
230        'reciprocal_division_perf',
231        'lpm_perf_autotest',
232        'red_all',
233        'barrier_autotest',
234        'hash_multiwriter_autotest',
235        'timer_racecond_autotest',
236        'efd_autotest',
237        'hash_functions_autotest',
238        'eventdev_selftest_sw',
239        'member_perf_autotest',
240        'efd_perf_autotest',
241        'lpm6_perf_autotest',
242        'red_perf',
243        'distributor_perf_autotest',
244        'ring_pmd_perf_autotest',
245        'pmd_perf_autotest',
246        'stack_perf_autotest',
247        'stack_nb_perf_autotest',
248]
249
250# All test cases in driver_test_names list are non-parallel
251driver_test_names = [
252        'link_bonding_autotest',
253        'link_bonding_mode4_autotest',
254        'link_bonding_rssconf_autotest',
255        'cryptodev_sw_mrvl_autotest',
256        'cryptodev_dpaa2_sec_autotest',
257        'cryptodev_dpaa_sec_autotest',
258        'cryptodev_qat_autotest',
259        'cryptodev_aesni_mb_autotest',
260        'cryptodev_openssl_autotest',
261        'cryptodev_scheduler_autotest',
262        'cryptodev_aesni_gcm_autotest',
263        'cryptodev_null_autotest',
264        'cryptodev_sw_snow3g_autotest',
265        'cryptodev_sw_kasumi_autotest',
266        'cryptodev_sw_zuc_autotest',
267]
268
269# All test cases in dump_test_names list are non-parallel
270dump_test_names = [
271        'dump_struct_sizes',
272        'dump_mempool',
273        'dump_malloc_stats',
274        'dump_devargs',
275        'dump_log_types',
276        'dump_ring',
277        'dump_physmem',
278        'dump_memzone',
279]
280
281if dpdk_conf.has('RTE_LIBRTE_PDUMP')
282	test_deps += 'pdump'
283endif
284if dpdk_conf.has('RTE_LIBRTE_I40E_PMD')
285	test_deps += 'pmd_i40e'
286endif
287if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
288	test_deps += 'pmd_ixgbe'
289endif
290if dpdk_conf.has('RTE_LIBRTE_BOND_PMD')
291	test_deps += 'pmd_bond'
292endif
293if dpdk_conf.has('RTE_LIBRTE_RING_PMD')
294	test_deps += 'pmd_ring'
295endif
296if dpdk_conf.has('RTE_LIBRTE_POWER')
297	test_deps += 'power'
298endif
299if dpdk_conf.has('RTE_LIBRTE_KNI')
300	test_deps += 'kni'
301endif
302
303cflags = machine_args
304if cc.has_argument('-Wno-format-truncation')
305    cflags += '-Wno-format-truncation'
306endif
307
308# specify -D_GNU_SOURCE unconditionally
309cflags += '-D_GNU_SOURCE'
310
311test_dep_objs = []
312if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV')
313	compress_test_dep = dependency('zlib', required: false)
314	if compress_test_dep.found()
315		test_dep_objs += compress_test_dep
316		test_sources += 'test_compressdev.c'
317		test_deps += 'compressdev'
318		fast_non_parallel_test_names += 'compressdev_autotest'
319	endif
320endif
321
322foreach d:test_deps
323	def_lib = get_option('default_library')
324	test_dep_objs += get_variable(def_lib + '_rte_' + d)
325endforeach
326test_dep_objs += cc.find_library('execinfo', required: false)
327
328link_libs = []
329if get_option('default_library') == 'static'
330	link_libs = dpdk_drivers
331endif
332
333if get_option('tests')
334	dpdk_test = executable('dpdk-test',
335		test_sources,
336		link_whole: link_libs,
337		dependencies: test_dep_objs,
338		c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
339		install_rpath: driver_install_path,
340		install: false)
341
342	# some perf tests (eg: memcpy perf autotest)take very long
343	# to complete, so timeout to 10 minutes
344	timeout_seconds = 600
345	timeout_seconds_fast = 10
346
347	# Retrieve the number of CPU cores, defaulting to 4.
348	num_cores = '0-3'
349	if host_machine.system() == 'linux'
350		num_cores = run_command('cat',
351					'/sys/devices/system/cpu/present'
352				       ).stdout().strip()
353	elif host_machine.system() == 'freebsd'
354		snum_cores = run_command('/sbin/sysctl', '-n',
355					 'hw.ncpu').stdout().strip()
356		inum_cores = snum_cores.to_int() - 1
357                num_cores = '0-@0@'.format(inum_cores)
358	endif
359
360	num_cores_arg = '-l ' + num_cores
361
362	test_args = [num_cores_arg, '-n 4']
363	foreach arg : fast_parallel_test_names
364		if host_machine.system() == 'linux'
365			test(arg, dpdk_test,
366				  env : ['DPDK_TEST=' + arg],
367				  args : test_args +
368					 ['--file-prefix=@0@'.format(arg)],
369			timeout : timeout_seconds_fast,
370			suite : 'fast-tests')
371		else
372			test(arg, dpdk_test,
373				env : ['DPDK_TEST=' + arg],
374				args : test_args,
375			timeout : timeout_seconds_fast,
376			suite : 'fast-tests')
377		endif
378	endforeach
379
380	foreach arg : fast_non_parallel_test_names
381		test(arg, dpdk_test,
382			env : ['DPDK_TEST=' + arg],
383			args : test_args,
384			timeout : timeout_seconds_fast,
385			is_parallel : false,
386			suite : 'fast-tests')
387	endforeach
388
389	foreach arg : perf_test_names
390		test(arg, dpdk_test,
391		env : ['DPDK_TEST=' + arg],
392		args : test_args,
393		timeout : timeout_seconds,
394		is_parallel : false,
395		suite : 'perf-tests')
396	endforeach
397
398	foreach arg : driver_test_names
399		test(arg, dpdk_test,
400			env : ['DPDK_TEST=' + arg],
401			args : test_args,
402			timeout : timeout_seconds,
403			is_parallel : false,
404			suite : 'driver-tests')
405	endforeach
406
407	foreach arg : dump_test_names
408		test(arg, dpdk_test,
409			env : ['DPDK_TEST=' + arg],
410			args : test_args,
411			timeout : timeout_seconds,
412			is_parallel : false,
413			suite : 'debug-tests')
414	endforeach
415endif
416