xref: /openbmc/qemu/tests/qemu-iotests/meson.build (revision 9febfa94b69b7146582c48a868bd2330ac45037f)
1if not have_tools or host_os == 'windows'
2  subdir_done()
3endif
4
5bash = find_program('bash', required: false, version: '>= 4.0')
6if not bash.found()
7  message('bash >= v4.0 not available ==> Disabled the qemu-iotests.')
8  subdir_done()
9endif
10
11qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd]
12qemu_iotests_env = {'PYTHON': python.full_path()}
13qemu_iotests_formats = {
14  'qcow2': 'quick',
15  'raw': 'slow',
16  'parallels': 'thorough',
17  'qed': 'thorough',
18  'vdi': 'thorough',
19  'vhdx': 'thorough',
20  'vmdk': 'thorough',
21  'vpc': 'thorough'
22}
23
24foreach k, v : emulators
25  if k.startswith('qemu-system-')
26    qemu_iotests_binaries += v
27  endif
28endforeach
29
30qemu_iotests_check_cmd = files('check')
31
32foreach format, speed: qemu_iotests_formats
33  if speed == 'quick'
34    suites = 'block'
35  else
36    suites = ['block-' + speed, speed]
37  endif
38
39  args = ['-tap', '-' + format]
40  if speed == 'quick'
41      args += ['-g', 'auto']
42  endif
43
44  rc = run_command(
45      [python, qemu_iotests_check_cmd] + args + ['-n'],
46      check: true,
47  )
48
49  foreach item: rc.stdout().strip().split()
50      args = [qemu_iotests_check_cmd,
51              '-tap', '-' + format, item,
52              '--source-dir', meson.current_source_dir(),
53              '--build-dir', meson.current_build_dir()]
54      # Some individual tests take as long as 45 seconds
55      # Bump the timeout to 3 minutes for some headroom
56      # on slow machines to minimize spurious failures
57      test('io-' + format + '-' + item,
58           python,
59           args: args,
60           depends: qemu_iotests_binaries,
61           env: qemu_iotests_env,
62           protocol: 'tap',
63           timeout: 180,
64           suite: suites)
65  endforeach
66endforeach
67