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