xref: /dpdk/app/test/suites/meson.build (revision 06e2856620a70000b2a28f0ea715fc247b85fd8d)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2023 Intel Corporation
3
4# some perf tests (eg: memcpy perf autotest) take a very long
5# to complete, so timeout to 10 minutes
6timeout_seconds = 600
7timeout_seconds_fast = 10
8timeout_seconds_stress = 900
9
10test_no_huge_args = ['--no-huge', '-m', '2048']
11has_hugepage = run_command(has_hugepages_cmd, check: true).stdout().strip() != '0'
12message('hugepage availability: @0@'.format(has_hugepage))
13if not has_hugepage
14    if arch_subdir == 'ppc'
15        # On ppc64, without huge pages, PA would be the default but fails like:
16        # EAL: Cannot use IOVA as 'PA' since physical addresses are not available
17        test_no_huge_args += '--iova-mode=va'
18    endif
19endif
20
21# process source files to determine the different unit test suites
22# - fast_tests
23# - perf_tests
24# - driver_tests
25# - stress_tests
26test_suites = run_command(get_test_suites_cmd, autotest_sources,
27         check: true).stdout().strip().split()
28foreach suite:test_suites
29    # simple cases - tests without parameters or special handling
30    suite = suite.split('=')
31    suite_name = suite[0]
32    suite_tests = suite[1].split(',')
33    if suite_name == 'non_suite_tests'
34        # tests not in any suite
35        foreach t: suite_tests
36            if developer_mode
37                warning('Test "@0@" is not defined in any test suite'.format(t))
38            endif
39            test(t, dpdk_test,
40                    env: ['DPDK_TEST=' + t],
41                    timeout: timeout_seconds,
42                    is_parallel: false)
43        endforeach
44    elif suite_name == 'stress-tests'
45        foreach t: suite_tests
46            test(t, dpdk_test,
47                    env: ['DPDK_TEST=' + t],
48                    timeout: timeout_seconds_stress,
49                    is_parallel: false,
50                    suite: suite_name)
51        endforeach
52    elif suite_name != 'fast-tests'
53        # simple cases - tests without parameters or special handling
54        foreach t: suite_tests
55            test(t, dpdk_test,
56                    env: ['DPDK_TEST=' + t],
57                    timeout: timeout_seconds,
58                    is_parallel: false,
59                    suite: suite_name)
60        endforeach
61    else
62        # special fast-test handling here
63        foreach t: suite_tests
64            params = t.split(':')
65            test_name = params[0]
66            nohuge = params[1] == 'true'
67            asan = params[2] == 'true'
68
69            test_args = []
70            if nohuge
71                test_args += test_no_huge_args
72            elif not has_hugepage
73                continue  #skip this tests
74            endif
75            if not asan and (get_option('b_sanitize') == 'address'
76                    or get_option('b_sanitize') == 'address,undefined')
77                continue  # skip this test
78            endif
79
80            if get_option('default_library') == 'shared'
81                test_args += ['-d', dpdk_drivers_build_dir]
82            endif
83
84            test(test_name, dpdk_test,
85                args : test_args,
86                env: ['DPDK_TEST=' + test_name],
87                timeout : timeout_seconds_fast,
88                is_parallel : false,
89                suite : 'fast-tests')
90            if not is_windows and test_name == 'trace_autotest'
91                test_args += ['--trace=.*']
92                test_args += ['--trace-dir=@0@'.format(meson.current_build_dir())]
93                test(test_name + '_with_traces', dpdk_test,
94                    args : test_args,
95                    env: ['DPDK_TEST=' + test_name],
96                    timeout : timeout_seconds_fast,
97                    is_parallel : false,
98                    suite : 'fast-tests')
99            endif
100        endforeach
101    endif
102endforeach
103
104# standalone test for telemetry
105if not is_windows and dpdk_conf.has('RTE_LIB_TELEMETRY')
106    test_args = [dpdk_test]
107    test_args += test_no_huge_args
108    if get_option('default_library') == 'shared'
109        test_args += ['-d', dpdk_drivers_build_dir]
110    endif
111    if dpdk_conf.has('RTE_CRYPTO_NULL')
112        test_args += ['--vdev=crypto_null0']
113    endif
114    if dpdk_conf.has('RTE_DMA_SKELETON')
115        test_args += ['--vdev=dma_skeleton0']
116    endif
117    if dpdk_conf.has('RTE_EVENT_SKELETON')
118        test_args += ['--vdev=event_skeleton0']
119    endif
120    if dpdk_conf.has('RTE_NET_NULL')
121        test_args += ['--vdev=net_null0']
122    endif
123    if dpdk_conf.has('RTE_RAW_SKELETON')
124        test_args += ['--vdev=rawdev_skeleton0']
125    endif
126    test_args += ['-a', '0000:00:00.0']
127    test('telemetry_all', find_program('test_telemetry.sh'),
128            args: test_args,
129            timeout : timeout_seconds_fast,
130            is_parallel : false,
131            suite : 'fast-tests')
132endif
133
134# dump tests are defined in commands.c, and not easily extractable
135dump_test_names = [
136        'dump_devargs',
137        'dump_log_types',
138        'dump_malloc_heaps',
139        'dump_malloc_stats',
140        'dump_mempool',
141        'dump_memzone',
142        'dump_physmem',
143        'dump_ring',
144        'dump_struct_sizes',
145]
146foreach arg : dump_test_names
147    test(arg, dpdk_test,
148                env : ['DPDK_TEST=' + arg],
149                timeout : timeout_seconds_fast,
150                is_parallel : false,
151                suite : 'debug-tests')
152endforeach
153