aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/meson.build
blob: 8d5520349dd638c8a234e66e143f2a2775f8b088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# QEMU functional tests:
# Tests that are put in the 'quick' category are run by default during
# 'make check'. Everything that should not be run during 'make check'
# (e.g. tests that fetch assets from the internet) should be put into
# the 'thorough' category instead.

# Most tests run too slow with TCI enabled, so skip the functional tests there
if get_option('tcg_interpreter')
  subdir_done()
endif

# Timeouts for individual tests that can be slow e.g. with debugging enabled
test_timeouts = {
  'aarch64_sbsaref' : 600,
  'aarch64_virt' : 360,
  'acpi_bits' : 240,
  'netdev_ethtool' : 180,
  'ppc_40p' : 240,
  'ppc64_hv' : 1000,
  'ppc64_powernv' : 120,
  'ppc64_pseries' : 120,
  's390x_ccw_virtio' : 180,
}

tests_generic_system = [
  'empty_cpu_model',
  'info_usernet',
  'version',
]

tests_generic_linuxuser = [
]

tests_generic_bsduser = [
]

tests_aarch64_system_thorough = [
  'aarch64_raspi3',
  'aarch64_raspi4',
  'aarch64_sbsaref',
  'aarch64_virt',
  'multiprocess',
]

tests_alpha_system_thorough = [
  'alpha_clipper',
]

tests_arm_system_thorough = [
  'arm_canona1100',
  'arm_integratorcp',
  'arm_raspi2',
]

tests_arm_linuxuser_thorough = [
  'arm_bflt',
]

tests_avr_system_thorough = [
  'avr_mega2560',
]

tests_loongarch64_system_thorough = [
  'loongarch64_virt',
]

tests_m68k_system_thorough = [
  'm68k_mcf5208evb',
  'm68k_nextcube',
  'm68k_q800',
]

tests_microblaze_system_thorough = [
  'microblaze_s3adsp1800'
]

tests_microblazeel_system_thorough = [
  'microblazeel_s3adsp1800'
]

tests_mips_system_thorough = [
  'mips_malta',
]

tests_mipsel_system_thorough = [
  'mipsel_malta',
]

tests_mips64el_system_thorough = [
  'mips64el_fuloong2e',
  'mips64el_loongson3v',
  'mips64el_malta',
]

tests_or1k_system_quick = [
  'or1k_sim',
]

tests_ppc_system_quick = [
  'ppc_74xx',
]

tests_ppc_system_thorough = [
  'ppc_405',
  'ppc_40p',
  'ppc_amiga',
  'ppc_bamboo',
  'ppc_mpc8544ds',
  'ppc_virtex_ml507',
]

tests_ppc64_system_thorough = [
  'ppc64_hv',
  'ppc64_powernv',
  'ppc64_pseries',
]

tests_rx_system_thorough = [
  'rx_gdbsim',
]

tests_s390x_system_thorough = [
  's390x_ccw_virtio',
  's390x_topology',
]

tests_sparc64_system_thorough = [
  'sparc64_sun4u',
]

tests_x86_64_system_quick = [
  'cpu_queries',
  'mem_addr_space',
  'pc_cpu_hotplug_props',
  'virtio_version',
  'x86_cpu_model_versions',
]

tests_x86_64_system_thorough = [
  'acpi_bits',
  'linux_initrd',
  'multiprocess',
  'netdev_ethtool',
  'virtio_gpu',
]

precache_all = []
foreach speed : ['quick', 'thorough']
  foreach dir : target_dirs

    target_base = dir.split('-')[0]

    if dir.endswith('-softmmu')
      sysmode = 'system'
      test_emulator = emulators['qemu-system-' + target_base]
    elif dir.endswith('-linux-user')
      sysmode = 'linuxuser'
      test_emulator = emulators['qemu-' + target_base]
    elif dir.endswith('-bsd-user')
      sysmode = 'bsduser'
      test_emulator = emulators['qemu-' + target_base]
    else
      continue
    endif

    if speed == 'quick'
      suites = ['func-quick', 'func-' + target_base]
      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
                     + get_variable('tests_generic_' + sysmode)
    else
      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
    endif

    test_deps = roms
    test_env = environment()
    if have_tools
      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
      test_deps += [qemu_img]
    endif
    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
                               meson.current_source_dir())

    foreach test : target_tests
      testname = '@0@-@1@'.format(target_base, test)
      testfile = 'test_' + test + '.py'
      testpath = meson.current_source_dir() / testfile
      teststamp = testname + '.tstamp'
      test_precache_env = environment()
      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
                                          meson.current_source_dir())
      precache = custom_target('func-precache-' + testname,
                               output: teststamp,
                               command: [python, testpath],
                               depend_files: files(testpath),
                               build_by_default: false,
                               env: test_precache_env)
      precache_all += precache

      # Ideally we would add 'precache' to 'depends' here, such that
      # 'build_by_default: false' lets the pre-caching automatically
      # run immediately before the test runs. In practice this is
      # broken in meson, with it running the pre-caching in the normal
      # compile phase https://github.com/mesonbuild/meson/issues/2518
      # If the above bug ever gets fixed, when QEMU changes the min
      # meson version, add the 'depends' and remove the custom
      # 'run_target' logic below & in Makefile.include
      test('func-' + testname,
           python,
           depends: [test_deps, test_emulator, emulator_modules],
           env: test_env,
           args: [testpath],
           protocol: 'tap',
           timeout: test_timeouts.get(test, 60),
           priority: test_timeouts.get(test, 60),
           suite: suites)
    endforeach
  endforeach
endforeach

run_target('precache-functional',
           depends: precache_all,
           command: ['true'])