xref: /openbmc/qemu/tests/qemu-iotests/meson.build (revision a0bc5997)
1*a0bc5997SRichard Hendersonif not have_tools or targetos == 'windows'
2f1f8af23SThomas Huth  subdir_done()
3f1f8af23SThomas Huthendif
4f1f8af23SThomas Huth
534f983d8SPaolo Bonziniforeach cflag: qemu_ldflags
62cf6a4e3SThomas Huth  if cflag.startswith('-fsanitize') and \
72cf6a4e3SThomas Huth     not cflag.contains('safe-stack') and not cflag.contains('cfi-icall')
82cf6a4e3SThomas Huth    message('Sanitizers are enabled ==> Disabled the qemu-iotests.')
92cf6a4e3SThomas Huth    subdir_done()
102cf6a4e3SThomas Huth  endif
112cf6a4e3SThomas Huthendforeach
122cf6a4e3SThomas Huth
132cf6a4e3SThomas Huthbash = find_program('bash', required: false, version: '>= 4.0')
142cf6a4e3SThomas Huthif not bash.found()
152cf6a4e3SThomas Huth  message('bash >= v4.0 not available ==> Disabled the qemu-iotests.')
162cf6a4e3SThomas Huth  subdir_done()
172cf6a4e3SThomas Huthendif
182cf6a4e3SThomas Huth
1998487b90SPaolo Bonziniqemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd]
2098487b90SPaolo Bonziniqemu_iotests_env = {'PYTHON': python.full_path()}
2198487b90SPaolo Bonziniqemu_iotests_formats = {
2298487b90SPaolo Bonzini  'qcow2': 'quick',
2398487b90SPaolo Bonzini  'raw': 'slow',
2498487b90SPaolo Bonzini  'qed': 'thorough',
2598487b90SPaolo Bonzini  'vmdk': 'thorough',
2698487b90SPaolo Bonzini  'vpc': 'thorough'
2798487b90SPaolo Bonzini}
2898487b90SPaolo Bonzini
2998487b90SPaolo Bonziniforeach k, v : emulators
3098487b90SPaolo Bonzini  if k.startswith('qemu-system-')
3198487b90SPaolo Bonzini    qemu_iotests_binaries += v
3298487b90SPaolo Bonzini  endif
3398487b90SPaolo Bonziniendforeach
34f1f8af23SThomas Huth
3551ab5f8bSDaniel P. Berrangéqemu_iotests_check_cmd = files('check')
3651ab5f8bSDaniel P. Berrangé
3798487b90SPaolo Bonziniforeach format, speed: qemu_iotests_formats
3898487b90SPaolo Bonzini  if speed == 'quick'
3998487b90SPaolo Bonzini    suites = 'block'
4098487b90SPaolo Bonzini  else
4198487b90SPaolo Bonzini    suites = ['block-' + speed, speed]
4298487b90SPaolo Bonzini  endif
4351ab5f8bSDaniel P. Berrangé
4451ab5f8bSDaniel P. Berrangé  args = ['-tap', '-' + format]
4551ab5f8bSDaniel P. Berrangé  if speed == 'quick'
4651ab5f8bSDaniel P. Berrangé      args += ['-g', 'auto']
4751ab5f8bSDaniel P. Berrangé  endif
4851ab5f8bSDaniel P. Berrangé
4951ab5f8bSDaniel P. Berrangé  rc = run_command(
5090834f5dSDaniel P. Berrangé      [python, qemu_iotests_check_cmd] + args + ['-n'],
5151ab5f8bSDaniel P. Berrangé      check: true,
5251ab5f8bSDaniel P. Berrangé  )
5351ab5f8bSDaniel P. Berrangé
5451ab5f8bSDaniel P. Berrangé  foreach item: rc.stdout().strip().split()
5590834f5dSDaniel P. Berrangé      args = [qemu_iotests_check_cmd,
5690834f5dSDaniel P. Berrangé              '-tap', '-' + format, item,
5751ab5f8bSDaniel P. Berrangé              '--source-dir', meson.current_source_dir(),
5851ab5f8bSDaniel P. Berrangé              '--build-dir', meson.current_build_dir()]
5951ab5f8bSDaniel P. Berrangé      # Some individual tests take as long as 45 seconds
6051ab5f8bSDaniel P. Berrangé      # Bump the timeout to 3 minutes for some headroom
6151ab5f8bSDaniel P. Berrangé      # on slow machines to minimize spurious failures
6251ab5f8bSDaniel P. Berrangé      test('io-' + format + '-' + item,
6390834f5dSDaniel P. Berrangé           python,
6451ab5f8bSDaniel P. Berrangé           args: args,
6551ab5f8bSDaniel P. Berrangé           depends: qemu_iotests_binaries,
6651ab5f8bSDaniel P. Berrangé           env: qemu_iotests_env,
67d316859fSPaolo Bonzini           protocol: 'tap',
6851ab5f8bSDaniel P. Berrangé           timeout: 180,
6951ab5f8bSDaniel P. Berrangé           suite: suites)
7051ab5f8bSDaniel P. Berrangé  endforeach
7198487b90SPaolo Bonziniendforeach
72