tuxrun_baselines.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. # Functional test that boots known good tuxboot images the same way
  2. # that tuxrun (www.tuxrun.org) does. This tool is used by things like
  3. # the LKFT project to run regression tests on kernels.
  4. #
  5. # Copyright (c) 2023 Linaro Ltd.
  6. #
  7. # Author:
  8. # Alex Bennée <alex.bennee@linaro.org>
  9. #
  10. # SPDX-License-Identifier: GPL-2.0-or-later
  11. import os
  12. import time
  13. import tempfile
  14. from avocado import skip, skipUnless
  15. from avocado_qemu import QemuSystemTest
  16. from avocado_qemu import exec_command, exec_command_and_wait_for_pattern
  17. from avocado_qemu import wait_for_console_pattern
  18. from avocado.utils import process
  19. from avocado.utils.path import find_command
  20. class TuxRunBaselineTest(QemuSystemTest):
  21. """
  22. :avocado: tags=accel:tcg
  23. """
  24. KERNEL_COMMON_COMMAND_LINE = 'printk.time=0'
  25. # Tests are ~10-40s, allow for --debug/--enable-gcov overhead
  26. timeout = 100
  27. def get_tag(self, tagname, default=None):
  28. """
  29. Get the metadata tag or return the default.
  30. """
  31. utag = self._get_unique_tag_val(tagname)
  32. print(f"{tagname}/{default} -> {utag}")
  33. if utag:
  34. return utag
  35. return default
  36. def setUp(self):
  37. super().setUp()
  38. # We need zstd for all the tuxrun tests
  39. # See https://github.com/avocado-framework/avocado/issues/5609
  40. zstd = find_command('zstd', False)
  41. if zstd is False:
  42. self.cancel('Could not find "zstd", which is required to '
  43. 'decompress rootfs')
  44. self.zstd = zstd
  45. # Process the TuxRun specific tags, most machines work with
  46. # reasonable defaults but we sometimes need to tweak the
  47. # config. To avoid open coding everything we store all these
  48. # details in the metadata for each test.
  49. # The tuxboot tag matches the root directory
  50. self.tuxboot = self.get_tag('tuxboot')
  51. # Most Linux's use ttyS0 for their serial port
  52. self.console = self.get_tag('console', "ttyS0")
  53. # Does the machine shutdown QEMU nicely on "halt"
  54. self.shutdown = self.get_tag('shutdown')
  55. # The name of the kernel Image file
  56. self.image = self.get_tag('image', "Image")
  57. self.root = self.get_tag('root', "vda")
  58. # Occasionally we need extra devices to hook things up
  59. self.extradev = self.get_tag('extradev')
  60. self.qemu_img = super().get_qemu_img()
  61. def wait_for_console_pattern(self, success_message, vm=None):
  62. wait_for_console_pattern(self, success_message,
  63. failure_message='Kernel panic - not syncing',
  64. vm=vm)
  65. def fetch_tuxrun_assets(self, csums=None, dt=None):
  66. """
  67. Fetch the TuxBoot assets. They are stored in a standard way so we
  68. use the per-test tags to fetch details.
  69. """
  70. base_url = f"https://storage.tuxboot.com/20230331/{self.tuxboot}/"
  71. # empty hash if we weren't passed one
  72. csums = {} if csums is None else csums
  73. ksum = csums.get(self.image, None)
  74. isum = csums.get("rootfs.ext4.zst", None)
  75. kernel_image = self.fetch_asset(base_url + self.image,
  76. asset_hash = ksum,
  77. algorithm = "sha256")
  78. disk_image_zst = self.fetch_asset(base_url + "rootfs.ext4.zst",
  79. asset_hash = isum,
  80. algorithm = "sha256")
  81. cmd = f"{self.zstd} -d {disk_image_zst} -o {self.workdir}/rootfs.ext4"
  82. process.run(cmd)
  83. if dt:
  84. dsum = csums.get(dt, None)
  85. dtb = self.fetch_asset(base_url + dt,
  86. asset_hash = dsum,
  87. algorithm = "sha256")
  88. else:
  89. dtb = None
  90. return (kernel_image, self.workdir + "/rootfs.ext4", dtb)
  91. def prepare_run(self, kernel, disk, drive, dtb=None, console_index=0):
  92. """
  93. Setup to run and add the common parameters to the system
  94. """
  95. self.vm.set_console(console_index=console_index)
  96. # all block devices are raw ext4's
  97. blockdev = "driver=raw,file.driver=file," \
  98. + f"file.filename={disk},node-name=hd0"
  99. kcmd_line = self.KERNEL_COMMON_COMMAND_LINE
  100. kcmd_line += f" root=/dev/{self.root}"
  101. kcmd_line += f" console={self.console}"
  102. self.vm.add_args('-kernel', kernel,
  103. '-append', kcmd_line,
  104. '-blockdev', blockdev)
  105. # Sometimes we need extra devices attached
  106. if self.extradev:
  107. self.vm.add_args('-device', self.extradev)
  108. self.vm.add_args('-device',
  109. f"{drive},drive=hd0")
  110. # Some machines need an explicit DTB
  111. if dtb:
  112. self.vm.add_args('-dtb', dtb)
  113. def run_tuxtest_tests(self, haltmsg):
  114. """
  115. Wait for the system to boot up, wait for the login prompt and
  116. then do a few things on the console. Trigger a shutdown and
  117. wait to exit cleanly.
  118. """
  119. self.wait_for_console_pattern("Welcome to TuxTest")
  120. time.sleep(0.2)
  121. exec_command(self, 'root')
  122. time.sleep(0.2)
  123. exec_command(self, 'cat /proc/interrupts')
  124. time.sleep(0.1)
  125. exec_command(self, 'cat /proc/self/maps')
  126. time.sleep(0.1)
  127. exec_command(self, 'uname -a')
  128. time.sleep(0.1)
  129. exec_command_and_wait_for_pattern(self, 'halt', haltmsg)
  130. # Wait for VM to shut down gracefully if it can
  131. if self.shutdown == "nowait":
  132. self.vm.shutdown()
  133. else:
  134. self.vm.wait()
  135. def common_tuxrun(self,
  136. csums=None,
  137. dt=None,
  138. drive="virtio-blk-device",
  139. haltmsg="reboot: System halted",
  140. console_index=0):
  141. """
  142. Common path for LKFT tests. Unless we need to do something
  143. special with the command line we can process most things using
  144. the tag metadata.
  145. """
  146. (kernel, disk, dtb) = self.fetch_tuxrun_assets(csums, dt)
  147. self.prepare_run(kernel, disk, drive, dtb, console_index)
  148. self.vm.launch()
  149. self.run_tuxtest_tests(haltmsg)
  150. def ppc64_common_tuxrun(self, sums, prefix):
  151. # add device args to command line.
  152. self.require_netdev('user')
  153. self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
  154. '-device', 'virtio-net,netdev=vnet')
  155. self.vm.add_args('-netdev', '{"type":"user","id":"hostnet0"}',
  156. '-device', '{"driver":"virtio-net-pci","netdev":'
  157. '"hostnet0","id":"net0","mac":"52:54:00:4c:e3:86",'
  158. '"bus":"pci.0","addr":"0x9"}')
  159. self.vm.add_args('-device', '{"driver":"qemu-xhci","p2":15,"p3":15,'
  160. '"id":"usb","bus":"pci.0","addr":"0x2"}')
  161. self.vm.add_args('-device', '{"driver":"virtio-scsi-pci","id":"scsi0"'
  162. ',"bus":"pci.0","addr":"0x3"}')
  163. self.vm.add_args('-device', '{"driver":"virtio-serial-pci","id":'
  164. '"virtio-serial0","bus":"pci.0","addr":"0x4"}')
  165. self.vm.add_args('-device', '{"driver":"scsi-cd","bus":"scsi0.0"'
  166. ',"channel":0,"scsi-id":0,"lun":0,"device_id":'
  167. '"drive-scsi0-0-0-0","id":"scsi0-0-0-0"}')
  168. self.vm.add_args('-device', '{"driver":"virtio-balloon-pci",'
  169. '"id":"balloon0","bus":"pci.0","addr":"0x6"}')
  170. self.vm.add_args('-audiodev', '{"id":"audio1","driver":"none"}')
  171. self.vm.add_args('-device', '{"driver":"usb-tablet","id":"input0"'
  172. ',"bus":"usb.0","port":"1"}')
  173. self.vm.add_args('-device', '{"driver":"usb-kbd","id":"input1"'
  174. ',"bus":"usb.0","port":"2"}')
  175. self.vm.add_args('-device', '{"driver":"VGA","id":"video0",'
  176. '"vgamem_mb":16,"bus":"pci.0","addr":"0x7"}')
  177. self.vm.add_args('-object', '{"qom-type":"rng-random","id":"objrng0"'
  178. ',"filename":"/dev/urandom"}',
  179. '-device', '{"driver":"virtio-rng-pci","rng":"objrng0"'
  180. ',"id":"rng0","bus":"pci.0","addr":"0x8"}')
  181. self.vm.add_args('-object', '{"qom-type":"cryptodev-backend-builtin",'
  182. '"id":"objcrypto0","queues":1}',
  183. '-device', '{"driver":"virtio-crypto-pci",'
  184. '"cryptodev":"objcrypto0","id":"crypto0","bus"'
  185. ':"pci.0","addr":"0xa"}')
  186. self.vm.add_args('-device', '{"driver":"spapr-pci-host-bridge"'
  187. ',"index":1,"id":"pci.1"}')
  188. self.vm.add_args('-device', '{"driver":"spapr-vscsi","id":"scsi1"'
  189. ',"reg":12288}')
  190. self.vm.add_args('-m', '2G,slots=32,maxmem=4G',
  191. '-object', 'memory-backend-ram,id=ram1,size=1G',
  192. '-device', 'pc-dimm,id=dimm1,memdev=ram1')
  193. # Create a temporary qcow2 and launch the test-case
  194. with tempfile.NamedTemporaryFile(prefix=prefix,
  195. suffix='.qcow2') as qcow2:
  196. process.run(self.qemu_img + ' create -f qcow2 ' +
  197. qcow2.name + ' 1G')
  198. self.vm.add_args('-drive', 'file=' + qcow2.name +
  199. ',format=qcow2,if=none,id='
  200. 'drive-virtio-disk1',
  201. '-device', 'virtio-blk-pci,bus=pci.0,'
  202. 'addr=0xb,drive=drive-virtio-disk1,id=virtio-disk1'
  203. ',bootindex=2')
  204. self.common_tuxrun(csums=sums, drive="scsi-hd")
  205. #
  206. # The tests themselves. The configuration is derived from how
  207. # tuxrun invokes qemu (with minor tweaks like using -blockdev
  208. # consistently). The tuxrun equivalent is something like:
  209. #
  210. # tuxrun --device qemu-{ARCH} \
  211. # --kernel https://storage.tuxboot.com/{TUXBOOT}/{IMAGE}
  212. #
  213. def test_arm64(self):
  214. """
  215. :avocado: tags=arch:aarch64
  216. :avocado: tags=cpu:cortex-a57
  217. :avocado: tags=machine:virt
  218. :avocado: tags=tuxboot:arm64
  219. :avocado: tags=console:ttyAMA0
  220. :avocado: tags=shutdown:nowait
  221. """
  222. sums = {"Image" :
  223. "ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7",
  224. "rootfs.ext4.zst" :
  225. "bbd5ed4b9c7d3f4ca19ba71a323a843c6b585e880115df3b7765769dbd9dd061"}
  226. self.common_tuxrun(csums=sums)
  227. def test_arm64be(self):
  228. """
  229. :avocado: tags=arch:aarch64
  230. :avocado: tags=cpu:cortex-a57
  231. :avocado: tags=endian:big
  232. :avocado: tags=machine:virt
  233. :avocado: tags=tuxboot:arm64be
  234. :avocado: tags=console:ttyAMA0
  235. :avocado: tags=shutdown:nowait
  236. """
  237. sums = { "Image" :
  238. "e0df4425eb2cd9ea9a283e808037f805641c65d8fcecc8f6407d8f4f339561b4",
  239. "rootfs.ext4.zst" :
  240. "e6ffd8813c8a335bc15728f2835f90539c84be7f8f5f691a8b01451b47fb4bd7"}
  241. self.common_tuxrun(csums=sums)
  242. def test_armv5(self):
  243. """
  244. :avocado: tags=arch:arm
  245. :avocado: tags=cpu:arm926
  246. :avocado: tags=machine:versatilepb
  247. :avocado: tags=tuxboot:armv5
  248. :avocado: tags=image:zImage
  249. :avocado: tags=console:ttyAMA0
  250. :avocado: tags=shutdown:nowait
  251. """
  252. sums = { "rootfs.ext4.zst" :
  253. "17177afa74e7294da0642861f08c88ca3c836764299a54bf6d1ce276cb9712a5",
  254. "versatile-pb.dtb" :
  255. "0bc0c0b0858cefd3c32b385c0d66d97142ded29472a496f4f490e42fc7615b25",
  256. "zImage" :
  257. "c95af2f27647c12265d75e9df44c22ff5228c59855f54aaa70f41ec2842e3a4d" }
  258. self.common_tuxrun(csums=sums,
  259. drive="virtio-blk-pci",
  260. dt="versatile-pb.dtb")
  261. def test_armv7(self):
  262. """
  263. :avocado: tags=arch:arm
  264. :avocado: tags=cpu:cortex-a15
  265. :avocado: tags=machine:virt
  266. :avocado: tags=tuxboot:armv7
  267. :avocado: tags=image:zImage
  268. :avocado: tags=console:ttyAMA0
  269. :avocado: tags=shutdown:nowait
  270. """
  271. sums = { "rootfs.ext4.zst" :
  272. "ab1fbbeaddda1ffdd45c9405a28cd5370c20f23a7cbc809cc90dc9f243a8eb5a",
  273. "zImage" :
  274. "4c7a22e9f15875bec06bd2a29d822496571eb297d4f22694099ffcdb19077572" }
  275. self.common_tuxrun(csums=sums)
  276. def test_armv7be(self):
  277. """
  278. :avocado: tags=arch:arm
  279. :avocado: tags=cpu:cortex-a15
  280. :avocado: tags=endian:big
  281. :avocado: tags=machine:virt
  282. :avocado: tags=tuxboot:armv7be
  283. :avocado: tags=image:zImage
  284. :avocado: tags=console:ttyAMA0
  285. :avocado: tags=shutdown:nowait
  286. """
  287. sums = {"rootfs.ext4.zst" :
  288. "42ed46dd2d59986206c5b1f6cf35eab58fe3fd20c96b41aaa16b32f3f90a9835",
  289. "zImage" :
  290. "7facc62082b57af12015b08f7fdbaf2f123ba07a478367853ae12b219afc9f2f" }
  291. self.common_tuxrun(csums=sums)
  292. def test_i386(self):
  293. """
  294. :avocado: tags=arch:i386
  295. :avocado: tags=cpu:coreduo
  296. :avocado: tags=machine:q35
  297. :avocado: tags=tuxboot:i386
  298. :avocado: tags=image:bzImage
  299. :avocado: tags=shutdown:nowait
  300. """
  301. sums = {"bzImage" :
  302. "a3e5b32a354729e65910f5a1ffcda7c14a6c12a55e8213fb86e277f1b76ed956",
  303. "rootfs.ext4.zst" :
  304. "f15e66b2bf673a210ec2a4b2e744a80530b36289e04f5388aab812b97f69754a" }
  305. self.common_tuxrun(csums=sums, drive="virtio-blk-pci")
  306. def test_mips32(self):
  307. """
  308. :avocado: tags=arch:mips
  309. :avocado: tags=machine:malta
  310. :avocado: tags=cpu:mips32r6-generic
  311. :avocado: tags=endian:big
  312. :avocado: tags=tuxboot:mips32
  313. :avocado: tags=image:vmlinux
  314. :avocado: tags=root:sda
  315. :avocado: tags=shutdown:nowait
  316. """
  317. sums = { "rootfs.ext4.zst" :
  318. "fc3da0b4c2f38d74c6d705123bb0f633c76ed953128f9d0859378c328a6d11a0",
  319. "vmlinux" :
  320. "bfd2172f8b17fb32970ca0c8c58f59c5a4ca38aa5855d920be3a69b5d16e52f0" }
  321. self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
  322. def test_mips32el(self):
  323. """
  324. :avocado: tags=arch:mipsel
  325. :avocado: tags=machine:malta
  326. :avocado: tags=cpu:mips32r6-generic
  327. :avocado: tags=tuxboot:mips32el
  328. :avocado: tags=image:vmlinux
  329. :avocado: tags=root:sda
  330. :avocado: tags=shutdown:nowait
  331. """
  332. sums = { "rootfs.ext4.zst" :
  333. "e799768e289fd69209c21f4dacffa11baea7543d5db101e8ce27e3bc2c41d90e",
  334. "vmlinux" :
  335. "8573867c68a8443db8de6d08bb33fb291c189ca2ca671471d3973a3e712096a3" }
  336. self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
  337. def test_mips64(self):
  338. """
  339. :avocado: tags=arch:mips64
  340. :avocado: tags=machine:malta
  341. :avocado: tags=tuxboot:mips64
  342. :avocado: tags=endian:big
  343. :avocado: tags=image:vmlinux
  344. :avocado: tags=root:sda
  345. :avocado: tags=shutdown:nowait
  346. """
  347. sums = { "rootfs.ext4.zst" :
  348. "69d91eeb04df3d8d172922c6993bb37d4deeb6496def75d8580f6f9de3e431da",
  349. "vmlinux" :
  350. "09010e51e4b8bcbbd2494786ffb48eca78f228e96e5c5438344b0eac4029dc61" }
  351. self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
  352. def test_mips64el(self):
  353. """
  354. :avocado: tags=arch:mips64el
  355. :avocado: tags=machine:malta
  356. :avocado: tags=tuxboot:mips64el
  357. :avocado: tags=image:vmlinux
  358. :avocado: tags=root:sda
  359. :avocado: tags=shutdown:nowait
  360. """
  361. sums = { "rootfs.ext4.zst" :
  362. "fba585368f5915b1498ed081863474b2d7ec4e97cdd46d21bdcb2f9698f83de4",
  363. "vmlinux" :
  364. "d4e08965e2155c4cccce7c5f34d18fe34c636cda2f2c9844387d614950155266" }
  365. self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
  366. def test_ppc32(self):
  367. """
  368. :avocado: tags=arch:ppc
  369. :avocado: tags=machine:ppce500
  370. :avocado: tags=cpu:e500mc
  371. :avocado: tags=tuxboot:ppc32
  372. :avocado: tags=image:uImage
  373. :avocado: tags=shutdown:nowait
  374. """
  375. sums = { "rootfs.ext4.zst" :
  376. "8885b9d999cc24d679542a02e9b6aaf48f718f2050ece6b8347074b6ee41dd09",
  377. "uImage" :
  378. "1a68f74b860fda022fb12e03c5efece8c2b8b590d96cca37a8481a3ae0b3f81f" }
  379. self.common_tuxrun(csums=sums, drive="virtio-blk-pci")
  380. def test_ppc64(self):
  381. """
  382. :avocado: tags=arch:ppc64
  383. :avocado: tags=machine:pseries
  384. :avocado: tags=cpu:POWER10
  385. :avocado: tags=endian:big
  386. :avocado: tags=console:hvc0
  387. :avocado: tags=tuxboot:ppc64
  388. :avocado: tags=image:vmlinux
  389. :avocado: tags=extradev:driver=spapr-vscsi
  390. :avocado: tags=root:sda
  391. """
  392. sums = { "rootfs.ext4.zst" :
  393. "1d953e81a4379e537fc8e41e05a0a59d9b453eef97aa03d47866c6c45b00bdff",
  394. "vmlinux" :
  395. "f22a9b9e924174a4c199f4c7e5d91a2339fcfe51c6eafd0907dc3e09b64ab728" }
  396. self.ppc64_common_tuxrun(sums, prefix='tuxrun_ppc64_')
  397. def test_ppc64le(self):
  398. """
  399. :avocado: tags=arch:ppc64
  400. :avocado: tags=machine:pseries
  401. :avocado: tags=cpu:POWER10
  402. :avocado: tags=console:hvc0
  403. :avocado: tags=tuxboot:ppc64le
  404. :avocado: tags=image:vmlinux
  405. :avocado: tags=extradev:driver=spapr-vscsi
  406. :avocado: tags=root:sda
  407. """
  408. sums = { "rootfs.ext4.zst" :
  409. "b442678c93fb8abe1f7d3bfa20556488de6b475c22c8fed363f42cf81a0a3906",
  410. "vmlinux" :
  411. "979eb61b445a010fb13e2b927126991f8ceef9c590fa2be0996c00e293e80cf2" }
  412. self.ppc64_common_tuxrun(sums, prefix='tuxrun_ppc64le_')
  413. def test_riscv32(self):
  414. """
  415. :avocado: tags=arch:riscv32
  416. :avocado: tags=machine:virt
  417. :avocado: tags=tuxboot:riscv32
  418. """
  419. sums = { "Image" :
  420. "89599407d7334de629a40e7ad6503c73670359eb5f5ae9d686353a3d6deccbd5",
  421. "fw_jump.elf" :
  422. "f2ef28a0b77826f79d085d3e4aa686f1159b315eff9099a37046b18936676985",
  423. "rootfs.ext4.zst" :
  424. "7168d296d0283238ea73cd5a775b3dd608e55e04c7b92b76ecce31bb13108cba" }
  425. self.common_tuxrun(csums=sums)
  426. def test_riscv64(self):
  427. """
  428. :avocado: tags=arch:riscv64
  429. :avocado: tags=machine:virt
  430. :avocado: tags=tuxboot:riscv64
  431. """
  432. sums = { "Image" :
  433. "cd634badc65e52fb63465ec99e309c0de0369f0841b7d9486f9729e119bac25e",
  434. "fw_jump.elf" :
  435. "6e3373abcab4305fe151b564a4c71110d833c21f2c0a1753b7935459e36aedcf",
  436. "rootfs.ext4.zst" :
  437. "b18e3a3bdf27be03da0b285e84cb71bf09eca071c3a087b42884b6982ed679eb" }
  438. self.common_tuxrun(csums=sums)
  439. def test_riscv32_maxcpu(self):
  440. """
  441. :avocado: tags=arch:riscv32
  442. :avocado: tags=machine:virt
  443. :avocado: tags=cpu:max
  444. :avocado: tags=tuxboot:riscv32
  445. """
  446. sums = { "Image" :
  447. "89599407d7334de629a40e7ad6503c73670359eb5f5ae9d686353a3d6deccbd5",
  448. "fw_jump.elf" :
  449. "f2ef28a0b77826f79d085d3e4aa686f1159b315eff9099a37046b18936676985",
  450. "rootfs.ext4.zst" :
  451. "7168d296d0283238ea73cd5a775b3dd608e55e04c7b92b76ecce31bb13108cba" }
  452. self.common_tuxrun(csums=sums)
  453. def test_riscv64_maxcpu(self):
  454. """
  455. :avocado: tags=arch:riscv64
  456. :avocado: tags=machine:virt
  457. :avocado: tags=cpu:max
  458. :avocado: tags=tuxboot:riscv64
  459. """
  460. sums = { "Image" :
  461. "cd634badc65e52fb63465ec99e309c0de0369f0841b7d9486f9729e119bac25e",
  462. "fw_jump.elf" :
  463. "6e3373abcab4305fe151b564a4c71110d833c21f2c0a1753b7935459e36aedcf",
  464. "rootfs.ext4.zst" :
  465. "b18e3a3bdf27be03da0b285e84cb71bf09eca071c3a087b42884b6982ed679eb" }
  466. self.common_tuxrun(csums=sums)
  467. def test_s390(self):
  468. """
  469. :avocado: tags=arch:s390x
  470. :avocado: tags=endian:big
  471. :avocado: tags=tuxboot:s390
  472. :avocado: tags=image:bzImage
  473. :avocado: tags=shutdown:nowait
  474. """
  475. sums = { "bzImage" :
  476. "0414e98dd1c3dafff8496c9cd9c28a5f8d04553bb5ba37e906a812b48d442ef0",
  477. "rootfs.ext4.zst" :
  478. "88c37c32276677f873a25ab9ec6247895b8e3e6f8259134de2a616080b8ab3fc" }
  479. self.common_tuxrun(csums=sums,
  480. drive="virtio-blk-ccw",
  481. haltmsg="Requesting system halt")
  482. # Note: some segfaults caused by unaligned userspace access
  483. @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
  484. def test_sh4(self):
  485. """
  486. :avocado: tags=arch:sh4
  487. :avocado: tags=machine:r2d
  488. :avocado: tags=cpu:sh7785
  489. :avocado: tags=tuxboot:sh4
  490. :avocado: tags=image:zImage
  491. :avocado: tags=root:sda
  492. :avocado: tags=console:ttySC1
  493. :avocado: tags=flaky
  494. """
  495. sums = { "rootfs.ext4.zst" :
  496. "3592a7a3d5a641e8b9821449e77bc43c9904a56c30d45da0694349cfd86743fd",
  497. "zImage" :
  498. "29d9b2aba604a0f53a5dc3b5d0f2b8e35d497de1129f8ee5139eb6fdf0db692f" }
  499. # The test is currently too unstable to do much in userspace
  500. # so we skip common_tuxrun and do a minimal boot and shutdown.
  501. (kernel, disk, dtb) = self.fetch_tuxrun_assets(csums=sums)
  502. # the console comes on the second serial port
  503. self.prepare_run(kernel, disk,
  504. "driver=ide-hd,bus=ide.0,unit=0",
  505. console_index=1)
  506. self.vm.launch()
  507. self.wait_for_console_pattern("Welcome to TuxTest")
  508. time.sleep(0.1)
  509. exec_command(self, 'root')
  510. time.sleep(0.1)
  511. exec_command_and_wait_for_pattern(self, 'halt',
  512. "reboot: System halted")
  513. def test_sparc64(self):
  514. """
  515. :avocado: tags=arch:sparc64
  516. :avocado: tags=tuxboot:sparc64
  517. :avocado: tags=image:vmlinux
  518. :avocado: tags=root:sda
  519. :avocado: tags=shutdown:nowait
  520. """
  521. sums = { "rootfs.ext4.zst" :
  522. "ad2f1dc436ab51583543d25d2c210cab478645d47078d30d129a66ab0e281d76",
  523. "vmlinux" :
  524. "e34313e4325ff21deaa3d38a502aa09a373ef62b9bd4d7f8f29388b688225c55" }
  525. self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
  526. def test_x86_64(self):
  527. """
  528. :avocado: tags=arch:x86_64
  529. :avocado: tags=machine:q35
  530. :avocado: tags=cpu:Nehalem
  531. :avocado: tags=tuxboot:x86_64
  532. :avocado: tags=image:bzImage
  533. :avocado: tags=root:sda
  534. :avocado: tags=shutdown:nowait
  535. """
  536. sums = { "bzImage" :
  537. "2bc7480a669ee9b6b82500a236aba0c54233debe98cb968268fa230f52f03461",
  538. "rootfs.ext4.zst" :
  539. "b72ac729769b8f51c6dffb221113c9a063c774dbe1d66af30eb593c4e9999b4b" }
  540. self.common_tuxrun(csums=sums,
  541. drive="driver=ide-hd,bus=ide.0,unit=0")