avocado/boot_linux_console.py: check tcg accel in test_ppc64_e500
[qemu.git] / tests / avocado / boot_linux_console.py
blob6d6e748572f288e2acf5025810ab53e4e7b3cdd7
1 # Functional test that boots a Linux kernel and checks the console
3 # Copyright (c) 2018 Red Hat, Inc.
5 # Author:
6 # Cleber Rosa <crosa@redhat.com>
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.
11 import os
12 import lzma
13 import gzip
14 import shutil
16 from avocado import skip
17 from avocado import skipUnless
18 from avocado_qemu import QemuSystemTest
19 from avocado_qemu import exec_command
20 from avocado_qemu import exec_command_and_wait_for_pattern
21 from avocado_qemu import interrupt_interactive_console_until_pattern
22 from avocado_qemu import wait_for_console_pattern
23 from avocado.utils import process
24 from avocado.utils import archive
26 """
27 Round up to next power of 2
28 """
29 def pow2ceil(x):
30 return 1 if x == 0 else 2**(x - 1).bit_length()
32 """
33 Expand file size to next power of 2
34 """
35 def image_pow2ceil_expand(path):
36 size = os.path.getsize(path)
37 size_aligned = pow2ceil(size)
38 if size != size_aligned:
39 with open(path, 'ab+') as fd:
40 fd.truncate(size_aligned)
42 class LinuxKernelTest(QemuSystemTest):
43 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
45 def wait_for_console_pattern(self, success_message, vm=None):
46 wait_for_console_pattern(self, success_message,
47 failure_message='Kernel panic - not syncing',
48 vm=vm)
50 def extract_from_deb(self, deb, path):
51 """
52 Extracts a file from a deb package into the test workdir
54 :param deb: path to the deb archive
55 :param path: path within the deb archive of the file to be extracted
56 :returns: path of the extracted file
57 """
58 cwd = os.getcwd()
59 os.chdir(self.workdir)
60 file_path = process.run("ar t %s" % deb).stdout_text.split()[2]
61 process.run("ar x %s %s" % (deb, file_path))
62 archive.extract(file_path, self.workdir)
63 os.chdir(cwd)
64 # Return complete path to extracted file. Because callers to
65 # extract_from_deb() specify 'path' with a leading slash, it is
66 # necessary to use os.path.relpath() as otherwise os.path.join()
67 # interprets it as an absolute path and drops the self.workdir part.
68 return os.path.normpath(os.path.join(self.workdir,
69 os.path.relpath(path, '/')))
71 def extract_from_rpm(self, rpm, path):
72 """
73 Extracts a file from an RPM package into the test workdir.
75 :param rpm: path to the rpm archive
76 :param path: path within the rpm archive of the file to be extracted
77 needs to be a relative path (starting with './') because
78 cpio(1), which is used to extract the file, expects that.
79 :returns: path of the extracted file
80 """
81 cwd = os.getcwd()
82 os.chdir(self.workdir)
83 process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True)
84 os.chdir(cwd)
85 return os.path.normpath(os.path.join(self.workdir, path))
87 class BootLinuxConsole(LinuxKernelTest):
88 """
89 Boots a Linux kernel and checks that the console is operational and the
90 kernel command line is properly passed from QEMU to the kernel
91 """
92 timeout = 90
94 def test_x86_64_pc(self):
95 """
96 :avocado: tags=arch:x86_64
97 :avocado: tags=machine:pc
98 """
99 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
100 '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
101 '/vmlinuz')
102 kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
103 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
105 self.vm.set_console()
106 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
107 self.vm.add_args('-kernel', kernel_path,
108 '-append', kernel_command_line)
109 self.vm.launch()
110 console_pattern = 'Kernel command line: %s' % kernel_command_line
111 self.wait_for_console_pattern(console_pattern)
113 def test_mips_malta(self):
115 :avocado: tags=arch:mips
116 :avocado: tags=machine:malta
117 :avocado: tags=endian:big
119 deb_url = ('http://snapshot.debian.org/archive/debian/'
120 '20130217T032700Z/pool/main/l/linux-2.6/'
121 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb')
122 deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04'
123 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
124 kernel_path = self.extract_from_deb(deb_path,
125 '/boot/vmlinux-2.6.32-5-4kc-malta')
127 self.vm.set_console()
128 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
129 self.vm.add_args('-kernel', kernel_path,
130 '-append', kernel_command_line)
131 self.vm.launch()
132 console_pattern = 'Kernel command line: %s' % kernel_command_line
133 self.wait_for_console_pattern(console_pattern)
135 def test_mips64el_malta(self):
137 This test requires the ar tool to extract "data.tar.gz" from
138 the Debian package.
140 The kernel can be rebuilt using this Debian kernel source [1] and
141 following the instructions on [2].
143 [1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/
144 #linux-source-2.6.32_2.6.32-48
145 [2] https://kernel-team.pages.debian.net/kernel-handbook/
146 ch-common-tasks.html#s-common-official
148 :avocado: tags=arch:mips64el
149 :avocado: tags=machine:malta
151 deb_url = ('http://snapshot.debian.org/archive/debian/'
152 '20130217T032700Z/pool/main/l/linux-2.6/'
153 'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb')
154 deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5'
155 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
156 kernel_path = self.extract_from_deb(deb_path,
157 '/boot/vmlinux-2.6.32-5-5kc-malta')
159 self.vm.set_console()
160 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
161 self.vm.add_args('-kernel', kernel_path,
162 '-append', kernel_command_line)
163 self.vm.launch()
164 console_pattern = 'Kernel command line: %s' % kernel_command_line
165 self.wait_for_console_pattern(console_pattern)
167 def test_mips64el_fuloong2e(self):
169 :avocado: tags=arch:mips64el
170 :avocado: tags=machine:fuloong2e
171 :avocado: tags=endian:little
173 deb_url = ('http://archive.debian.org/debian/pool/main/l/linux/'
174 'linux-image-3.16.0-6-loongson-2e_3.16.56-1+deb8u1_mipsel.deb')
175 deb_hash = 'd04d446045deecf7b755ef576551de0c4184dd44'
176 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
177 kernel_path = self.extract_from_deb(deb_path,
178 '/boot/vmlinux-3.16.0-6-loongson-2e')
180 self.vm.set_console()
181 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
182 self.vm.add_args('-kernel', kernel_path,
183 '-append', kernel_command_line)
184 self.vm.launch()
185 console_pattern = 'Kernel command line: %s' % kernel_command_line
186 self.wait_for_console_pattern(console_pattern)
188 def test_mips_malta_cpio(self):
190 :avocado: tags=arch:mips
191 :avocado: tags=machine:malta
192 :avocado: tags=endian:big
194 deb_url = ('http://snapshot.debian.org/archive/debian/'
195 '20160601T041800Z/pool/main/l/linux/'
196 'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb')
197 deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8'
198 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
199 kernel_path = self.extract_from_deb(deb_path,
200 '/boot/vmlinux-4.5.0-2-4kc-malta')
201 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
202 '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
203 'mips/rootfs.cpio.gz')
204 initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
205 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
206 initrd_path = self.workdir + "rootfs.cpio"
207 archive.gzip_uncompress(initrd_path_gz, initrd_path)
209 self.vm.set_console()
210 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
211 + 'console=ttyS0 console=tty '
212 + 'rdinit=/sbin/init noreboot')
213 self.vm.add_args('-kernel', kernel_path,
214 '-initrd', initrd_path,
215 '-append', kernel_command_line,
216 '-no-reboot')
217 self.vm.launch()
218 self.wait_for_console_pattern('Boot successful.')
220 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
221 'BogoMIPS')
222 exec_command_and_wait_for_pattern(self, 'uname -a',
223 'Debian')
224 exec_command_and_wait_for_pattern(self, 'reboot',
225 'reboot: Restarting system')
226 # Wait for VM to shut down gracefully
227 self.vm.wait()
229 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
230 def test_mips64el_malta_5KEc_cpio(self):
232 :avocado: tags=arch:mips64el
233 :avocado: tags=machine:malta
234 :avocado: tags=endian:little
235 :avocado: tags=cpu:5KEc
237 kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
238 'raw/9ad2df38/mips/malta/mips64el/'
239 'vmlinux-3.19.3.mtoman.20150408')
240 kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
241 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
242 initrd_url = ('https://github.com/groeck/linux-build-test/'
243 'raw/8584a59e/rootfs/'
244 'mipsel64/rootfs.mipsel64r1.cpio.gz')
245 initrd_hash = '1dbb8a396e916847325284dbe2151167'
246 initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
247 asset_hash=initrd_hash)
248 initrd_path = self.workdir + "rootfs.cpio"
249 archive.gzip_uncompress(initrd_path_gz, initrd_path)
251 self.vm.set_console()
252 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
253 + 'console=ttyS0 console=tty '
254 + 'rdinit=/sbin/init noreboot')
255 self.vm.add_args('-kernel', kernel_path,
256 '-initrd', initrd_path,
257 '-append', kernel_command_line,
258 '-no-reboot')
259 self.vm.launch()
260 wait_for_console_pattern(self, 'Boot successful.')
262 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
263 'MIPS 5KE')
264 exec_command_and_wait_for_pattern(self, 'uname -a',
265 '3.19.3.mtoman.20150408')
266 exec_command_and_wait_for_pattern(self, 'reboot',
267 'reboot: Restarting system')
268 # Wait for VM to shut down gracefully
269 self.vm.wait()
271 def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
272 kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
273 kernel_path = self.workdir + "kernel"
274 with lzma.open(kernel_path_xz, 'rb') as f_in:
275 with open(kernel_path, 'wb') as f_out:
276 shutil.copyfileobj(f_in, f_out)
278 self.vm.set_console()
279 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
280 + 'mem=256m@@0x0 '
281 + 'console=ttyS0')
282 self.vm.add_args('-no-reboot',
283 '-kernel', kernel_path,
284 '-append', kernel_command_line)
285 self.vm.launch()
286 console_pattern = 'Kernel command line: %s' % kernel_command_line
287 self.wait_for_console_pattern(console_pattern)
289 def test_mips_malta32el_nanomips_4k(self):
291 :avocado: tags=arch:mipsel
292 :avocado: tags=machine:malta
293 :avocado: tags=endian:little
294 :avocado: tags=cpu:I7200
296 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
297 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
298 'generic_nano32r6el_page4k.xz')
299 kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
300 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
302 def test_mips_malta32el_nanomips_16k_up(self):
304 :avocado: tags=arch:mipsel
305 :avocado: tags=machine:malta
306 :avocado: tags=endian:little
307 :avocado: tags=cpu:I7200
309 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
310 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
311 'generic_nano32r6el_page16k_up.xz')
312 kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
313 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
315 def test_mips_malta32el_nanomips_64k_dbg(self):
317 :avocado: tags=arch:mipsel
318 :avocado: tags=machine:malta
319 :avocado: tags=endian:little
320 :avocado: tags=cpu:I7200
322 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
323 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
324 'generic_nano32r6el_page64k_dbg.xz')
325 kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
326 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
328 def test_aarch64_virt(self):
330 :avocado: tags=arch:aarch64
331 :avocado: tags=machine:virt
332 :avocado: tags=accel:tcg
333 :avocado: tags=cpu:cortex-a53
335 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
336 '/linux/releases/29/Everything/aarch64/os/images/pxeboot'
337 '/vmlinuz')
338 kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493'
339 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
341 self.vm.set_console()
342 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
343 'console=ttyAMA0')
344 self.require_accelerator("tcg")
345 self.vm.add_args('-cpu', 'cortex-a53',
346 '-accel', 'tcg',
347 '-kernel', kernel_path,
348 '-append', kernel_command_line)
349 self.vm.launch()
350 console_pattern = 'Kernel command line: %s' % kernel_command_line
351 self.wait_for_console_pattern(console_pattern)
353 def test_aarch64_xlnx_versal_virt(self):
355 :avocado: tags=arch:aarch64
356 :avocado: tags=machine:xlnx-versal-virt
357 :avocado: tags=device:pl011
358 :avocado: tags=device:arm_gicv3
359 :avocado: tags=accel:tcg
361 images_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/'
362 'bionic-updates/main/installer-arm64/'
363 '20101020ubuntu543.15/images/')
364 kernel_url = images_url + 'netboot/ubuntu-installer/arm64/linux'
365 kernel_hash = '5bfc54cf7ed8157d93f6e5b0241e727b6dc22c50'
366 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
368 initrd_url = images_url + 'netboot/ubuntu-installer/arm64/initrd.gz'
369 initrd_hash = 'd385d3e88d53e2004c5d43cbe668b458a094f772'
370 initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
372 self.vm.set_console()
373 self.vm.add_args('-m', '2G',
374 '-accel', 'tcg',
375 '-kernel', kernel_path,
376 '-initrd', initrd_path)
377 self.vm.launch()
378 self.wait_for_console_pattern('Checked W+X mappings: passed')
380 def test_arm_virt(self):
382 :avocado: tags=arch:arm
383 :avocado: tags=machine:virt
384 :avocado: tags=accel:tcg
386 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
387 '/linux/releases/29/Everything/armhfp/os/images/pxeboot'
388 '/vmlinuz')
389 kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
390 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
392 self.vm.set_console()
393 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
394 'console=ttyAMA0')
395 self.vm.add_args('-kernel', kernel_path,
396 '-append', kernel_command_line)
397 self.vm.launch()
398 console_pattern = 'Kernel command line: %s' % kernel_command_line
399 self.wait_for_console_pattern(console_pattern)
401 def test_arm_emcraft_sf2(self):
403 :avocado: tags=arch:arm
404 :avocado: tags=machine:emcraft-sf2
405 :avocado: tags=endian:little
406 :avocado: tags=u-boot
407 :avocado: tags=accel:tcg
409 uboot_url = ('https://raw.githubusercontent.com/'
410 'Subbaraya-Sundeep/qemu-test-binaries/'
411 'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot')
412 uboot_hash = 'cbb8cbab970f594bf6523b9855be209c08374ae2'
413 uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash)
414 spi_url = ('https://raw.githubusercontent.com/'
415 'Subbaraya-Sundeep/qemu-test-binaries/'
416 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin')
417 spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501'
418 spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash)
420 self.vm.set_console()
421 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
422 self.vm.add_args('-kernel', uboot_path,
423 '-append', kernel_command_line,
424 '-drive', 'file=' + spi_path + ',if=mtd,format=raw',
425 '-no-reboot')
426 self.vm.launch()
427 self.wait_for_console_pattern('Enter \'help\' for a list')
429 exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15',
430 'eth0: link becomes ready')
431 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
432 '3 packets transmitted, 3 packets received, 0% packet loss')
434 def do_test_arm_raspi2(self, uart_id):
436 :avocado: tags=accel:tcg
438 The kernel can be rebuilt using the kernel source referenced
439 and following the instructions on the on:
440 https://www.raspberrypi.org/documentation/linux/kernel/building.md
442 serial_kernel_cmdline = {
443 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
445 deb_url = ('http://archive.raspberrypi.org/debian/'
446 'pool/main/r/raspberrypi-firmware/'
447 'raspberrypi-kernel_1.20190215-1_armhf.deb')
448 deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
449 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
450 kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
451 dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
453 self.vm.set_console()
454 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
455 serial_kernel_cmdline[uart_id] +
456 ' root=/dev/mmcblk0p2 rootwait ' +
457 'dwc_otg.fiq_fsm_enable=0')
458 self.vm.add_args('-kernel', kernel_path,
459 '-dtb', dtb_path,
460 '-append', kernel_command_line,
461 '-device', 'usb-kbd')
462 self.vm.launch()
463 console_pattern = 'Kernel command line: %s' % kernel_command_line
464 self.wait_for_console_pattern(console_pattern)
465 console_pattern = 'Product: QEMU USB Keyboard'
466 self.wait_for_console_pattern(console_pattern)
468 def test_arm_raspi2_uart0(self):
470 :avocado: tags=arch:arm
471 :avocado: tags=machine:raspi2b
472 :avocado: tags=device:pl011
473 :avocado: tags=accel:tcg
475 self.do_test_arm_raspi2(0)
477 def test_arm_raspi2_initrd(self):
479 :avocado: tags=arch:arm
480 :avocado: tags=machine:raspi2b
482 deb_url = ('http://archive.raspberrypi.org/debian/'
483 'pool/main/r/raspberrypi-firmware/'
484 'raspberrypi-kernel_1.20190215-1_armhf.deb')
485 deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
486 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
487 kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
488 dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
490 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
491 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
492 'arm/rootfs-armv7a.cpio.gz')
493 initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
494 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
495 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
496 archive.gzip_uncompress(initrd_path_gz, initrd_path)
498 self.vm.set_console()
499 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
500 'earlycon=pl011,0x3f201000 console=ttyAMA0 '
501 'panic=-1 noreboot ' +
502 'dwc_otg.fiq_fsm_enable=0')
503 self.vm.add_args('-kernel', kernel_path,
504 '-dtb', dtb_path,
505 '-initrd', initrd_path,
506 '-append', kernel_command_line,
507 '-no-reboot')
508 self.vm.launch()
509 self.wait_for_console_pattern('Boot successful.')
511 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
512 'BCM2835')
513 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
514 '/soc/cprman@7e101000')
515 exec_command(self, 'halt')
516 # Wait for VM to shut down gracefully
517 self.vm.wait()
519 def test_arm_exynos4210_initrd(self):
521 :avocado: tags=arch:arm
522 :avocado: tags=machine:smdkc210
523 :avocado: tags=accel:tcg
525 deb_url = ('https://snapshot.debian.org/archive/debian/'
526 '20190928T224601Z/pool/main/l/linux/'
527 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb')
528 deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82'
529 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
530 kernel_path = self.extract_from_deb(deb_path,
531 '/boot/vmlinuz-4.19.0-6-armmp')
532 dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb'
533 dtb_path = self.extract_from_deb(deb_path, dtb_path)
535 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
536 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
537 'arm/rootfs-armv5.cpio.gz')
538 initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
539 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
540 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
541 archive.gzip_uncompress(initrd_path_gz, initrd_path)
543 self.vm.set_console()
544 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
545 'earlycon=exynos4210,0x13800000 earlyprintk ' +
546 'console=ttySAC0,115200n8 ' +
547 'random.trust_cpu=off cryptomgr.notests ' +
548 'cpuidle.off=1 panic=-1 noreboot')
550 self.vm.add_args('-kernel', kernel_path,
551 '-dtb', dtb_path,
552 '-initrd', initrd_path,
553 '-append', kernel_command_line,
554 '-no-reboot')
555 self.vm.launch()
557 self.wait_for_console_pattern('Boot successful.')
558 # TODO user command, for now the uart is stuck
560 def test_arm_cubieboard_initrd(self):
562 :avocado: tags=arch:arm
563 :avocado: tags=machine:cubieboard
564 :avocado: tags=accel:tcg
566 deb_url = ('https://apt.armbian.com/pool/main/l/'
567 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
568 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
569 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
570 kernel_path = self.extract_from_deb(deb_path,
571 '/boot/vmlinuz-5.10.16-sunxi')
572 dtb_path = '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
573 dtb_path = self.extract_from_deb(deb_path, dtb_path)
574 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
575 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
576 'arm/rootfs-armv5.cpio.gz')
577 initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
578 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
579 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
580 archive.gzip_uncompress(initrd_path_gz, initrd_path)
582 self.vm.set_console()
583 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
584 'console=ttyS0,115200 '
585 'usbcore.nousb '
586 'panic=-1 noreboot')
587 self.vm.add_args('-kernel', kernel_path,
588 '-dtb', dtb_path,
589 '-initrd', initrd_path,
590 '-append', kernel_command_line,
591 '-no-reboot')
592 self.vm.launch()
593 self.wait_for_console_pattern('Boot successful.')
595 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
596 'Allwinner sun4i/sun5i')
597 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
598 'system-control@1c00000')
599 # cubieboard's reboot is not functioning; omit reboot test.
601 def test_arm_cubieboard_sata(self):
603 :avocado: tags=arch:arm
604 :avocado: tags=machine:cubieboard
605 :avocado: tags=accel:tcg
607 deb_url = ('https://apt.armbian.com/pool/main/l/'
608 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
609 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
610 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
611 kernel_path = self.extract_from_deb(deb_path,
612 '/boot/vmlinuz-5.10.16-sunxi')
613 dtb_path = '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
614 dtb_path = self.extract_from_deb(deb_path, dtb_path)
615 rootfs_url = ('https://github.com/groeck/linux-build-test/raw/'
616 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
617 'arm/rootfs-armv5.ext2.gz')
618 rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93'
619 rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
620 rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
621 archive.gzip_uncompress(rootfs_path_gz, rootfs_path)
623 self.vm.set_console()
624 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
625 'console=ttyS0,115200 '
626 'usbcore.nousb '
627 'root=/dev/sda ro '
628 'panic=-1 noreboot')
629 self.vm.add_args('-kernel', kernel_path,
630 '-dtb', dtb_path,
631 '-drive', 'if=none,format=raw,id=disk0,file='
632 + rootfs_path,
633 '-device', 'ide-hd,bus=ide.0,drive=disk0',
634 '-append', kernel_command_line,
635 '-no-reboot')
636 self.vm.launch()
637 self.wait_for_console_pattern('Boot successful.')
639 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
640 'Allwinner sun4i/sun5i')
641 exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
642 'sda')
643 # cubieboard's reboot is not functioning; omit reboot test.
645 @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
646 def test_arm_quanta_gsj(self):
648 :avocado: tags=arch:arm
649 :avocado: tags=machine:quanta-gsj
650 :avocado: tags=accel:tcg
652 # 25 MiB compressed, 32 MiB uncompressed.
653 image_url = (
654 'https://github.com/hskinnemoen/openbmc/releases/download/'
655 '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz')
656 image_hash = '14895e634923345cb5c8776037ff7876df96f6b1'
657 image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
658 image_name = 'obmc.mtd'
659 image_path = os.path.join(self.workdir, image_name)
660 archive.gzip_uncompress(image_path_gz, image_path)
662 self.vm.set_console()
663 drive_args = 'file=' + image_path + ',if=mtd,bus=0,unit=0'
664 self.vm.add_args('-drive', drive_args)
665 self.vm.launch()
667 # Disable drivers and services that stall for a long time during boot,
668 # to avoid running past the 90-second timeout. These may be removed
669 # as the corresponding device support is added.
670 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + (
671 'console=${console} '
672 'mem=${mem} '
673 'initcall_blacklist=npcm_i2c_bus_driver_init '
674 'systemd.mask=systemd-random-seed.service '
675 'systemd.mask=dropbearkey.service '
678 self.wait_for_console_pattern('> BootBlock by Nuvoton')
679 self.wait_for_console_pattern('>Device: Poleg BMC NPCM730')
680 self.wait_for_console_pattern('>Skip DDR init.')
681 self.wait_for_console_pattern('U-Boot ')
682 interrupt_interactive_console_until_pattern(
683 self, 'Hit any key to stop autoboot:', 'U-Boot>')
684 exec_command_and_wait_for_pattern(
685 self, "setenv bootargs ${bootargs} " + kernel_command_line,
686 'U-Boot>')
687 exec_command_and_wait_for_pattern(
688 self, 'run romboot', 'Booting Kernel from flash')
689 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
690 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
691 self.wait_for_console_pattern('OpenBMC Project Reference Distro')
692 self.wait_for_console_pattern('gsj login:')
694 def test_arm_quanta_gsj_initrd(self):
696 :avocado: tags=arch:arm
697 :avocado: tags=machine:quanta-gsj
698 :avocado: tags=accel:tcg
700 initrd_url = (
701 'https://github.com/hskinnemoen/openbmc/releases/download/'
702 '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz')
703 initrd_hash = '98fefe5d7e56727b1eb17d5c00311b1b5c945300'
704 initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
705 kernel_url = (
706 'https://github.com/hskinnemoen/openbmc/releases/download/'
707 '20200711-gsj-qemu-0/uImage-gsj.bin')
708 kernel_hash = 'fa67b2f141d56d39b3c54305c0e8a899c99eb2c7'
709 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
710 dtb_url = (
711 'https://github.com/hskinnemoen/openbmc/releases/download/'
712 '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb')
713 dtb_hash = '18315f7006d7b688d8312d5c727eecd819aa36a4'
714 dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash)
716 self.vm.set_console()
717 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
718 'console=ttyS0,115200n8 '
719 'earlycon=uart8250,mmio32,0xf0001000')
720 self.vm.add_args('-kernel', kernel_path,
721 '-initrd', initrd_path,
722 '-dtb', dtb_path,
723 '-append', kernel_command_line)
724 self.vm.launch()
726 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
727 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
728 self.wait_for_console_pattern(
729 'Give root password for system maintenance')
731 def test_arm_orangepi(self):
733 :avocado: tags=arch:arm
734 :avocado: tags=machine:orangepi-pc
735 :avocado: tags=accel:tcg
737 deb_url = ('https://apt.armbian.com/pool/main/l/'
738 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
739 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
740 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
741 kernel_path = self.extract_from_deb(deb_path,
742 '/boot/vmlinuz-5.10.16-sunxi')
743 dtb_path = '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
744 dtb_path = self.extract_from_deb(deb_path, dtb_path)
746 self.vm.set_console()
747 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
748 'console=ttyS0,115200n8 '
749 'earlycon=uart,mmio32,0x1c28000')
750 self.vm.add_args('-kernel', kernel_path,
751 '-dtb', dtb_path,
752 '-append', kernel_command_line)
753 self.vm.launch()
754 console_pattern = 'Kernel command line: %s' % kernel_command_line
755 self.wait_for_console_pattern(console_pattern)
757 def test_arm_orangepi_initrd(self):
759 :avocado: tags=arch:arm
760 :avocado: tags=accel:tcg
761 :avocado: tags=machine:orangepi-pc
763 deb_url = ('https://apt.armbian.com/pool/main/l/'
764 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
765 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
766 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
767 kernel_path = self.extract_from_deb(deb_path,
768 '/boot/vmlinuz-5.10.16-sunxi')
769 dtb_path = '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
770 dtb_path = self.extract_from_deb(deb_path, dtb_path)
771 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
772 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
773 'arm/rootfs-armv7a.cpio.gz')
774 initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
775 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
776 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
777 archive.gzip_uncompress(initrd_path_gz, initrd_path)
779 self.vm.set_console()
780 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
781 'console=ttyS0,115200 '
782 'panic=-1 noreboot')
783 self.vm.add_args('-kernel', kernel_path,
784 '-dtb', dtb_path,
785 '-initrd', initrd_path,
786 '-append', kernel_command_line,
787 '-no-reboot')
788 self.vm.launch()
789 self.wait_for_console_pattern('Boot successful.')
791 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
792 'Allwinner sun8i Family')
793 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
794 'system-control@1c00000')
795 exec_command_and_wait_for_pattern(self, 'reboot',
796 'reboot: Restarting system')
797 # Wait for VM to shut down gracefully
798 self.vm.wait()
800 def test_arm_orangepi_sd(self):
802 :avocado: tags=arch:arm
803 :avocado: tags=accel:tcg
804 :avocado: tags=machine:orangepi-pc
805 :avocado: tags=device:sd
807 deb_url = ('https://apt.armbian.com/pool/main/l/'
808 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
809 deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
810 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
811 kernel_path = self.extract_from_deb(deb_path,
812 '/boot/vmlinuz-5.10.16-sunxi')
813 dtb_path = '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
814 dtb_path = self.extract_from_deb(deb_path, dtb_path)
815 rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/'
816 'kci-2019.02/armel/base/rootfs.ext2.xz')
817 rootfs_hash = '692510cb625efda31640d1de0a8d60e26040f061'
818 rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
819 rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
820 archive.lzma_uncompress(rootfs_path_xz, rootfs_path)
821 image_pow2ceil_expand(rootfs_path)
823 self.vm.set_console()
824 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
825 'console=ttyS0,115200 '
826 'root=/dev/mmcblk0 rootwait rw '
827 'panic=-1 noreboot')
828 self.vm.add_args('-kernel', kernel_path,
829 '-dtb', dtb_path,
830 '-drive', 'file=' + rootfs_path + ',if=sd,format=raw',
831 '-append', kernel_command_line,
832 '-no-reboot')
833 self.vm.launch()
834 shell_ready = "/bin/sh: can't access tty; job control turned off"
835 self.wait_for_console_pattern(shell_ready)
837 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
838 'Allwinner sun8i Family')
839 exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
840 'mmcblk0')
841 exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
842 'eth0: Link is Up')
843 exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
844 'udhcpc: lease of 10.0.2.15 obtained')
845 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
846 '3 packets transmitted, 3 packets received, 0% packet loss')
847 exec_command_and_wait_for_pattern(self, 'reboot',
848 'reboot: Restarting system')
849 # Wait for VM to shut down gracefully
850 self.vm.wait()
852 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
853 def test_arm_orangepi_bionic_20_08(self):
855 :avocado: tags=arch:arm
856 :avocado: tags=machine:orangepi-pc
857 :avocado: tags=device:sd
860 # This test download a 275 MiB compressed image and expand it
861 # to 1036 MiB, but the underlying filesystem is 1552 MiB...
862 # As we expand it to 2 GiB we are safe.
864 image_url = ('https://archive.armbian.com/orangepipc/archive/'
865 'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')
866 image_hash = ('b4d6775f5673486329e45a0586bf06b6'
867 'dbe792199fd182ac6b9c7bb6c7d3e6dd')
868 image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash,
869 algorithm='sha256')
870 image_path = archive.extract(image_path_xz, self.workdir)
871 image_pow2ceil_expand(image_path)
873 self.vm.set_console()
874 self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw',
875 '-nic', 'user',
876 '-no-reboot')
877 self.vm.launch()
879 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
880 'console=ttyS0,115200 '
881 'loglevel=7 '
882 'nosmp '
883 'systemd.default_timeout_start_sec=9000 '
884 'systemd.mask=armbian-zram-config.service '
885 'systemd.mask=armbian-ramlog.service')
887 self.wait_for_console_pattern('U-Boot SPL')
888 self.wait_for_console_pattern('Autoboot in ')
889 exec_command_and_wait_for_pattern(self, ' ', '=>')
890 exec_command_and_wait_for_pattern(self, "setenv extraargs '" +
891 kernel_command_line + "'", '=>')
892 exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...');
894 self.wait_for_console_pattern('systemd[1]: Set hostname ' +
895 'to <orangepipc>')
896 self.wait_for_console_pattern('Starting Load Kernel Modules...')
898 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
899 def test_arm_orangepi_uboot_netbsd9(self):
901 :avocado: tags=arch:arm
902 :avocado: tags=machine:orangepi-pc
903 :avocado: tags=device:sd
904 :avocado: tags=os:netbsd
906 # This test download a 304MB compressed image and expand it to 2GB
907 deb_url = ('http://snapshot.debian.org/archive/debian/'
908 '20200108T145233Z/pool/main/u/u-boot/'
909 'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb')
910 deb_hash = 'f67f404a80753ca3d1258f13e38f2b060e13db99'
911 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
912 # We use the common OrangePi PC 'plus' build of U-Boot for our secondary
913 # program loader (SPL). We will then set the path to the more specific
914 # OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt,
915 # before to boot NetBSD.
916 uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin'
917 uboot_path = self.extract_from_deb(deb_path, uboot_path)
918 image_url = ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/'
919 'evbarm-earmv7hf/binary/gzimg/armv7.img.gz')
920 image_hash = '2babb29d36d8360adcb39c09e31060945259917a'
921 image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
922 image_path = os.path.join(self.workdir, 'armv7.img')
923 archive.gzip_uncompress(image_path_gz, image_path)
924 image_pow2ceil_expand(image_path)
925 image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path
927 # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc
928 with open(uboot_path, 'rb') as f_in:
929 with open(image_path, 'r+b') as f_out:
930 f_out.seek(8 * 1024)
931 shutil.copyfileobj(f_in, f_out)
933 self.vm.set_console()
934 self.vm.add_args('-nic', 'user',
935 '-drive', image_drive_args,
936 '-global', 'allwinner-rtc.base-year=2000',
937 '-no-reboot')
938 self.vm.launch()
939 wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1')
940 interrupt_interactive_console_until_pattern(self,
941 'Hit any key to stop autoboot:',
942 'switch to partitions #0, OK')
944 exec_command_and_wait_for_pattern(self, '', '=>')
945 cmd = 'setenv bootargs root=ld0a'
946 exec_command_and_wait_for_pattern(self, cmd, '=>')
947 cmd = 'setenv kernel netbsd-GENERIC.ub'
948 exec_command_and_wait_for_pattern(self, cmd, '=>')
949 cmd = 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb'
950 exec_command_and_wait_for_pattern(self, cmd, '=>')
951 cmd = ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; "
952 "fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; "
953 "fdt addr ${fdt_addr_r}; "
954 "bootm ${kernel_addr_r} - ${fdt_addr_r}'")
955 exec_command_and_wait_for_pattern(self, cmd, '=>')
957 exec_command_and_wait_for_pattern(self, 'boot',
958 'Booting kernel from Legacy Image')
959 wait_for_console_pattern(self, 'Starting kernel ...')
960 wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)')
961 # Wait for user-space
962 wait_for_console_pattern(self, 'Starting root file system check')
964 def test_aarch64_raspi3_atf(self):
966 :avocado: tags=arch:aarch64
967 :avocado: tags=machine:raspi3b
968 :avocado: tags=cpu:cortex-a53
969 :avocado: tags=device:pl011
970 :avocado: tags=atf
972 zip_url = ('https://github.com/pbatard/RPi3/releases/download/'
973 'v1.15/RPi3_UEFI_Firmware_v1.15.zip')
974 zip_hash = '74b3bd0de92683cadb14e008a7575e1d0c3cafb9'
975 zip_path = self.fetch_asset(zip_url, asset_hash=zip_hash)
977 archive.extract(zip_path, self.workdir)
978 efi_fd = os.path.join(self.workdir, 'RPI_EFI.fd')
980 self.vm.set_console(console_index=1)
981 self.vm.add_args('-nodefaults',
982 '-device', 'loader,file=%s,force-raw=true' % efi_fd)
983 self.vm.launch()
984 self.wait_for_console_pattern('version UEFI Firmware v1.15')
986 def test_s390x_s390_ccw_virtio(self):
988 :avocado: tags=arch:s390x
989 :avocado: tags=machine:s390-ccw-virtio
991 kernel_url = ('https://archives.fedoraproject.org/pub/archive'
992 '/fedora-secondary/releases/29/Everything/s390x/os/images'
993 '/kernel.img')
994 kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313'
995 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
997 self.vm.set_console()
998 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0'
999 self.vm.add_args('-nodefaults',
1000 '-kernel', kernel_path,
1001 '-append', kernel_command_line)
1002 self.vm.launch()
1003 console_pattern = 'Kernel command line: %s' % kernel_command_line
1004 self.wait_for_console_pattern(console_pattern)
1006 def test_alpha_clipper(self):
1008 :avocado: tags=arch:alpha
1009 :avocado: tags=machine:clipper
1011 kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/'
1012 'installer-alpha/20090123lenny10/images/cdrom/vmlinuz')
1013 kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3'
1014 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
1016 uncompressed_kernel = archive.uncompress(kernel_path, self.workdir)
1018 self.vm.set_console()
1019 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
1020 self.vm.add_args('-nodefaults',
1021 '-kernel', uncompressed_kernel,
1022 '-append', kernel_command_line)
1023 self.vm.launch()
1024 console_pattern = 'Kernel command line: %s' % kernel_command_line
1025 self.wait_for_console_pattern(console_pattern)
1027 def test_m68k_q800(self):
1029 :avocado: tags=arch:m68k
1030 :avocado: tags=machine:q800
1032 deb_url = ('https://snapshot.debian.org/archive/debian-ports'
1033 '/20191021T083923Z/pool-m68k/main'
1034 '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
1035 deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
1036 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
1037 kernel_path = self.extract_from_deb(deb_path,
1038 '/boot/vmlinux-5.3.0-1-m68k')
1040 self.vm.set_console()
1041 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
1042 'console=ttyS0 vga=off')
1043 self.vm.add_args('-kernel', kernel_path,
1044 '-append', kernel_command_line)
1045 self.vm.launch()
1046 console_pattern = 'Kernel command line: %s' % kernel_command_line
1047 self.wait_for_console_pattern(console_pattern)
1048 console_pattern = 'No filesystem could mount root'
1049 self.wait_for_console_pattern(console_pattern)
1051 def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0):
1052 tar_url = ('https://www.qemu-advent-calendar.org'
1053 '/2018/download/day' + day + '.tar.xz')
1054 file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
1055 archive.extract(file_path, self.workdir)
1056 self.vm.set_console(console_index=console)
1057 self.vm.add_args('-kernel',
1058 self.workdir + '/day' + day + '/' + kernel_name)
1059 self.vm.launch()
1060 self.wait_for_console_pattern('QEMU advent calendar')
1062 def test_arm_vexpressa9(self):
1064 :avocado: tags=arch:arm
1065 :avocado: tags=machine:vexpress-a9
1067 tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b'
1068 self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb')
1069 self.do_test_advcal_2018('16', tar_hash, 'winter.zImage')
1071 def test_arm_ast2400_palmetto_openbmc_v2_9_0(self):
1073 :avocado: tags=arch:arm
1074 :avocado: tags=machine:palmetto-bmc
1077 image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
1078 'obmc-phosphor-image-palmetto.static.mtd')
1079 image_hash = ('3e13bbbc28e424865dc42f35ad672b10f2e82cdb11846bb28fa625b48beafd0d')
1080 image_path = self.fetch_asset(image_url, asset_hash=image_hash,
1081 algorithm='sha256')
1083 self.do_test_arm_aspeed(image_path)
1085 def test_arm_ast2500_romulus_openbmc_v2_9_0(self):
1087 :avocado: tags=arch:arm
1088 :avocado: tags=machine:romulus-bmc
1091 image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
1092 'obmc-phosphor-image-romulus.static.mtd')
1093 image_hash = ('820341076803f1955bc31e647a512c79f9add4f5233d0697678bab4604c7bb25')
1094 image_path = self.fetch_asset(image_url, asset_hash=image_hash,
1095 algorithm='sha256')
1097 self.do_test_arm_aspeed(image_path)
1099 def do_test_arm_aspeed(self, image):
1100 self.vm.set_console()
1101 self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
1102 '-net', 'nic')
1103 self.vm.launch()
1105 self.wait_for_console_pattern("U-Boot 2016.07")
1106 self.wait_for_console_pattern("## Loading kernel from FIT Image at 20080000")
1107 self.wait_for_console_pattern("Starting kernel ...")
1108 self.wait_for_console_pattern("Booting Linux on physical CPU 0x0")
1109 self.wait_for_console_pattern(
1110 "aspeed-smc 1e620000.spi: read control register: 203b0641")
1111 self.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ")
1112 self.wait_for_console_pattern("systemd[1]: Set hostname to")
1114 def test_arm_ast2600_debian(self):
1116 :avocado: tags=arch:arm
1117 :avocado: tags=machine:tacoma-bmc
1119 deb_url = ('http://snapshot.debian.org/archive/debian/'
1120 '20210302T203551Z/'
1121 'pool/main/l/linux/'
1122 'linux-image-5.10.0-3-armmp_5.10.13-1_armhf.deb')
1123 deb_hash = 'db40d32fe39255d05482bea48d72467b67d6225bb2a2a4d6f618cb8976f1e09e'
1124 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash,
1125 algorithm='sha256')
1126 kernel_path = self.extract_from_deb(deb_path, '/boot/vmlinuz-5.10.0-3-armmp')
1127 dtb_path = self.extract_from_deb(deb_path,
1128 '/usr/lib/linux-image-5.10.0-3-armmp/aspeed-bmc-opp-tacoma.dtb')
1130 self.vm.set_console()
1131 self.vm.add_args('-kernel', kernel_path,
1132 '-dtb', dtb_path,
1133 '-net', 'nic')
1134 self.vm.launch()
1135 self.wait_for_console_pattern("Booting Linux on physical CPU 0xf00")
1136 self.wait_for_console_pattern("SMP: Total of 2 processors activated")
1137 self.wait_for_console_pattern("No filesystem could mount root")
1139 def test_m68k_mcf5208evb(self):
1141 :avocado: tags=arch:m68k
1142 :avocado: tags=machine:mcf5208evb
1144 tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
1145 self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf')
1147 def test_or1k_sim(self):
1149 :avocado: tags=arch:or1k
1150 :avocado: tags=machine:or1k-sim
1152 tar_hash = '20334cdaf386108c530ff0badaecc955693027dd'
1153 self.do_test_advcal_2018('20', tar_hash, 'vmlinux')
1155 def test_nios2_10m50(self):
1157 :avocado: tags=arch:nios2
1158 :avocado: tags=machine:10m50-ghrd
1160 tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918'
1161 self.do_test_advcal_2018('14', tar_hash, 'vmlinux.elf')
1163 def test_ppc64_e500(self):
1165 :avocado: tags=arch:ppc64
1166 :avocado: tags=machine:ppce500
1167 :avocado: tags=cpu:e5500
1168 :avocado: tags=accel:tcg
1170 self.require_accelerator("tcg")
1171 tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
1172 self.do_test_advcal_2018('19', tar_hash, 'uImage')
1174 def do_test_ppc64_powernv(self, proc):
1175 self.require_accelerator("tcg")
1176 images_url = ('https://github.com/open-power/op-build/releases/download/v2.7/')
1178 kernel_url = images_url + 'zImage.epapr'
1179 kernel_hash = '0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd'
1180 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash,
1181 algorithm='sha256')
1182 self.vm.set_console()
1183 self.vm.add_args('-kernel', kernel_path,
1184 '-append', 'console=tty0 console=hvc0',
1185 '-device', 'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0',
1186 '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234',
1187 '-device', 'e1000e,bus=bridge1,addr=0x3',
1188 '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2')
1189 self.vm.launch()
1191 self.wait_for_console_pattern("CPU: " + proc + " generation processor")
1192 self.wait_for_console_pattern("zImage starting: loaded")
1193 self.wait_for_console_pattern("Run /init as init process")
1194 self.wait_for_console_pattern("Creating 1 MTD partitions")
1196 def test_ppc_powernv8(self):
1198 :avocado: tags=arch:ppc64
1199 :avocado: tags=machine:powernv8
1200 :avocado: tags=accel:tcg
1202 self.do_test_ppc64_powernv('P8')
1204 def test_ppc_powernv9(self):
1206 :avocado: tags=arch:ppc64
1207 :avocado: tags=machine:powernv9
1208 :avocado: tags=accel:tcg
1210 self.do_test_ppc64_powernv('P9')
1212 def test_ppc_g3beige(self):
1214 :avocado: tags=arch:ppc
1215 :avocado: tags=machine:g3beige
1217 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1218 self.vm.add_args('-M', 'graphics=off')
1219 self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
1221 def test_ppc_mac99(self):
1223 :avocado: tags=arch:ppc
1224 :avocado: tags=machine:mac99
1226 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1227 self.vm.add_args('-M', 'graphics=off')
1228 self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
1230 def test_sh4_r2d(self):
1232 :avocado: tags=arch:sh4
1233 :avocado: tags=machine:r2d
1235 tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
1236 self.vm.add_args('-append', 'console=ttySC1')
1237 self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1)
1239 def test_sparc_ss20(self):
1241 :avocado: tags=arch:sparc
1242 :avocado: tags=machine:SS-20
1244 tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
1245 self.do_test_advcal_2018('11', tar_hash, 'zImage.elf')
1247 def test_xtensa_lx60(self):
1249 :avocado: tags=arch:xtensa
1250 :avocado: tags=machine:lx60
1251 :avocado: tags=cpu:dc233c
1253 tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
1254 self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')