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