| 1 | if not have_tools or host_os == 'windows' |
| 2 | subdir_done() |
| 3 | endif |
| 4 | |
| 5 | bash = find_program('bash', required: false, version: '>= 4.0') |
| 6 | if not bash.found() |
| 7 | message('bash >= v4.0 not available ==> Disabled the qemu-iotests.') |
| 8 | subdir_done() |
| 9 | endif |
| 10 | |
| 11 | qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd] |
| 12 | qemu_iotests_env = {'PYTHON': python.full_path()} |
| 13 | # If altering this definition, also update docs/devel/testing/main.rst |
| 14 | # section on 'check-block' targets to reflect the changes |
| 15 | qemu_iotests_drivers = { |
| 16 | 'qcow2': 'quick', |
| 17 | 'raw': 'slow', |
| 18 | 'luks': 'thorough', |
| 19 | 'nbd': 'thorough', |
| 20 | 'parallels': 'thorough', |
| 21 | 'qed': 'thorough', |
| 22 | 'vdi': 'thorough', |
| 23 | 'vhdx': 'thorough', |
| 24 | 'vmdk': 'thorough', |
| 25 | 'vpc': 'thorough', |
| 26 | } |
| 27 | |
| 28 | foreach k, v : emulators |
| 29 | if k.startswith('qemu-system-') |
| 30 | qemu_iotests_binaries += v |
| 31 | endif |
| 32 | endforeach |
| 33 | |
| 34 | qemu_iotests_check_cmd = files('check') |
| 35 | |
| 36 | foreach driver, speed: qemu_iotests_drivers |
| 37 | # Drivers tagged 'quick' get the subset of tests in the 'auto' |
| 38 | # group, run by default with 'make check' / 'make check-block' |
| 39 | seen = [] |
| 40 | if speed == 'quick' |
| 41 | args = ['-tap', '-' + driver, '-g', 'auto'] |
| 42 | suites = ['block'] |
| 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 | seen += item |
| 51 | args = [qemu_iotests_check_cmd, |
| 52 | '-tap', '-' + driver, item, |
| 53 | '--source-dir', meson.current_source_dir(), |
| 54 | '--build-dir', meson.current_build_dir()] |
| 55 | # Some individual tests take as long as 3 minutes |
| 56 | # in high load scenarios. Bump the timeout to 5 |
| 57 | # minutes for some headroom on slow / loaded |
| 58 | # machines to minimize spurious failures |
| 59 | test('io-' + driver + '-' + item, |
| 60 | python, |
| 61 | args: args, |
| 62 | depends: qemu_iotests_binaries, |
| 63 | env: qemu_iotests_env, |
| 64 | protocol: 'tap', |
| 65 | timeout: 300, |
| 66 | suite: suites) |
| 67 | endforeach |
| 68 | endif |
| 69 | |
| 70 | # Every driver gets put in the driver specific suite |
| 71 | suites = ['block-' + driver + '-optional'] |
| 72 | # Any driver tagged quick or slow also gets added to slow |
| 73 | # otherwise its tagged thorough |
| 74 | if speed != 'thorough' |
| 75 | suites += ['block-slow'] |
| 76 | else |
| 77 | suites += ['block-thorough'] |
| 78 | endif |
| 79 | |
| 80 | args = ['-tap', '-' + driver] |
| 81 | |
| 82 | rc = run_command( |
| 83 | [python, qemu_iotests_check_cmd] + args + ['-n'], |
| 84 | check: true, |
| 85 | ) |
| 86 | |
| 87 | foreach item: rc.stdout().strip().split() |
| 88 | # Skip any tests already added from the 'auto' group |
| 89 | # as they're run in the 'quick' suite already |
| 90 | if item in seen |
| 91 | continue |
| 92 | endif |
| 93 | |
| 94 | args = [qemu_iotests_check_cmd, |
| 95 | '-tap', '-' + driver, item, |
| 96 | '--source-dir', meson.current_source_dir(), |
| 97 | '--build-dir', meson.current_build_dir()] |
| 98 | # See earlier note about timeouts |
| 99 | test('io-' + driver + '-' + item, |
| 100 | python, |
| 101 | args: args, |
| 102 | depends: qemu_iotests_binaries, |
| 103 | env: qemu_iotests_env, |
| 104 | protocol: 'tap', |
| 105 | timeout: 300, |
| 106 | suite: suites) |
| 107 | endforeach |
| 108 | endforeach |