xref: /dpdk/app/test/meson.build (revision 70581c355d6965f7be2dbf1c4fc0d30778c53b98)
1a9de470cSBruce Richardson# SPDX-License-Identifier: BSD-3-Clause
250823f30SBruce Richardson# Copyright(c) 2017-2023 Intel Corporation
3a9de470cSBruce Richardson
450823f30SBruce Richardson# the main test files [test.c and commands.c] relies on these libraries
550823f30SBruce Richardsondeps += ['cmdline', 'ring', 'mempool', 'mbuf']
650823f30SBruce Richardsonsources += files('commands.c', 'test.c')
78cb511bbSIlya Maximets
867f2abe4SBruce Richardson# optional dependencies: some files may use these - and so we should link them in -
967f2abe4SBruce Richardson# but do not explicitly require them so they are not listed in the per-file lists below
1006811370SBruce Richardsonoptional_deps = ['crypto_scheduler', 'lpm']
1167f2abe4SBruce Richardson
1250823f30SBruce Richardson# some other utility C files, providing functions used by various tests
1350823f30SBruce Richardson# so we need to include these deps in the dependency list for the files using those fns.
1450823f30SBruce Richardsonpacket_burst_generator_deps = ['net']
1550823f30SBruce Richardsonsample_packet_forward_deps = ['net_ring', 'ethdev', 'bus_vdev']
1650823f30SBruce Richardsonvirtual_pmd_deps = ['ethdev', 'net', 'bus_pci']
1750823f30SBruce Richardson# test_cryptodev has material that other crypto tests need
18a89a9ca3SBruce Richardsontest_cryptodev_deps = ['bus_vdev', 'net', 'cryptodev', 'security']
19a9de470cSBruce Richardson
2050823f30SBruce Richardsonsource_file_deps = {
2150823f30SBruce Richardson    # The C files providing functionality to other test cases
2250823f30SBruce Richardson    'packet_burst_generator.c': packet_burst_generator_deps,
2350823f30SBruce Richardson    'sample_packet_forward.c': sample_packet_forward_deps,
2450823f30SBruce Richardson    'virtual_pmd.c': virtual_pmd_deps,
25a9de470cSBruce Richardson
2650823f30SBruce Richardson    # the various test_*.c files
2750823f30SBruce Richardson    'test_acl.c': ['net', 'acl'],
2850823f30SBruce Richardson    'test_alarm.c': [],
296c5c6571SChengwen Feng    'test_argparse.c': ['argparse'],
3050823f30SBruce Richardson    'test_atomic.c': ['hash'],
3150823f30SBruce Richardson    'test_barrier.c': [],
32916c50ddSTyler Retzlaff    'test_bitcount.c': [],
3350823f30SBruce Richardson    'test_bitmap.c': [],
3450823f30SBruce Richardson    'test_bitops.c': [],
3599a11976SMattias Rönnblom    'test_bitset.c': [],
3650823f30SBruce Richardson    'test_bitratestats.c': ['metrics', 'bitratestats', 'ethdev'] + sample_packet_forward_deps,
3750823f30SBruce Richardson    'test_bpf.c': ['bpf', 'net'],
3850823f30SBruce Richardson    'test_byteorder.c': [],
39be22019aSStephen Hemminger    'test_cfgfile.c': ['cfgfile'],
4050823f30SBruce Richardson    'test_cksum.c': ['net'],
4150823f30SBruce Richardson    'test_cksum_perf.c': ['net'],
4250823f30SBruce Richardson    'test_cmdline.c': [],
4350823f30SBruce Richardson    'test_cmdline_cirbuf.c': [],
4450823f30SBruce Richardson    'test_cmdline_etheraddr.c': ['net'],
4550823f30SBruce Richardson    'test_cmdline_ipaddr.c': [],
4650823f30SBruce Richardson    'test_cmdline_lib.c': [],
4750823f30SBruce Richardson    'test_cmdline_num.c': [],
4850823f30SBruce Richardson    'test_cmdline_portlist.c': [],
4950823f30SBruce Richardson    'test_cmdline_string.c': [],
5050823f30SBruce Richardson    'test_common.c': [],
5150823f30SBruce Richardson    'test_compressdev.c': ['compressdev'],
5250823f30SBruce Richardson    'test_cpuflags.c': [],
5350823f30SBruce Richardson    'test_crc.c': ['net'],
5450823f30SBruce Richardson    'test_cryptodev.c': test_cryptodev_deps,
5550823f30SBruce Richardson    'test_cryptodev_asym.c': ['bus_vdev'] + test_cryptodev_deps,
5650823f30SBruce Richardson    'test_cryptodev_blockcipher.c': test_cryptodev_deps,
5750823f30SBruce Richardson    'test_cryptodev_crosscheck.c': test_cryptodev_deps,
5850823f30SBruce Richardson    'test_cryptodev_security_ipsec.c': test_cryptodev_deps,
5950823f30SBruce Richardson    'test_cryptodev_security_pdcp.c': test_cryptodev_deps,
605df0478dSAnoob Joseph    'test_cryptodev_security_tls_record.c': ['cryptodev', 'security'],
6150823f30SBruce Richardson    'test_cycles.c': [],
6250823f30SBruce Richardson    'test_debug.c': [],
6350823f30SBruce Richardson    'test_devargs.c': ['kvargs'],
64ecca8a0bSMattias Rönnblom    'test_dispatcher.c': ['dispatcher'],
6550823f30SBruce Richardson    'test_distributor.c': ['distributor'],
6650823f30SBruce Richardson    'test_distributor_perf.c': ['distributor'],
6750823f30SBruce Richardson    'test_dmadev.c': ['dmadev', 'bus_vdev'],
6850823f30SBruce Richardson    'test_dmadev_api.c': ['dmadev'],
6950823f30SBruce Richardson    'test_eal_flags.c': [],
7050823f30SBruce Richardson    'test_eal_fs.c': [],
7150823f30SBruce Richardson    'test_efd.c': ['efd', 'net'],
7250823f30SBruce Richardson    'test_efd_perf.c': ['efd', 'hash'],
7350823f30SBruce Richardson    'test_errno.c': [],
742834e6ddSFerruh Yigit    'test_ethdev_api.c': ['ethdev'],
7550823f30SBruce Richardson    'test_ethdev_link.c': ['ethdev'],
7650823f30SBruce Richardson    'test_event_crypto_adapter.c': ['cryptodev', 'eventdev', 'bus_vdev'],
77a276e7c8SAmit Prakash Shukla    'test_event_dma_adapter.c': ['dmadev', 'eventdev', 'bus_vdev'],
7850823f30SBruce Richardson    'test_event_eth_rx_adapter.c': ['ethdev', 'eventdev', 'bus_vdev'],
7950823f30SBruce Richardson    'test_event_eth_tx_adapter.c': ['bus_vdev', 'ethdev', 'net_ring', 'eventdev'],
8050823f30SBruce Richardson    'test_event_ring.c': ['eventdev'],
8150823f30SBruce Richardson    'test_event_timer_adapter.c': ['ethdev', 'eventdev', 'bus_vdev'],
8250823f30SBruce Richardson    'test_eventdev.c': ['eventdev', 'bus_vdev'],
8350823f30SBruce Richardson    'test_external_mem.c': [],
8450823f30SBruce Richardson    'test_fbarray.c': [],
8550823f30SBruce Richardson    'test_fib.c': ['net', 'fib'],
8650823f30SBruce Richardson    'test_fib6.c': ['rib', 'fib'],
8750823f30SBruce Richardson    'test_fib6_perf.c': ['fib'],
8850823f30SBruce Richardson    'test_fib_perf.c': ['net', 'fib'],
8950823f30SBruce Richardson    'test_flow_classify.c': ['net', 'acl', 'table', 'ethdev', 'flow_classify'],
9050823f30SBruce Richardson    'test_func_reentrancy.c': ['hash', 'lpm'],
9150823f30SBruce Richardson    'test_graph.c': ['graph'],
9250823f30SBruce Richardson    'test_graph_perf.c': ['graph'],
9350823f30SBruce Richardson    'test_hash.c': ['net', 'hash'],
9450823f30SBruce Richardson    'test_hash_functions.c': ['hash'],
9550823f30SBruce Richardson    'test_hash_multiwriter.c': ['hash'],
9650823f30SBruce Richardson    'test_hash_perf.c': ['hash'],
9750823f30SBruce Richardson    'test_hash_readwrite.c': ['hash'],
9850823f30SBruce Richardson    'test_hash_readwrite_lf_perf.c': ['hash'],
9950823f30SBruce Richardson    'test_interrupts.c': [],
10050823f30SBruce Richardson    'test_ipfrag.c': ['net', 'ip_frag'],
10150823f30SBruce Richardson    'test_ipsec.c': ['bus_vdev', 'net', 'cryptodev', 'ipsec', 'security'],
10250823f30SBruce Richardson    'test_ipsec_perf.c': ['net', 'ipsec'],
10350823f30SBruce Richardson    'test_ipsec_sad.c': ['ipsec'],
10450823f30SBruce Richardson    'test_kvargs.c': ['kvargs'],
10550823f30SBruce Richardson    'test_latencystats.c': ['ethdev', 'latencystats', 'metrics'] + sample_packet_forward_deps,
106b0faa833SMattias Rönnblom    'test_lcore_var.c': [],
1072cd441bdSMattias Rönnblom    'test_lcore_var_perf.c': [],
10850823f30SBruce Richardson    'test_lcores.c': [],
10950823f30SBruce Richardson    'test_link_bonding.c': ['ethdev', 'net_bond',
11050823f30SBruce Richardson        'net'] + packet_burst_generator_deps + virtual_pmd_deps,
11150823f30SBruce Richardson    'test_link_bonding_mode4.c': ['ethdev', 'net_ring', 'net_bond',
11250823f30SBruce Richardson        'net'] + packet_burst_generator_deps,
11350823f30SBruce Richardson    'test_link_bonding_rssconf.c': ['ethdev', 'bus_vdev', 'net_bond'],
11450823f30SBruce Richardson    'test_logs.c': [],
11550823f30SBruce Richardson    'test_lpm.c': ['net', 'lpm'],
11650823f30SBruce Richardson    'test_lpm6.c': ['lpm'],
11750823f30SBruce Richardson    'test_lpm6_perf.c': ['lpm'],
11850823f30SBruce Richardson    'test_lpm_perf.c': ['net', 'lpm'],
11950823f30SBruce Richardson    'test_malloc.c': [],
12050823f30SBruce Richardson    'test_malloc_perf.c': [],
12150823f30SBruce Richardson    'test_mbuf.c': ['net'],
12250823f30SBruce Richardson    'test_mcslock.c': [],
12350823f30SBruce Richardson    'test_member.c': ['member', 'net'],
12450823f30SBruce Richardson    'test_member_perf.c': ['hash', 'member'],
12550823f30SBruce Richardson    'test_memcpy.c': [],
12650823f30SBruce Richardson    'test_memcpy_perf.c': [],
12750823f30SBruce Richardson    'test_memory.c': [],
12850823f30SBruce Richardson    'test_mempool.c': [],
12950823f30SBruce Richardson    'test_mempool_perf.c': [],
13050823f30SBruce Richardson    'test_memzone.c': [],
13150823f30SBruce Richardson    'test_meter.c': ['meter'],
13250823f30SBruce Richardson    'test_metrics.c': ['metrics'],
13306811370SBruce Richardson    'test_mp_secondary.c': ['hash'],
134719b37ddSStephen Hemminger    'test_net_ether.c': ['net'],
135ca786defSRobin Jarry    'test_net_ip6.c': ['net'],
1360c614a0fSStephen Hemminger    'test_pcapng.c': ['ethdev', 'net', 'pcapng', 'bus_vdev'],
13750823f30SBruce Richardson    'test_pdcp.c': ['eventdev', 'pdcp', 'net', 'timer', 'security'],
13850823f30SBruce Richardson    'test_pdump.c': ['pdump'] + sample_packet_forward_deps,
13950823f30SBruce Richardson    'test_per_lcore.c': [],
14050823f30SBruce Richardson    'test_pflock.c': [],
14150823f30SBruce Richardson    'test_pie.c': ['sched'],
14250823f30SBruce Richardson    'test_pmd_perf.c': ['ethdev', 'net'] + packet_burst_generator_deps,
14350823f30SBruce Richardson    'test_pmd_ring.c': ['net_ring', 'ethdev', 'bus_vdev'],
14450823f30SBruce Richardson    'test_pmd_ring_perf.c': ['ethdev', 'net_ring', 'bus_vdev'],
14550823f30SBruce Richardson    'test_power.c': ['power'],
14650823f30SBruce Richardson    'test_power_cpufreq.c': ['power'],
14750823f30SBruce Richardson    'test_power_intel_uncore.c': ['power'],
14850823f30SBruce Richardson    'test_power_kvm_vm.c': ['power'],
14950823f30SBruce Richardson    'test_prefetch.c': [],
150077596a4SPaul Szczepanek    'test_ptr_compress.c': ['ptr_compress'],
15150823f30SBruce Richardson    'test_rand_perf.c': [],
15250823f30SBruce Richardson    'test_rawdev.c': ['rawdev', 'bus_vdev'],
15350823f30SBruce Richardson    'test_rcu_qsbr.c': ['rcu', 'hash'],
15450823f30SBruce Richardson    'test_rcu_qsbr_perf.c': ['rcu', 'hash'],
15550823f30SBruce Richardson    'test_reassembly_perf.c': ['net', 'ip_frag'],
15650823f30SBruce Richardson    'test_reciprocal_division.c': [],
15750823f30SBruce Richardson    'test_reciprocal_division_perf.c': [],
15850823f30SBruce Richardson    'test_red.c': ['sched'],
15950823f30SBruce Richardson    'test_reorder.c': ['reorder'],
16050823f30SBruce Richardson    'test_rib.c': ['net', 'rib'],
16150823f30SBruce Richardson    'test_rib6.c': ['net', 'rib'],
162a4cb5461SPaul Szczepanek    'test_ring.c': ['ptr_compress'],
163a4cb5461SPaul Szczepanek    'test_ring_hts_stress.c': ['ptr_compress'],
164a4cb5461SPaul Szczepanek    'test_ring_mpmc_stress.c': ['ptr_compress'],
165a4cb5461SPaul Szczepanek    'test_ring_mt_peek_stress.c': ['ptr_compress'],
166a4cb5461SPaul Szczepanek    'test_ring_mt_peek_stress_zc.c': ['ptr_compress'],
167a4cb5461SPaul Szczepanek    'test_ring_perf.c': ['ptr_compress'],
168a4cb5461SPaul Szczepanek    'test_ring_rts_stress.c': ['ptr_compress'],
169a4cb5461SPaul Szczepanek    'test_ring_st_peek_stress.c': ['ptr_compress'],
170a4cb5461SPaul Szczepanek    'test_ring_st_peek_stress_zc.c': ['ptr_compress'],
171a4cb5461SPaul Szczepanek    'test_ring_stress.c': ['ptr_compress'],
17250823f30SBruce Richardson    'test_rwlock.c': [],
17350823f30SBruce Richardson    'test_sched.c': ['net', 'sched'],
17450823f30SBruce Richardson    'test_security.c': ['net', 'security'],
17550823f30SBruce Richardson    'test_security_inline_macsec.c': ['ethdev', 'security'],
17650823f30SBruce Richardson    'test_security_inline_proto.c': ['ethdev', 'security', 'eventdev'] + test_cryptodev_deps,
1771d3a3e18SAnoob Joseph    'test_security_proto.c' : ['cryptodev', 'security'],
17850823f30SBruce Richardson    'test_seqlock.c': [],
17950823f30SBruce Richardson    'test_service_cores.c': [],
180*70581c35SKonstantin Ananyev    'test_soring.c': [],
181*70581c35SKonstantin Ananyev    'test_soring_mt_stress.c': [],
182*70581c35SKonstantin Ananyev    'test_soring_stress.c': [],
18350823f30SBruce Richardson    'test_spinlock.c': [],
18450823f30SBruce Richardson    'test_stack.c': ['stack'],
18550823f30SBruce Richardson    'test_stack_perf.c': ['stack'],
18650823f30SBruce Richardson    'test_string_fns.c': [],
18750823f30SBruce Richardson    'test_table.c': ['table', 'pipeline', 'port'],
18850823f30SBruce Richardson    'test_table_acl.c': ['net', 'table', 'pipeline', 'port'],
18950823f30SBruce Richardson    'test_table_combined.c': ['table', 'pipeline', 'port'],
19050823f30SBruce Richardson    'test_table_pipeline.c': ['pipeline', 'table', 'port'],
19150823f30SBruce Richardson    'test_table_ports.c': ['table', 'pipeline', 'port'],
19250823f30SBruce Richardson    'test_table_tables.c': ['table', 'pipeline', 'port'],
19350823f30SBruce Richardson    'test_tailq.c': [],
19450823f30SBruce Richardson    'test_telemetry_data.c': ['telemetry'],
19550823f30SBruce Richardson    'test_telemetry_json.c': ['telemetry'],
19650823f30SBruce Richardson    'test_thash.c': ['net', 'hash'],
19750823f30SBruce Richardson    'test_thash_perf.c': ['hash'],
19850823f30SBruce Richardson    'test_threads.c': [],
19950823f30SBruce Richardson    'test_ticketlock.c': [],
20050823f30SBruce Richardson    'test_timer.c': ['timer'],
20150823f30SBruce Richardson    'test_timer_perf.c': ['timer'],
20250823f30SBruce Richardson    'test_timer_racecond.c': ['timer'],
20350823f30SBruce Richardson    'test_timer_secondary.c': ['timer'],
20450823f30SBruce Richardson    'test_trace.c': [],
20550823f30SBruce Richardson    'test_trace_perf.c': [],
20650823f30SBruce Richardson    'test_trace_register.c': [],
20750823f30SBruce Richardson    'test_vdev.c': ['kvargs', 'bus_vdev'],
20850823f30SBruce Richardson    'test_version.c': [],
20950823f30SBruce Richardson}
210a9de470cSBruce Richardson
21150823f30SBruce Richardsonsource_file_ext_deps = {
21250823f30SBruce Richardson    'test_compressdev.c': ['zlib'],
21350823f30SBruce Richardson    'test_pcapng.c': ['pcap'],
21450823f30SBruce Richardson}
21574822233SDavid Marchand
21650823f30SBruce Richardsondef_lib = get_option('default_library')
21750823f30SBruce Richardsonforeach f, f_deps : source_file_deps
21850823f30SBruce Richardson    has_deps = true
21950823f30SBruce Richardson    foreach d : f_deps
22050823f30SBruce Richardson        if not is_variable(def_lib + '_rte_' + d)
22150823f30SBruce Richardson            has_deps = false
22250823f30SBruce Richardson            break
22350823f30SBruce Richardson        else
22450823f30SBruce Richardson            # technically we might not need this dep, but adding it is harmless
22550823f30SBruce Richardson            if d not in deps
22650823f30SBruce Richardson                deps += d
227949c97aeSBruce Richardson            endif
228a9de470cSBruce Richardson        endif
22950823f30SBruce Richardson    endforeach
23050823f30SBruce Richardson    # check for any external dependencies for this file
23150823f30SBruce Richardson    if source_file_ext_deps.has_key(f)
23250823f30SBruce Richardson        foreach d: source_file_ext_deps.get(f)
23350823f30SBruce Richardson            dep = dependency(d, required: false, method: 'pkg-config')
23450823f30SBruce Richardson            if not dep.found()
23550823f30SBruce Richardson                message('Skipping test file @0@ due to missing external dependency @1@'.format(f, d))
23650823f30SBruce Richardson                has_deps = false
23750823f30SBruce Richardson            else
23850823f30SBruce Richardson                ext_deps += dep
239bb9be9a4SDavid Marchand            endif
24050823f30SBruce Richardson        endforeach
241bb9be9a4SDavid Marchand    endif
24250823f30SBruce Richardson    if has_deps
24350823f30SBruce Richardson        sources += files(f)
244cbff4d8dSDavid Marchand    endif
24550823f30SBruce Richardsonendforeach
24667f2abe4SBruce Richardson# add the optional dependencies
24767f2abe4SBruce Richardsonforeach d:optional_deps
24867f2abe4SBruce Richardson    if is_variable(def_lib + '_rte_' + d) and d not in deps
24967f2abe4SBruce Richardson        deps += d
25067f2abe4SBruce Richardson    endif
25167f2abe4SBruce Richardsonendforeach
252bd24488cSAnoob Joseph
253a9de470cSBruce Richardsonif cc.has_argument('-Wno-format-truncation')
254a9de470cSBruce Richardson    cflags += '-Wno-format-truncation'
255a9de470cSBruce Richardsonendif
256a9de470cSBruce Richardson
2576b896504SKiran Kumar K# Strict-aliasing rules are violated by uint8_t[] to context size casts.
2586b896504SKiran Kumar Kcflags += '-fno-strict-aliasing'
259a9de470cSBruce Richardson
26061ede395SFerruh Yigit# Enable using internal APIs in unit tests
26150823f30SBruce Richardsoncflags += '-DALLOW_INTERNAL_API'
26261ede395SFerruh Yigit
26350823f30SBruce Richardson# create a symlink in the app/test directory for the binary, for backward compatibility
26450823f30SBruce Richardsonif not is_windows
26550823f30SBruce Richardson    custom_target('test_symlink',
26650823f30SBruce Richardson            output: 'dpdk-test',
26750823f30SBruce Richardson            command: ['ln', '-sf', '../dpdk-test', '@OUTPUT@'],
26850823f30SBruce Richardson            build_by_default: true,
26950823f30SBruce Richardson            install: false)
270a9de470cSBruce Richardsonendif
271be22019aSStephen Hemminger
272be22019aSStephen Hemmingersubdir('test_cfgfiles')
273be22019aSStephen Hemminger
274be22019aSStephen Hemmingerresources += test_cfgfile_h
275