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