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-opts-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-uuid': [], 50 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], 51 'test-qapi-util': [], 52 'test-interval-tree': [], 53 'test-xs-node': [qom], 54 'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'], 55} 56 57if have_system or have_tools 58 tests += { 59 'test-qmp-event': [testqapi], 60 } 61 62 if seccomp.found() 63 tests += {'test-seccomp': ['../../system/qemu-seccomp.c', seccomp]} 64 endif 65endif 66 67if have_block 68 tests += { 69 'test-coroutine': [testblock], 70 'test-aio': [testblock], 71 'test-aio-multithread': [testblock], 72 'test-throttle': [testblock], 73 'test-thread-pool': [testblock], 74 'test-hbitmap': [testblock], 75 'test-bdrv-drain': [testblock], 76 'test-bdrv-graph-mod': [testblock], 77 'test-blockjob': [testblock], 78 'test-blockjob-txn': [testblock], 79 'test-block-backend': [testblock], 80 'test-block-iothread': [testblock], 81 'test-write-threshold': [testblock], 82 'test-crypto-hash': [crypto], 83 'test-crypto-hmac': [crypto], 84 'test-crypto-cipher': [crypto], 85 'test-crypto-akcipher': [crypto], 86 'test-crypto-secret': [crypto, keyutils], 87 'test-crypto-der': [crypto], 88 'test-authz-simple': [authz], 89 'test-authz-list': [authz], 90 'test-authz-listfile': [authz], 91 'test-io-task': [testblock], 92 'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io], 93 'test-io-channel-file': ['io-channel-helpers.c', io], 94 'test-io-channel-command': ['io-channel-helpers.c', io], 95 'test-io-channel-buffer': ['io-channel-helpers.c', io], 96 'test-io-channel-null': [io], 97 'test-crypto-ivgen': [io], 98 'test-crypto-afsplit': [io], 99 'test-crypto-block': [io], 100 } 101 if gnutls.found() and \ 102 tasn1.found() and \ 103 host_os != 'windows' 104 tests += { 105 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 106 tasn1, crypto, gnutls], 107 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c', 108 tasn1, crypto, gnutls], 109 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 110 tasn1, io, crypto, gnutls]} 111 endif 112 if pam.found() 113 tests += {'test-authz-pam': [authz]} 114 endif 115 if xts == 'private' 116 tests += {'test-crypto-xts': [crypto, io]} 117 endif 118 if host_os != 'windows' 119 tests += { 120 'test-image-locking': [testblock], 121 'test-nested-aio-poll': [testblock], 122 } 123 endif 124 if config_host_data.get('CONFIG_REPLICATION') 125 tests += {'test-replication': [testblock]} 126 endif 127 if nettle.found() or gcrypt.found() 128 tests += {'test-crypto-pbkdf': [io]} 129 endif 130endif 131 132if have_system 133 tests += { 134 'test-iov': [], 135 'test-qmp-cmds': [testqapi], 136 'test-xbzrle': [migration], 137 'test-timed-average': [], 138 'test-util-sockets': ['socket-helpers.c'], 139 'test-base64': [], 140 'test-bufferiszero': [], 141 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], 142 'test-vmstate': [migration, io], 143 'test-yank': ['socket-helpers.c', qom, io, chardev] 144 } 145 if config_host_data.get('CONFIG_INOTIFY1') 146 tests += {'test-util-filemonitor': []} 147 endif 148 149 # Some tests: test-char, test-qdev-global-props, and test-qga, 150 # are not runnable under TSan due to a known issue. 151 # https://github.com/google/sanitizers/issues/1116 152 if not get_option('tsan') 153 if host_os != 'windows' 154 tests += { 155 'test-char': ['socket-helpers.c', qom, io, chardev] 156 } 157 endif 158 159 tests += { 160 'test-qdev-global-props': [qom, hwcore] 161 } 162 endif 163endif 164 165if have_ga and host_os == 'linux' 166 tests += {'test-qga': ['../qtest/libqmp.c']} 167 test_deps += {'test-qga': qga} 168endif 169 170test_env = environment() 171test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) 172test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) 173 174slow_tests = { 175 'test-aio-multithread' : 120, 176 'test-crypto-block' : 300, 177 'test-crypto-tlscredsx509': 45, 178 'test-crypto-tlssession': 45 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