meson.build 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. # QEMU functional tests:
  2. # Tests that are put in the 'quick' category are run by default during
  3. # 'make check'. Everything that should not be run during 'make check'
  4. # (e.g. tests that fetch assets from the internet) should be put into
  5. # the 'thorough' category instead.
  6. # Most tests run too slow with TCI enabled, so skip the functional tests there
  7. if get_option('tcg_interpreter')
  8. subdir_done()
  9. endif
  10. # Timeouts for individual tests that can be slow e.g. with debugging enabled
  11. test_timeouts = {
  12. 'aarch64_aspeed' : 600,
  13. 'aarch64_raspi4' : 480,
  14. 'aarch64_rme_virt' : 1200,
  15. 'aarch64_rme_sbsaref' : 1200,
  16. 'aarch64_sbsaref_alpine' : 720,
  17. 'aarch64_sbsaref_freebsd' : 720,
  18. 'aarch64_tuxrun' : 240,
  19. 'aarch64_virt' : 720,
  20. 'acpi_bits' : 420,
  21. 'arm_aspeed_palmetto' : 120,
  22. 'arm_aspeed_romulus' : 120,
  23. 'arm_aspeed_ast2500' : 480,
  24. 'arm_aspeed_ast2600' : 720,
  25. 'arm_aspeed_rainier' : 240,
  26. 'arm_bpim2u' : 500,
  27. 'arm_collie' : 180,
  28. 'arm_cubieboard' : 360,
  29. 'arm_orangepi' : 540,
  30. 'arm_quanta_gsj' : 240,
  31. 'arm_raspi2' : 120,
  32. 'arm_tuxrun' : 240,
  33. 'arm_sx1' : 360,
  34. 'intel_iommu': 300,
  35. 'mips_malta' : 120,
  36. 'mipsel_replay' : 480,
  37. 'netdev_ethtool' : 180,
  38. 'ppc_40p' : 240,
  39. 'ppc64_hv' : 1000,
  40. 'ppc64_powernv' : 480,
  41. 'ppc64_pseries' : 480,
  42. 'ppc64_tuxrun' : 420,
  43. 'ppc64_mac99' : 120,
  44. 'riscv64_tuxrun' : 120,
  45. 's390x_ccw_virtio' : 420,
  46. 'sh4_tuxrun' : 240,
  47. 'virtio_balloon': 120,
  48. 'x86_64_kvm_xen' : 180,
  49. }
  50. tests_generic_system = [
  51. 'empty_cpu_model',
  52. 'info_usernet',
  53. 'version',
  54. ]
  55. tests_generic_linuxuser = [
  56. ]
  57. tests_generic_bsduser = [
  58. ]
  59. tests_aarch64_system_quick = [
  60. 'migration',
  61. ]
  62. tests_aarch64_system_thorough = [
  63. 'aarch64_aspeed',
  64. 'aarch64_raspi3',
  65. 'aarch64_raspi4',
  66. 'aarch64_rme_virt',
  67. 'aarch64_rme_sbsaref',
  68. 'aarch64_sbsaref',
  69. 'aarch64_sbsaref_alpine',
  70. 'aarch64_sbsaref_freebsd',
  71. 'aarch64_tcg_plugins',
  72. 'aarch64_tuxrun',
  73. 'aarch64_virt',
  74. 'aarch64_xen',
  75. 'aarch64_xlnx_versal',
  76. 'multiprocess',
  77. ]
  78. tests_alpha_system_quick = [
  79. 'migration',
  80. ]
  81. tests_alpha_system_thorough = [
  82. 'alpha_clipper',
  83. ]
  84. tests_arm_system_quick = [
  85. 'migration',
  86. ]
  87. tests_arm_system_thorough = [
  88. 'arm_aspeed_ast1030',
  89. 'arm_aspeed_palmetto',
  90. 'arm_aspeed_romulus',
  91. 'arm_aspeed_ast2500',
  92. 'arm_aspeed_ast2600',
  93. 'arm_aspeed_rainier',
  94. 'arm_bpim2u',
  95. 'arm_canona1100',
  96. 'arm_collie',
  97. 'arm_cubieboard',
  98. 'arm_emcraft_sf2',
  99. 'arm_integratorcp',
  100. 'arm_microbit',
  101. 'arm_orangepi',
  102. 'arm_quanta_gsj',
  103. 'arm_raspi2',
  104. 'arm_smdkc210',
  105. 'arm_sx1',
  106. 'arm_vexpress',
  107. 'arm_virt',
  108. 'arm_tuxrun',
  109. ]
  110. tests_arm_linuxuser_thorough = [
  111. 'arm_bflt',
  112. ]
  113. tests_avr_system_thorough = [
  114. 'avr_mega2560',
  115. ]
  116. tests_hppa_system_quick = [
  117. 'hppa_seabios',
  118. ]
  119. tests_i386_system_quick = [
  120. 'migration',
  121. ]
  122. tests_i386_system_thorough = [
  123. 'i386_tuxrun',
  124. ]
  125. tests_loongarch64_system_thorough = [
  126. 'loongarch64_virt',
  127. ]
  128. tests_m68k_system_thorough = [
  129. 'm68k_mcf5208evb',
  130. 'm68k_nextcube',
  131. 'm68k_q800',
  132. 'm68k_tuxrun',
  133. ]
  134. tests_microblaze_system_thorough = [
  135. 'microblaze_s3adsp1800'
  136. ]
  137. tests_microblazeel_system_thorough = [
  138. 'microblazeel_s3adsp1800'
  139. ]
  140. tests_mips_system_thorough = [
  141. 'mips_malta',
  142. 'mips_replay',
  143. 'mips_tuxrun',
  144. ]
  145. tests_mipsel_system_thorough = [
  146. 'mipsel_malta',
  147. 'mipsel_replay',
  148. 'mipsel_tuxrun',
  149. ]
  150. tests_mips64_system_thorough = [
  151. 'mips64_tuxrun',
  152. ]
  153. tests_mips64el_system_thorough = [
  154. 'mips64el_fuloong2e',
  155. 'mips64el_loongson3v',
  156. 'mips64el_malta',
  157. 'mips64el_replay',
  158. 'mips64el_tuxrun',
  159. ]
  160. tests_or1k_system_thorough = [
  161. 'or1k_sim',
  162. ]
  163. tests_ppc_system_quick = [
  164. 'migration',
  165. 'ppc_74xx',
  166. ]
  167. tests_ppc_system_thorough = [
  168. 'ppc_405',
  169. 'ppc_40p',
  170. 'ppc_amiga',
  171. 'ppc_bamboo',
  172. 'ppc_mac',
  173. 'ppc_mpc8544ds',
  174. 'ppc_sam460ex',
  175. 'ppc_tuxrun',
  176. 'ppc_virtex_ml507',
  177. ]
  178. tests_ppc64_system_quick = [
  179. 'migration',
  180. ]
  181. tests_ppc64_system_thorough = [
  182. 'ppc64_e500',
  183. 'ppc64_hv',
  184. 'ppc64_powernv',
  185. 'ppc64_pseries',
  186. 'ppc64_tuxrun',
  187. 'ppc64_mac99',
  188. ]
  189. tests_riscv32_system_quick = [
  190. 'migration',
  191. 'riscv_opensbi',
  192. ]
  193. tests_riscv32_system_thorough = [
  194. 'riscv32_tuxrun',
  195. ]
  196. tests_riscv64_system_quick = [
  197. 'migration',
  198. 'riscv_opensbi',
  199. ]
  200. tests_riscv64_system_thorough = [
  201. 'riscv64_tuxrun',
  202. ]
  203. tests_rx_system_thorough = [
  204. 'rx_gdbsim',
  205. ]
  206. tests_s390x_system_thorough = [
  207. 's390x_ccw_virtio',
  208. 's390x_topology',
  209. 's390x_tuxrun',
  210. ]
  211. tests_sh4_system_thorough = [
  212. 'sh4_r2d',
  213. 'sh4_tuxrun',
  214. ]
  215. tests_sh4eb_system_thorough = [
  216. 'sh4eb_r2d',
  217. ]
  218. tests_sparc_system_quick = [
  219. 'migration',
  220. ]
  221. tests_sparc_system_thorough = [
  222. 'sparc_sun4m',
  223. ]
  224. tests_sparc64_system_quick = [
  225. 'migration',
  226. ]
  227. tests_sparc64_system_thorough = [
  228. 'sparc64_sun4u',
  229. 'sparc64_tuxrun',
  230. ]
  231. tests_x86_64_system_quick = [
  232. 'cpu_queries',
  233. 'mem_addr_space',
  234. 'migration',
  235. 'pc_cpu_hotplug_props',
  236. 'virtio_version',
  237. 'x86_cpu_model_versions',
  238. 'vnc',
  239. ]
  240. tests_x86_64_system_thorough = [
  241. 'acpi_bits',
  242. 'intel_iommu',
  243. 'linux_initrd',
  244. 'multiprocess',
  245. 'netdev_ethtool',
  246. 'virtio_balloon',
  247. 'virtio_gpu',
  248. 'x86_64_hotplug_blk',
  249. 'x86_64_hotplug_cpu',
  250. 'x86_64_kvm_xen',
  251. 'x86_64_tuxrun',
  252. ]
  253. tests_xtensa_system_thorough = [
  254. 'xtensa_lx60',
  255. ]
  256. precache_all = []
  257. foreach speed : ['quick', 'thorough']
  258. foreach dir : target_dirs
  259. target_base = dir.split('-')[0]
  260. if dir.endswith('-softmmu')
  261. sysmode = 'system'
  262. test_emulator = emulators['qemu-system-' + target_base]
  263. elif dir.endswith('-linux-user')
  264. sysmode = 'linuxuser'
  265. test_emulator = emulators['qemu-' + target_base]
  266. elif dir.endswith('-bsd-user')
  267. sysmode = 'bsduser'
  268. test_emulator = emulators['qemu-' + target_base]
  269. else
  270. continue
  271. endif
  272. if speed == 'quick'
  273. suites = ['func-quick', 'func-' + target_base]
  274. target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
  275. + get_variable('tests_generic_' + sysmode)
  276. else
  277. suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
  278. target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
  279. endif
  280. test_deps = roms
  281. test_env = environment()
  282. if have_tools
  283. test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
  284. test_deps += [qemu_img]
  285. endif
  286. test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
  287. test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
  288. test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
  289. meson.current_source_dir())
  290. foreach test : target_tests
  291. testname = '@0@-@1@'.format(target_base, test)
  292. testfile = 'test_' + test + '.py'
  293. testpath = meson.current_source_dir() / testfile
  294. teststamp = testname + '.tstamp'
  295. test_precache_env = environment()
  296. test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
  297. test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
  298. meson.current_source_dir())
  299. precache = custom_target('func-precache-' + testname,
  300. output: teststamp,
  301. command: [python, testpath],
  302. depend_files: files(testpath),
  303. build_by_default: false,
  304. env: test_precache_env)
  305. precache_all += precache
  306. # Ideally we would add 'precache' to 'depends' here, such that
  307. # 'build_by_default: false' lets the pre-caching automatically
  308. # run immediately before the test runs. In practice this is
  309. # broken in meson, with it running the pre-caching in the normal
  310. # compile phase https://github.com/mesonbuild/meson/issues/2518
  311. # If the above bug ever gets fixed, when QEMU changes the min
  312. # meson version, add the 'depends' and remove the custom
  313. # 'run_target' logic below & in Makefile.include
  314. test('func-' + testname,
  315. python,
  316. depends: [test_deps, test_emulator, emulator_modules],
  317. env: test_env,
  318. args: [testpath],
  319. protocol: 'tap',
  320. timeout: test_timeouts.get(test, 90),
  321. priority: test_timeouts.get(test, 90),
  322. suite: suites)
  323. endforeach
  324. endforeach
  325. endforeach
  326. run_target('precache-functional',
  327. depends: precache_all,
  328. command: ['true'])