1# Record/replay test that boots a Linux kernel 2# 3# Copyright (c) 2020 ISP RAS 4# 5# Author: 6# Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> 7# 8# This work is licensed under the terms of the GNU GPL, version 2 or 9# later. See the COPYING file in the top-level directory. 10 11import os 12import lzma 13import shutil 14import logging 15import time 16 17from avocado import skip 18from avocado import skipUnless 19from avocado import skipUnless 20from avocado_qemu import wait_for_console_pattern 21from avocado.utils import archive 22from avocado.utils import process 23from boot_linux_console import LinuxKernelTest 24 25class ReplayKernelBase(LinuxKernelTest): 26 """ 27 Boots a Linux kernel in record mode and checks that the console 28 is operational and the kernel command line is properly passed 29 from QEMU to the kernel. 30 Then replays the same scenario and verifies, that QEMU correctly 31 terminates. 32 """ 33 34 timeout = 120 35 KERNEL_COMMON_COMMAND_LINE = 'printk.time=1 panic=-1 ' 36 37 def run_vm(self, kernel_path, kernel_command_line, console_pattern, 38 record, shift, args, replay_path): 39 # icount requires TCG to be available 40 self.require_accelerator('tcg') 41 42 logger = logging.getLogger('replay') 43 start_time = time.time() 44 vm = self.get_vm() 45 vm.set_console() 46 if record: 47 logger.info('recording the execution...') 48 mode = 'record' 49 else: 50 logger.info('replaying the execution...') 51 mode = 'replay' 52 vm.add_args('-icount', 'shift=%s,rr=%s,rrfile=%s' % 53 (shift, mode, replay_path), 54 '-kernel', kernel_path, 55 '-append', kernel_command_line, 56 '-net', 'none', 57 '-no-reboot') 58 if args: 59 vm.add_args(*args) 60 vm.launch() 61 self.wait_for_console_pattern(console_pattern, vm) 62 if record: 63 vm.shutdown() 64 logger.info('finished the recording with log size %s bytes' 65 % os.path.getsize(replay_path)) 66 else: 67 vm.wait() 68 logger.info('successfully finished the replay') 69 elapsed = time.time() - start_time 70 logger.info('elapsed time %.2f sec' % elapsed) 71 return elapsed 72 73 def run_rr(self, kernel_path, kernel_command_line, console_pattern, 74 shift=7, args=None): 75 replay_path = os.path.join(self.workdir, 'replay.bin') 76 t1 = self.run_vm(kernel_path, kernel_command_line, console_pattern, 77 True, shift, args, replay_path) 78 t2 = self.run_vm(kernel_path, kernel_command_line, console_pattern, 79 False, shift, args, replay_path) 80 logger = logging.getLogger('replay') 81 logger.info('replay overhead {:.2%}'.format(t2 / t1 - 1)) 82 83class ReplayKernelNormal(ReplayKernelBase): 84 85 def test_i386_pc(self): 86 """ 87 :avocado: tags=arch:i386 88 :avocado: tags=machine:pc 89 """ 90 kernel_url = ('https://storage.tuxboot.com/20230331/i386/bzImage') 91 kernel_hash = 'a3e5b32a354729e65910f5a1ffcda7c14a6c12a55e8213fb86e277f1b76ed956' 92 kernel_path = self.fetch_asset(kernel_url, 93 asset_hash=kernel_hash, 94 algorithm = "sha256") 95 96 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' 97 console_pattern = 'VFS: Cannot open root device' 98 99 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5) 100 101 # See https://gitlab.com/qemu-project/qemu/-/issues/2010 102 @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test sometimes gets stuck') 103 def test_x86_64_pc(self): 104 """ 105 :avocado: tags=arch:x86_64 106 :avocado: tags=machine:pc 107 :avocado: tags=flaky 108 """ 109 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' 110 '/linux/releases/29/Everything/x86_64/os/images/pxeboot' 111 '/vmlinuz') 112 kernel_hash = '23bebd2680757891cf7adedb033532163a792495' 113 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 114 115 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' 116 console_pattern = 'VFS: Cannot open root device' 117 118 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5) 119 120 def test_mips_malta(self): 121 """ 122 :avocado: tags=arch:mips 123 :avocado: tags=machine:malta 124 :avocado: tags=endian:big 125 """ 126 deb_url = ('http://snapshot.debian.org/archive/debian/' 127 '20130217T032700Z/pool/main/l/linux-2.6/' 128 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') 129 deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' 130 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) 131 kernel_path = self.extract_from_deb(deb_path, 132 '/boot/vmlinux-2.6.32-5-4kc-malta') 133 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' 134 console_pattern = 'Kernel command line: %s' % kernel_command_line 135 136 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5) 137 138 # See https://gitlab.com/qemu-project/qemu/-/issues/2013 139 @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab') 140 def test_mips64el_malta(self): 141 """ 142 This test requires the ar tool to extract "data.tar.gz" from 143 the Debian package. 144 145 The kernel can be rebuilt using this Debian kernel source [1] and 146 following the instructions on [2]. 147 148 [1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/ 149 #linux-source-2.6.32_2.6.32-48 150 [2] https://kernel-team.pages.debian.net/kernel-handbook/ 151 ch-common-tasks.html#s-common-official 152 153 :avocado: tags=arch:mips64el 154 :avocado: tags=machine:malta 155 :avocado: tags=flaky 156 """ 157 deb_url = ('http://snapshot.debian.org/archive/debian/' 158 '20130217T032700Z/pool/main/l/linux-2.6/' 159 'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb') 160 deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5' 161 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) 162 kernel_path = self.extract_from_deb(deb_path, 163 '/boot/vmlinux-2.6.32-5-5kc-malta') 164 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' 165 console_pattern = 'Kernel command line: %s' % kernel_command_line 166 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5) 167 168 def test_aarch64_virt(self): 169 """ 170 :avocado: tags=arch:aarch64 171 :avocado: tags=machine:virt 172 :avocado: tags=cpu:cortex-a53 173 """ 174 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' 175 '/linux/releases/29/Everything/aarch64/os/images/pxeboot' 176 '/vmlinuz') 177 kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493' 178 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 179 180 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 181 'console=ttyAMA0') 182 console_pattern = 'VFS: Cannot open root device' 183 184 self.run_rr(kernel_path, kernel_command_line, console_pattern) 185 186 def test_arm_virt(self): 187 """ 188 :avocado: tags=arch:arm 189 :avocado: tags=machine:virt 190 """ 191 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' 192 '/linux/releases/29/Everything/armhfp/os/images/pxeboot' 193 '/vmlinuz') 194 kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4' 195 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 196 197 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 198 'console=ttyAMA0') 199 console_pattern = 'VFS: Cannot open root device' 200 201 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1) 202 203 @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab') 204 205 def test_arm_cubieboard_initrd(self): 206 """ 207 :avocado: tags=arch:arm 208 :avocado: tags=machine:cubieboard 209 :avocado: tags=flaky 210 """ 211 deb_url = ('https://apt.armbian.com/pool/main/l/' 212 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb') 213 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' 214 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) 215 kernel_path = self.extract_from_deb(deb_path, 216 '/boot/vmlinuz-5.10.16-sunxi') 217 dtb_path = '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb' 218 dtb_path = self.extract_from_deb(deb_path, dtb_path) 219 initrd_url = ('https://github.com/groeck/linux-build-test/raw/' 220 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' 221 'arm/rootfs-armv5.cpio.gz') 222 initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b' 223 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) 224 initrd_path = os.path.join(self.workdir, 'rootfs.cpio') 225 archive.gzip_uncompress(initrd_path_gz, initrd_path) 226 227 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 228 'console=ttyS0,115200 ' 229 'usbcore.nousb ' 230 'panic=-1 noreboot') 231 console_pattern = 'Boot successful.' 232 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1, 233 args=('-dtb', dtb_path, 234 '-initrd', initrd_path, 235 '-no-reboot')) 236 237 def test_s390x_s390_ccw_virtio(self): 238 """ 239 :avocado: tags=arch:s390x 240 :avocado: tags=machine:s390-ccw-virtio 241 """ 242 kernel_url = ('https://archives.fedoraproject.org/pub/archive' 243 '/fedora-secondary/releases/29/Everything/s390x/os/images' 244 '/kernel.img') 245 kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313' 246 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 247 248 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0' 249 console_pattern = 'Kernel command line: %s' % kernel_command_line 250 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=9) 251 252 def test_alpha_clipper(self): 253 """ 254 :avocado: tags=arch:alpha 255 :avocado: tags=machine:clipper 256 """ 257 kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/' 258 'installer-alpha/20090123lenny10/images/cdrom/vmlinuz') 259 kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3' 260 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 261 262 uncompressed_kernel = archive.uncompress(kernel_path, self.workdir) 263 264 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' 265 console_pattern = 'Kernel command line: %s' % kernel_command_line 266 self.run_rr(uncompressed_kernel, kernel_command_line, console_pattern, shift=9, 267 args=('-nodefaults', )) 268 269 def test_ppc64_pseries(self): 270 """ 271 :avocado: tags=arch:ppc64 272 :avocado: tags=machine:pseries 273 :avocado: tags=accel:tcg 274 """ 275 kernel_url = ('https://archives.fedoraproject.org/pub/archive' 276 '/fedora-secondary/releases/29/Everything/ppc64le/os' 277 '/ppc/ppc64/vmlinuz') 278 kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77' 279 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 280 281 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0' 282 console_pattern = 'VFS: Cannot open root device' 283 self.run_rr(kernel_path, kernel_command_line, console_pattern) 284 285 def test_ppc64_powernv(self): 286 """ 287 :avocado: tags=arch:ppc64 288 :avocado: tags=machine:powernv 289 :avocado: tags=accel:tcg 290 """ 291 kernel_url = ('https://archives.fedoraproject.org/pub/archive' 292 '/fedora-secondary/releases/29/Everything/ppc64le/os' 293 '/ppc/ppc64/vmlinuz') 294 kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77' 295 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 296 297 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + \ 298 'console=tty0 console=hvc0' 299 console_pattern = 'VFS: Cannot open root device' 300 self.run_rr(kernel_path, kernel_command_line, console_pattern) 301 302 def test_m68k_q800(self): 303 """ 304 :avocado: tags=arch:m68k 305 :avocado: tags=machine:q800 306 """ 307 deb_url = ('https://snapshot.debian.org/archive/debian-ports' 308 '/20191021T083923Z/pool-m68k/main' 309 '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb') 310 deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1' 311 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) 312 kernel_path = self.extract_from_deb(deb_path, 313 '/boot/vmlinux-5.3.0-1-m68k') 314 315 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 316 'console=ttyS0 vga=off') 317 console_pattern = 'No filesystem could mount root' 318 self.run_rr(kernel_path, kernel_command_line, console_pattern) 319 320 def do_test_advcal_2018(self, file_path, kernel_name, args=None): 321 archive.extract(file_path, self.workdir) 322 323 for entry in os.scandir(self.workdir): 324 if entry.name.startswith('day') and entry.is_dir(): 325 kernel_path = os.path.join(entry.path, kernel_name) 326 break 327 328 kernel_command_line = '' 329 console_pattern = 'QEMU advent calendar' 330 self.run_rr(kernel_path, kernel_command_line, console_pattern, 331 args=args) 332 333 def test_arm_vexpressa9(self): 334 """ 335 :avocado: tags=arch:arm 336 :avocado: tags=machine:vexpress-a9 337 """ 338 tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b' 339 tar_url = ('https://qemu-advcal.gitlab.io' 340 '/qac-best-of-multiarch/download/day16.tar.xz') 341 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 342 dtb_path = self.workdir + '/day16/vexpress-v2p-ca9.dtb' 343 self.do_test_advcal_2018(file_path, 'winter.zImage', 344 args=('-dtb', dtb_path)) 345 346 def test_m68k_mcf5208evb(self): 347 """ 348 :avocado: tags=arch:m68k 349 :avocado: tags=machine:mcf5208evb 350 """ 351 tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c' 352 tar_url = ('https://qemu-advcal.gitlab.io' 353 '/qac-best-of-multiarch/download/day07.tar.xz') 354 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 355 self.do_test_advcal_2018(file_path, 'sanity-clause.elf') 356 357 @skip("Test currently broken") # Console stuck as of 5.2-rc1 358 def test_microblaze_s3adsp1800(self): 359 """ 360 :avocado: tags=arch:microblaze 361 :avocado: tags=machine:petalogix-s3adsp1800 362 """ 363 tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f' 364 tar_url = ('https://qemu-advcal.gitlab.io' 365 '/qac-best-of-multiarch/download/day17.tar.xz') 366 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 367 self.do_test_advcal_2018(file_path, 'ballerina.bin') 368 369 def test_ppc64_e500(self): 370 """ 371 :avocado: tags=arch:ppc64 372 :avocado: tags=machine:ppce500 373 :avocado: tags=cpu:e5500 374 """ 375 tar_hash = '6951d86d644b302898da2fd701739c9406527fe1' 376 tar_url = ('https://qemu-advcal.gitlab.io' 377 '/qac-best-of-multiarch/download/day19.tar.xz') 378 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 379 self.do_test_advcal_2018(file_path, 'uImage') 380 381 def test_or1k_sim(self): 382 """ 383 :avocado: tags=arch:or1k 384 :avocado: tags=machine:or1k-sim 385 """ 386 tar_hash = '20334cdaf386108c530ff0badaecc955693027dd' 387 tar_url = ('https://qemu-advcal.gitlab.io' 388 '/qac-best-of-multiarch/download/day20.tar.xz') 389 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 390 self.do_test_advcal_2018(file_path, 'vmlinux') 391 392 @skip("nios2 emulation is buggy under record/replay") 393 def test_nios2_10m50(self): 394 """ 395 :avocado: tags=arch:nios2 396 :avocado: tags=machine:10m50-ghrd 397 """ 398 tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918' 399 tar_url = ('https://qemu-advcal.gitlab.io' 400 '/qac-best-of-multiarch/download/day14.tar.xz') 401 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 402 self.do_test_advcal_2018(file_path, 'vmlinux.elf') 403 404 def test_ppc_g3beige(self): 405 """ 406 :avocado: tags=arch:ppc 407 :avocado: tags=machine:g3beige 408 """ 409 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' 410 tar_url = ('https://qemu-advcal.gitlab.io' 411 '/qac-best-of-multiarch/download/day15.tar.xz') 412 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 413 self.do_test_advcal_2018(file_path, 'invaders.elf', 414 args=('-M', 'graphics=off')) 415 416 def test_ppc_mac99(self): 417 """ 418 :avocado: tags=arch:ppc 419 :avocado: tags=machine:mac99 420 """ 421 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' 422 tar_url = ('https://qemu-advcal.gitlab.io' 423 '/qac-best-of-multiarch/download/day15.tar.xz') 424 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 425 self.do_test_advcal_2018(file_path, 'invaders.elf', 426 args=('-M', 'graphics=off')) 427 428 def test_sparc_ss20(self): 429 """ 430 :avocado: tags=arch:sparc 431 :avocado: tags=machine:SS-20 432 """ 433 tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f' 434 tar_url = ('https://qemu-advcal.gitlab.io' 435 '/qac-best-of-multiarch/download/day11.tar.xz') 436 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 437 self.do_test_advcal_2018(file_path, 'zImage.elf') 438 439 def test_xtensa_lx60(self): 440 """ 441 :avocado: tags=arch:xtensa 442 :avocado: tags=machine:lx60 443 :avocado: tags=cpu:dc233c 444 """ 445 tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' 446 tar_url = ('https://qemu-advcal.gitlab.io' 447 '/qac-best-of-multiarch/download/day02.tar.xz') 448 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) 449 self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf') 450 451@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') 452class ReplayKernelSlow(ReplayKernelBase): 453 # Override the timeout, because this kernel includes an inner 454 # loop which is executed with TB recompilings during replay, 455 # making it very slow. 456 timeout = 180 457 458 def test_mips_malta_cpio(self): 459 """ 460 :avocado: tags=arch:mips 461 :avocado: tags=machine:malta 462 :avocado: tags=endian:big 463 :avocado: tags=slowness:high 464 """ 465 deb_url = ('http://snapshot.debian.org/archive/debian/' 466 '20160601T041800Z/pool/main/l/linux/' 467 'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb') 468 deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8' 469 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) 470 kernel_path = self.extract_from_deb(deb_path, 471 '/boot/vmlinux-4.5.0-2-4kc-malta') 472 initrd_url = ('https://github.com/groeck/linux-build-test/raw/' 473 '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' 474 'mips/rootfs.cpio.gz') 475 initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99' 476 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) 477 initrd_path = self.workdir + "rootfs.cpio" 478 archive.gzip_uncompress(initrd_path_gz, initrd_path) 479 480 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 481 'console=ttyS0 console=tty ' 482 'rdinit=/sbin/init noreboot') 483 console_pattern = 'Boot successful.' 484 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5, 485 args=('-initrd', initrd_path)) 486 487 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') 488 def test_mips64el_malta_5KEc_cpio(self): 489 """ 490 :avocado: tags=arch:mips64el 491 :avocado: tags=machine:malta 492 :avocado: tags=endian:little 493 :avocado: tags=slowness:high 494 :avocado: tags=cpu:5KEc 495 """ 496 kernel_url = ('https://github.com/philmd/qemu-testing-blob/' 497 'raw/9ad2df38/mips/malta/mips64el/' 498 'vmlinux-3.19.3.mtoman.20150408') 499 kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754' 500 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 501 initrd_url = ('https://github.com/groeck/linux-build-test/' 502 'raw/8584a59e/rootfs/' 503 'mipsel64/rootfs.mipsel64r1.cpio.gz') 504 initrd_hash = '1dbb8a396e916847325284dbe2151167' 505 initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5', 506 asset_hash=initrd_hash) 507 initrd_path = self.workdir + "rootfs.cpio" 508 archive.gzip_uncompress(initrd_path_gz, initrd_path) 509 510 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 511 'console=ttyS0 console=tty ' 512 'rdinit=/sbin/init noreboot') 513 console_pattern = 'Boot successful.' 514 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5, 515 args=('-initrd', initrd_path)) 516 517 def do_test_mips_malta32el_nanomips(self, kernel_path_xz): 518 kernel_path = self.workdir + "kernel" 519 with lzma.open(kernel_path_xz, 'rb') as f_in: 520 with open(kernel_path, 'wb') as f_out: 521 shutil.copyfileobj(f_in, f_out) 522 523 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 524 'mem=256m@@0x0 ' 525 'console=ttyS0') 526 console_pattern = 'Kernel command line: %s' % kernel_command_line 527 self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5) 528 529 def test_mips_malta32el_nanomips_4k(self): 530 """ 531 :avocado: tags=arch:mipsel 532 :avocado: tags=machine:malta 533 :avocado: tags=endian:little 534 :avocado: tags=cpu:I7200 535 """ 536 kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/' 537 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 538 'generic_nano32r6el_page4k.xz') 539 kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6' 540 kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 541 self.do_test_mips_malta32el_nanomips(kernel_path_xz) 542 543 def test_mips_malta32el_nanomips_16k_up(self): 544 """ 545 :avocado: tags=arch:mipsel 546 :avocado: tags=machine:malta 547 :avocado: tags=endian:little 548 :avocado: tags=cpu:I7200 549 """ 550 kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/' 551 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 552 'generic_nano32r6el_page16k_up.xz') 553 kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc' 554 kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 555 self.do_test_mips_malta32el_nanomips(kernel_path_xz) 556 557 def test_mips_malta32el_nanomips_64k_dbg(self): 558 """ 559 :avocado: tags=arch:mipsel 560 :avocado: tags=machine:malta 561 :avocado: tags=endian:little 562 :avocado: tags=cpu:I7200 563 """ 564 kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/' 565 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 566 'generic_nano32r6el_page64k_dbg.xz') 567 kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180' 568 kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) 569 self.do_test_mips_malta32el_nanomips(kernel_path_xz) 570