1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2017 Intel Corporation
4 include $(RTE_SDK)/mk/rte.vars.mk
6 ifeq ($(CONFIG_RTE_APP_TEST),y)
11 # Define an externally linked resource. A linked resource is an arbitrary
12 # file that is linked into the test binary. The application refers to this
13 # resource by name. The linked generates identifiers beg_<name> and end_<name>
14 # for referencing by the C code.
16 # Parameters: <unique name>, <file to be linked>
17 define linked_resource
21 $Q [ "$$(<D)" = . ] || ln -fs $$<
22 $Q $(OBJCOPY) -I binary -B $(RTE_OBJCOPY_ARCH) -O $(RTE_OBJCOPY_TARGET) \
24 .data=.rodata,alloc,load,data,contents,readonly \
25 --redefine-sym _binary_$$(subst .,_,$$(<F))_start=beg_$(1) \
26 --redefine-sym _binary_$$(subst .,_,$$(<F))_end=end_$(1) \
27 --redefine-sym _binary_$$(subst .,_,$$(<F))_size=siz_$(1) \
31 ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y)
32 define linked_tar_resource
35 $Q tar -C $$(dir $$<) -cf $$@ $$(notdir $$<)
36 $(call linked_resource,$(1),$(1).tar)
38 else # ! CONFIG_RTE_APP_TEST_RESOURCE_TAR
40 endif # CONFIG_RTE_APP_TEST_RESOURCE_TAR
48 # all sources are stored in SRCS-y
50 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := commands.c
53 SRCS-y += test_resource.c
54 test_resource.res: test_resource.c
56 $(eval $(call linked_resource,test_resource_c,test_resource.res))
57 $(eval $(call linked_tar_resource,test_resource_tar,test_resource.c))
58 SRCS-$(CONFIG_RTE_APP_TEST_RESOURCE_TAR) += test_cfgfile.c
59 $(eval $(call linked_tar_resource,test_cfgfiles,test_cfgfiles))
60 SRCS-y += test_prefetch.c
61 SRCS-y += test_byteorder.c
62 SRCS-y += test_per_lcore.c
63 SRCS-y += test_atomic.c
64 SRCS-y += test_barrier.c
65 SRCS-y += test_malloc.c
66 SRCS-y += test_cycles.c
67 SRCS-y += test_spinlock.c
68 SRCS-y += test_memory.c
69 SRCS-y += test_memzone.c
70 SRCS-y += test_bitmap.c
71 SRCS-y += test_reciprocal_division.c
72 SRCS-y += test_reciprocal_division_perf.c
73 SRCS-y += test_fbarray.c
74 SRCS-y += test_external_mem.c
77 SRCS-y += test_ring_perf.c
78 SRCS-y += test_pmd_perf.c
80 ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
81 SRCS-y += test_table.c
82 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test_table_pipeline.c
83 SRCS-y += test_table_tables.c
84 SRCS-y += test_table_ports.c
85 SRCS-y += test_table_combined.c
86 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_table_acl.c
87 SRCS-$(CONFIG_RTE_LIBRTE_FLOW_CLASSIFY) += test_flow_classify.c
90 SRCS-y += test_rwlock.c
92 SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer.c
93 SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer_perf.c
94 SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer_racecond.c
96 SRCS-y += test_mempool.c
97 SRCS-y += test_mempool_perf.c
100 SRCS-y += test_logs.c
102 SRCS-y += test_memcpy.c
103 SRCS-y += test_memcpy_perf.c
106 SRCS-$(CONFIG_RTE_LIBRTE_MEMBER) += test_member.c
107 SRCS-$(CONFIG_RTE_LIBRTE_MEMBER) += test_member_perf.c
109 SRCS-$(CONFIG_RTE_LIBRTE_EFD) += test_efd.c
110 SRCS-$(CONFIG_RTE_LIBRTE_EFD) += test_efd_perf.c
112 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash.c
113 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_thash.c
114 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_perf.c
115 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_functions.c
116 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_multiwriter.c
117 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_readwrite.c
118 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_readwrite_lf.c
120 SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm.c
121 SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm_perf.c
122 SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6.c
123 SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6_perf.c
125 SRCS-y += test_debug.c
126 SRCS-y += test_errno.c
127 SRCS-y += test_tailq.c
128 SRCS-y += test_string_fns.c
129 SRCS-y += test_cpuflags.c
130 SRCS-y += test_mp_secondary.c
131 SRCS-y += test_eal_flags.c
132 SRCS-y += test_eal_fs.c
133 SRCS-y += test_alarm.c
134 SRCS-y += test_interrupts.c
135 SRCS-y += test_version.c
136 SRCS-y += test_func_reentrancy.c
138 SRCS-y += test_service_cores.c
140 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline.c
141 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c
142 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c
143 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_portlist.c
144 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_ipaddr.c
145 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_cirbuf.c
146 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
147 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
149 SRCS-$(CONFIG_RTE_LIBRTE_NET) += test_crc.c
151 ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
153 SRCS-y += test_sched.c
156 SRCS-$(CONFIG_RTE_LIBRTE_METER) += test_meter.c
157 SRCS-$(CONFIG_RTE_LIBRTE_KNI) += test_kni.c
158 SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power.c test_power_acpi_cpufreq.c
159 SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power_kvm_vm.c
160 SRCS-y += test_common.c
162 SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor.c
163 SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor_perf.c
165 SRCS-$(CONFIG_RTE_LIBRTE_REORDER) += test_reorder.c
167 SRCS-y += virtual_pmd.c
168 SRCS-y += packet_burst_generator.c
169 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_acl.c
171 ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
172 SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding.c
173 SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_mode4.c
176 ifeq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)
177 SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_rssconf.c
180 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
181 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
183 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
184 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
185 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c
187 SRCS-$(CONFIG_RTE_LIBRTE_METRICS) += test_metrics.c
189 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
190 SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += test_compressdev.c
193 ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
194 SRCS-y += test_eventdev.c
195 SRCS-y += test_event_ring.c
196 SRCS-y += test_event_eth_rx_adapter.c
197 SRCS-y += test_event_eth_tx_adapter.c
198 SRCS-y += test_event_timer_adapter.c
199 SRCS-y += test_event_crypto_adapter.c
202 ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y)
203 SRCS-y += test_rawdev.c
206 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
208 SRCS-$(CONFIG_RTE_LIBRTE_BPF) += test_bpf.c
210 CFLAGS += -DALLOW_EXPERIMENTAL_API
213 CFLAGS += $(WERROR_FLAGS)
216 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
217 ifeq ($(CONFIG_RTE_LIBRTE_COMPRESSDEV),y)
222 # Disable VTA for memcpy test
223 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
224 ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
225 CFLAGS_test_memcpy.o += -fno-var-tracking-assignments
226 CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
227 # for older GCC versions, allow us to initialize an event using
228 # designated initializers.
229 ifeq ($(shell test $(GCC_VERSION) -le 50 && echo 1), 1)
230 CFLAGS_test_eventdev_sw.o += -Wno-missing-field-initializers
231 CFLAGS_test_event_timer_adapter.o += -Wno-missing-field-initializers
232 CFLAGS_test_event_crypto_adapter.o += -Wno-missing-field-initializers
237 # Link against shared libraries when needed
238 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
239 ifneq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
240 $(error Link bonding tests require CONFIG_RTE_LIBRTE_PMD_RING=y)
244 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
246 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
247 LDLIBS += -lrte_pmd_bond
250 ifeq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)
251 LDLIBS += -lrte_pmd_null
254 ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
255 LDLIBS += -lrte_pmd_ring
258 ifeq ($(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER),y)
259 LDLIBS += -lrte_pmd_crypto_scheduler
264 ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y)
268 include $(RTE_SDK)/mk/rte.app.mk