xref: /dpdk/app/test/meson.build (revision 70581c355d6965f7be2dbf1c4fc0d30778c53b98)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2017-2023 Intel Corporation
3
4# the main test files [test.c and commands.c] relies on these libraries
5deps += ['cmdline', 'ring', 'mempool', 'mbuf']
6sources += files('commands.c', 'test.c')
7
8# optional dependencies: some files may use these - and so we should link them in -
9# but do not explicitly require them so they are not listed in the per-file lists below
10optional_deps = ['crypto_scheduler', 'lpm']
11
12# some other utility C files, providing functions used by various tests
13# so we need to include these deps in the dependency list for the files using those fns.
14packet_burst_generator_deps = ['net']
15sample_packet_forward_deps = ['net_ring', 'ethdev', 'bus_vdev']
16virtual_pmd_deps = ['ethdev', 'net', 'bus_pci']
17# test_cryptodev has material that other crypto tests need
18test_cryptodev_deps = ['bus_vdev', 'net', 'cryptodev', 'security']
19
20source_file_deps = {
21    # The C files providing functionality to other test cases
22    'packet_burst_generator.c': packet_burst_generator_deps,
23    'sample_packet_forward.c': sample_packet_forward_deps,
24    'virtual_pmd.c': virtual_pmd_deps,
25
26    # the various test_*.c files
27    'test_acl.c': ['net', 'acl'],
28    'test_alarm.c': [],
29    'test_argparse.c': ['argparse'],
30    'test_atomic.c': ['hash'],
31    'test_barrier.c': [],
32    'test_bitcount.c': [],
33    'test_bitmap.c': [],
34    'test_bitops.c': [],
35    'test_bitset.c': [],
36    'test_bitratestats.c': ['metrics', 'bitratestats', 'ethdev'] + sample_packet_forward_deps,
37    'test_bpf.c': ['bpf', 'net'],
38    'test_byteorder.c': [],
39    'test_cfgfile.c': ['cfgfile'],
40    'test_cksum.c': ['net'],
41    'test_cksum_perf.c': ['net'],
42    'test_cmdline.c': [],
43    'test_cmdline_cirbuf.c': [],
44    'test_cmdline_etheraddr.c': ['net'],
45    'test_cmdline_ipaddr.c': [],
46    'test_cmdline_lib.c': [],
47    'test_cmdline_num.c': [],
48    'test_cmdline_portlist.c': [],
49    'test_cmdline_string.c': [],
50    'test_common.c': [],
51    'test_compressdev.c': ['compressdev'],
52    'test_cpuflags.c': [],
53    'test_crc.c': ['net'],
54    'test_cryptodev.c': test_cryptodev_deps,
55    'test_cryptodev_asym.c': ['bus_vdev'] + test_cryptodev_deps,
56    'test_cryptodev_blockcipher.c': test_cryptodev_deps,
57    'test_cryptodev_crosscheck.c': test_cryptodev_deps,
58    'test_cryptodev_security_ipsec.c': test_cryptodev_deps,
59    'test_cryptodev_security_pdcp.c': test_cryptodev_deps,
60    'test_cryptodev_security_tls_record.c': ['cryptodev', 'security'],
61    'test_cycles.c': [],
62    'test_debug.c': [],
63    'test_devargs.c': ['kvargs'],
64    'test_dispatcher.c': ['dispatcher'],
65    'test_distributor.c': ['distributor'],
66    'test_distributor_perf.c': ['distributor'],
67    'test_dmadev.c': ['dmadev', 'bus_vdev'],
68    'test_dmadev_api.c': ['dmadev'],
69    'test_eal_flags.c': [],
70    'test_eal_fs.c': [],
71    'test_efd.c': ['efd', 'net'],
72    'test_efd_perf.c': ['efd', 'hash'],
73    'test_errno.c': [],
74    'test_ethdev_api.c': ['ethdev'],
75    'test_ethdev_link.c': ['ethdev'],
76    'test_event_crypto_adapter.c': ['cryptodev', 'eventdev', 'bus_vdev'],
77    'test_event_dma_adapter.c': ['dmadev', 'eventdev', 'bus_vdev'],
78    'test_event_eth_rx_adapter.c': ['ethdev', 'eventdev', 'bus_vdev'],
79    'test_event_eth_tx_adapter.c': ['bus_vdev', 'ethdev', 'net_ring', 'eventdev'],
80    'test_event_ring.c': ['eventdev'],
81    'test_event_timer_adapter.c': ['ethdev', 'eventdev', 'bus_vdev'],
82    'test_eventdev.c': ['eventdev', 'bus_vdev'],
83    'test_external_mem.c': [],
84    'test_fbarray.c': [],
85    'test_fib.c': ['net', 'fib'],
86    'test_fib6.c': ['rib', 'fib'],
87    'test_fib6_perf.c': ['fib'],
88    'test_fib_perf.c': ['net', 'fib'],
89    'test_flow_classify.c': ['net', 'acl', 'table', 'ethdev', 'flow_classify'],
90    'test_func_reentrancy.c': ['hash', 'lpm'],
91    'test_graph.c': ['graph'],
92    'test_graph_perf.c': ['graph'],
93    'test_hash.c': ['net', 'hash'],
94    'test_hash_functions.c': ['hash'],
95    'test_hash_multiwriter.c': ['hash'],
96    'test_hash_perf.c': ['hash'],
97    'test_hash_readwrite.c': ['hash'],
98    'test_hash_readwrite_lf_perf.c': ['hash'],
99    'test_interrupts.c': [],
100    'test_ipfrag.c': ['net', 'ip_frag'],
101    'test_ipsec.c': ['bus_vdev', 'net', 'cryptodev', 'ipsec', 'security'],
102    'test_ipsec_perf.c': ['net', 'ipsec'],
103    'test_ipsec_sad.c': ['ipsec'],
104    'test_kvargs.c': ['kvargs'],
105    'test_latencystats.c': ['ethdev', 'latencystats', 'metrics'] + sample_packet_forward_deps,
106    'test_lcore_var.c': [],
107    'test_lcore_var_perf.c': [],
108    'test_lcores.c': [],
109    'test_link_bonding.c': ['ethdev', 'net_bond',
110        'net'] + packet_burst_generator_deps + virtual_pmd_deps,
111    'test_link_bonding_mode4.c': ['ethdev', 'net_ring', 'net_bond',
112        'net'] + packet_burst_generator_deps,
113    'test_link_bonding_rssconf.c': ['ethdev', 'bus_vdev', 'net_bond'],
114    'test_logs.c': [],
115    'test_lpm.c': ['net', 'lpm'],
116    'test_lpm6.c': ['lpm'],
117    'test_lpm6_perf.c': ['lpm'],
118    'test_lpm_perf.c': ['net', 'lpm'],
119    'test_malloc.c': [],
120    'test_malloc_perf.c': [],
121    'test_mbuf.c': ['net'],
122    'test_mcslock.c': [],
123    'test_member.c': ['member', 'net'],
124    'test_member_perf.c': ['hash', 'member'],
125    'test_memcpy.c': [],
126    'test_memcpy_perf.c': [],
127    'test_memory.c': [],
128    'test_mempool.c': [],
129    'test_mempool_perf.c': [],
130    'test_memzone.c': [],
131    'test_meter.c': ['meter'],
132    'test_metrics.c': ['metrics'],
133    'test_mp_secondary.c': ['hash'],
134    'test_net_ether.c': ['net'],
135    'test_net_ip6.c': ['net'],
136    'test_pcapng.c': ['ethdev', 'net', 'pcapng', 'bus_vdev'],
137    'test_pdcp.c': ['eventdev', 'pdcp', 'net', 'timer', 'security'],
138    'test_pdump.c': ['pdump'] + sample_packet_forward_deps,
139    'test_per_lcore.c': [],
140    'test_pflock.c': [],
141    'test_pie.c': ['sched'],
142    'test_pmd_perf.c': ['ethdev', 'net'] + packet_burst_generator_deps,
143    'test_pmd_ring.c': ['net_ring', 'ethdev', 'bus_vdev'],
144    'test_pmd_ring_perf.c': ['ethdev', 'net_ring', 'bus_vdev'],
145    'test_power.c': ['power'],
146    'test_power_cpufreq.c': ['power'],
147    'test_power_intel_uncore.c': ['power'],
148    'test_power_kvm_vm.c': ['power'],
149    'test_prefetch.c': [],
150    'test_ptr_compress.c': ['ptr_compress'],
151    'test_rand_perf.c': [],
152    'test_rawdev.c': ['rawdev', 'bus_vdev'],
153    'test_rcu_qsbr.c': ['rcu', 'hash'],
154    'test_rcu_qsbr_perf.c': ['rcu', 'hash'],
155    'test_reassembly_perf.c': ['net', 'ip_frag'],
156    'test_reciprocal_division.c': [],
157    'test_reciprocal_division_perf.c': [],
158    'test_red.c': ['sched'],
159    'test_reorder.c': ['reorder'],
160    'test_rib.c': ['net', 'rib'],
161    'test_rib6.c': ['net', 'rib'],
162    'test_ring.c': ['ptr_compress'],
163    'test_ring_hts_stress.c': ['ptr_compress'],
164    'test_ring_mpmc_stress.c': ['ptr_compress'],
165    'test_ring_mt_peek_stress.c': ['ptr_compress'],
166    'test_ring_mt_peek_stress_zc.c': ['ptr_compress'],
167    'test_ring_perf.c': ['ptr_compress'],
168    'test_ring_rts_stress.c': ['ptr_compress'],
169    'test_ring_st_peek_stress.c': ['ptr_compress'],
170    'test_ring_st_peek_stress_zc.c': ['ptr_compress'],
171    'test_ring_stress.c': ['ptr_compress'],
172    'test_rwlock.c': [],
173    'test_sched.c': ['net', 'sched'],
174    'test_security.c': ['net', 'security'],
175    'test_security_inline_macsec.c': ['ethdev', 'security'],
176    'test_security_inline_proto.c': ['ethdev', 'security', 'eventdev'] + test_cryptodev_deps,
177    'test_security_proto.c' : ['cryptodev', 'security'],
178    'test_seqlock.c': [],
179    'test_service_cores.c': [],
180    'test_soring.c': [],
181    'test_soring_mt_stress.c': [],
182    'test_soring_stress.c': [],
183    'test_spinlock.c': [],
184    'test_stack.c': ['stack'],
185    'test_stack_perf.c': ['stack'],
186    'test_string_fns.c': [],
187    'test_table.c': ['table', 'pipeline', 'port'],
188    'test_table_acl.c': ['net', 'table', 'pipeline', 'port'],
189    'test_table_combined.c': ['table', 'pipeline', 'port'],
190    'test_table_pipeline.c': ['pipeline', 'table', 'port'],
191    'test_table_ports.c': ['table', 'pipeline', 'port'],
192    'test_table_tables.c': ['table', 'pipeline', 'port'],
193    'test_tailq.c': [],
194    'test_telemetry_data.c': ['telemetry'],
195    'test_telemetry_json.c': ['telemetry'],
196    'test_thash.c': ['net', 'hash'],
197    'test_thash_perf.c': ['hash'],
198    'test_threads.c': [],
199    'test_ticketlock.c': [],
200    'test_timer.c': ['timer'],
201    'test_timer_perf.c': ['timer'],
202    'test_timer_racecond.c': ['timer'],
203    'test_timer_secondary.c': ['timer'],
204    'test_trace.c': [],
205    'test_trace_perf.c': [],
206    'test_trace_register.c': [],
207    'test_vdev.c': ['kvargs', 'bus_vdev'],
208    'test_version.c': [],
209}
210
211source_file_ext_deps = {
212    'test_compressdev.c': ['zlib'],
213    'test_pcapng.c': ['pcap'],
214}
215
216def_lib = get_option('default_library')
217foreach f, f_deps : source_file_deps
218    has_deps = true
219    foreach d : f_deps
220        if not is_variable(def_lib + '_rte_' + d)
221            has_deps = false
222            break
223        else
224            # technically we might not need this dep, but adding it is harmless
225            if d not in deps
226                deps += d
227            endif
228        endif
229    endforeach
230    # check for any external dependencies for this file
231    if source_file_ext_deps.has_key(f)
232        foreach d: source_file_ext_deps.get(f)
233            dep = dependency(d, required: false, method: 'pkg-config')
234            if not dep.found()
235                message('Skipping test file @0@ due to missing external dependency @1@'.format(f, d))
236                has_deps = false
237            else
238                ext_deps += dep
239            endif
240        endforeach
241    endif
242    if has_deps
243        sources += files(f)
244    endif
245endforeach
246# add the optional dependencies
247foreach d:optional_deps
248    if is_variable(def_lib + '_rte_' + d) and d not in deps
249        deps += d
250    endif
251endforeach
252
253if cc.has_argument('-Wno-format-truncation')
254    cflags += '-Wno-format-truncation'
255endif
256
257# Strict-aliasing rules are violated by uint8_t[] to context size casts.
258cflags += '-fno-strict-aliasing'
259
260# Enable using internal APIs in unit tests
261cflags += '-DALLOW_INTERNAL_API'
262
263# create a symlink in the app/test directory for the binary, for backward compatibility
264if not is_windows
265    custom_target('test_symlink',
266            output: 'dpdk-test',
267            command: ['ln', '-sf', '../dpdk-test', '@OUTPUT@'],
268            build_by_default: true,
269            install: false)
270endif
271
272subdir('test_cfgfiles')
273
274resources += test_cfgfile_h
275