1 # Functional test that boots a Linux kernel and checks the console
3 # Copyright (c) 2018 Red Hat, Inc.
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.
16 from avocado import skip
17 from avocado import skipUnless
18 from avocado import skipIf
19 from avocado_qemu import QemuSystemTest
20 from avocado_qemu import exec_command
21 from avocado_qemu import exec_command_and_wait_for_pattern
22 from avocado_qemu import interrupt_interactive_console_until_pattern
23 from avocado_qemu import wait_for_console_pattern
24 from avocado.utils import process
25 from avocado.utils import archive
28 Round up to next power of 2
31 return 1 if x == 0 else 2**(x - 1).bit_length()
34 Expand file size to next power of 2
36 def image_pow2ceil_expand(path):
37 size = os.path.getsize(path)
38 size_aligned = pow2ceil(size)
39 if size != size_aligned:
40 with open(path, 'ab+') as fd:
41 fd.truncate(size_aligned)
43 class LinuxKernelTest(QemuSystemTest):
44 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
46 def wait_for_console_pattern(self, success_message, vm=None):
47 wait_for_console_pattern(self, success_message,
48 failure_message='Kernel panic - not syncing',
51 def extract_from_deb(self, deb, path):
53 Extracts a file from a deb package into the test workdir
55 :param deb: path to the deb archive
56 :param path: path within the deb archive of the file to be extracted
57 :returns: path of the extracted file
60 os.chdir(self.workdir)
61 file_path = process.run("ar t %s" % deb).stdout_text.split()[2]
62 process.run("ar x %s %s" % (deb, file_path))
63 archive.extract(file_path, self.workdir)
65 # Return complete path to extracted file. Because callers to
66 # extract_from_deb() specify 'path' with a leading slash, it is
67 # necessary to use os.path.relpath() as otherwise os.path.join()
68 # interprets it as an absolute path and drops the self.workdir part.
69 return os.path.normpath(os.path.join(self.workdir,
70 os.path.relpath(path, '/')))
72 def extract_from_rpm(self, rpm, path):
74 Extracts a file from an RPM package into the test workdir.
76 :param rpm: path to the rpm archive
77 :param path: path within the rpm archive of the file to be extracted
78 needs to be a relative path (starting with './') because
79 cpio(1), which is used to extract the file, expects that.
80 :returns: path of the extracted file
83 os.chdir(self.workdir)
84 process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True)
86 return os.path.normpath(os.path.join(self.workdir, path))
88 class BootLinuxConsole(LinuxKernelTest):
90 Boots a Linux kernel and checks that the console is operational and the
91 kernel command line is properly passed from QEMU to the kernel
95 def test_x86_64_pc(self):
97 :avocado: tags=arch:x86_64
98 :avocado: tags=machine:pc
100 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
101 '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
103 kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
104 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
106 self.vm.set_console()
107 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
108 self.vm.add_args('-kernel', kernel_path,
109 '-append', kernel_command_line)
111 console_pattern = 'Kernel command line: %s' % kernel_command_line
112 self.wait_for_console_pattern(console_pattern)
114 def test_mips_malta(self):
116 :avocado: tags=arch:mips
117 :avocado: tags=machine:malta
118 :avocado: tags=endian:big
120 deb_url = ('http://snapshot.debian.org/archive/debian/'
121 '20130217T032700Z/pool/main/l/linux-2.6/'
122 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb')
123 deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04'
124 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
125 kernel_path = self.extract_from_deb(deb_path,
126 '/boot/vmlinux-2.6.32-5-4kc-malta')
128 self.vm.set_console()
129 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
130 self.vm.add_args('-kernel', kernel_path,
131 '-append', kernel_command_line)
133 console_pattern = 'Kernel command line: %s' % kernel_command_line
134 self.wait_for_console_pattern(console_pattern)
136 def test_mips64el_malta(self):
138 This test requires the ar tool to extract "data.tar.gz" from
141 The kernel can be rebuilt using this Debian kernel source [1] and
142 following the instructions on [2].
144 [1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/
145 #linux-source-2.6.32_2.6.32-48
146 [2] https://kernel-team.pages.debian.net/kernel-handbook/
147 ch-common-tasks.html#s-common-official
149 :avocado: tags=arch:mips64el
150 :avocado: tags=machine:malta
152 deb_url = ('http://snapshot.debian.org/archive/debian/'
153 '20130217T032700Z/pool/main/l/linux-2.6/'
154 'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb')
155 deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5'
156 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
157 kernel_path = self.extract_from_deb(deb_path,
158 '/boot/vmlinux-2.6.32-5-5kc-malta')
160 self.vm.set_console()
161 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
162 self.vm.add_args('-kernel', kernel_path,
163 '-append', kernel_command_line)
165 console_pattern = 'Kernel command line: %s' % kernel_command_line
166 self.wait_for_console_pattern(console_pattern)
168 def test_mips64el_fuloong2e(self):
170 :avocado: tags=arch:mips64el
171 :avocado: tags=machine:fuloong2e
172 :avocado: tags=endian:little
174 deb_url = ('http://archive.debian.org/debian/pool/main/l/linux/'
175 'linux-image-3.16.0-6-loongson-2e_3.16.56-1+deb8u1_mipsel.deb')
176 deb_hash = 'd04d446045deecf7b755ef576551de0c4184dd44'
177 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
178 kernel_path = self.extract_from_deb(deb_path,
179 '/boot/vmlinux-3.16.0-6-loongson-2e')
181 self.vm.set_console()
182 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
183 self.vm.add_args('-kernel', kernel_path,
184 '-append', kernel_command_line)
186 console_pattern = 'Kernel command line: %s' % kernel_command_line
187 self.wait_for_console_pattern(console_pattern)
189 def test_mips_malta_cpio(self):
191 :avocado: tags=arch:mips
192 :avocado: tags=machine:malta
193 :avocado: tags=endian:big
195 deb_url = ('http://snapshot.debian.org/archive/debian/'
196 '20160601T041800Z/pool/main/l/linux/'
197 'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb')
198 deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8'
199 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
200 kernel_path = self.extract_from_deb(deb_path,
201 '/boot/vmlinux-4.5.0-2-4kc-malta')
202 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
203 '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
204 'mips/rootfs.cpio.gz')
205 initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
206 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
207 initrd_path = self.workdir + "rootfs.cpio"
208 archive.gzip_uncompress(initrd_path_gz, initrd_path)
210 self.vm.set_console()
211 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
212 + 'console=ttyS0 console=tty '
213 + 'rdinit=/sbin/init noreboot')
214 self.vm.add_args('-kernel', kernel_path,
215 '-initrd', initrd_path,
216 '-append', kernel_command_line,
219 self.wait_for_console_pattern('Boot successful.')
221 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
223 exec_command_and_wait_for_pattern(self, 'uname -a',
225 exec_command_and_wait_for_pattern(self, 'reboot',
226 'reboot: Restarting system')
227 # Wait for VM to shut down gracefully
230 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
231 def test_mips64el_malta_5KEc_cpio(self):
233 :avocado: tags=arch:mips64el
234 :avocado: tags=machine:malta
235 :avocado: tags=endian:little
236 :avocado: tags=cpu:5KEc
238 kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
239 'raw/9ad2df38/mips/malta/mips64el/'
240 'vmlinux-3.19.3.mtoman.20150408')
241 kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
242 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
243 initrd_url = ('https://github.com/groeck/linux-build-test/'
244 'raw/8584a59e/rootfs/'
245 'mipsel64/rootfs.mipsel64r1.cpio.gz')
246 initrd_hash = '1dbb8a396e916847325284dbe2151167'
247 initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
248 asset_hash=initrd_hash)
249 initrd_path = self.workdir + "rootfs.cpio"
250 archive.gzip_uncompress(initrd_path_gz, initrd_path)
252 self.vm.set_console()
253 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
254 + 'console=ttyS0 console=tty '
255 + 'rdinit=/sbin/init noreboot')
256 self.vm.add_args('-kernel', kernel_path,
257 '-initrd', initrd_path,
258 '-append', kernel_command_line,
261 wait_for_console_pattern(self, 'Boot successful.')
263 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
265 exec_command_and_wait_for_pattern(self, 'uname -a',
266 '3.19.3.mtoman.20150408')
267 exec_command_and_wait_for_pattern(self, 'reboot',
268 'reboot: Restarting system')
269 # Wait for VM to shut down gracefully
272 def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
273 kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
274 kernel_path = self.workdir + "kernel"
275 with lzma.open(kernel_path_xz, 'rb') as f_in:
276 with open(kernel_path, 'wb') as f_out:
277 shutil.copyfileobj(f_in, f_out)
279 self.vm.set_console()
280 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
283 self.vm.add_args('-no-reboot',
284 '-kernel', kernel_path,
285 '-append', kernel_command_line)
287 console_pattern = 'Kernel command line: %s' % kernel_command_line
288 self.wait_for_console_pattern(console_pattern)
290 def test_mips_malta32el_nanomips_4k(self):
292 :avocado: tags=arch:mipsel
293 :avocado: tags=machine:malta
294 :avocado: tags=endian:little
295 :avocado: tags=cpu:I7200
297 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
298 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
299 'generic_nano32r6el_page4k.xz')
300 kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
301 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
303 def test_mips_malta32el_nanomips_16k_up(self):
305 :avocado: tags=arch:mipsel
306 :avocado: tags=machine:malta
307 :avocado: tags=endian:little
308 :avocado: tags=cpu:I7200
310 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
311 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
312 'generic_nano32r6el_page16k_up.xz')
313 kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
314 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
316 def test_mips_malta32el_nanomips_64k_dbg(self):
318 :avocado: tags=arch:mipsel
319 :avocado: tags=machine:malta
320 :avocado: tags=endian:little
321 :avocado: tags=cpu:I7200
323 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
324 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
325 'generic_nano32r6el_page64k_dbg.xz')
326 kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
327 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
329 def test_aarch64_xlnx_versal_virt(self):
331 :avocado: tags=arch:aarch64
332 :avocado: tags=machine:xlnx-versal-virt
333 :avocado: tags=device:pl011
334 :avocado: tags=device:arm_gicv3
335 :avocado: tags=accel:tcg
337 images_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/'
338 'bionic-updates/main/installer-arm64/'
339 '20101020ubuntu543.19/images/')
340 kernel_url = images_url + 'netboot/ubuntu-installer/arm64/linux'
341 kernel_hash = 'e167757620640eb26de0972f578741924abb3a82'
342 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
344 initrd_url = images_url + 'netboot/ubuntu-installer/arm64/initrd.gz'
345 initrd_hash = 'cab5cb3fcefca8408aa5aae57f24574bfce8bdb9'
346 initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
348 self.vm.set_console()
349 self.vm.add_args('-m', '2G',
351 '-kernel', kernel_path,
352 '-initrd', initrd_path)
354 self.wait_for_console_pattern('Checked W+X mappings: passed')
356 def test_arm_virt(self):
358 :avocado: tags=arch:arm
359 :avocado: tags=machine:virt
360 :avocado: tags=accel:tcg
362 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
363 '/linux/releases/29/Everything/armhfp/os/images/pxeboot'
365 kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
366 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
368 self.vm.set_console()
369 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
371 self.vm.add_args('-kernel', kernel_path,
372 '-append', kernel_command_line)
374 console_pattern = 'Kernel command line: %s' % kernel_command_line
375 self.wait_for_console_pattern(console_pattern)
377 def test_arm_emcraft_sf2(self):
379 :avocado: tags=arch:arm
380 :avocado: tags=machine:emcraft-sf2
381 :avocado: tags=endian:little
382 :avocado: tags=u-boot
383 :avocado: tags=accel:tcg
385 self.require_netdev('user')
387 uboot_url = ('https://raw.githubusercontent.com/'
388 'Subbaraya-Sundeep/qemu-test-binaries/'
389 'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot')
390 uboot_hash = 'cbb8cbab970f594bf6523b9855be209c08374ae2'
391 uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash)
392 spi_url = ('https://raw.githubusercontent.com/'
393 'Subbaraya-Sundeep/qemu-test-binaries/'
394 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin')
395 spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501'
396 spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash)
398 self.vm.set_console()
399 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
400 self.vm.add_args('-kernel', uboot_path,
401 '-append', kernel_command_line,
402 '-drive', 'file=' + spi_path + ',if=mtd,format=raw',
405 self.wait_for_console_pattern('Enter \'help\' for a list')
407 exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15',
408 'eth0: link becomes ready')
409 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
410 '3 packets transmitted, 3 packets received, 0% packet loss')
412 def do_test_arm_raspi2(self, uart_id):
414 :avocado: tags=accel:tcg
416 The kernel can be rebuilt using the kernel source referenced
417 and following the instructions on the on:
418 https://www.raspberrypi.org/documentation/linux/kernel/building.md
420 serial_kernel_cmdline = {
421 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
423 deb_url = ('http://archive.raspberrypi.org/debian/'
424 'pool/main/r/raspberrypi-firmware/'
425 'raspberrypi-kernel_1.20190215-1_armhf.deb')
426 deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
427 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
428 kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
429 dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
431 self.vm.set_console()
432 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
433 serial_kernel_cmdline[uart_id] +
434 ' root=/dev/mmcblk0p2 rootwait ' +
435 'dwc_otg.fiq_fsm_enable=0')
436 self.vm.add_args('-kernel', kernel_path,
438 '-append', kernel_command_line,
439 '-device', 'usb-kbd')
441 console_pattern = 'Kernel command line: %s' % kernel_command_line
442 self.wait_for_console_pattern(console_pattern)
443 console_pattern = 'Product: QEMU USB Keyboard'
444 self.wait_for_console_pattern(console_pattern)
446 def test_arm_raspi2_uart0(self):
448 :avocado: tags=arch:arm
449 :avocado: tags=machine:raspi2b
450 :avocado: tags=device:pl011
451 :avocado: tags=accel:tcg
453 self.do_test_arm_raspi2(0)
455 def test_arm_raspi2_initrd(self):
457 :avocado: tags=arch:arm
458 :avocado: tags=machine:raspi2b
460 deb_url = ('http://archive.raspberrypi.org/debian/'
461 'pool/main/r/raspberrypi-firmware/'
462 'raspberrypi-kernel_1.20190215-1_armhf.deb')
463 deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
464 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
465 kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
466 dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
468 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
469 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
470 'arm/rootfs-armv7a.cpio.gz')
471 initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
472 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
473 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
474 archive.gzip_uncompress(initrd_path_gz, initrd_path)
476 self.vm.set_console()
477 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
478 'earlycon=pl011,0x3f201000 console=ttyAMA0 '
479 'panic=-1 noreboot ' +
480 'dwc_otg.fiq_fsm_enable=0')
481 self.vm.add_args('-kernel', kernel_path,
483 '-initrd', initrd_path,
484 '-append', kernel_command_line,
487 self.wait_for_console_pattern('Boot successful.')
489 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
491 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
492 '/soc/cprman@7e101000')
493 exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System halted')
494 # Wait for VM to shut down gracefully
497 def test_arm_exynos4210_initrd(self):
499 :avocado: tags=arch:arm
500 :avocado: tags=machine:smdkc210
501 :avocado: tags=accel:tcg
503 deb_url = ('https://snapshot.debian.org/archive/debian/'
504 '20190928T224601Z/pool/main/l/linux/'
505 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb')
506 deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82'
507 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
508 kernel_path = self.extract_from_deb(deb_path,
509 '/boot/vmlinuz-4.19.0-6-armmp')
510 dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb'
511 dtb_path = self.extract_from_deb(deb_path, dtb_path)
513 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
514 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
515 'arm/rootfs-armv5.cpio.gz')
516 initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
517 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
518 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
519 archive.gzip_uncompress(initrd_path_gz, initrd_path)
521 self.vm.set_console()
522 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
523 'earlycon=exynos4210,0x13800000 earlyprintk ' +
524 'console=ttySAC0,115200n8 ' +
525 'random.trust_cpu=off cryptomgr.notests ' +
526 'cpuidle.off=1 panic=-1 noreboot')
528 self.vm.add_args('-kernel', kernel_path,
530 '-initrd', initrd_path,
531 '-append', kernel_command_line,
535 self.wait_for_console_pattern('Boot successful.')
536 # TODO user command, for now the uart is stuck
538 def test_arm_cubieboard_initrd(self):
540 :avocado: tags=arch:arm
541 :avocado: tags=machine:cubieboard
542 :avocado: tags=accel:tcg
544 deb_url = ('https://apt.armbian.com/pool/main/l/'
545 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
546 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
547 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
548 kernel_path = self.extract_from_deb(deb_path,
549 '/boot/vmlinuz-5.10.16-sunxi')
550 dtb_path = '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
551 dtb_path = self.extract_from_deb(deb_path, dtb_path)
552 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
553 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
554 'arm/rootfs-armv5.cpio.gz')
555 initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
556 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
557 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
558 archive.gzip_uncompress(initrd_path_gz, initrd_path)
560 self.vm.set_console()
561 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
562 'console=ttyS0,115200 '
565 self.vm.add_args('-kernel', kernel_path,
567 '-initrd', initrd_path,
568 '-append', kernel_command_line,
571 self.wait_for_console_pattern('Boot successful.')
573 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
574 'Allwinner sun4i/sun5i')
575 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
576 'system-control@1c00000')
577 # cubieboard's reboot is not functioning; omit reboot test.
579 def test_arm_cubieboard_sata(self):
581 :avocado: tags=arch:arm
582 :avocado: tags=machine:cubieboard
583 :avocado: tags=accel:tcg
585 deb_url = ('https://apt.armbian.com/pool/main/l/'
586 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
587 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
588 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
589 kernel_path = self.extract_from_deb(deb_path,
590 '/boot/vmlinuz-5.10.16-sunxi')
591 dtb_path = '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
592 dtb_path = self.extract_from_deb(deb_path, dtb_path)
593 rootfs_url = ('https://github.com/groeck/linux-build-test/raw/'
594 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
595 'arm/rootfs-armv5.ext2.gz')
596 rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93'
597 rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
598 rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
599 archive.gzip_uncompress(rootfs_path_gz, rootfs_path)
601 self.vm.set_console()
602 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
603 'console=ttyS0,115200 '
607 self.vm.add_args('-kernel', kernel_path,
609 '-drive', 'if=none,format=raw,id=disk0,file='
611 '-device', 'ide-hd,bus=ide.0,drive=disk0',
612 '-append', kernel_command_line,
615 self.wait_for_console_pattern('Boot successful.')
617 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
618 'Allwinner sun4i/sun5i')
619 exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
621 # cubieboard's reboot is not functioning; omit reboot test.
623 @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
624 def test_arm_quanta_gsj(self):
626 :avocado: tags=arch:arm
627 :avocado: tags=machine:quanta-gsj
628 :avocado: tags=accel:tcg
630 # 25 MiB compressed, 32 MiB uncompressed.
632 'https://github.com/hskinnemoen/openbmc/releases/download/'
633 '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz')
634 image_hash = '14895e634923345cb5c8776037ff7876df96f6b1'
635 image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
636 image_name = 'obmc.mtd'
637 image_path = os.path.join(self.workdir, image_name)
638 archive.gzip_uncompress(image_path_gz, image_path)
640 self.vm.set_console()
641 drive_args = 'file=' + image_path + ',if=mtd,bus=0,unit=0'
642 self.vm.add_args('-drive', drive_args)
645 # Disable drivers and services that stall for a long time during boot,
646 # to avoid running past the 90-second timeout. These may be removed
647 # as the corresponding device support is added.
648 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + (
649 'console=${console} '
651 'initcall_blacklist=npcm_i2c_bus_driver_init '
652 'systemd.mask=systemd-random-seed.service '
653 'systemd.mask=dropbearkey.service '
656 self.wait_for_console_pattern('> BootBlock by Nuvoton')
657 self.wait_for_console_pattern('>Device: Poleg BMC NPCM730')
658 self.wait_for_console_pattern('>Skip DDR init.')
659 self.wait_for_console_pattern('U-Boot ')
660 interrupt_interactive_console_until_pattern(
661 self, 'Hit any key to stop autoboot:', 'U-Boot>')
662 exec_command_and_wait_for_pattern(
663 self, "setenv bootargs ${bootargs} " + kernel_command_line,
665 exec_command_and_wait_for_pattern(
666 self, 'run romboot', 'Booting Kernel from flash')
667 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
668 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
669 self.wait_for_console_pattern('OpenBMC Project Reference Distro')
670 self.wait_for_console_pattern('gsj login:')
672 def test_arm_quanta_gsj_initrd(self):
674 :avocado: tags=arch:arm
675 :avocado: tags=machine:quanta-gsj
676 :avocado: tags=accel:tcg
679 'https://github.com/hskinnemoen/openbmc/releases/download/'
680 '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz')
681 initrd_hash = '98fefe5d7e56727b1eb17d5c00311b1b5c945300'
682 initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
684 'https://github.com/hskinnemoen/openbmc/releases/download/'
685 '20200711-gsj-qemu-0/uImage-gsj.bin')
686 kernel_hash = 'fa67b2f141d56d39b3c54305c0e8a899c99eb2c7'
687 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
689 'https://github.com/hskinnemoen/openbmc/releases/download/'
690 '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb')
691 dtb_hash = '18315f7006d7b688d8312d5c727eecd819aa36a4'
692 dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash)
694 self.vm.set_console()
695 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
696 'console=ttyS0,115200n8 '
697 'earlycon=uart8250,mmio32,0xf0001000')
698 self.vm.add_args('-kernel', kernel_path,
699 '-initrd', initrd_path,
701 '-append', kernel_command_line)
704 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
705 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
706 self.wait_for_console_pattern(
707 'Give root password for system maintenance')
709 def test_arm_orangepi(self):
711 :avocado: tags=arch:arm
712 :avocado: tags=machine:orangepi-pc
713 :avocado: tags=accel:tcg
715 deb_url = ('https://apt.armbian.com/pool/main/l/'
716 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
717 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
718 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
719 kernel_path = self.extract_from_deb(deb_path,
720 '/boot/vmlinuz-5.10.16-sunxi')
721 dtb_path = '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
722 dtb_path = self.extract_from_deb(deb_path, dtb_path)
724 self.vm.set_console()
725 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
726 'console=ttyS0,115200n8 '
727 'earlycon=uart,mmio32,0x1c28000')
728 self.vm.add_args('-kernel', kernel_path,
730 '-append', kernel_command_line)
732 console_pattern = 'Kernel command line: %s' % kernel_command_line
733 self.wait_for_console_pattern(console_pattern)
735 def test_arm_orangepi_initrd(self):
737 :avocado: tags=arch:arm
738 :avocado: tags=accel:tcg
739 :avocado: tags=machine:orangepi-pc
741 deb_url = ('https://apt.armbian.com/pool/main/l/'
742 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
743 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
744 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
745 kernel_path = self.extract_from_deb(deb_path,
746 '/boot/vmlinuz-5.10.16-sunxi')
747 dtb_path = '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
748 dtb_path = self.extract_from_deb(deb_path, dtb_path)
749 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
750 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
751 'arm/rootfs-armv7a.cpio.gz')
752 initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
753 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
754 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
755 archive.gzip_uncompress(initrd_path_gz, initrd_path)
757 self.vm.set_console()
758 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
759 'console=ttyS0,115200 '
761 self.vm.add_args('-kernel', kernel_path,
763 '-initrd', initrd_path,
764 '-append', kernel_command_line,
767 self.wait_for_console_pattern('Boot successful.')
769 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
770 'Allwinner sun8i Family')
771 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
772 'system-control@1c00000')
773 exec_command_and_wait_for_pattern(self, 'reboot',
774 'reboot: Restarting system')
775 # Wait for VM to shut down gracefully
778 def test_arm_orangepi_sd(self):
780 :avocado: tags=arch:arm
781 :avocado: tags=accel:tcg
782 :avocado: tags=machine:orangepi-pc
783 :avocado: tags=device:sd
785 self.require_netdev('user')
787 deb_url = ('https://apt.armbian.com/pool/main/l/'
788 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
789 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
790 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
791 kernel_path = self.extract_from_deb(deb_path,
792 '/boot/vmlinuz-5.10.16-sunxi')
793 dtb_path = '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
794 dtb_path = self.extract_from_deb(deb_path, dtb_path)
795 rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/'
796 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz')
797 rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a'
798 rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
799 rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
800 archive.lzma_uncompress(rootfs_path_xz, rootfs_path)
801 image_pow2ceil_expand(rootfs_path)
803 self.vm.set_console()
804 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
805 'console=ttyS0,115200 '
806 'root=/dev/mmcblk0 rootwait rw '
808 self.vm.add_args('-kernel', kernel_path,
810 '-drive', 'file=' + rootfs_path + ',if=sd,format=raw',
811 '-append', kernel_command_line,
814 shell_ready = "/bin/sh: can't access tty; job control turned off"
815 self.wait_for_console_pattern(shell_ready)
817 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
818 'Allwinner sun8i Family')
819 exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
821 exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
823 exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
824 'udhcpc: lease of 10.0.2.15 obtained')
825 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
826 '3 packets transmitted, 3 packets received, 0% packet loss')
827 exec_command_and_wait_for_pattern(self, 'reboot',
828 'reboot: Restarting system')
829 # Wait for VM to shut down gracefully
832 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
833 def test_arm_orangepi_bionic_20_08(self):
835 :avocado: tags=arch:arm
836 :avocado: tags=machine:orangepi-pc
837 :avocado: tags=device:sd
840 # This test download a 275 MiB compressed image and expand it
841 # to 1036 MiB, but the underlying filesystem is 1552 MiB...
842 # As we expand it to 2 GiB we are safe.
844 image_url = ('https://archive.armbian.com/orangepipc/archive/'
845 'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')
846 image_hash = ('b4d6775f5673486329e45a0586bf06b6'
847 'dbe792199fd182ac6b9c7bb6c7d3e6dd')
848 image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash,
850 image_path = archive.extract(image_path_xz, self.workdir)
851 image_pow2ceil_expand(image_path)
853 self.vm.set_console()
854 self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw',
859 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
860 'console=ttyS0,115200 '
863 'systemd.default_timeout_start_sec=9000 '
864 'systemd.mask=armbian-zram-config.service '
865 'systemd.mask=armbian-ramlog.service')
867 self.wait_for_console_pattern('U-Boot SPL')
868 self.wait_for_console_pattern('Autoboot in ')
869 exec_command_and_wait_for_pattern(self, ' ', '=>')
870 exec_command_and_wait_for_pattern(self, "setenv extraargs '" +
871 kernel_command_line + "'", '=>')
872 exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...');
874 self.wait_for_console_pattern('systemd[1]: Set hostname ' +
876 self.wait_for_console_pattern('Starting Load Kernel Modules...')
878 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
879 def test_arm_orangepi_uboot_netbsd9(self):
881 :avocado: tags=arch:arm
882 :avocado: tags=machine:orangepi-pc
883 :avocado: tags=device:sd
884 :avocado: tags=os:netbsd
886 # This test download a 304MB compressed image and expand it to 2GB
887 deb_url = ('http://snapshot.debian.org/archive/debian/'
888 '20200108T145233Z/pool/main/u/u-boot/'
889 'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb')
890 deb_hash = 'f67f404a80753ca3d1258f13e38f2b060e13db99'
891 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
892 # We use the common OrangePi PC 'plus' build of U-Boot for our secondary
893 # program loader (SPL). We will then set the path to the more specific
894 # OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt,
895 # before to boot NetBSD.
896 uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin'
897 uboot_path = self.extract_from_deb(deb_path, uboot_path)
898 image_url = ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/'
899 'evbarm-earmv7hf/binary/gzimg/armv7.img.gz')
900 image_hash = '2babb29d36d8360adcb39c09e31060945259917a'
901 image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
902 image_path = os.path.join(self.workdir, 'armv7.img')
903 archive.gzip_uncompress(image_path_gz, image_path)
904 image_pow2ceil_expand(image_path)
905 image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path
907 # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc
908 with open(uboot_path, 'rb') as f_in:
909 with open(image_path, 'r+b') as f_out:
911 shutil.copyfileobj(f_in, f_out)
913 self.vm.set_console()
914 self.vm.add_args('-nic', 'user',
915 '-drive', image_drive_args,
916 '-global', 'allwinner-rtc.base-year=2000',
919 wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1')
920 interrupt_interactive_console_until_pattern(self,
921 'Hit any key to stop autoboot:',
922 'switch to partitions #0, OK')
924 exec_command_and_wait_for_pattern(self, '', '=>')
925 cmd = 'setenv bootargs root=ld0a'
926 exec_command_and_wait_for_pattern(self, cmd, '=>')
927 cmd = 'setenv kernel netbsd-GENERIC.ub'
928 exec_command_and_wait_for_pattern(self, cmd, '=>')
929 cmd = 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb'
930 exec_command_and_wait_for_pattern(self, cmd, '=>')
931 cmd = ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; "
932 "fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; "
933 "fdt addr ${fdt_addr_r}; "
934 "bootm ${kernel_addr_r} - ${fdt_addr_r}'")
935 exec_command_and_wait_for_pattern(self, cmd, '=>')
937 exec_command_and_wait_for_pattern(self, 'boot',
938 'Booting kernel from Legacy Image')
939 wait_for_console_pattern(self, 'Starting kernel ...')
940 wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)')
941 # Wait for user-space
942 wait_for_console_pattern(self, 'Starting root file system check')
944 def test_aarch64_raspi3_atf(self):
946 :avocado: tags=arch:aarch64
947 :avocado: tags=machine:raspi3b
948 :avocado: tags=cpu:cortex-a53
949 :avocado: tags=device:pl011
952 zip_url = ('https://github.com/pbatard/RPi3/releases/download/'
953 'v1.15/RPi3_UEFI_Firmware_v1.15.zip')
954 zip_hash = '74b3bd0de92683cadb14e008a7575e1d0c3cafb9'
955 zip_path = self.fetch_asset(zip_url, asset_hash=zip_hash)
957 archive.extract(zip_path, self.workdir)
958 efi_fd = os.path.join(self.workdir, 'RPI_EFI.fd')
960 self.vm.set_console(console_index=1)
961 self.vm.add_args('-nodefaults',
962 '-device', 'loader,file=%s,force-raw=true' % efi_fd)
964 self.wait_for_console_pattern('version UEFI Firmware v1.15')
966 def test_s390x_s390_ccw_virtio(self):
968 :avocado: tags=arch:s390x
969 :avocado: tags=machine:s390-ccw-virtio
971 kernel_url = ('https://archives.fedoraproject.org/pub/archive'
972 '/fedora-secondary/releases/29/Everything/s390x/os/images'
974 kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313'
975 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
977 self.vm.set_console()
978 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0'
979 self.vm.add_args('-nodefaults',
980 '-kernel', kernel_path,
981 '-append', kernel_command_line)
983 console_pattern = 'Kernel command line: %s' % kernel_command_line
984 self.wait_for_console_pattern(console_pattern)
986 def test_alpha_clipper(self):
988 :avocado: tags=arch:alpha
989 :avocado: tags=machine:clipper
991 kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/'
992 'installer-alpha/20090123lenny10/images/cdrom/vmlinuz')
993 kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3'
994 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
996 uncompressed_kernel = archive.uncompress(kernel_path, self.workdir)
998 self.vm.set_console()
999 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
1000 self.vm.add_args('-nodefaults',
1001 '-kernel', uncompressed_kernel,
1002 '-append', kernel_command_line)
1004 console_pattern = 'Kernel command line: %s' % kernel_command_line
1005 self.wait_for_console_pattern(console_pattern)
1007 def test_m68k_q800(self):
1009 :avocado: tags=arch:m68k
1010 :avocado: tags=machine:q800
1012 deb_url = ('https://snapshot.debian.org/archive/debian-ports'
1013 '/20191021T083923Z/pool-m68k/main'
1014 '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
1015 deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
1016 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
1017 kernel_path = self.extract_from_deb(deb_path,
1018 '/boot/vmlinux-5.3.0-1-m68k')
1020 self.vm.set_console()
1021 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
1022 'console=ttyS0 vga=off')
1023 self.vm.add_args('-kernel', kernel_path,
1024 '-append', kernel_command_line)
1026 console_pattern = 'Kernel command line: %s' % kernel_command_line
1027 self.wait_for_console_pattern(console_pattern)
1028 console_pattern = 'No filesystem could mount root'
1029 self.wait_for_console_pattern(console_pattern)
1031 def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0):
1032 tar_url = ('https://qemu-advcal.gitlab.io'
1033 '/qac-best-of-multiarch/download/day' + day + '.tar.xz')
1034 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
1035 archive.extract(file_path, self.workdir)
1036 self.vm.set_console(console_index=console)
1037 self.vm.add_args('-kernel',
1038 self.workdir + '/day' + day + '/' + kernel_name)
1040 self.wait_for_console_pattern('QEMU advent calendar')
1042 def test_arm_vexpressa9(self):
1044 :avocado: tags=arch:arm
1045 :avocado: tags=machine:vexpress-a9
1047 tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b'
1048 self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb')
1049 self.do_test_advcal_2018('16', tar_hash, 'winter.zImage')
1051 def test_arm_ast2600_debian(self):
1053 :avocado: tags=arch:arm
1054 :avocado: tags=machine:tacoma-bmc
1056 deb_url = ('http://snapshot.debian.org/archive/debian/'
1058 'pool/main/l/linux/'
1059 'linux-image-5.10.0-3-armmp_5.10.13-1_armhf.deb')
1060 deb_hash = 'db40d32fe39255d05482bea48d72467b67d6225bb2a2a4d6f618cb8976f1e09e'
1061 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash,
1063 kernel_path = self.extract_from_deb(deb_path, '/boot/vmlinuz-5.10.0-3-armmp')
1064 dtb_path = self.extract_from_deb(deb_path,
1065 '/usr/lib/linux-image-5.10.0-3-armmp/aspeed-bmc-opp-tacoma.dtb')
1067 self.vm.set_console()
1068 self.vm.add_args('-kernel', kernel_path,
1072 self.wait_for_console_pattern("Booting Linux on physical CPU 0xf00")
1073 self.wait_for_console_pattern("SMP: Total of 2 processors activated")
1074 self.wait_for_console_pattern("No filesystem could mount root")
1076 def test_m68k_mcf5208evb(self):
1078 :avocado: tags=arch:m68k
1079 :avocado: tags=machine:mcf5208evb
1081 tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
1082 self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf')
1084 def test_or1k_sim(self):
1086 :avocado: tags=arch:or1k
1087 :avocado: tags=machine:or1k-sim
1089 tar_hash = '20334cdaf386108c530ff0badaecc955693027dd'
1090 self.do_test_advcal_2018('20', tar_hash, 'vmlinux')
1092 def test_nios2_10m50(self):
1094 :avocado: tags=arch:nios2
1095 :avocado: tags=machine:10m50-ghrd
1097 tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918'
1098 self.do_test_advcal_2018('14', tar_hash, 'vmlinux.elf')
1100 def test_ppc64_e500(self):
1102 :avocado: tags=arch:ppc64
1103 :avocado: tags=machine:ppce500
1104 :avocado: tags=cpu:e5500
1105 :avocado: tags=accel:tcg
1107 self.require_accelerator("tcg")
1108 tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
1109 self.do_test_advcal_2018('19', tar_hash, 'uImage')
1111 def do_test_ppc64_powernv(self, proc):
1112 self.require_accelerator("tcg")
1113 images_url = ('https://github.com/open-power/op-build/releases/download/v2.7/')
1115 kernel_url = images_url + 'zImage.epapr'
1116 kernel_hash = '0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd'
1117 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash,
1119 self.vm.set_console()
1120 self.vm.add_args('-kernel', kernel_path,
1121 '-append', 'console=tty0 console=hvc0',
1122 '-device', 'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0',
1123 '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234',
1124 '-device', 'e1000e,bus=bridge1,addr=0x3',
1125 '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2')
1128 self.wait_for_console_pattern("CPU: " + proc + " generation processor")
1129 self.wait_for_console_pattern("zImage starting: loaded")
1130 self.wait_for_console_pattern("Run /init as init process")
1131 self.wait_for_console_pattern("Creating 1 MTD partitions")
1133 def test_ppc_powernv8(self):
1135 :avocado: tags=arch:ppc64
1136 :avocado: tags=machine:powernv8
1137 :avocado: tags=accel:tcg
1139 self.do_test_ppc64_powernv('P8')
1141 def test_ppc_powernv9(self):
1143 :avocado: tags=arch:ppc64
1144 :avocado: tags=machine:powernv9
1145 :avocado: tags=accel:tcg
1147 self.do_test_ppc64_powernv('P9')
1149 def test_ppc_g3beige(self):
1151 :avocado: tags=arch:ppc
1152 :avocado: tags=machine:g3beige
1153 :avocado: tags=accel:tcg
1155 # TODO: g3beige works with kvm_pr but we don't have a
1156 # reliable way ATM (e.g. looking at /proc/modules) to detect
1157 # whether we're running kvm_hv or kvm_pr. For now let's
1158 # disable this test if we don't have TCG support.
1159 self.require_accelerator("tcg")
1160 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1161 self.vm.add_args('-M', 'graphics=off')
1162 self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
1164 def test_ppc_mac99(self):
1166 :avocado: tags=arch:ppc
1167 :avocado: tags=machine:mac99
1168 :avocado: tags=accel:tcg
1170 # TODO: mac99 works with kvm_pr but we don't have a
1171 # reliable way ATM (e.g. looking at /proc/modules) to detect
1172 # whether we're running kvm_hv or kvm_pr. For now let's
1173 # disable this test if we don't have TCG support.
1174 self.require_accelerator("tcg")
1175 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1176 self.vm.add_args('-M', 'graphics=off')
1177 self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
1179 # This test has a 6-10% failure rate on various hosts that look
1180 # like issues with a buggy kernel. As a result we don't want it
1181 # gating releases on Gitlab.
1182 @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
1183 def test_sh4_r2d(self):
1185 :avocado: tags=arch:sh4
1186 :avocado: tags=machine:r2d
1188 tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
1189 self.vm.add_args('-append', 'console=ttySC1')
1190 self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1)
1192 def test_sparc_ss20(self):
1194 :avocado: tags=arch:sparc
1195 :avocado: tags=machine:SS-20
1197 tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
1198 self.do_test_advcal_2018('11', tar_hash, 'zImage.elf')
1200 def test_xtensa_lx60(self):
1202 :avocado: tags=arch:xtensa
1203 :avocado: tags=machine:lx60
1204 :avocado: tags=cpu:dc233c
1206 tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
1207 self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')