1da668aa1SThomas Huth 2da668aa1SThomas Huthtestblock = declare_dependency(dependencies: [block], sources: 'iothread.c') 3da668aa1SThomas Huth 4da668aa1SThomas Huthtests = { 5da668aa1SThomas Huth 'check-block-qdict': [], 6da668aa1SThomas Huth 'check-qdict': [], 7da668aa1SThomas Huth 'check-qnum': [], 8da668aa1SThomas Huth 'check-qstring': [], 9da668aa1SThomas Huth 'check-qlist': [], 10da668aa1SThomas Huth 'check-qnull': [], 11da668aa1SThomas Huth 'check-qobject': [], 12da668aa1SThomas Huth 'check-qjson': [], 13da668aa1SThomas Huth 'check-qlit': [], 146bbee5dbSMarc-André Lureau 'test-error-report': [], 15da668aa1SThomas Huth 'test-qobject-output-visitor': [testqapi], 16da668aa1SThomas Huth 'test-clone-visitor': [testqapi], 17da668aa1SThomas Huth 'test-qobject-input-visitor': [testqapi], 1818fa3ebcSPaolo Bonzini 'test-forward-visitor': [testqapi], 19da668aa1SThomas Huth 'test-string-input-visitor': [testqapi], 20da668aa1SThomas Huth 'test-string-output-visitor': [testqapi], 21da668aa1SThomas Huth 'test-visitor-serialization': [testqapi], 22da668aa1SThomas Huth 'test-bitmap': [], 2371177490SEric Auger 'test-resv-mem': [], 24af4c26e6SZhao Liu # all code tested by test-x86-topo is inside topology.h 25af4c26e6SZhao Liu 'test-x86-topo': [], 26da668aa1SThomas Huth 'test-cutils': [], 2702346297SLuis Pires 'test-div128': [], 28da668aa1SThomas Huth 'test-shift128': [], 29da668aa1SThomas Huth 'test-mul64': [], 30da668aa1SThomas Huth # all code tested by test-int128 is inside int128.h 31da668aa1SThomas Huth 'test-int128': [], 32da668aa1SThomas Huth 'rcutorture': [], 33da668aa1SThomas Huth 'test-rcu-list': [], 34da668aa1SThomas Huth 'test-rcu-simpleq': [], 35da668aa1SThomas Huth 'test-rcu-tailq': [], 36da668aa1SThomas Huth 'test-rcu-slist': [], 37da668aa1SThomas Huth 'test-qdist': [], 38da668aa1SThomas Huth 'test-qht': [], 39e3feb2ccSEmilio Cota 'test-qtree': [], 40da668aa1SThomas Huth 'test-bitops': [], 41da668aa1SThomas Huth 'test-bitcnt': [], 42da668aa1SThomas Huth 'test-qgraph': ['../qtest/libqos/qgraph.c'], 43da668aa1SThomas Huth 'check-qom-interface': [qom], 44da668aa1SThomas Huth 'check-qom-proplist': [qom], 45da668aa1SThomas Huth 'test-qemu-opts': [], 46da668aa1SThomas Huth 'test-keyval': [testqapi], 47da668aa1SThomas Huth 'test-logging': [], 48da668aa1SThomas Huth 'test-qapi-util': [], 490d99d37aSRichard Henderson 'test-interval-tree': [], 50f2f262c3SMark Cave-Ayland 'test-fifo': [], 51da668aa1SThomas Huth} 52da668aa1SThomas Huth 53da668aa1SThomas Huthif have_system or have_tools 54da668aa1SThomas Huth tests += { 55da668aa1SThomas Huth 'test-qmp-event': [testqapi], 56da668aa1SThomas Huth } 57d2ea8dacSDaniel P. Berrangé 58d2ea8dacSDaniel P. Berrangé if seccomp.found() 598d7f2e76SPhilippe Mathieu-Daudé tests += {'test-seccomp': ['../../system/qemu-seccomp.c', seccomp]} 60d2ea8dacSDaniel P. Berrangé endif 61da668aa1SThomas Huthendif 62da668aa1SThomas Huth 63da668aa1SThomas Huthif have_block 64da668aa1SThomas Huth tests += { 65da668aa1SThomas Huth 'test-coroutine': [testblock], 66da668aa1SThomas Huth 'test-aio': [testblock], 67da668aa1SThomas Huth 'test-aio-multithread': [testblock], 68da668aa1SThomas Huth 'test-throttle': [testblock], 69da668aa1SThomas Huth 'test-thread-pool': [testblock], 70da668aa1SThomas Huth 'test-hbitmap': [testblock], 71da668aa1SThomas Huth 'test-bdrv-drain': [testblock], 72da668aa1SThomas Huth 'test-bdrv-graph-mod': [testblock], 73da668aa1SThomas Huth 'test-blockjob': [testblock], 74da668aa1SThomas Huth 'test-blockjob-txn': [testblock], 75da668aa1SThomas Huth 'test-block-backend': [testblock], 76da668aa1SThomas Huth 'test-block-iothread': [testblock], 77da668aa1SThomas Huth 'test-write-threshold': [testblock], 78da668aa1SThomas Huth 'test-crypto-hash': [crypto], 79da668aa1SThomas Huth 'test-crypto-hmac': [crypto], 80da668aa1SThomas Huth 'test-crypto-cipher': [crypto], 81689309c4SLei He 'test-crypto-akcipher': [crypto], 82da668aa1SThomas Huth 'test-crypto-secret': [crypto, keyutils], 8399d423f1SLei He 'test-crypto-der': [crypto], 84da668aa1SThomas Huth 'test-authz-simple': [authz], 85da668aa1SThomas Huth 'test-authz-list': [authz], 86da668aa1SThomas Huth 'test-authz-listfile': [authz], 87da668aa1SThomas Huth 'test-io-task': [testblock], 88da668aa1SThomas Huth 'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io], 89da668aa1SThomas Huth 'test-io-channel-file': ['io-channel-helpers.c', io], 90da668aa1SThomas Huth 'test-io-channel-command': ['io-channel-helpers.c', io], 91da668aa1SThomas Huth 'test-io-channel-buffer': ['io-channel-helpers.c', io], 9287e42764SDaniel P. Berrangé 'test-io-channel-null': [io], 93da668aa1SThomas Huth 'test-crypto-ivgen': [io], 94da668aa1SThomas Huth 'test-crypto-afsplit': [io], 95da668aa1SThomas Huth 'test-crypto-block': [io], 9634dca3f5SPaolo Bonzini 'test-timed-average': [], 9734dca3f5SPaolo Bonzini 'test-uuid': [], 98da668aa1SThomas Huth } 9957612511SPaolo Bonzini if gnutls.found() and \ 100ba7ed407SPaolo Bonzini tasn1.found() and \ 101d0cda6f4SPaolo Bonzini host_os != 'windows' 102da668aa1SThomas Huth tests += { 1030e9bb8adSPhilippe Mathieu-Daudé 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 104da668aa1SThomas Huth tasn1, crypto, gnutls], 1050e9bb8adSPhilippe Mathieu-Daudé 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'crypto-tls-psk-helpers.c', 106da668aa1SThomas Huth tasn1, crypto, gnutls], 1070e9bb8adSPhilippe Mathieu-Daudé 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 108da668aa1SThomas Huth tasn1, io, crypto, gnutls]} 109da668aa1SThomas Huth endif 11005e391aeSPaolo Bonzini if pam.found() 111da668aa1SThomas Huth tests += {'test-authz-pam': [authz]} 112da668aa1SThomas Huth endif 11357612511SPaolo Bonzini if xts == 'private' 114da668aa1SThomas Huth tests += {'test-crypto-xts': [crypto, io]} 115da668aa1SThomas Huth endif 116d0cda6f4SPaolo Bonzini if host_os != 'windows' 117844a12a6SStefan Hajnoczi tests += { 118844a12a6SStefan Hajnoczi 'test-image-locking': [testblock], 119*89d26d34SPaolo Bonzini 'test-nested-aio-poll': [], 120844a12a6SStefan Hajnoczi } 121da668aa1SThomas Huth endif 122406523f6SPaolo Bonzini if config_host_data.get('CONFIG_REPLICATION') 123da668aa1SThomas Huth tests += {'test-replication': [testblock]} 124da668aa1SThomas Huth endif 125da668aa1SThomas Huth tests += {'test-crypto-pbkdf': [io]} 126da668aa1SThomas Huthendif 127da668aa1SThomas Huth 128da668aa1SThomas Huthif have_system 129da668aa1SThomas Huth tests += { 13034dca3f5SPaolo Bonzini 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], 131da668aa1SThomas Huth 'test-iov': [], 13234dca3f5SPaolo Bonzini 'test-opts-visitor': [testqapi], 13334dca3f5SPaolo Bonzini 'test-xs-node': [qom], 13434dca3f5SPaolo Bonzini 'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'], 135da668aa1SThomas Huth 'test-qmp-cmds': [testqapi], 136da668aa1SThomas Huth 'test-xbzrle': [migration], 137da668aa1SThomas Huth 'test-util-sockets': ['socket-helpers.c'], 138da668aa1SThomas Huth 'test-base64': [], 139da668aa1SThomas Huth 'test-bufferiszero': [], 14062b6323dSPhilippe Mathieu-Daudé 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], 141d3a0bb77SLukas Straub 'test-vmstate': [migration, io], 142d3a0bb77SLukas Straub 'test-yank': ['socket-helpers.c', qom, io, chardev] 143da668aa1SThomas Huth } 1449d30c78cSVolker Rümelin if config_host_data.get('CONFIG_INOTIFY1') 145da668aa1SThomas Huth tests += {'test-util-filemonitor': []} 146da668aa1SThomas Huth endif 147da668aa1SThomas Huth 148da668aa1SThomas Huth # Some tests: test-char, test-qdev-global-props, and test-qga, 149da668aa1SThomas Huth # are not runnable under TSan due to a known issue. 150da668aa1SThomas Huth # https://github.com/google/sanitizers/issues/1116 15134f983d8SPaolo Bonzini if not get_option('tsan') 152d0cda6f4SPaolo Bonzini if host_os != 'windows' 153da668aa1SThomas Huth tests += { 154da668aa1SThomas Huth 'test-char': ['socket-helpers.c', qom, io, chardev] 155da668aa1SThomas Huth } 156da668aa1SThomas Huth endif 157da668aa1SThomas Huth 158da668aa1SThomas Huth tests += { 1599d587100SMarc-André Lureau 'test-qdev-global-props': [qom, hwcore] 160da668aa1SThomas Huth } 161da668aa1SThomas Huth endif 162da668aa1SThomas Huthendif 163da668aa1SThomas Huth 164d0cda6f4SPaolo Bonziniif have_ga and host_os == 'linux' 165c6d3bcb4SMarc-André Lureau tests += {'test-qga': ['../qtest/libqmp.c']} 166da668aa1SThomas Huth test_deps += {'test-qga': qga} 167da668aa1SThomas Huthendif 168da668aa1SThomas Huth 169da668aa1SThomas Huthtest_env = environment() 170da668aa1SThomas Huthtest_env.set('G_TEST_SRCDIR', meson.current_source_dir()) 171da668aa1SThomas Huthtest_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) 172da668aa1SThomas Huth 173da668aa1SThomas Huthslow_tests = { 174c45f8f1aSThomas Huth 'test-aio-multithread' : 120, 17555f7c6a5SPeter Maydell 'test-bufferiszero': 60, 176e1b363e3SThomas Huth 'test-crypto-block' : 300, 17755f7c6a5SPeter Maydell 'test-crypto-tlscredsx509': 90, 17855f7c6a5SPeter Maydell 'test-crypto-tlssession': 90, 17963b18312SKevin Wolf 'test-replication': 60, 180da668aa1SThomas Huth} 181da668aa1SThomas Huth 182da668aa1SThomas Huthforeach test_name, extra: tests 183da668aa1SThomas Huth src = [test_name + '.c'] 184da668aa1SThomas Huth deps = [qemuutil] 185da668aa1SThomas Huth if extra.length() > 0 186da668aa1SThomas Huth # use a sourceset to quickly separate sources and deps 187da668aa1SThomas Huth test_ss = ss.source_set() 188da668aa1SThomas Huth test_ss.add(extra) 189da668aa1SThomas Huth src += test_ss.all_sources() 190da668aa1SThomas Huth deps += test_ss.all_dependencies() 191da668aa1SThomas Huth endif 192da668aa1SThomas Huth exe = executable(test_name, src, genh, dependencies: deps) 193da668aa1SThomas Huth 194da668aa1SThomas Huth test(test_name, exe, 195da668aa1SThomas Huth depends: test_deps.get(test_name, []), 196da668aa1SThomas Huth env: test_env, 197da668aa1SThomas Huth args: ['--tap', '-k'], 198da668aa1SThomas Huth protocol: 'tap', 199da668aa1SThomas Huth timeout: slow_tests.get(test_name, 30), 200da668aa1SThomas Huth priority: slow_tests.get(test_name, 30), 201da668aa1SThomas Huth suite: ['unit']) 202da668aa1SThomas Huthendforeach 203