| 1 | |
| 2 | testblock = declare_dependency(dependencies: [block], sources: 'iothread.c') |
| 3 | |
| 4 | tests = { |
| 5 | 'check-block-qdict': [], |
| 6 | 'check-qdict': [], |
| 7 | 'check-qnum': [], |
| 8 | 'check-qstring': [], |
| 9 | 'check-qlist': [], |
| 10 | 'check-qnull': [], |
| 11 | 'check-qobject': [], |
| 12 | 'check-qjson': [], |
| 13 | 'check-json-parser': [], |
| 14 | 'check-qlit': [], |
| 15 | 'test-error-report': [], |
| 16 | 'test-qobject-output-visitor': [testqapi], |
| 17 | 'test-clone-visitor': [testqapi], |
| 18 | 'test-qobject-input-visitor': [testqapi], |
| 19 | 'test-forward-visitor': [testqapi], |
| 20 | 'test-string-input-visitor': [testqapi], |
| 21 | 'test-string-output-visitor': [testqapi], |
| 22 | 'test-visitor-serialization': [testqapi], |
| 23 | 'test-bitmap': [], |
| 24 | 'test-resv-mem': [], |
| 25 | # all code tested by test-x86-topo is inside topology.h |
| 26 | 'test-x86-topo': [], |
| 27 | 'test-cutils': [], |
| 28 | 'test-div128': [], |
| 29 | 'test-shift128': [], |
| 30 | 'test-mul64': [], |
| 31 | # all code tested by test-int128 is inside int128.h |
| 32 | 'test-int128': [], |
| 33 | 'rcutorture': [], |
| 34 | 'test-rcu-list': [], |
| 35 | 'test-rcu-simpleq': [], |
| 36 | 'test-rcu-tailq': [], |
| 37 | 'test-rcu-slist': [], |
| 38 | 'test-qdist': [], |
| 39 | 'test-qht': [], |
| 40 | 'test-qtree': [], |
| 41 | 'test-bitops': [], |
| 42 | 'test-bitcnt': [], |
| 43 | 'test-qgraph': ['../qtest/libqos/qgraph.c'], |
| 44 | 'check-qom-interface': [qom], |
| 45 | 'check-qom-proplist': [qom], |
| 46 | 'test-qemu-opts': [], |
| 47 | 'test-keyval': [testqapi], |
| 48 | 'test-logging': [], |
| 49 | 'test-qapi-util': [], |
| 50 | 'test-interval-tree': [], |
| 51 | 'test-fifo': [], |
| 52 | 'test-envlist': [], |
| 53 | } |
| 54 | |
| 55 | if have_system or have_tools |
| 56 | tests += { |
| 57 | 'test-qmp-event': [testqapi], |
| 58 | } |
| 59 | |
| 60 | if seccomp.found() |
| 61 | tests += {'test-seccomp': ['../../system/qemu-seccomp.c', seccomp]} |
| 62 | endif |
| 63 | endif |
| 64 | |
| 65 | if have_block |
| 66 | tests += { |
| 67 | 'test-coroutine': [testblock], |
| 68 | 'test-aio': [testblock], |
| 69 | 'test-aio-multithread': [testblock], |
| 70 | 'test-throttle': [testblock], |
| 71 | 'test-thread-pool': [testblock], |
| 72 | 'test-hbitmap': [testblock], |
| 73 | 'test-bdrv-drain': [testblock], |
| 74 | 'test-bdrv-graph-mod': [testblock], |
| 75 | 'test-blockjob': [testblock], |
| 76 | 'test-blockjob-txn': [testblock], |
| 77 | 'test-block-backend': [testblock], |
| 78 | 'test-block-accounting': [testblock], |
| 79 | 'test-block-iothread': [testblock], |
| 80 | 'test-write-threshold': [testblock], |
| 81 | 'test-crypto-hash': [crypto], |
| 82 | 'test-crypto-hmac': [crypto], |
| 83 | 'test-crypto-cipher': [crypto], |
| 84 | 'test-crypto-akcipher': [crypto], |
| 85 | 'test-crypto-secret': [crypto, keyutils], |
| 86 | 'test-crypto-der': [crypto], |
| 87 | 'test-authz-simple': [authz], |
| 88 | 'test-authz-list': [authz], |
| 89 | 'test-authz-listfile': [authz], |
| 90 | 'test-io-task': [testblock], |
| 91 | 'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io], |
| 92 | 'test-io-channel-file': ['io-channel-helpers.c', io], |
| 93 | 'test-io-channel-command': ['io-channel-helpers.c', io], |
| 94 | 'test-io-channel-buffer': ['io-channel-helpers.c', io], |
| 95 | 'test-io-channel-null': [io], |
| 96 | 'test-crypto-ivgen': [io], |
| 97 | 'test-crypto-afsplit': [io], |
| 98 | 'test-crypto-block': [io], |
| 99 | 'test-timed-average': [], |
| 100 | 'test-uuid': [], |
| 101 | } |
| 102 | if gnutls.found() and \ |
| 103 | tasn1.found() and \ |
| 104 | host_os != 'windows' |
| 105 | tests += { |
| 106 | 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', |
| 107 | tasn1, crypto, gnutls], |
| 108 | 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'crypto-tls-psk-helpers.c', |
| 109 | tasn1, crypto, gnutls], |
| 110 | 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', |
| 111 | tasn1, io, crypto, gnutls]} |
| 112 | endif |
| 113 | if pam.found() |
| 114 | tests += {'test-authz-pam': [authz]} |
| 115 | endif |
| 116 | if host_os != 'windows' |
| 117 | tests += { |
| 118 | 'test-image-locking': [testblock], |
| 119 | 'test-nested-aio-poll': [], |
| 120 | } |
| 121 | endif |
| 122 | if config_host_data.get('CONFIG_REPLICATION') |
| 123 | tests += {'test-replication': [testblock]} |
| 124 | endif |
| 125 | tests += {'test-crypto-pbkdf': [io]} |
| 126 | endif |
| 127 | |
| 128 | if have_system |
| 129 | tests += { |
| 130 | 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], |
| 131 | 'test-iov': [], |
| 132 | 'test-opts-visitor': [testqapi], |
| 133 | 'test-xs-node': [qom], |
| 134 | 'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'], |
| 135 | 'test-qmp-cmds': [testqapi], |
| 136 | 'test-xbzrle': [migration], |
| 137 | 'test-util-sockets': ['socket-helpers.c'], |
| 138 | 'test-base64': [], |
| 139 | 'test-bufferiszero': [], |
| 140 | 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], |
| 141 | 'test-vmstate': [migration, io], |
| 142 | 'test-yank': ['socket-helpers.c', qom, io, chardev], |
| 143 | 'test-ram-discard-manager': [ |
| 144 | 'test-ram-discard-manager.c', |
| 145 | 'test-ram-discard-manager-stubs.c', |
| 146 | meson.project_source_root() / 'system/ram-discard-manager.c', |
| 147 | genh, qemuutil, qom |
| 148 | ], |
| 149 | } |
| 150 | if config_host_data.get('CONFIG_INOTIFY1') |
| 151 | tests += {'test-util-filemonitor': []} |
| 152 | endif |
| 153 | |
| 154 | # Some tests: test-char, test-qdev-global-props, and test-qga, |
| 155 | # are not runnable under TSan due to a known issue. |
| 156 | # https://github.com/google/sanitizers/issues/1116 |
| 157 | if not get_option('tsan') |
| 158 | if host_os != 'windows' |
| 159 | tests += { |
| 160 | 'test-char': ['socket-helpers.c', qom, io, chardev] |
| 161 | } |
| 162 | endif |
| 163 | |
| 164 | tests += { |
| 165 | 'test-qdev-global-props': [qom, hwcore] |
| 166 | } |
| 167 | endif |
| 168 | tests += {'test-qdev': [qom, hwcore]} |
| 169 | endif |
| 170 | |
| 171 | if have_ga and host_os == 'linux' |
| 172 | tests += {'test-qga': ['../qtest/libqmp.c', '../qtest/libqtest.c']} |
| 173 | test_deps += {'test-qga': qga} |
| 174 | endif |
| 175 | |
| 176 | test_env = environment() |
| 177 | test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) |
| 178 | test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) |
| 179 | |
| 180 | slow_tests = { |
| 181 | 'test-aio-multithread' : 120, |
| 182 | 'test-bufferiszero': 60, |
| 183 | 'test-crypto-block' : 300, |
| 184 | 'test-crypto-tlscredsx509': 90, |
| 185 | 'test-crypto-tlssession': 90, |
| 186 | 'test-replication': 60, |
| 187 | 'rcutorture': 30, |
| 188 | 'test-rcu-list': 30, |
| 189 | 'test-rcu-simpleq': 30, |
| 190 | 'test-rcu-tailq': 30, |
| 191 | 'test-rcu-slist': 30, |
| 192 | 'test-thread-pool': 30, |
| 193 | } |
| 194 | |
| 195 | foreach test_name, extra: tests |
| 196 | src = [test_name + '.c'] |
| 197 | deps = [qemuutil] |
| 198 | if extra.length() > 0 |
| 199 | # use a sourceset to quickly separate sources and deps |
| 200 | test_ss = ss.source_set() |
| 201 | test_ss.add(extra) |
| 202 | src += test_ss.all_sources() |
| 203 | deps += test_ss.all_dependencies() |
| 204 | endif |
| 205 | exe = executable(test_name, src, genh, dependencies: deps) |
| 206 | |
| 207 | test(test_name, exe, |
| 208 | depends: test_deps.get(test_name, []), |
| 209 | env: test_env, |
| 210 | args: ['--tap', '-k'], |
| 211 | protocol: 'tap', |
| 212 | timeout: slow_tests.get(test_name, 30), |
| 213 | priority: slow_tests.get(test_name, 30), |
| 214 | suite: ['unit'] + |
| 215 | (slow_tests.has_key(test_name) ? ['slow'] : [])) |
| 216 | endforeach |