target/mips: Simplify decode_opc_mxu() ifdef'ry
[qemu/ar7.git] / tests / acceptance / boot_linux_console.py
blobeb012867997f7b67d05fd8f61a0318591ffa0c2e
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 Test
19 from avocado_qemu import exec_command_and_wait_for_pattern
20 from avocado_qemu import interrupt_interactive_console_until_pattern
21 from avocado_qemu import wait_for_console_pattern
22 from avocado.utils import process
23 from avocado.utils import archive
24 from avocado.utils.path import find_command, CmdNotFoundError
26 P7ZIP_AVAILABLE = True
27 try:
28 find_command('7z')
29 except CmdNotFoundError:
30 P7ZIP_AVAILABLE = False
32 """
33 Round up to next power of 2
34 """
35 def pow2ceil(x):
36 return 1 if x == 0 else 2**(x - 1).bit_length()
38 """
39 Expand file size to next power of 2
40 """
41 def image_pow2ceil_expand(path):
42 size = os.path.getsize(path)
43 size_aligned = pow2ceil(size)
44 if size != size_aligned:
45 with open(path, 'ab+') as fd:
46 fd.truncate(size_aligned)
48 class LinuxKernelTest(Test):
49 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
51 def wait_for_console_pattern(self, success_message, vm=None):
52 wait_for_console_pattern(self, success_message,
53 failure_message='Kernel panic - not syncing',
54 vm=vm)
56 def extract_from_deb(self, deb, path):
57 """
58 Extracts a file from a deb package into the test workdir
60 :param deb: path to the deb archive
61 :param path: path within the deb archive of the file to be extracted
62 :returns: path of the extracted file
63 """
64 cwd = os.getcwd()
65 os.chdir(self.workdir)
66 file_path = process.run("ar t %s" % deb).stdout_text.split()[2]
67 process.run("ar x %s %s" % (deb, file_path))
68 archive.extract(file_path, self.workdir)
69 os.chdir(cwd)
70 # Return complete path to extracted file. Because callers to
71 # extract_from_deb() specify 'path' with a leading slash, it is
72 # necessary to use os.path.relpath() as otherwise os.path.join()
73 # interprets it as an absolute path and drops the self.workdir part.
74 return os.path.normpath(os.path.join(self.workdir,
75 os.path.relpath(path, '/')))
77 def extract_from_rpm(self, rpm, path):
78 """
79 Extracts a file from an RPM package into the test workdir.
81 :param rpm: path to the rpm archive
82 :param path: path within the rpm archive of the file to be extracted
83 needs to be a relative path (starting with './') because
84 cpio(1), which is used to extract the file, expects that.
85 :returns: path of the extracted file
86 """
87 cwd = os.getcwd()
88 os.chdir(self.workdir)
89 process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True)
90 os.chdir(cwd)
91 return os.path.normpath(os.path.join(self.workdir, path))
93 class BootLinuxConsole(LinuxKernelTest):
94 """
95 Boots a Linux kernel and checks that the console is operational and the
96 kernel command line is properly passed from QEMU to the kernel
97 """
98 timeout = 90
100 def test_x86_64_pc(self):
102 :avocado: tags=arch:x86_64
103 :avocado: tags=machine:pc
105 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
106 '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
107 '/vmlinuz')
108 kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
109 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
111 self.vm.set_console()
112 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
113 self.vm.add_args('-kernel', kernel_path,
114 '-append', kernel_command_line)
115 self.vm.launch()
116 console_pattern = 'Kernel command line: %s' % kernel_command_line
117 self.wait_for_console_pattern(console_pattern)
119 def test_mips_malta(self):
121 :avocado: tags=arch:mips
122 :avocado: tags=machine:malta
123 :avocado: tags=endian:big
125 deb_url = ('http://snapshot.debian.org/archive/debian/'
126 '20130217T032700Z/pool/main/l/linux-2.6/'
127 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb')
128 deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04'
129 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
130 kernel_path = self.extract_from_deb(deb_path,
131 '/boot/vmlinux-2.6.32-5-4kc-malta')
133 self.vm.set_console()
134 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
135 self.vm.add_args('-kernel', kernel_path,
136 '-append', kernel_command_line)
137 self.vm.launch()
138 console_pattern = 'Kernel command line: %s' % kernel_command_line
139 self.wait_for_console_pattern(console_pattern)
141 def test_mips64el_malta(self):
143 This test requires the ar tool to extract "data.tar.gz" from
144 the Debian package.
146 The kernel can be rebuilt using this Debian kernel source [1] and
147 following the instructions on [2].
149 [1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/
150 #linux-source-2.6.32_2.6.32-48
151 [2] https://kernel-team.pages.debian.net/kernel-handbook/
152 ch-common-tasks.html#s-common-official
154 :avocado: tags=arch:mips64el
155 :avocado: tags=machine:malta
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')
165 self.vm.set_console()
166 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
167 self.vm.add_args('-kernel', kernel_path,
168 '-append', kernel_command_line)
169 self.vm.launch()
170 console_pattern = 'Kernel command line: %s' % kernel_command_line
171 self.wait_for_console_pattern(console_pattern)
173 def test_mips64el_fuloong2e(self):
175 :avocado: tags=arch:mips64el
176 :avocado: tags=machine:fuloong2e
177 :avocado: tags=endian:little
179 deb_url = ('http://archive.debian.org/debian/pool/main/l/linux/'
180 'linux-image-3.16.0-6-loongson-2e_3.16.56-1+deb8u1_mipsel.deb')
181 deb_hash = 'd04d446045deecf7b755ef576551de0c4184dd44'
182 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
183 kernel_path = self.extract_from_deb(deb_path,
184 '/boot/vmlinux-3.16.0-6-loongson-2e')
186 self.vm.set_console()
187 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
188 self.vm.add_args('-kernel', kernel_path,
189 '-append', kernel_command_line)
190 self.vm.launch()
191 console_pattern = 'Kernel command line: %s' % kernel_command_line
192 self.wait_for_console_pattern(console_pattern)
194 def test_mips_malta_cpio(self):
196 :avocado: tags=arch:mips
197 :avocado: tags=machine:malta
198 :avocado: tags=endian:big
200 deb_url = ('http://snapshot.debian.org/archive/debian/'
201 '20160601T041800Z/pool/main/l/linux/'
202 'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb')
203 deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8'
204 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
205 kernel_path = self.extract_from_deb(deb_path,
206 '/boot/vmlinux-4.5.0-2-4kc-malta')
207 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
208 '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
209 'mips/rootfs.cpio.gz')
210 initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
211 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
212 initrd_path = self.workdir + "rootfs.cpio"
213 archive.gzip_uncompress(initrd_path_gz, initrd_path)
215 self.vm.set_console()
216 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
217 + 'console=ttyS0 console=tty '
218 + 'rdinit=/sbin/init noreboot')
219 self.vm.add_args('-kernel', kernel_path,
220 '-initrd', initrd_path,
221 '-append', kernel_command_line,
222 '-no-reboot')
223 self.vm.launch()
224 self.wait_for_console_pattern('Boot successful.')
226 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
227 'BogoMIPS')
228 exec_command_and_wait_for_pattern(self, 'uname -a',
229 'Debian')
230 exec_command_and_wait_for_pattern(self, 'reboot',
231 'reboot: Restarting system')
232 # Wait for VM to shut down gracefully
233 self.vm.wait()
235 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
236 def test_mips64el_malta_5KEc_cpio(self):
238 :avocado: tags=arch:mips64el
239 :avocado: tags=machine:malta
240 :avocado: tags=endian:little
242 kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
243 'raw/9ad2df38/mips/malta/mips64el/'
244 'vmlinux-3.19.3.mtoman.20150408')
245 kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
246 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
247 initrd_url = ('https://github.com/groeck/linux-build-test/'
248 'raw/8584a59e/rootfs/'
249 'mipsel64/rootfs.mipsel64r1.cpio.gz')
250 initrd_hash = '1dbb8a396e916847325284dbe2151167'
251 initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
252 asset_hash=initrd_hash)
253 initrd_path = self.workdir + "rootfs.cpio"
254 archive.gzip_uncompress(initrd_path_gz, initrd_path)
256 self.vm.set_console()
257 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
258 + 'console=ttyS0 console=tty '
259 + 'rdinit=/sbin/init noreboot')
260 self.vm.add_args('-cpu', '5KEc',
261 '-kernel', kernel_path,
262 '-initrd', initrd_path,
263 '-append', kernel_command_line,
264 '-no-reboot')
265 self.vm.launch()
266 wait_for_console_pattern(self, 'Boot successful.')
268 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
269 'MIPS 5KE')
270 exec_command_and_wait_for_pattern(self, 'uname -a',
271 '3.19.3.mtoman.20150408')
272 exec_command_and_wait_for_pattern(self, 'reboot',
273 'reboot: Restarting system')
274 # Wait for VM to shut down gracefully
275 self.vm.wait()
277 def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
278 kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
279 kernel_path = self.workdir + "kernel"
280 with lzma.open(kernel_path_xz, 'rb') as f_in:
281 with open(kernel_path, 'wb') as f_out:
282 shutil.copyfileobj(f_in, f_out)
284 self.vm.set_console()
285 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
286 + 'mem=256m@@0x0 '
287 + 'console=ttyS0')
288 self.vm.add_args('-no-reboot',
289 '-cpu', 'I7200',
290 '-kernel', kernel_path,
291 '-append', kernel_command_line)
292 self.vm.launch()
293 console_pattern = 'Kernel command line: %s' % kernel_command_line
294 self.wait_for_console_pattern(console_pattern)
296 def test_mips_malta32el_nanomips_4k(self):
298 :avocado: tags=arch:mipsel
299 :avocado: tags=machine:malta
300 :avocado: tags=endian:little
302 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
303 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
304 'generic_nano32r6el_page4k.xz')
305 kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
306 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
308 def test_mips_malta32el_nanomips_16k_up(self):
310 :avocado: tags=arch:mipsel
311 :avocado: tags=machine:malta
312 :avocado: tags=endian:little
314 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
315 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
316 'generic_nano32r6el_page16k_up.xz')
317 kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
318 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
320 def test_mips_malta32el_nanomips_64k_dbg(self):
322 :avocado: tags=arch:mipsel
323 :avocado: tags=machine:malta
324 :avocado: tags=endian:little
326 kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
327 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
328 'generic_nano32r6el_page64k_dbg.xz')
329 kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
330 self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
332 def test_aarch64_virt(self):
334 :avocado: tags=arch:aarch64
335 :avocado: tags=machine:virt
337 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
338 '/linux/releases/29/Everything/aarch64/os/images/pxeboot'
339 '/vmlinuz')
340 kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493'
341 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
343 self.vm.set_console()
344 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
345 'console=ttyAMA0')
346 self.vm.add_args('-cpu', 'cortex-a53',
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
360 images_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/'
361 'bionic-updates/main/installer-arm64/'
362 '20101020ubuntu543.15/images/')
363 kernel_url = images_url + 'netboot/ubuntu-installer/arm64/linux'
364 kernel_hash = '5bfc54cf7ed8157d93f6e5b0241e727b6dc22c50'
365 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
367 initrd_url = images_url + 'netboot/ubuntu-installer/arm64/initrd.gz'
368 initrd_hash = 'd385d3e88d53e2004c5d43cbe668b458a094f772'
369 initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
371 self.vm.set_console()
372 self.vm.add_args('-m', '2G',
373 '-kernel', kernel_path,
374 '-initrd', initrd_path)
375 self.vm.launch()
376 self.wait_for_console_pattern('Checked W+X mappings: passed')
378 def test_arm_virt(self):
380 :avocado: tags=arch:arm
381 :avocado: tags=machine:virt
383 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
384 '/linux/releases/29/Everything/armhfp/os/images/pxeboot'
385 '/vmlinuz')
386 kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
387 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
389 self.vm.set_console()
390 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
391 'console=ttyAMA0')
392 self.vm.add_args('-kernel', kernel_path,
393 '-append', kernel_command_line)
394 self.vm.launch()
395 console_pattern = 'Kernel command line: %s' % kernel_command_line
396 self.wait_for_console_pattern(console_pattern)
398 def test_arm_emcraft_sf2(self):
400 :avocado: tags=arch:arm
401 :avocado: tags=machine:emcraft-sf2
402 :avocado: tags=endian:little
403 :avocado: tags=u-boot
405 uboot_url = ('https://raw.githubusercontent.com/'
406 'Subbaraya-Sundeep/qemu-test-binaries/'
407 'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot')
408 uboot_hash = 'cbb8cbab970f594bf6523b9855be209c08374ae2'
409 uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash)
410 spi_url = ('https://raw.githubusercontent.com/'
411 'Subbaraya-Sundeep/qemu-test-binaries/'
412 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin')
413 spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501'
414 spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash)
416 self.vm.set_console()
417 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
418 self.vm.add_args('-kernel', uboot_path,
419 '-append', kernel_command_line,
420 '-drive', 'file=' + spi_path + ',if=mtd,format=raw',
421 '-no-reboot')
422 self.vm.launch()
423 self.wait_for_console_pattern('Enter \'help\' for a list')
425 exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15',
426 'eth0: link becomes ready')
427 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
428 '3 packets transmitted, 3 packets received, 0% packet loss')
430 def do_test_arm_raspi2(self, uart_id):
432 The kernel can be rebuilt using the kernel source referenced
433 and following the instructions on the on:
434 https://www.raspberrypi.org/documentation/linux/kernel/building.md
436 serial_kernel_cmdline = {
437 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
439 deb_url = ('http://archive.raspberrypi.org/debian/'
440 'pool/main/r/raspberrypi-firmware/'
441 'raspberrypi-kernel_1.20190215-1_armhf.deb')
442 deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
443 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
444 kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
445 dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
447 self.vm.set_console()
448 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
449 serial_kernel_cmdline[uart_id] +
450 ' root=/dev/mmcblk0p2 rootwait ' +
451 'dwc_otg.fiq_fsm_enable=0')
452 self.vm.add_args('-kernel', kernel_path,
453 '-dtb', dtb_path,
454 '-append', kernel_command_line,
455 '-device', 'usb-kbd')
456 self.vm.launch()
457 console_pattern = 'Kernel command line: %s' % kernel_command_line
458 self.wait_for_console_pattern(console_pattern)
459 console_pattern = 'Product: QEMU USB Keyboard'
460 self.wait_for_console_pattern(console_pattern)
462 def test_arm_raspi2_uart0(self):
464 :avocado: tags=arch:arm
465 :avocado: tags=machine:raspi2
466 :avocado: tags=device:pl011
468 self.do_test_arm_raspi2(0)
470 def test_arm_exynos4210_initrd(self):
472 :avocado: tags=arch:arm
473 :avocado: tags=machine:smdkc210
475 deb_url = ('https://snapshot.debian.org/archive/debian/'
476 '20190928T224601Z/pool/main/l/linux/'
477 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb')
478 deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82'
479 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
480 kernel_path = self.extract_from_deb(deb_path,
481 '/boot/vmlinuz-4.19.0-6-armmp')
482 dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb'
483 dtb_path = self.extract_from_deb(deb_path, dtb_path)
485 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
486 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
487 'arm/rootfs-armv5.cpio.gz')
488 initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
489 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
490 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
491 archive.gzip_uncompress(initrd_path_gz, initrd_path)
493 self.vm.set_console()
494 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
495 'earlycon=exynos4210,0x13800000 earlyprintk ' +
496 'console=ttySAC0,115200n8 ' +
497 'random.trust_cpu=off cryptomgr.notests ' +
498 'cpuidle.off=1 panic=-1 noreboot')
500 self.vm.add_args('-kernel', kernel_path,
501 '-dtb', dtb_path,
502 '-initrd', initrd_path,
503 '-append', kernel_command_line,
504 '-no-reboot')
505 self.vm.launch()
507 self.wait_for_console_pattern('Boot successful.')
508 # TODO user command, for now the uart is stuck
510 @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'),
511 'Test artifacts fetched from unreliable apt.armbian.com')
512 def test_arm_cubieboard_initrd(self):
514 :avocado: tags=arch:arm
515 :avocado: tags=machine:cubieboard
517 deb_url = ('https://apt.armbian.com/pool/main/l/'
518 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
519 deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
520 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
521 kernel_path = self.extract_from_deb(deb_path,
522 '/boot/vmlinuz-4.20.7-sunxi')
523 dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
524 dtb_path = self.extract_from_deb(deb_path, dtb_path)
525 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
526 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
527 'arm/rootfs-armv5.cpio.gz')
528 initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
529 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
530 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
531 archive.gzip_uncompress(initrd_path_gz, initrd_path)
533 self.vm.set_console()
534 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
535 'console=ttyS0,115200 '
536 'usbcore.nousb '
537 'panic=-1 noreboot')
538 self.vm.add_args('-kernel', kernel_path,
539 '-dtb', dtb_path,
540 '-initrd', initrd_path,
541 '-append', kernel_command_line,
542 '-no-reboot')
543 self.vm.launch()
544 self.wait_for_console_pattern('Boot successful.')
546 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
547 'Allwinner sun4i/sun5i')
548 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
549 'system-control@1c00000')
550 # cubieboard's reboot is not functioning; omit reboot test.
552 @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'),
553 'Test artifacts fetched from unreliable apt.armbian.com')
554 def test_arm_cubieboard_sata(self):
556 :avocado: tags=arch:arm
557 :avocado: tags=machine:cubieboard
559 deb_url = ('https://apt.armbian.com/pool/main/l/'
560 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
561 deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
562 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
563 kernel_path = self.extract_from_deb(deb_path,
564 '/boot/vmlinuz-4.20.7-sunxi')
565 dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
566 dtb_path = self.extract_from_deb(deb_path, dtb_path)
567 rootfs_url = ('https://github.com/groeck/linux-build-test/raw/'
568 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
569 'arm/rootfs-armv5.ext2.gz')
570 rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93'
571 rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
572 rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
573 archive.gzip_uncompress(rootfs_path_gz, rootfs_path)
575 self.vm.set_console()
576 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
577 'console=ttyS0,115200 '
578 'usbcore.nousb '
579 'root=/dev/sda ro '
580 'panic=-1 noreboot')
581 self.vm.add_args('-kernel', kernel_path,
582 '-dtb', dtb_path,
583 '-drive', 'if=none,format=raw,id=disk0,file='
584 + rootfs_path,
585 '-device', 'ide-hd,bus=ide.0,drive=disk0',
586 '-append', kernel_command_line,
587 '-no-reboot')
588 self.vm.launch()
589 self.wait_for_console_pattern('Boot successful.')
591 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
592 'Allwinner sun4i/sun5i')
593 exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
594 'sda')
595 # cubieboard's reboot is not functioning; omit reboot test.
597 @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
598 def test_arm_quanta_gsj(self):
600 :avocado: tags=arch:arm
601 :avocado: tags=machine:quanta-gsj
603 # 25 MiB compressed, 32 MiB uncompressed.
604 image_url = (
605 'https://github.com/hskinnemoen/openbmc/releases/download/'
606 '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz')
607 image_hash = '14895e634923345cb5c8776037ff7876df96f6b1'
608 image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
609 image_name = 'obmc.mtd'
610 image_path = os.path.join(self.workdir, image_name)
611 archive.gzip_uncompress(image_path_gz, image_path)
613 self.vm.set_console()
614 drive_args = 'file=' + image_path + ',if=mtd,bus=0,unit=0'
615 self.vm.add_args('-drive', drive_args)
616 self.vm.launch()
618 # Disable drivers and services that stall for a long time during boot,
619 # to avoid running past the 90-second timeout. These may be removed
620 # as the corresponding device support is added.
621 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + (
622 'console=${console} '
623 'mem=${mem} '
624 'initcall_blacklist=npcm_i2c_bus_driver_init '
625 'systemd.mask=systemd-random-seed.service '
626 'systemd.mask=dropbearkey.service '
629 self.wait_for_console_pattern('> BootBlock by Nuvoton')
630 self.wait_for_console_pattern('>Device: Poleg BMC NPCM730')
631 self.wait_for_console_pattern('>Skip DDR init.')
632 self.wait_for_console_pattern('U-Boot ')
633 interrupt_interactive_console_until_pattern(
634 self, 'Hit any key to stop autoboot:', 'U-Boot>')
635 exec_command_and_wait_for_pattern(
636 self, "setenv bootargs ${bootargs} " + kernel_command_line,
637 'U-Boot>')
638 exec_command_and_wait_for_pattern(
639 self, 'run romboot', 'Booting Kernel from flash')
640 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
641 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
642 self.wait_for_console_pattern('OpenBMC Project Reference Distro')
643 self.wait_for_console_pattern('gsj login:')
645 def test_arm_quanta_gsj_initrd(self):
647 :avocado: tags=arch:arm
648 :avocado: tags=machine:quanta-gsj
650 initrd_url = (
651 'https://github.com/hskinnemoen/openbmc/releases/download/'
652 '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz')
653 initrd_hash = '98fefe5d7e56727b1eb17d5c00311b1b5c945300'
654 initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
655 kernel_url = (
656 'https://github.com/hskinnemoen/openbmc/releases/download/'
657 '20200711-gsj-qemu-0/uImage-gsj.bin')
658 kernel_hash = 'fa67b2f141d56d39b3c54305c0e8a899c99eb2c7'
659 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
660 dtb_url = (
661 'https://github.com/hskinnemoen/openbmc/releases/download/'
662 '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb')
663 dtb_hash = '18315f7006d7b688d8312d5c727eecd819aa36a4'
664 dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash)
666 self.vm.set_console()
667 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
668 'console=ttyS0,115200n8 '
669 'earlycon=uart8250,mmio32,0xf0001000')
670 self.vm.add_args('-kernel', kernel_path,
671 '-initrd', initrd_path,
672 '-dtb', dtb_path,
673 '-append', kernel_command_line)
674 self.vm.launch()
676 self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
677 self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
678 self.wait_for_console_pattern(
679 'Give root password for system maintenance')
681 @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'),
682 'Test artifacts fetched from unreliable apt.armbian.com')
683 def test_arm_orangepi(self):
685 :avocado: tags=arch:arm
686 :avocado: tags=machine:orangepi-pc
688 deb_url = ('https://apt.armbian.com/pool/main/l/'
689 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
690 deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
691 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
692 kernel_path = self.extract_from_deb(deb_path,
693 '/boot/vmlinuz-4.20.7-sunxi')
694 dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb'
695 dtb_path = self.extract_from_deb(deb_path, dtb_path)
697 self.vm.set_console()
698 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
699 'console=ttyS0,115200n8 '
700 'earlycon=uart,mmio32,0x1c28000')
701 self.vm.add_args('-kernel', kernel_path,
702 '-dtb', dtb_path,
703 '-append', kernel_command_line)
704 self.vm.launch()
705 console_pattern = 'Kernel command line: %s' % kernel_command_line
706 self.wait_for_console_pattern(console_pattern)
708 @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'),
709 'Test artifacts fetched from unreliable apt.armbian.com')
710 def test_arm_orangepi_initrd(self):
712 :avocado: tags=arch:arm
713 :avocado: tags=machine:orangepi-pc
715 deb_url = ('https://apt.armbian.com/pool/main/l/'
716 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
717 deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
718 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
719 kernel_path = self.extract_from_deb(deb_path,
720 '/boot/vmlinuz-4.20.7-sunxi')
721 dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb'
722 dtb_path = self.extract_from_deb(deb_path, dtb_path)
723 initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
724 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
725 'arm/rootfs-armv7a.cpio.gz')
726 initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
727 initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
728 initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
729 archive.gzip_uncompress(initrd_path_gz, initrd_path)
731 self.vm.set_console()
732 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
733 'console=ttyS0,115200 '
734 'panic=-1 noreboot')
735 self.vm.add_args('-kernel', kernel_path,
736 '-dtb', dtb_path,
737 '-initrd', initrd_path,
738 '-append', kernel_command_line,
739 '-no-reboot')
740 self.vm.launch()
741 self.wait_for_console_pattern('Boot successful.')
743 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
744 'Allwinner sun8i Family')
745 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
746 'system-control@1c00000')
747 exec_command_and_wait_for_pattern(self, 'reboot',
748 'reboot: Restarting system')
749 # Wait for VM to shut down gracefully
750 self.vm.wait()
752 @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'),
753 'Test artifacts fetched from unreliable apt.armbian.com')
754 def test_arm_orangepi_sd(self):
756 :avocado: tags=arch:arm
757 :avocado: tags=machine:orangepi-pc
758 :avocado: tags=device:sd
760 deb_url = ('https://apt.armbian.com/pool/main/l/'
761 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
762 deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
763 deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
764 kernel_path = self.extract_from_deb(deb_path,
765 '/boot/vmlinuz-4.20.7-sunxi')
766 dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb'
767 dtb_path = self.extract_from_deb(deb_path, dtb_path)
768 rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/'
769 'kci-2019.02/armel/base/rootfs.ext2.xz')
770 rootfs_hash = '692510cb625efda31640d1de0a8d60e26040f061'
771 rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
772 rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
773 archive.lzma_uncompress(rootfs_path_xz, rootfs_path)
774 image_pow2ceil_expand(rootfs_path)
776 self.vm.set_console()
777 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
778 'console=ttyS0,115200 '
779 'root=/dev/mmcblk0 rootwait rw '
780 'panic=-1 noreboot')
781 self.vm.add_args('-kernel', kernel_path,
782 '-dtb', dtb_path,
783 '-drive', 'file=' + rootfs_path + ',if=sd,format=raw',
784 '-append', kernel_command_line,
785 '-no-reboot')
786 self.vm.launch()
787 shell_ready = "/bin/sh: can't access tty; job control turned off"
788 self.wait_for_console_pattern(shell_ready)
790 exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
791 'Allwinner sun8i Family')
792 exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
793 'mmcblk0')
794 exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
795 'eth0: Link is Up')
796 exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
797 'udhcpc: lease of 10.0.2.15 obtained')
798 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
799 '3 packets transmitted, 3 packets received, 0% packet loss')
800 exec_command_and_wait_for_pattern(self, 'reboot',
801 'reboot: Restarting system')
802 # Wait for VM to shut down gracefully
803 self.vm.wait()
805 def do_test_arm_orangepi_uboot_armbian(self, image_path):
806 self.vm.set_console()
807 self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw',
808 '-nic', 'user',
809 '-no-reboot')
810 self.vm.launch()
812 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
813 'console=ttyS0,115200 '
814 'loglevel=7 '
815 'nosmp '
816 'systemd.default_timeout_start_sec=9000 '
817 'systemd.mask=armbian-zram-config.service '
818 'systemd.mask=armbian-ramlog.service')
820 self.wait_for_console_pattern('U-Boot SPL')
821 self.wait_for_console_pattern('Autoboot in ')
822 exec_command_and_wait_for_pattern(self, ' ', '=>')
823 exec_command_and_wait_for_pattern(self, "setenv extraargs '" +
824 kernel_command_line + "'", '=>')
825 exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...');
827 self.wait_for_console_pattern('systemd[1]: Set hostname ' +
828 'to <orangepipc>')
829 self.wait_for_console_pattern('Starting Load Kernel Modules...')
831 @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'),
832 'Test artifacts fetched from unreliable apt.armbian.com')
833 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
834 @skipUnless(P7ZIP_AVAILABLE, '7z not installed')
835 def test_arm_orangepi_bionic_19_11(self):
837 :avocado: tags=arch:arm
838 :avocado: tags=machine:orangepi-pc
839 :avocado: tags=device:sd
842 # This test download a 196MB compressed image and expand it to 1GB
843 image_url = ('https://dl.armbian.com/orangepipc/archive/'
844 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z')
845 image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e'
846 image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash)
847 image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img'
848 image_path = os.path.join(self.workdir, image_name)
849 process.run("7z e -o%s %s" % (self.workdir, image_path_7z))
850 image_pow2ceil_expand(image_path)
852 self.do_test_arm_orangepi_uboot_armbian(image_path)
854 @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'),
855 'Test artifacts fetched from unreliable apt.armbian.com')
856 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
857 def test_arm_orangepi_bionic_20_08(self):
859 :avocado: tags=arch:arm
860 :avocado: tags=machine:orangepi-pc
861 :avocado: tags=device:sd
864 # This test download a 275 MiB compressed image and expand it
865 # to 1036 MiB, but the underlying filesystem is 1552 MiB...
866 # As we expand it to 2 GiB we are safe.
868 image_url = ('https://dl.armbian.com/orangepipc/archive/'
869 'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')
870 image_hash = ('b4d6775f5673486329e45a0586bf06b6'
871 'dbe792199fd182ac6b9c7bb6c7d3e6dd')
872 image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash,
873 algorithm='sha256')
874 image_path = archive.extract(image_path_xz, self.workdir)
875 image_pow2ceil_expand(image_path)
877 self.do_test_arm_orangepi_uboot_armbian(image_path)
879 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
880 def test_arm_orangepi_uboot_netbsd9(self):
882 :avocado: tags=arch:arm
883 :avocado: tags=machine:orangepi-pc
884 :avocado: tags=device:sd
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:
910 f_out.seek(8 * 1024)
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',
917 '-no-reboot')
918 self.vm.launch()
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:raspi3
948 :avocado: tags=cpu:cortex-a53
949 :avocado: tags=device:pl011
950 :avocado: tags=atf
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)
963 self.vm.launch()
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'
973 '/kernel.img')
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)
982 self.vm.launch()
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)
1003 self.vm.launch()
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)
1025 self.vm.launch()
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://www.qemu-advent-calendar.org'
1033 '/2018/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)
1039 self.vm.launch()
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_m68k_mcf5208evb(self):
1053 :avocado: tags=arch:m68k
1054 :avocado: tags=machine:mcf5208evb
1056 tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
1057 self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf')
1059 def test_or1k_sim(self):
1061 :avocado: tags=arch:or1k
1062 :avocado: tags=machine:or1k-sim
1064 tar_hash = '20334cdaf386108c530ff0badaecc955693027dd'
1065 self.do_test_advcal_2018('20', tar_hash, 'vmlinux')
1067 def test_nios2_10m50(self):
1069 :avocado: tags=arch:nios2
1070 :avocado: tags=machine:10m50-ghrd
1072 tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918'
1073 self.do_test_advcal_2018('14', tar_hash, 'vmlinux.elf')
1075 def test_ppc64_e500(self):
1077 :avocado: tags=arch:ppc64
1078 :avocado: tags=machine:ppce500
1080 tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
1081 self.vm.add_args('-cpu', 'e5500')
1082 self.do_test_advcal_2018('19', tar_hash, 'uImage')
1084 def test_ppc_g3beige(self):
1086 :avocado: tags=arch:ppc
1087 :avocado: tags=machine:g3beige
1089 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1090 self.vm.add_args('-M', 'graphics=off')
1091 self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
1093 def test_ppc_mac99(self):
1095 :avocado: tags=arch:ppc
1096 :avocado: tags=machine:mac99
1098 tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1099 self.vm.add_args('-M', 'graphics=off')
1100 self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
1102 def test_sh4_r2d(self):
1104 :avocado: tags=arch:sh4
1105 :avocado: tags=machine:r2d
1107 tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
1108 self.vm.add_args('-append', 'console=ttySC1')
1109 self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1)
1111 def test_sparc_ss20(self):
1113 :avocado: tags=arch:sparc
1114 :avocado: tags=machine:SS-20
1116 tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
1117 self.do_test_advcal_2018('11', tar_hash, 'zImage.elf')
1119 def test_xtensa_lx60(self):
1121 :avocado: tags=arch:xtensa
1122 :avocado: tags=machine:lx60
1124 tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
1125 self.vm.add_args('-cpu', 'dc233c')
1126 self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')