1 # Functional test that boots a Linux kernel and checks the console
3 # Copyright (c) 2018 Red Hat, Inc.
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.
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
27 Round up to next power of 2
30 return 1 if x
== 0 else 2**(x
- 1).bit_length()
33 Expand file size to next power of 2
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',
50 def extract_from_deb(self
, deb
, path
):
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
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
)
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
):
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
82 os
.chdir(self
.workdir
)
83 process
.run("rpm2cpio %s | cpio -id %s" % (rpm
, path
), shell
=True)
85 return os
.path
.normpath(os
.path
.join(self
.workdir
, path
))
87 class BootLinuxConsole(LinuxKernelTest
):
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
94 def test_x86_64_pc(self
):
96 :avocado: tags=arch:x86_64
97 :avocado: tags=machine:pc
99 kernel_url
= ('https://archives.fedoraproject.org/pub/archive/fedora'
100 '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
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
)
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
)
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
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
)
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
)
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
,
218 self
.wait_for_console_pattern('Boot successful.')
220 exec_command_and_wait_for_pattern(self
, 'cat /proc/cpuinfo',
222 exec_command_and_wait_for_pattern(self
, 'uname -a',
224 exec_command_and_wait_for_pattern(self
, 'reboot',
225 'reboot: Restarting system')
226 # Wait for VM to shut down gracefully
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
,
260 wait_for_console_pattern(self
, 'Boot successful.')
262 exec_command_and_wait_for_pattern(self
, 'cat /proc/cpuinfo',
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
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
282 self
.vm
.add_args('-no-reboot',
283 '-kernel', kernel_path
,
284 '-append', kernel_command_line
)
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_xlnx_versal_virt(self
):
330 :avocado: tags=arch:aarch64
331 :avocado: tags=machine:xlnx-versal-virt
332 :avocado: tags=device:pl011
333 :avocado: tags=device:arm_gicv3
334 :avocado: tags=accel:tcg
336 images_url
= ('http://ports.ubuntu.com/ubuntu-ports/dists/'
337 'bionic-updates/main/installer-arm64/'
338 '20101020ubuntu543.15/images/')
339 kernel_url
= images_url
+ 'netboot/ubuntu-installer/arm64/linux'
340 kernel_hash
= '5bfc54cf7ed8157d93f6e5b0241e727b6dc22c50'
341 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
)
343 initrd_url
= images_url
+ 'netboot/ubuntu-installer/arm64/initrd.gz'
344 initrd_hash
= 'd385d3e88d53e2004c5d43cbe668b458a094f772'
345 initrd_path
= self
.fetch_asset(initrd_url
, asset_hash
=initrd_hash
)
347 self
.vm
.set_console()
348 self
.vm
.add_args('-m', '2G',
350 '-kernel', kernel_path
,
351 '-initrd', initrd_path
)
353 self
.wait_for_console_pattern('Checked W+X mappings: passed')
355 def test_arm_virt(self
):
357 :avocado: tags=arch:arm
358 :avocado: tags=machine:virt
359 :avocado: tags=accel:tcg
361 kernel_url
= ('https://archives.fedoraproject.org/pub/archive/fedora'
362 '/linux/releases/29/Everything/armhfp/os/images/pxeboot'
364 kernel_hash
= 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
365 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
)
367 self
.vm
.set_console()
368 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
370 self
.vm
.add_args('-kernel', kernel_path
,
371 '-append', kernel_command_line
)
373 console_pattern
= 'Kernel command line: %s' % kernel_command_line
374 self
.wait_for_console_pattern(console_pattern
)
376 def test_arm_emcraft_sf2(self
):
378 :avocado: tags=arch:arm
379 :avocado: tags=machine:emcraft-sf2
380 :avocado: tags=endian:little
381 :avocado: tags=u-boot
382 :avocado: tags=accel:tcg
384 uboot_url
= ('https://raw.githubusercontent.com/'
385 'Subbaraya-Sundeep/qemu-test-binaries/'
386 'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot')
387 uboot_hash
= 'cbb8cbab970f594bf6523b9855be209c08374ae2'
388 uboot_path
= self
.fetch_asset(uboot_url
, asset_hash
=uboot_hash
)
389 spi_url
= ('https://raw.githubusercontent.com/'
390 'Subbaraya-Sundeep/qemu-test-binaries/'
391 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin')
392 spi_hash
= '65523a1835949b6f4553be96dec1b6a38fb05501'
393 spi_path
= self
.fetch_asset(spi_url
, asset_hash
=spi_hash
)
395 self
.vm
.set_console()
396 kernel_command_line
= self
.KERNEL_COMMON_COMMAND_LINE
397 self
.vm
.add_args('-kernel', uboot_path
,
398 '-append', kernel_command_line
,
399 '-drive', 'file=' + spi_path
+ ',if=mtd,format=raw',
402 self
.wait_for_console_pattern('Enter \'help\' for a list')
404 exec_command_and_wait_for_pattern(self
, 'ifconfig eth0 10.0.2.15',
405 'eth0: link becomes ready')
406 exec_command_and_wait_for_pattern(self
, 'ping -c 3 10.0.2.2',
407 '3 packets transmitted, 3 packets received, 0% packet loss')
409 def do_test_arm_raspi2(self
, uart_id
):
411 :avocado: tags=accel:tcg
413 The kernel can be rebuilt using the kernel source referenced
414 and following the instructions on the on:
415 https://www.raspberrypi.org/documentation/linux/kernel/building.md
417 serial_kernel_cmdline
= {
418 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
420 deb_url
= ('http://archive.raspberrypi.org/debian/'
421 'pool/main/r/raspberrypi-firmware/'
422 'raspberrypi-kernel_1.20190215-1_armhf.deb')
423 deb_hash
= 'cd284220b32128c5084037553db3c482426f3972'
424 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
425 kernel_path
= self
.extract_from_deb(deb_path
, '/boot/kernel7.img')
426 dtb_path
= self
.extract_from_deb(deb_path
, '/boot/bcm2709-rpi-2-b.dtb')
428 self
.vm
.set_console()
429 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
430 serial_kernel_cmdline
[uart_id
] +
431 ' root=/dev/mmcblk0p2 rootwait ' +
432 'dwc_otg.fiq_fsm_enable=0')
433 self
.vm
.add_args('-kernel', kernel_path
,
435 '-append', kernel_command_line
,
436 '-device', 'usb-kbd')
438 console_pattern
= 'Kernel command line: %s' % kernel_command_line
439 self
.wait_for_console_pattern(console_pattern
)
440 console_pattern
= 'Product: QEMU USB Keyboard'
441 self
.wait_for_console_pattern(console_pattern
)
443 def test_arm_raspi2_uart0(self
):
445 :avocado: tags=arch:arm
446 :avocado: tags=machine:raspi2b
447 :avocado: tags=device:pl011
448 :avocado: tags=accel:tcg
450 self
.do_test_arm_raspi2(0)
452 def test_arm_raspi2_initrd(self
):
454 :avocado: tags=arch:arm
455 :avocado: tags=machine:raspi2b
457 deb_url
= ('http://archive.raspberrypi.org/debian/'
458 'pool/main/r/raspberrypi-firmware/'
459 'raspberrypi-kernel_1.20190215-1_armhf.deb')
460 deb_hash
= 'cd284220b32128c5084037553db3c482426f3972'
461 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
462 kernel_path
= self
.extract_from_deb(deb_path
, '/boot/kernel7.img')
463 dtb_path
= self
.extract_from_deb(deb_path
, '/boot/bcm2709-rpi-2-b.dtb')
465 initrd_url
= ('https://github.com/groeck/linux-build-test/raw/'
466 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
467 'arm/rootfs-armv7a.cpio.gz')
468 initrd_hash
= '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
469 initrd_path_gz
= self
.fetch_asset(initrd_url
, asset_hash
=initrd_hash
)
470 initrd_path
= os
.path
.join(self
.workdir
, 'rootfs.cpio')
471 archive
.gzip_uncompress(initrd_path_gz
, initrd_path
)
473 self
.vm
.set_console()
474 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
475 'earlycon=pl011,0x3f201000 console=ttyAMA0 '
476 'panic=-1 noreboot ' +
477 'dwc_otg.fiq_fsm_enable=0')
478 self
.vm
.add_args('-kernel', kernel_path
,
480 '-initrd', initrd_path
,
481 '-append', kernel_command_line
,
484 self
.wait_for_console_pattern('Boot successful.')
486 exec_command_and_wait_for_pattern(self
, 'cat /proc/cpuinfo',
488 exec_command_and_wait_for_pattern(self
, 'cat /proc/iomem',
489 '/soc/cprman@7e101000')
490 exec_command(self
, 'halt')
491 # Wait for VM to shut down gracefully
494 def test_arm_exynos4210_initrd(self
):
496 :avocado: tags=arch:arm
497 :avocado: tags=machine:smdkc210
498 :avocado: tags=accel:tcg
500 deb_url
= ('https://snapshot.debian.org/archive/debian/'
501 '20190928T224601Z/pool/main/l/linux/'
502 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb')
503 deb_hash
= 'fa9df4a0d38936cb50084838f2cb933f570d7d82'
504 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
505 kernel_path
= self
.extract_from_deb(deb_path
,
506 '/boot/vmlinuz-4.19.0-6-armmp')
507 dtb_path
= '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb'
508 dtb_path
= self
.extract_from_deb(deb_path
, dtb_path
)
510 initrd_url
= ('https://github.com/groeck/linux-build-test/raw/'
511 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
512 'arm/rootfs-armv5.cpio.gz')
513 initrd_hash
= '2b50f1873e113523967806f4da2afe385462ff9b'
514 initrd_path_gz
= self
.fetch_asset(initrd_url
, asset_hash
=initrd_hash
)
515 initrd_path
= os
.path
.join(self
.workdir
, 'rootfs.cpio')
516 archive
.gzip_uncompress(initrd_path_gz
, initrd_path
)
518 self
.vm
.set_console()
519 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
520 'earlycon=exynos4210,0x13800000 earlyprintk ' +
521 'console=ttySAC0,115200n8 ' +
522 'random.trust_cpu=off cryptomgr.notests ' +
523 'cpuidle.off=1 panic=-1 noreboot')
525 self
.vm
.add_args('-kernel', kernel_path
,
527 '-initrd', initrd_path
,
528 '-append', kernel_command_line
,
532 self
.wait_for_console_pattern('Boot successful.')
533 # TODO user command, for now the uart is stuck
535 def test_arm_cubieboard_initrd(self
):
537 :avocado: tags=arch:arm
538 :avocado: tags=machine:cubieboard
539 :avocado: tags=accel:tcg
541 deb_url
= ('https://apt.armbian.com/pool/main/l/'
542 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
543 deb_hash
= '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
544 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
545 kernel_path
= self
.extract_from_deb(deb_path
,
546 '/boot/vmlinuz-5.10.16-sunxi')
547 dtb_path
= '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
548 dtb_path
= self
.extract_from_deb(deb_path
, dtb_path
)
549 initrd_url
= ('https://github.com/groeck/linux-build-test/raw/'
550 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
551 'arm/rootfs-armv5.cpio.gz')
552 initrd_hash
= '2b50f1873e113523967806f4da2afe385462ff9b'
553 initrd_path_gz
= self
.fetch_asset(initrd_url
, asset_hash
=initrd_hash
)
554 initrd_path
= os
.path
.join(self
.workdir
, 'rootfs.cpio')
555 archive
.gzip_uncompress(initrd_path_gz
, initrd_path
)
557 self
.vm
.set_console()
558 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
559 'console=ttyS0,115200 '
562 self
.vm
.add_args('-kernel', kernel_path
,
564 '-initrd', initrd_path
,
565 '-append', kernel_command_line
,
568 self
.wait_for_console_pattern('Boot successful.')
570 exec_command_and_wait_for_pattern(self
, 'cat /proc/cpuinfo',
571 'Allwinner sun4i/sun5i')
572 exec_command_and_wait_for_pattern(self
, 'cat /proc/iomem',
573 'system-control@1c00000')
574 # cubieboard's reboot is not functioning; omit reboot test.
576 def test_arm_cubieboard_sata(self
):
578 :avocado: tags=arch:arm
579 :avocado: tags=machine:cubieboard
580 :avocado: tags=accel:tcg
582 deb_url
= ('https://apt.armbian.com/pool/main/l/'
583 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
584 deb_hash
= '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
585 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
586 kernel_path
= self
.extract_from_deb(deb_path
,
587 '/boot/vmlinuz-5.10.16-sunxi')
588 dtb_path
= '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
589 dtb_path
= self
.extract_from_deb(deb_path
, dtb_path
)
590 rootfs_url
= ('https://github.com/groeck/linux-build-test/raw/'
591 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
592 'arm/rootfs-armv5.ext2.gz')
593 rootfs_hash
= '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93'
594 rootfs_path_gz
= self
.fetch_asset(rootfs_url
, asset_hash
=rootfs_hash
)
595 rootfs_path
= os
.path
.join(self
.workdir
, 'rootfs.cpio')
596 archive
.gzip_uncompress(rootfs_path_gz
, rootfs_path
)
598 self
.vm
.set_console()
599 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
600 'console=ttyS0,115200 '
604 self
.vm
.add_args('-kernel', kernel_path
,
606 '-drive', 'if=none,format=raw,id=disk0,file='
608 '-device', 'ide-hd,bus=ide.0,drive=disk0',
609 '-append', kernel_command_line
,
612 self
.wait_for_console_pattern('Boot successful.')
614 exec_command_and_wait_for_pattern(self
, 'cat /proc/cpuinfo',
615 'Allwinner sun4i/sun5i')
616 exec_command_and_wait_for_pattern(self
, 'cat /proc/partitions',
618 # cubieboard's reboot is not functioning; omit reboot test.
620 @skipUnless(os
.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
621 def test_arm_quanta_gsj(self
):
623 :avocado: tags=arch:arm
624 :avocado: tags=machine:quanta-gsj
625 :avocado: tags=accel:tcg
627 # 25 MiB compressed, 32 MiB uncompressed.
629 'https://github.com/hskinnemoen/openbmc/releases/download/'
630 '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz')
631 image_hash
= '14895e634923345cb5c8776037ff7876df96f6b1'
632 image_path_gz
= self
.fetch_asset(image_url
, asset_hash
=image_hash
)
633 image_name
= 'obmc.mtd'
634 image_path
= os
.path
.join(self
.workdir
, image_name
)
635 archive
.gzip_uncompress(image_path_gz
, image_path
)
637 self
.vm
.set_console()
638 drive_args
= 'file=' + image_path
+ ',if=mtd,bus=0,unit=0'
639 self
.vm
.add_args('-drive', drive_args
)
642 # Disable drivers and services that stall for a long time during boot,
643 # to avoid running past the 90-second timeout. These may be removed
644 # as the corresponding device support is added.
645 kernel_command_line
= self
.KERNEL_COMMON_COMMAND_LINE
+ (
646 'console=${console} '
648 'initcall_blacklist=npcm_i2c_bus_driver_init '
649 'systemd.mask=systemd-random-seed.service '
650 'systemd.mask=dropbearkey.service '
653 self
.wait_for_console_pattern('> BootBlock by Nuvoton')
654 self
.wait_for_console_pattern('>Device: Poleg BMC NPCM730')
655 self
.wait_for_console_pattern('>Skip DDR init.')
656 self
.wait_for_console_pattern('U-Boot ')
657 interrupt_interactive_console_until_pattern(
658 self
, 'Hit any key to stop autoboot:', 'U-Boot>')
659 exec_command_and_wait_for_pattern(
660 self
, "setenv bootargs ${bootargs} " + kernel_command_line
,
662 exec_command_and_wait_for_pattern(
663 self
, 'run romboot', 'Booting Kernel from flash')
664 self
.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
665 self
.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
666 self
.wait_for_console_pattern('OpenBMC Project Reference Distro')
667 self
.wait_for_console_pattern('gsj login:')
669 def test_arm_quanta_gsj_initrd(self
):
671 :avocado: tags=arch:arm
672 :avocado: tags=machine:quanta-gsj
673 :avocado: tags=accel:tcg
676 'https://github.com/hskinnemoen/openbmc/releases/download/'
677 '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz')
678 initrd_hash
= '98fefe5d7e56727b1eb17d5c00311b1b5c945300'
679 initrd_path
= self
.fetch_asset(initrd_url
, asset_hash
=initrd_hash
)
681 'https://github.com/hskinnemoen/openbmc/releases/download/'
682 '20200711-gsj-qemu-0/uImage-gsj.bin')
683 kernel_hash
= 'fa67b2f141d56d39b3c54305c0e8a899c99eb2c7'
684 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
)
686 'https://github.com/hskinnemoen/openbmc/releases/download/'
687 '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb')
688 dtb_hash
= '18315f7006d7b688d8312d5c727eecd819aa36a4'
689 dtb_path
= self
.fetch_asset(dtb_url
, asset_hash
=dtb_hash
)
691 self
.vm
.set_console()
692 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
693 'console=ttyS0,115200n8 '
694 'earlycon=uart8250,mmio32,0xf0001000')
695 self
.vm
.add_args('-kernel', kernel_path
,
696 '-initrd', initrd_path
,
698 '-append', kernel_command_line
)
701 self
.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
702 self
.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
703 self
.wait_for_console_pattern(
704 'Give root password for system maintenance')
706 def test_arm_orangepi(self
):
708 :avocado: tags=arch:arm
709 :avocado: tags=machine:orangepi-pc
710 :avocado: tags=accel:tcg
712 deb_url
= ('https://apt.armbian.com/pool/main/l/'
713 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
714 deb_hash
= '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
715 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
716 kernel_path
= self
.extract_from_deb(deb_path
,
717 '/boot/vmlinuz-5.10.16-sunxi')
718 dtb_path
= '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
719 dtb_path
= self
.extract_from_deb(deb_path
, dtb_path
)
721 self
.vm
.set_console()
722 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
723 'console=ttyS0,115200n8 '
724 'earlycon=uart,mmio32,0x1c28000')
725 self
.vm
.add_args('-kernel', kernel_path
,
727 '-append', kernel_command_line
)
729 console_pattern
= 'Kernel command line: %s' % kernel_command_line
730 self
.wait_for_console_pattern(console_pattern
)
732 def test_arm_orangepi_initrd(self
):
734 :avocado: tags=arch:arm
735 :avocado: tags=accel:tcg
736 :avocado: tags=machine:orangepi-pc
738 deb_url
= ('https://apt.armbian.com/pool/main/l/'
739 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
740 deb_hash
= '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
741 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
742 kernel_path
= self
.extract_from_deb(deb_path
,
743 '/boot/vmlinuz-5.10.16-sunxi')
744 dtb_path
= '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
745 dtb_path
= self
.extract_from_deb(deb_path
, dtb_path
)
746 initrd_url
= ('https://github.com/groeck/linux-build-test/raw/'
747 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
748 'arm/rootfs-armv7a.cpio.gz')
749 initrd_hash
= '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
750 initrd_path_gz
= self
.fetch_asset(initrd_url
, asset_hash
=initrd_hash
)
751 initrd_path
= os
.path
.join(self
.workdir
, 'rootfs.cpio')
752 archive
.gzip_uncompress(initrd_path_gz
, initrd_path
)
754 self
.vm
.set_console()
755 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
756 'console=ttyS0,115200 '
758 self
.vm
.add_args('-kernel', kernel_path
,
760 '-initrd', initrd_path
,
761 '-append', kernel_command_line
,
764 self
.wait_for_console_pattern('Boot successful.')
766 exec_command_and_wait_for_pattern(self
, 'cat /proc/cpuinfo',
767 'Allwinner sun8i Family')
768 exec_command_and_wait_for_pattern(self
, 'cat /proc/iomem',
769 'system-control@1c00000')
770 exec_command_and_wait_for_pattern(self
, 'reboot',
771 'reboot: Restarting system')
772 # Wait for VM to shut down gracefully
775 def test_arm_orangepi_sd(self
):
777 :avocado: tags=arch:arm
778 :avocado: tags=accel:tcg
779 :avocado: tags=machine:orangepi-pc
780 :avocado: tags=device:sd
782 deb_url
= ('https://apt.armbian.com/pool/main/l/'
783 'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
784 deb_hash
= '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
785 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
786 kernel_path
= self
.extract_from_deb(deb_path
,
787 '/boot/vmlinuz-5.10.16-sunxi')
788 dtb_path
= '/usr/lib/linux-image-current-sunxi/sun8i-h3-orangepi-pc.dtb'
789 dtb_path
= self
.extract_from_deb(deb_path
, dtb_path
)
790 rootfs_url
= ('http://storage.kernelci.org/images/rootfs/buildroot/'
791 'kci-2019.02/armel/base/rootfs.ext2.xz')
792 rootfs_hash
= '692510cb625efda31640d1de0a8d60e26040f061'
793 rootfs_path_xz
= self
.fetch_asset(rootfs_url
, asset_hash
=rootfs_hash
)
794 rootfs_path
= os
.path
.join(self
.workdir
, 'rootfs.cpio')
795 archive
.lzma_uncompress(rootfs_path_xz
, rootfs_path
)
796 image_pow2ceil_expand(rootfs_path
)
798 self
.vm
.set_console()
799 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
800 'console=ttyS0,115200 '
801 'root=/dev/mmcblk0 rootwait rw '
803 self
.vm
.add_args('-kernel', kernel_path
,
805 '-drive', 'file=' + rootfs_path
+ ',if=sd,format=raw',
806 '-append', kernel_command_line
,
809 shell_ready
= "/bin/sh: can't access tty; job control turned off"
810 self
.wait_for_console_pattern(shell_ready
)
812 exec_command_and_wait_for_pattern(self
, 'cat /proc/cpuinfo',
813 'Allwinner sun8i Family')
814 exec_command_and_wait_for_pattern(self
, 'cat /proc/partitions',
816 exec_command_and_wait_for_pattern(self
, 'ifconfig eth0 up',
818 exec_command_and_wait_for_pattern(self
, 'udhcpc eth0',
819 'udhcpc: lease of 10.0.2.15 obtained')
820 exec_command_and_wait_for_pattern(self
, 'ping -c 3 10.0.2.2',
821 '3 packets transmitted, 3 packets received, 0% packet loss')
822 exec_command_and_wait_for_pattern(self
, 'reboot',
823 'reboot: Restarting system')
824 # Wait for VM to shut down gracefully
827 @skipUnless(os
.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
828 def test_arm_orangepi_bionic_20_08(self
):
830 :avocado: tags=arch:arm
831 :avocado: tags=machine:orangepi-pc
832 :avocado: tags=device:sd
835 # This test download a 275 MiB compressed image and expand it
836 # to 1036 MiB, but the underlying filesystem is 1552 MiB...
837 # As we expand it to 2 GiB we are safe.
839 image_url
= ('https://archive.armbian.com/orangepipc/archive/'
840 'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')
841 image_hash
= ('b4d6775f5673486329e45a0586bf06b6'
842 'dbe792199fd182ac6b9c7bb6c7d3e6dd')
843 image_path_xz
= self
.fetch_asset(image_url
, asset_hash
=image_hash
,
845 image_path
= archive
.extract(image_path_xz
, self
.workdir
)
846 image_pow2ceil_expand(image_path
)
848 self
.vm
.set_console()
849 self
.vm
.add_args('-drive', 'file=' + image_path
+ ',if=sd,format=raw',
854 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
855 'console=ttyS0,115200 '
858 'systemd.default_timeout_start_sec=9000 '
859 'systemd.mask=armbian-zram-config.service '
860 'systemd.mask=armbian-ramlog.service')
862 self
.wait_for_console_pattern('U-Boot SPL')
863 self
.wait_for_console_pattern('Autoboot in ')
864 exec_command_and_wait_for_pattern(self
, ' ', '=>')
865 exec_command_and_wait_for_pattern(self
, "setenv extraargs '" +
866 kernel_command_line
+ "'", '=>')
867 exec_command_and_wait_for_pattern(self
, 'boot', 'Starting kernel ...');
869 self
.wait_for_console_pattern('systemd[1]: Set hostname ' +
871 self
.wait_for_console_pattern('Starting Load Kernel Modules...')
873 @skipUnless(os
.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
874 def test_arm_orangepi_uboot_netbsd9(self
):
876 :avocado: tags=arch:arm
877 :avocado: tags=machine:orangepi-pc
878 :avocado: tags=device:sd
879 :avocado: tags=os:netbsd
881 # This test download a 304MB compressed image and expand it to 2GB
882 deb_url
= ('http://snapshot.debian.org/archive/debian/'
883 '20200108T145233Z/pool/main/u/u-boot/'
884 'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb')
885 deb_hash
= 'f67f404a80753ca3d1258f13e38f2b060e13db99'
886 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
887 # We use the common OrangePi PC 'plus' build of U-Boot for our secondary
888 # program loader (SPL). We will then set the path to the more specific
889 # OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt,
890 # before to boot NetBSD.
891 uboot_path
= '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin'
892 uboot_path
= self
.extract_from_deb(deb_path
, uboot_path
)
893 image_url
= ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/'
894 'evbarm-earmv7hf/binary/gzimg/armv7.img.gz')
895 image_hash
= '2babb29d36d8360adcb39c09e31060945259917a'
896 image_path_gz
= self
.fetch_asset(image_url
, asset_hash
=image_hash
)
897 image_path
= os
.path
.join(self
.workdir
, 'armv7.img')
898 archive
.gzip_uncompress(image_path_gz
, image_path
)
899 image_pow2ceil_expand(image_path
)
900 image_drive_args
= 'if=sd,format=raw,snapshot=on,file=' + image_path
902 # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc
903 with
open(uboot_path
, 'rb') as f_in
:
904 with
open(image_path
, 'r+b') as f_out
:
906 shutil
.copyfileobj(f_in
, f_out
)
908 self
.vm
.set_console()
909 self
.vm
.add_args('-nic', 'user',
910 '-drive', image_drive_args
,
911 '-global', 'allwinner-rtc.base-year=2000',
914 wait_for_console_pattern(self
, 'U-Boot 2020.01+dfsg-1')
915 interrupt_interactive_console_until_pattern(self
,
916 'Hit any key to stop autoboot:',
917 'switch to partitions #0, OK')
919 exec_command_and_wait_for_pattern(self
, '', '=>')
920 cmd
= 'setenv bootargs root=ld0a'
921 exec_command_and_wait_for_pattern(self
, cmd
, '=>')
922 cmd
= 'setenv kernel netbsd-GENERIC.ub'
923 exec_command_and_wait_for_pattern(self
, cmd
, '=>')
924 cmd
= 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb'
925 exec_command_and_wait_for_pattern(self
, cmd
, '=>')
926 cmd
= ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; "
927 "fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; "
928 "fdt addr ${fdt_addr_r}; "
929 "bootm ${kernel_addr_r} - ${fdt_addr_r}'")
930 exec_command_and_wait_for_pattern(self
, cmd
, '=>')
932 exec_command_and_wait_for_pattern(self
, 'boot',
933 'Booting kernel from Legacy Image')
934 wait_for_console_pattern(self
, 'Starting kernel ...')
935 wait_for_console_pattern(self
, 'NetBSD 9.0 (GENERIC)')
936 # Wait for user-space
937 wait_for_console_pattern(self
, 'Starting root file system check')
939 def test_aarch64_raspi3_atf(self
):
941 :avocado: tags=arch:aarch64
942 :avocado: tags=machine:raspi3b
943 :avocado: tags=cpu:cortex-a53
944 :avocado: tags=device:pl011
947 zip_url
= ('https://github.com/pbatard/RPi3/releases/download/'
948 'v1.15/RPi3_UEFI_Firmware_v1.15.zip')
949 zip_hash
= '74b3bd0de92683cadb14e008a7575e1d0c3cafb9'
950 zip_path
= self
.fetch_asset(zip_url
, asset_hash
=zip_hash
)
952 archive
.extract(zip_path
, self
.workdir
)
953 efi_fd
= os
.path
.join(self
.workdir
, 'RPI_EFI.fd')
955 self
.vm
.set_console(console_index
=1)
956 self
.vm
.add_args('-nodefaults',
957 '-device', 'loader,file=%s,force-raw=true' % efi_fd
)
959 self
.wait_for_console_pattern('version UEFI Firmware v1.15')
961 def test_s390x_s390_ccw_virtio(self
):
963 :avocado: tags=arch:s390x
964 :avocado: tags=machine:s390-ccw-virtio
966 kernel_url
= ('https://archives.fedoraproject.org/pub/archive'
967 '/fedora-secondary/releases/29/Everything/s390x/os/images'
969 kernel_hash
= 'e8e8439103ef8053418ef062644ffd46a7919313'
970 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
)
972 self
.vm
.set_console()
973 kernel_command_line
= self
.KERNEL_COMMON_COMMAND_LINE
+ 'console=sclp0'
974 self
.vm
.add_args('-nodefaults',
975 '-kernel', kernel_path
,
976 '-append', kernel_command_line
)
978 console_pattern
= 'Kernel command line: %s' % kernel_command_line
979 self
.wait_for_console_pattern(console_pattern
)
981 def test_alpha_clipper(self
):
983 :avocado: tags=arch:alpha
984 :avocado: tags=machine:clipper
986 kernel_url
= ('http://archive.debian.org/debian/dists/lenny/main/'
987 'installer-alpha/20090123lenny10/images/cdrom/vmlinuz')
988 kernel_hash
= '3a943149335529e2ed3e74d0d787b85fb5671ba3'
989 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
)
991 uncompressed_kernel
= archive
.uncompress(kernel_path
, self
.workdir
)
993 self
.vm
.set_console()
994 kernel_command_line
= self
.KERNEL_COMMON_COMMAND_LINE
+ 'console=ttyS0'
995 self
.vm
.add_args('-nodefaults',
996 '-kernel', uncompressed_kernel
,
997 '-append', kernel_command_line
)
999 console_pattern
= 'Kernel command line: %s' % kernel_command_line
1000 self
.wait_for_console_pattern(console_pattern
)
1002 def test_m68k_q800(self
):
1004 :avocado: tags=arch:m68k
1005 :avocado: tags=machine:q800
1007 deb_url
= ('https://snapshot.debian.org/archive/debian-ports'
1008 '/20191021T083923Z/pool-m68k/main'
1009 '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
1010 deb_hash
= '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
1011 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
)
1012 kernel_path
= self
.extract_from_deb(deb_path
,
1013 '/boot/vmlinux-5.3.0-1-m68k')
1015 self
.vm
.set_console()
1016 kernel_command_line
= (self
.KERNEL_COMMON_COMMAND_LINE
+
1017 'console=ttyS0 vga=off')
1018 self
.vm
.add_args('-kernel', kernel_path
,
1019 '-append', kernel_command_line
)
1021 console_pattern
= 'Kernel command line: %s' % kernel_command_line
1022 self
.wait_for_console_pattern(console_pattern
)
1023 console_pattern
= 'No filesystem could mount root'
1024 self
.wait_for_console_pattern(console_pattern
)
1026 def do_test_advcal_2018(self
, day
, tar_hash
, kernel_name
, console
=0):
1027 tar_url
= ('https://www.qemu-advent-calendar.org'
1028 '/2018/download/day' + day
+ '.tar.xz')
1029 file_path
= self
.fetch_asset(tar_url
, asset_hash
=tar_hash
)
1030 archive
.extract(file_path
, self
.workdir
)
1031 self
.vm
.set_console(console_index
=console
)
1032 self
.vm
.add_args('-kernel',
1033 self
.workdir
+ '/day' + day
+ '/' + kernel_name
)
1035 self
.wait_for_console_pattern('QEMU advent calendar')
1037 def test_arm_vexpressa9(self
):
1039 :avocado: tags=arch:arm
1040 :avocado: tags=machine:vexpress-a9
1042 tar_hash
= '32b7677ce8b6f1471fb0059865f451169934245b'
1043 self
.vm
.add_args('-dtb', self
.workdir
+ '/day16/vexpress-v2p-ca9.dtb')
1044 self
.do_test_advcal_2018('16', tar_hash
, 'winter.zImage')
1046 def test_arm_ast2400_palmetto_openbmc_v2_9_0(self
):
1048 :avocado: tags=arch:arm
1049 :avocado: tags=machine:palmetto-bmc
1052 image_url
= ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
1053 'obmc-phosphor-image-palmetto.static.mtd')
1054 image_hash
= ('3e13bbbc28e424865dc42f35ad672b10f2e82cdb11846bb28fa625b48beafd0d')
1055 image_path
= self
.fetch_asset(image_url
, asset_hash
=image_hash
,
1058 self
.do_test_arm_aspeed(image_path
)
1060 def test_arm_ast2500_romulus_openbmc_v2_9_0(self
):
1062 :avocado: tags=arch:arm
1063 :avocado: tags=machine:romulus-bmc
1066 image_url
= ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
1067 'obmc-phosphor-image-romulus.static.mtd')
1068 image_hash
= ('820341076803f1955bc31e647a512c79f9add4f5233d0697678bab4604c7bb25')
1069 image_path
= self
.fetch_asset(image_url
, asset_hash
=image_hash
,
1072 self
.do_test_arm_aspeed(image_path
)
1074 def do_test_arm_aspeed(self
, image
):
1075 self
.vm
.set_console()
1076 self
.vm
.add_args('-drive', 'file=' + image
+ ',if=mtd,format=raw',
1080 self
.wait_for_console_pattern("U-Boot 2016.07")
1081 self
.wait_for_console_pattern("## Loading kernel from FIT Image at 20080000")
1082 self
.wait_for_console_pattern("Starting kernel ...")
1083 self
.wait_for_console_pattern("Booting Linux on physical CPU 0x0")
1084 self
.wait_for_console_pattern(
1085 "aspeed-smc 1e620000.spi: read control register: 203b0641")
1086 self
.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ")
1087 self
.wait_for_console_pattern("systemd[1]: Set hostname to")
1089 def test_arm_ast2600_debian(self
):
1091 :avocado: tags=arch:arm
1092 :avocado: tags=machine:tacoma-bmc
1094 deb_url
= ('http://snapshot.debian.org/archive/debian/'
1096 'pool/main/l/linux/'
1097 'linux-image-5.10.0-3-armmp_5.10.13-1_armhf.deb')
1098 deb_hash
= 'db40d32fe39255d05482bea48d72467b67d6225bb2a2a4d6f618cb8976f1e09e'
1099 deb_path
= self
.fetch_asset(deb_url
, asset_hash
=deb_hash
,
1101 kernel_path
= self
.extract_from_deb(deb_path
, '/boot/vmlinuz-5.10.0-3-armmp')
1102 dtb_path
= self
.extract_from_deb(deb_path
,
1103 '/usr/lib/linux-image-5.10.0-3-armmp/aspeed-bmc-opp-tacoma.dtb')
1105 self
.vm
.set_console()
1106 self
.vm
.add_args('-kernel', kernel_path
,
1110 self
.wait_for_console_pattern("Booting Linux on physical CPU 0xf00")
1111 self
.wait_for_console_pattern("SMP: Total of 2 processors activated")
1112 self
.wait_for_console_pattern("No filesystem could mount root")
1114 def test_m68k_mcf5208evb(self
):
1116 :avocado: tags=arch:m68k
1117 :avocado: tags=machine:mcf5208evb
1119 tar_hash
= 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
1120 self
.do_test_advcal_2018('07', tar_hash
, 'sanity-clause.elf')
1122 def test_or1k_sim(self
):
1124 :avocado: tags=arch:or1k
1125 :avocado: tags=machine:or1k-sim
1127 tar_hash
= '20334cdaf386108c530ff0badaecc955693027dd'
1128 self
.do_test_advcal_2018('20', tar_hash
, 'vmlinux')
1130 def test_nios2_10m50(self
):
1132 :avocado: tags=arch:nios2
1133 :avocado: tags=machine:10m50-ghrd
1135 tar_hash
= 'e4251141726c412ac0407c5a6bceefbbff018918'
1136 self
.do_test_advcal_2018('14', tar_hash
, 'vmlinux.elf')
1138 def test_ppc64_e500(self
):
1140 :avocado: tags=arch:ppc64
1141 :avocado: tags=machine:ppce500
1142 :avocado: tags=cpu:e5500
1143 :avocado: tags=accel:tcg
1145 self
.require_accelerator("tcg")
1146 tar_hash
= '6951d86d644b302898da2fd701739c9406527fe1'
1147 self
.do_test_advcal_2018('19', tar_hash
, 'uImage')
1149 def do_test_ppc64_powernv(self
, proc
):
1150 self
.require_accelerator("tcg")
1151 images_url
= ('https://github.com/open-power/op-build/releases/download/v2.7/')
1153 kernel_url
= images_url
+ 'zImage.epapr'
1154 kernel_hash
= '0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd'
1155 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
,
1157 self
.vm
.set_console()
1158 self
.vm
.add_args('-kernel', kernel_path
,
1159 '-append', 'console=tty0 console=hvc0',
1160 '-device', 'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0',
1161 '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234',
1162 '-device', 'e1000e,bus=bridge1,addr=0x3',
1163 '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2')
1166 self
.wait_for_console_pattern("CPU: " + proc
+ " generation processor")
1167 self
.wait_for_console_pattern("zImage starting: loaded")
1168 self
.wait_for_console_pattern("Run /init as init process")
1169 self
.wait_for_console_pattern("Creating 1 MTD partitions")
1171 def test_ppc_powernv8(self
):
1173 :avocado: tags=arch:ppc64
1174 :avocado: tags=machine:powernv8
1175 :avocado: tags=accel:tcg
1177 self
.do_test_ppc64_powernv('P8')
1179 def test_ppc_powernv9(self
):
1181 :avocado: tags=arch:ppc64
1182 :avocado: tags=machine:powernv9
1183 :avocado: tags=accel:tcg
1185 self
.do_test_ppc64_powernv('P9')
1187 def test_ppc_g3beige(self
):
1189 :avocado: tags=arch:ppc
1190 :avocado: tags=machine:g3beige
1191 :avocado: tags=accel:tcg
1193 # TODO: g3beige works with kvm_pr but we don't have a
1194 # reliable way ATM (e.g. looking at /proc/modules) to detect
1195 # whether we're running kvm_hv or kvm_pr. For now let's
1196 # disable this test if we don't have TCG support.
1197 self
.require_accelerator("tcg")
1198 tar_hash
= 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1199 self
.vm
.add_args('-M', 'graphics=off')
1200 self
.do_test_advcal_2018('15', tar_hash
, 'invaders.elf')
1202 def test_ppc_mac99(self
):
1204 :avocado: tags=arch:ppc
1205 :avocado: tags=machine:mac99
1206 :avocado: tags=accel:tcg
1208 # TODO: mac99 works with kvm_pr but we don't have a
1209 # reliable way ATM (e.g. looking at /proc/modules) to detect
1210 # whether we're running kvm_hv or kvm_pr. For now let's
1211 # disable this test if we don't have TCG support.
1212 self
.require_accelerator("tcg")
1213 tar_hash
= 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
1214 self
.vm
.add_args('-M', 'graphics=off')
1215 self
.do_test_advcal_2018('15', tar_hash
, 'invaders.elf')
1217 def test_sh4_r2d(self
):
1219 :avocado: tags=arch:sh4
1220 :avocado: tags=machine:r2d
1222 tar_hash
= 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
1223 self
.vm
.add_args('-append', 'console=ttySC1')
1224 self
.do_test_advcal_2018('09', tar_hash
, 'zImage', console
=1)
1226 def test_sparc_ss20(self
):
1228 :avocado: tags=arch:sparc
1229 :avocado: tags=machine:SS-20
1231 tar_hash
= 'b18550d5d61c7615d989a06edace051017726a9f'
1232 self
.do_test_advcal_2018('11', tar_hash
, 'zImage.elf')
1234 def test_xtensa_lx60(self
):
1236 :avocado: tags=arch:xtensa
1237 :avocado: tags=machine:lx60
1238 :avocado: tags=cpu:dc233c
1240 tar_hash
= '49e88d9933742f0164b60839886c9739cb7a0d34'
1241 self
.do_test_advcal_2018('02', tar_hash
, 'santas-sleigh-ride.elf')