1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017 Intel Corporation 3 4if not get_option('tests') 5 subdir_done() 6endif 7 8test_sources = files('commands.c', 9 'packet_burst_generator.c', 10 'test.c', 11 'test_acl.c', 12 'test_alarm.c', 13 'test_atomic.c', 14 'test_barrier.c', 15 'test_bpf.c', 16 'test_byteorder.c', 17 'test_cmdline.c', 18 'test_cmdline_cirbuf.c', 19 'test_cmdline_etheraddr.c', 20 'test_cmdline_ipaddr.c', 21 'test_cmdline_lib.c', 22 'test_cmdline_num.c', 23 'test_cmdline_portlist.c', 24 'test_cmdline_string.c', 25 'test_common.c', 26 'test_cpuflags.c', 27 'test_crc.c', 28 'test_cryptodev.c', 29 'test_cryptodev_asym.c', 30 'test_cryptodev_blockcipher.c', 31 'test_cryptodev_security_pdcp.c', 32 'test_cycles.c', 33 'test_debug.c', 34 'test_distributor.c', 35 'test_distributor_perf.c', 36 'test_eal_flags.c', 37 'test_eal_fs.c', 38 'test_efd.c', 39 'test_efd_perf.c', 40 'test_errno.c', 41 'test_event_crypto_adapter.c', 42 'test_event_eth_rx_adapter.c', 43 'test_event_ring.c', 44 'test_event_timer_adapter.c', 45 'test_eventdev.c', 46 'test_external_mem.c', 47 'test_fbarray.c', 48 'test_fib.c', 49 'test_fib_perf.c', 50 'test_fib6.c', 51 'test_fib6_perf.c', 52 'test_func_reentrancy.c', 53 'test_flow_classify.c', 54 'test_hash.c', 55 'test_hash_functions.c', 56 'test_hash_multiwriter.c', 57 'test_hash_readwrite.c', 58 'test_hash_perf.c', 59 'test_hash_readwrite_lf_perf.c', 60 'test_interrupts.c', 61 'test_ipsec.c', 62 'test_ipsec_sad.c', 63 'test_kni.c', 64 'test_kvargs.c', 65 'test_link_bonding.c', 66 'test_link_bonding_rssconf.c', 67 'test_logs.c', 68 'test_lpm.c', 69 'test_lpm6.c', 70 'test_lpm6_perf.c', 71 'test_lpm_perf.c', 72 'test_malloc.c', 73 'test_mbuf.c', 74 'test_member.c', 75 'test_member_perf.c', 76 'test_memcpy.c', 77 'test_memcpy_perf.c', 78 'test_memory.c', 79 'test_mempool.c', 80 'test_mempool_perf.c', 81 'test_memzone.c', 82 'test_meter.c', 83 'test_metrics.c', 84 'test_mcslock.c', 85 'test_mp_secondary.c', 86 'test_per_lcore.c', 87 'test_pmd_perf.c', 88 'test_power.c', 89 'test_power_cpufreq.c', 90 'test_power_kvm_vm.c', 91 'test_prefetch.c', 92 'test_rand_perf.c', 93 'test_rawdev.c', 94 'test_rcu_qsbr.c', 95 'test_rcu_qsbr_perf.c', 96 'test_reciprocal_division.c', 97 'test_reciprocal_division_perf.c', 98 'test_red.c', 99 'test_reorder.c', 100 'test_rib.c', 101 'test_rib6.c', 102 'test_ring.c', 103 'test_ring_perf.c', 104 'test_rwlock.c', 105 'test_sched.c', 106 'test_service_cores.c', 107 'test_spinlock.c', 108 'test_stack.c', 109 'test_stack_perf.c', 110 'test_string_fns.c', 111 'test_table.c', 112 'test_table_acl.c', 113 'test_table_combined.c', 114 'test_table_pipeline.c', 115 'test_table_ports.c', 116 'test_table_tables.c', 117 'test_tailq.c', 118 'test_thash.c', 119 'test_timer.c', 120 'test_timer_perf.c', 121 'test_timer_racecond.c', 122 'test_timer_secondary.c', 123 'test_ticketlock.c', 124 'test_version.c', 125 'virtual_pmd.c' 126) 127 128test_deps = ['acl', 129 'bitratestats', 130 'bpf', 131 'cfgfile', 132 'cmdline', 133 'cryptodev', 134 'distributor', 135 'efd', 136 'ethdev', 137 'eventdev', 138 'fib', 139 'flow_classify', 140 'hash', 141 'ipsec', 142 'latencystats', 143 'lpm', 144 'member', 145 'metrics', 146 'pipeline', 147 'port', 148 'rawdev', 149 'rcu', 150 'reorder', 151 'rib', 152 'ring', 153 'stack', 154 'timer' 155] 156 157fast_test_names = [ 158 'acl_autotest', 159 'alarm_autotest', 160 'atomic_autotest', 161 'byteorder_autotest', 162 'cmdline_autotest', 163 'common_autotest', 164 'cpuflags_autotest', 165 'cycles_autotest', 166 'debug_autotest', 167 'eal_flags_c_opt_autotest', 168 'eal_flags_master_opt_autotest', 169 'eal_flags_n_opt_autotest', 170 'eal_flags_hpet_autotest', 171 'eal_flags_no_huge_autotest', 172 'eal_flags_w_opt_autotest', 173 'eal_flags_b_opt_autotest', 174 'eal_flags_vdev_opt_autotest', 175 'eal_flags_r_opt_autotest', 176 'eal_flags_mem_autotest', 177 'eal_flags_file_prefix_autotest', 178 'eal_flags_misc_autotest', 179 'eal_fs_autotest', 180 'errno_autotest', 181 'event_ring_autotest', 182 'fib_autotest', 183 'fib6_autotest', 184 'func_reentrancy_autotest', 185 'flow_classify_autotest', 186 'hash_autotest', 187 'interrupt_autotest', 188 'logs_autotest', 189 'lpm_autotest', 190 'lpm6_autotest', 191 'malloc_autotest', 192 'mbuf_autotest', 193 'mcslock_autotest', 194 'memcpy_autotest', 195 'memory_autotest', 196 'mempool_autotest', 197 'memzone_autotest', 198 'meter_autotest', 199 'multiprocess_autotest', 200 'per_lcore_autotest', 201 'prefetch_autotest', 202 'rcu_qsbr_autotest', 203 'red_autotest', 204 'rib_autotest', 205 'rib6_autotest', 206 'ring_autotest', 207 'rwlock_test1_autotest', 208 'rwlock_rda_autotest', 209 'rwlock_rds_wrm_autotest', 210 'rwlock_rde_wro_autotest', 211 'sched_autotest', 212 'spinlock_autotest', 213 'stack_autotest', 214 'stack_lf_autotest', 215 'string_autotest', 216 'table_autotest', 217 'tailq_autotest', 218 'timer_autotest', 219 'user_delay_us', 220 'version_autotest', 221 'crc_autotest', 222 'delay_us_sleep_autotest', 223 'distributor_autotest', 224 'eventdev_common_autotest', 225 'fbarray_autotest', 226 'hash_readwrite_func_autotest', 227 'ipsec_autotest', 228 'kni_autotest', 229 'kvargs_autotest', 230 'member_autotest', 231 'metrics_autotest', 232 'power_cpufreq_autotest', 233 'power_autotest', 234 'power_kvm_vm_autotest', 235 'reorder_autotest', 236 'service_autotest', 237 'thash_autotest', 238] 239 240perf_test_names = [ 241 'ring_perf_autotest', 242 'mempool_perf_autotest', 243 'memcpy_perf_autotest', 244 'hash_perf_autotest', 245 'timer_perf_autotest', 246 'reciprocal_division', 247 'reciprocal_division_perf', 248 'lpm_perf_autotest', 249 'rib_slow_autotest', 250 'fib_slow_autotest', 251 'fib_perf_autotest', 252 'red_all', 253 'barrier_autotest', 254 'hash_multiwriter_autotest', 255 'timer_racecond_autotest', 256 'efd_autotest', 257 'hash_functions_autotest', 258 'member_perf_autotest', 259 'efd_perf_autotest', 260 'lpm6_perf_autotest', 261 'rib6_slow_autotest', 262 'fib6_slow_autotest', 263 'fib6_perf_autotest', 264 'rcu_qsbr_perf_autotest', 265 'red_perf', 266 'distributor_perf_autotest', 267 'pmd_perf_autotest', 268 'stack_perf_autotest', 269 'stack_lf_perf_autotest', 270 'rand_perf_autotest', 271 'hash_readwrite_perf_autotest', 272 'hash_readwrite_lf_perf_autotest', 273] 274 275driver_test_names = [ 276 'cryptodev_aesni_mb_autotest', 277 'cryptodev_aesni_gcm_autotest', 278 'cryptodev_dpaa_sec_autotest', 279 'cryptodev_dpaa2_sec_autotest', 280 'cryptodev_null_autotest', 281 'cryptodev_octeontx2_autotest', 282 'cryptodev_openssl_autotest', 283 'cryptodev_openssl_asym_autotest', 284 'cryptodev_qat_autotest', 285 'cryptodev_sw_armv8_autotest', 286 'cryptodev_sw_kasumi_autotest', 287 'cryptodev_sw_mvsam_autotest', 288 'cryptodev_sw_snow3g_autotest', 289 'cryptodev_sw_zuc_autotest', 290 'eventdev_selftest_octeontx', 291 'eventdev_selftest_sw', 292 'link_bonding_autotest', 293 'link_bonding_rssconf_autotest', 294 'rawdev_autotest', 295] 296 297dump_test_names = [ 298 'dump_struct_sizes', 299 'dump_mempool', 300 'dump_malloc_stats', 301 'dump_devargs', 302 'dump_log_types', 303 'dump_ring', 304 'dump_physmem', 305 'dump_memzone', 306] 307 308# The following linkages are an exception to allow running the 309# unit tests without requiring that the developer install the 310# DPDK libraries. Explicit linkage of drivers (plugin libraries) 311# in applications should not be used. 312if dpdk_conf.has('RTE_LIBRTE_RING_MEMPOOL') 313 test_deps += 'mempool_ring' 314endif 315if dpdk_conf.has('RTE_LIBRTE_STACK_MEMPOOL') 316 test_deps += 'mempool_stack' 317endif 318if dpdk_conf.has('RTE_LIBRTE_SKELETON_EVENTDEV_PMD') 319 test_deps += 'pmd_skeleton_event' 320endif 321 322# The following linkages of drivers are required because 323# they are used via a driver-specific API. 324if dpdk_conf.has('RTE_LIBRTE_BOND_PMD') 325 test_deps += 'pmd_bond' 326endif 327if dpdk_conf.has('RTE_LIBRTE_RING_PMD') 328 test_deps += 'pmd_ring' 329 test_sources += 'test_pmd_ring_perf.c' 330 test_sources += 'test_pmd_ring.c' 331 test_sources += 'test_event_eth_tx_adapter.c' 332 test_sources += 'test_bitratestats.c' 333 test_sources += 'test_latencystats.c' 334 test_sources += 'test_link_bonding_mode4.c' 335 test_sources += 'sample_packet_forward.c' 336 test_sources += 'test_pdump.c' 337 fast_test_names += 'ring_pmd_autotest' 338 perf_test_names += 'ring_pmd_perf_autotest' 339 fast_test_names += 'event_eth_tx_adapter_autotest' 340 fast_test_names += 'bitratestats_autotest' 341 fast_test_names += 'latencystats_autotest' 342 driver_test_names += 'link_bonding_mode4_autotest' 343 fast_test_names += 'pdump_autotest' 344endif 345 346if dpdk_conf.has('RTE_LIBRTE_POWER') 347 test_deps += 'power' 348endif 349if dpdk_conf.has('RTE_LIBRTE_KNI') 350 test_deps += 'kni' 351endif 352if dpdk_conf.has('RTE_LIBRTE_PDUMP') 353 test_deps += 'pdump' 354endif 355 356cflags = machine_args 357if cc.has_argument('-Wno-format-truncation') 358 cflags += '-Wno-format-truncation' 359endif 360 361# specify -D_GNU_SOURCE unconditionally 362cflags += '-D_GNU_SOURCE' 363 364test_dep_objs = [] 365if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV') 366 compress_test_dep = dependency('zlib', required: false) 367 if compress_test_dep.found() 368 test_dep_objs += compress_test_dep 369 test_sources += 'test_compressdev.c' 370 test_deps += 'compressdev' 371 fast_test_names += 'compressdev_autotest' 372 endif 373endif 374 375if dpdk_conf.has('RTE_LIBRTE_PMD_CRYPTO_SCHEDULER') 376 driver_test_names += 'cryptodev_scheduler_autotest' 377endif 378 379foreach d:test_deps 380 def_lib = get_option('default_library') 381 test_dep_objs += get_variable(def_lib + '_rte_' + d) 382endforeach 383test_dep_objs += cc.find_library('execinfo', required: false) 384 385link_libs = [] 386if get_option('default_library') == 'static' 387 link_libs = dpdk_drivers 388endif 389 390dpdk_test = executable('dpdk-test', 391 test_sources, 392 link_whole: link_libs, 393 dependencies: test_dep_objs, 394 c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], 395 install_rpath: driver_install_path, 396 install: true) 397 398# some perf tests (eg: memcpy perf autotest)take very long 399# to complete, so timeout to 10 minutes 400timeout_seconds = 600 401timeout_seconds_fast = 10 402 403get_coremask = find_program('get-coremask.sh') 404num_cores_arg = '-l ' + run_command(get_coremask).stdout().strip() 405 406test_args = [num_cores_arg] 407 408foreach arg : fast_test_names 409 if (get_option('default_library') == 'shared' and 410 arg == 'event_eth_tx_adapter_autotest') 411 foreach drv:dpdk_drivers 412 test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] 413 endforeach 414 endif 415 if host_machine.system() == 'linux' 416 test(arg, dpdk_test, 417 env : ['DPDK_TEST=' + arg], 418 args : test_args + 419 ['--file-prefix=@0@'.format(arg)], 420 timeout : timeout_seconds_fast, 421 is_parallel : false, 422 suite : 'fast-tests') 423 else 424 test(arg, dpdk_test, 425 env : ['DPDK_TEST=' + arg], 426 args : test_args, 427 timeout : timeout_seconds_fast, 428 is_parallel : false, 429 suite : 'fast-tests') 430 endif 431endforeach 432 433foreach arg : perf_test_names 434 test(arg, dpdk_test, 435 env : ['DPDK_TEST=' + arg], 436 args : test_args, 437 timeout : timeout_seconds, 438 is_parallel : false, 439 suite : 'perf-tests') 440endforeach 441 442foreach arg : driver_test_names 443 test(arg, dpdk_test, 444 env : ['DPDK_TEST=' + arg], 445 args : test_args, 446 timeout : timeout_seconds, 447 is_parallel : false, 448 suite : 'driver-tests') 449endforeach 450 451foreach arg : dump_test_names 452 test(arg, dpdk_test, 453 env : ['DPDK_TEST=' + arg], 454 args : test_args, 455 timeout : timeout_seconds, 456 is_parallel : false, 457 suite : 'debug-tests') 458endforeach 459