1*279588d4SMarc-André Lureaupy3 = import('python').find_installation() 2*279588d4SMarc-André Lureau 3a9726a90SMarc-André Lureauqht_bench = executable('qht-bench', 4*279588d4SMarc-André Lureau sources: 'qht-bench.c', 5a9726a90SMarc-André Lureau dependencies: [qemuutil]) 6a9726a90SMarc-André Lureau 737e27776SMarc-André Lureautest_qapi_outputs = [ 837e27776SMarc-André Lureau 'qapi-builtin-types.c', 937e27776SMarc-André Lureau 'qapi-builtin-types.h', 1037e27776SMarc-André Lureau 'qapi-builtin-visit.c', 1137e27776SMarc-André Lureau 'qapi-builtin-visit.h', 1237e27776SMarc-André Lureau 'test-qapi-commands-sub-sub-module.c', 1337e27776SMarc-André Lureau 'test-qapi-commands-sub-sub-module.h', 1437e27776SMarc-André Lureau 'test-qapi-commands.c', 1537e27776SMarc-André Lureau 'test-qapi-commands.h', 1637e27776SMarc-André Lureau 'test-qapi-emit-events.c', 1737e27776SMarc-André Lureau 'test-qapi-emit-events.h', 1837e27776SMarc-André Lureau 'test-qapi-events-sub-sub-module.c', 1937e27776SMarc-André Lureau 'test-qapi-events-sub-sub-module.h', 2037e27776SMarc-André Lureau 'test-qapi-events.c', 2137e27776SMarc-André Lureau 'test-qapi-events.h', 2237e27776SMarc-André Lureau 'test-qapi-init-commands.c', 2337e27776SMarc-André Lureau 'test-qapi-init-commands.h', 2437e27776SMarc-André Lureau 'test-qapi-introspect.c', 2537e27776SMarc-André Lureau 'test-qapi-introspect.h', 2637e27776SMarc-André Lureau 'test-qapi-types-sub-sub-module.c', 2737e27776SMarc-André Lureau 'test-qapi-types-sub-sub-module.h', 2837e27776SMarc-André Lureau 'test-qapi-types.c', 2937e27776SMarc-André Lureau 'test-qapi-types.h', 3037e27776SMarc-André Lureau 'test-qapi-visit-sub-sub-module.c', 3137e27776SMarc-André Lureau 'test-qapi-visit-sub-sub-module.h', 3237e27776SMarc-André Lureau 'test-qapi-visit.c', 3337e27776SMarc-André Lureau 'test-qapi-visit.h', 3437e27776SMarc-André Lureau] 3537e27776SMarc-André Lureau 3637e27776SMarc-André Lureautest_qapi_files = custom_target('Test QAPI files', 3737e27776SMarc-André Lureau output: test_qapi_outputs, 3837e27776SMarc-André Lureau input: files('qapi-schema/qapi-schema-test.json', 3937e27776SMarc-André Lureau 'qapi-schema/include/sub-module.json', 4037e27776SMarc-André Lureau 'qapi-schema/sub-sub-module.json'), 4137e27776SMarc-André Lureau command: [ qapi_gen, '-o', meson.current_build_dir(), 4237e27776SMarc-André Lureau '-b', '-p', 'test-', '@INPUT0@' ], 4337e27776SMarc-André Lureau depend_files: qapi_gen_depends) 4437e27776SMarc-André Lureau 4537e27776SMarc-André Lureau# meson doesn't like generated output in other directories 4637e27776SMarc-André Lureau# perhaps change qapi_gen to replace / with _, like Meson itself does? 4737e27776SMarc-André Lureausubdir('include') 4837e27776SMarc-André Lureau 4937e27776SMarc-André Lureaulibtestqapi = static_library('testqapi', sources: [test_qapi_files, test_qapi_outputs_extra]) 5037e27776SMarc-André Lureautestqapi = declare_dependency(link_with: libtestqapi) 5137e27776SMarc-André Lureau 52*279588d4SMarc-André Lureautestblock = declare_dependency(dependencies: [block], sources: 'iothread.c') 53*279588d4SMarc-André Lureau 54*279588d4SMarc-André Lureautests = { 55*279588d4SMarc-André Lureau 'check-block-qdict': [], 56*279588d4SMarc-André Lureau 'check-qdict': [], 57*279588d4SMarc-André Lureau 'check-qnum': [], 58*279588d4SMarc-André Lureau 'check-qstring': [], 59*279588d4SMarc-André Lureau 'check-qlist': [], 60*279588d4SMarc-André Lureau 'check-qnull': [], 61*279588d4SMarc-André Lureau 'check-qobject': [], 62*279588d4SMarc-André Lureau 'check-qjson': [], 63*279588d4SMarc-André Lureau 'check-qlit': [], 64*279588d4SMarc-André Lureau 'test-qobject-output-visitor': [testqapi], 65*279588d4SMarc-André Lureau 'test-clone-visitor': [testqapi], 66*279588d4SMarc-André Lureau 'test-qobject-input-visitor': [testqapi], 67*279588d4SMarc-André Lureau 'test-string-input-visitor': [testqapi], 68*279588d4SMarc-André Lureau 'test-string-output-visitor': [testqapi], 69*279588d4SMarc-André Lureau 'test-qmp-event': [testqapi], 70*279588d4SMarc-André Lureau 'test-opts-visitor': [testqapi], 71*279588d4SMarc-André Lureau 'test-visitor-serialization': [testqapi], 72*279588d4SMarc-André Lureau 'test-bitmap': [], 73*279588d4SMarc-André Lureau # all code tested by test-x86-cpuid is inside topology.h 74*279588d4SMarc-André Lureau 'test-x86-cpuid': [], 75*279588d4SMarc-André Lureau 'test-cutils': [], 76*279588d4SMarc-André Lureau 'test-shift128': [], 77*279588d4SMarc-André Lureau 'test-mul64': [], 78*279588d4SMarc-André Lureau # all code tested by test-int128 is inside int128.h 79*279588d4SMarc-André Lureau 'test-int128': [], 80*279588d4SMarc-André Lureau 'rcutorture': [], 81*279588d4SMarc-André Lureau 'test-rcu-list': [], 82*279588d4SMarc-André Lureau 'test-rcu-simpleq': [], 83*279588d4SMarc-André Lureau 'test-rcu-tailq': [], 84*279588d4SMarc-André Lureau 'test-rcu-slist': [], 85*279588d4SMarc-André Lureau 'test-qdist': [], 86*279588d4SMarc-André Lureau 'test-qht': [], 87*279588d4SMarc-André Lureau 'test-bitops': [], 88*279588d4SMarc-André Lureau 'test-bitcnt': [], 89*279588d4SMarc-André Lureau 'test-qgraph': ['qtest/libqos/qgraph.c'], 90*279588d4SMarc-André Lureau 'check-qom-interface': [qom], 91*279588d4SMarc-André Lureau 'check-qom-proplist': [qom], 92*279588d4SMarc-André Lureau 'test-qemu-opts': [], 93*279588d4SMarc-André Lureau 'test-keyval': [testqapi], 94*279588d4SMarc-André Lureau 'test-logging': [], 95*279588d4SMarc-André Lureau 'test-uuid': [], 96*279588d4SMarc-André Lureau 'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c'], 97*279588d4SMarc-André Lureau 'test-qapi-util': [], 98*279588d4SMarc-André Lureau} 99*279588d4SMarc-André Lureau 100*279588d4SMarc-André Lureautest_deps = { 101*279588d4SMarc-André Lureau 'test-qht-par': qht_bench, 102*279588d4SMarc-André Lureau} 103*279588d4SMarc-André Lureau 104*279588d4SMarc-André Lureauif have_block 105*279588d4SMarc-André Lureau tests += { 106*279588d4SMarc-André Lureau 'test-coroutine': [testblock], 107*279588d4SMarc-André Lureau 'test-aio': [testblock], 108*279588d4SMarc-André Lureau 'test-aio-multithread': [testblock], 109*279588d4SMarc-André Lureau 'test-throttle': [testblock], 110*279588d4SMarc-André Lureau 'test-thread-pool': [testblock], 111*279588d4SMarc-André Lureau 'test-hbitmap': [testblock], 112*279588d4SMarc-André Lureau 'test-bdrv-drain': [testblock], 113*279588d4SMarc-André Lureau 'test-bdrv-graph-mod': [testblock], 114*279588d4SMarc-André Lureau 'test-blockjob': [testblock], 115*279588d4SMarc-André Lureau 'test-blockjob-txn': [testblock], 116*279588d4SMarc-André Lureau 'test-block-backend': [testblock], 117*279588d4SMarc-André Lureau 'test-block-iothread': [testblock], 118*279588d4SMarc-André Lureau 'test-write-threshold': [testblock], 119*279588d4SMarc-André Lureau 'test-crypto-hash': [crypto], 120*279588d4SMarc-André Lureau 'test-crypto-hmac': [crypto], 121*279588d4SMarc-André Lureau 'test-crypto-cipher': [crypto], 122*279588d4SMarc-André Lureau 'test-crypto-secret': [crypto, keyutils], 123*279588d4SMarc-André Lureau 'test-authz-simple': [authz], 124*279588d4SMarc-André Lureau 'test-authz-list': [authz], 125*279588d4SMarc-André Lureau 'test-authz-listfile': [authz], 126*279588d4SMarc-André Lureau 'test-io-task': [testblock], 127*279588d4SMarc-André Lureau 'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io], 128*279588d4SMarc-André Lureau 'test-io-channel-file': ['io-channel-helpers.c', io], 129*279588d4SMarc-André Lureau 'test-io-channel-command': ['io-channel-helpers.c', io], 130*279588d4SMarc-André Lureau 'test-io-channel-buffer': ['io-channel-helpers.c', io], 131*279588d4SMarc-André Lureau 'test-crypto-ivgen': [io], 132*279588d4SMarc-André Lureau 'test-crypto-afsplit': [io], 133*279588d4SMarc-André Lureau 'test-crypto-block': [io], 134*279588d4SMarc-André Lureau } 135*279588d4SMarc-André Lureau if 'CONFIG_GNUTLS' in config_host and \ 136*279588d4SMarc-André Lureau 'CONFIG_TASN1' in config_host 137*279588d4SMarc-André Lureau tests += { 138*279588d4SMarc-André Lureau 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 139*279588d4SMarc-André Lureau tasn1, crypto], 140*279588d4SMarc-André Lureau 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c', 141*279588d4SMarc-André Lureau tasn1, crypto], 142*279588d4SMarc-André Lureau 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 143*279588d4SMarc-André Lureau tasn1, io, crypto]} 144*279588d4SMarc-André Lureau endif 145*279588d4SMarc-André Lureau if 'CONFIG_AUTH_PAM' in config_host 146*279588d4SMarc-André Lureau tests += {'test-authz-pam': [authz]} 147*279588d4SMarc-André Lureau endif 148*279588d4SMarc-André Lureau if 'CONFIG_QEMU_PRIVATE_XTS' in config_host 149*279588d4SMarc-André Lureau tests += {'test-crypto-xts': [crypto, io]} 150*279588d4SMarc-André Lureau endif 151*279588d4SMarc-André Lureau if 'CONFIG_POSIX' in config_host 152*279588d4SMarc-André Lureau tests += {'test-image-locking': [testblock]} 153*279588d4SMarc-André Lureau endif 154*279588d4SMarc-André Lureau if 'CONFIG_REPLICATION' in config_host 155*279588d4SMarc-André Lureau tests += {'test-replication': [testblock]} 156*279588d4SMarc-André Lureau endif 157*279588d4SMarc-André Lureau if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host 158*279588d4SMarc-André Lureau tests += {'test-crypto-pbkdf': [io]} 159*279588d4SMarc-André Lureau endif 160*279588d4SMarc-André Lureauendif 161*279588d4SMarc-André Lureau 162*279588d4SMarc-André Lureauif have_system 163*279588d4SMarc-André Lureau tests += { 164*279588d4SMarc-André Lureau 'test-iov': [], 165*279588d4SMarc-André Lureau 'test-qmp-cmds': [testqapi], 166*279588d4SMarc-André Lureau 'test-xbzrle': [migration], 167*279588d4SMarc-André Lureau 'test-timed-average': [], 168*279588d4SMarc-André Lureau 'test-util-sockets': ['socket-helpers.c'], 169*279588d4SMarc-André Lureau 'test-base64': [], 170*279588d4SMarc-André Lureau 'test-bufferiszero': [], 171*279588d4SMarc-André Lureau 'test-vmstate': [migration, io] 172*279588d4SMarc-André Lureau } 173*279588d4SMarc-André Lureau if 'CONFIG_INOTIFY1' in config_host 174*279588d4SMarc-André Lureau tests += {'test-util-filemonitor': []} 175*279588d4SMarc-André Lureau endif 176*279588d4SMarc-André Lureau 177*279588d4SMarc-André Lureau # Some tests: test-char, test-qdev-global-props, and test-qga, 178*279588d4SMarc-André Lureau # are not runnable under TSan due to a known issue. 179*279588d4SMarc-André Lureau # https://github.com/google/sanitizers/issues/1116 180*279588d4SMarc-André Lureau if 'CONFIG_TSAN' not in config_host 181*279588d4SMarc-André Lureau tests += { 182*279588d4SMarc-André Lureau 'test-char': ['socket-helpers.c', qom, io, chardev], 183*279588d4SMarc-André Lureau 'test-qdev-global-props': [qom, hwcore, testqapi] 184*279588d4SMarc-André Lureau } 185*279588d4SMarc-André Lureau endif 186*279588d4SMarc-André Lureauendif 187*279588d4SMarc-André Lureau 188*279588d4SMarc-André Lureauif 'CONFIG_TSAN' not in config_host and \ 189*279588d4SMarc-André Lureau 'CONFIG_GUEST_AGENT' in config_host and \ 190*279588d4SMarc-André Lureau 'CONFIG_LINUX' in config_host 191*279588d4SMarc-André Lureau tests += {'test-qga': ['qtest/libqtest.c']} 192*279588d4SMarc-André Lureau test_deps += {'test-qga': qga} 193*279588d4SMarc-André Lureauendif 194*279588d4SMarc-André Lureau 195*279588d4SMarc-André Lureautest_env = environment() 196*279588d4SMarc-André Lureautest_env.set('G_TEST_SRCDIR', meson.current_source_dir()) 197*279588d4SMarc-André Lureautest_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) 198*279588d4SMarc-André Lureau 199*279588d4SMarc-André Lureauforeach test_name, extra: tests 200*279588d4SMarc-André Lureau src = [test_name + '.c'] 201*279588d4SMarc-André Lureau deps = [qemuutil] 202*279588d4SMarc-André Lureau if extra.length() > 0 203*279588d4SMarc-André Lureau # use a sourceset to quickly separate sources and deps 204*279588d4SMarc-André Lureau test_ss = ss.source_set() 205*279588d4SMarc-André Lureau test_ss.add(extra) 206*279588d4SMarc-André Lureau src += test_ss.all_sources() 207*279588d4SMarc-André Lureau deps += test_ss.all_dependencies() 208*279588d4SMarc-André Lureau endif 209*279588d4SMarc-André Lureau exe = executable(test_name, src, dependencies: deps) 210*279588d4SMarc-André Lureau 211*279588d4SMarc-André Lureau test(test_name, exe, 212*279588d4SMarc-André Lureau depends: test_deps.get(test_name, []), 213*279588d4SMarc-André Lureau env: test_env, 214*279588d4SMarc-André Lureau args: ['--tap', '-k'], 215*279588d4SMarc-André Lureau protocol: 'tap', 216*279588d4SMarc-André Lureau suite: ['unit']) 217*279588d4SMarc-André Lureauendforeach 218*279588d4SMarc-André Lureau 219d3ca592bSPaolo Bonziniif have_system and 'CONFIG_POSIX' in config_host 220d3ca592bSPaolo Bonzini subdir('qemu-iotests') 221d3ca592bSPaolo Bonziniendif 222d3ca592bSPaolo Bonzini 223ce1c1e7aSPaolo Bonzinitest('decodetree', sh, 224ce1c1e7aSPaolo Bonzini args: [ files('decode/check.sh'), config_host['PYTHON'], files('../scripts/decodetree.py') ], 225ce1c1e7aSPaolo Bonzini workdir: meson.current_source_dir() / 'decode', 226ce1c1e7aSPaolo Bonzini suite: 'decodetree') 2273941996bSPaolo Bonzini 2283941996bSPaolo Bonziniif 'CONFIG_TCG' in config_host 2293941996bSPaolo Bonzini subdir('fp') 230ffac93dfSPaolo Bonzini if 'CONFIG_PLUGIN' in config_host 231ffac93dfSPaolo Bonzini subdir('plugin') 232ffac93dfSPaolo Bonzini endif 2333941996bSPaolo Bonziniendif 2343afe7ab0SPaolo Bonzini 2353afe7ab0SPaolo Bonzinisubdir('qapi-schema') 236a2ce7dbdSPaolo Bonzinisubdir('qtest') 237