]>
Commit | Line | Data |
---|---|---|
c1cc73f4 CR |
1 | # Functional test that boots a Linux kernel and checks the console |
2 | # | |
3 | # Copyright (c) 2018 Red Hat, Inc. | |
4 | # | |
5 | # Author: | |
6 | # Cleber Rosa <crosa@redhat.com> | |
7 | # | |
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. | |
10 | ||
f8792047 | 11 | import os |
f375ad6a | 12 | import lzma |
89368673 | 13 | import gzip |
f375ad6a | 14 | import shutil |
c1cc73f4 | 15 | |
efdb45bf | 16 | from avocado import skipUnless |
c1cc73f4 | 17 | from avocado_qemu import Test |
2b17d81f | 18 | from avocado_qemu import exec_command_and_wait_for_pattern |
921589fb | 19 | from avocado_qemu import interrupt_interactive_console_until_pattern |
77bcd248 | 20 | from avocado_qemu import wait_for_console_pattern |
f8792047 PMD |
21 | from avocado.utils import process |
22 | from avocado.utils import archive | |
784b8796 | 23 | from avocado.utils.path import find_command, CmdNotFoundError |
c1cc73f4 | 24 | |
784b8796 PMD |
25 | P7ZIP_AVAILABLE = True |
26 | try: | |
27 | find_command('7z') | |
28 | except CmdNotFoundError: | |
29 | P7ZIP_AVAILABLE = False | |
c1cc73f4 | 30 | |
12121c49 | 31 | class LinuxKernelTest(Test): |
b50fcd39 CR |
32 | KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' |
33 | ||
12121c49 | 34 | def wait_for_console_pattern(self, success_message, vm=None): |
77bcd248 | 35 | wait_for_console_pattern(self, success_message, |
12121c49 PD |
36 | failure_message='Kernel panic - not syncing', |
37 | vm=vm) | |
89368673 | 38 | |
f8792047 PMD |
39 | def extract_from_deb(self, deb, path): |
40 | """ | |
41 | Extracts a file from a deb package into the test workdir | |
42 | ||
43 | :param deb: path to the deb archive | |
45260388 | 44 | :param path: path within the deb archive of the file to be extracted |
f8792047 PMD |
45 | :returns: path of the extracted file |
46 | """ | |
47 | cwd = os.getcwd() | |
48 | os.chdir(self.workdir) | |
6c1c4c33 PMD |
49 | file_path = process.run("ar t %s" % deb).stdout_text.split()[2] |
50 | process.run("ar x %s %s" % (deb, file_path)) | |
51 | archive.extract(file_path, self.workdir) | |
f8792047 | 52 | os.chdir(cwd) |
921a9f6d LM |
53 | # Return complete path to extracted file. Because callers to |
54 | # extract_from_deb() specify 'path' with a leading slash, it is | |
55 | # necessary to use os.path.relpath() as otherwise os.path.join() | |
56 | # interprets it as an absolute path and drops the self.workdir part. | |
57 | return os.path.normpath(os.path.join(self.workdir, | |
58 | os.path.relpath(path, '/'))) | |
f8792047 | 59 | |
76a901d2 LM |
60 | def extract_from_rpm(self, rpm, path): |
61 | """ | |
62 | Extracts a file from an RPM package into the test workdir. | |
63 | ||
64 | :param rpm: path to the rpm archive | |
65 | :param path: path within the rpm archive of the file to be extracted | |
66 | needs to be a relative path (starting with './') because | |
67 | cpio(1), which is used to extract the file, expects that. | |
68 | :returns: path of the extracted file | |
69 | """ | |
70 | cwd = os.getcwd() | |
71 | os.chdir(self.workdir) | |
72 | process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True) | |
73 | os.chdir(cwd) | |
74 | return os.path.normpath(os.path.join(self.workdir, path)) | |
75 | ||
12121c49 PD |
76 | class BootLinuxConsole(LinuxKernelTest): |
77 | """ | |
78 | Boots a Linux kernel and checks that the console is operational and the | |
79 | kernel command line is properly passed from QEMU to the kernel | |
80 | """ | |
81 | timeout = 90 | |
82 | ||
78664ed8 CR |
83 | def test_x86_64_pc(self): |
84 | """ | |
85 | :avocado: tags=arch:x86_64 | |
86 | :avocado: tags=machine:pc | |
87 | """ | |
93bbbdf6 CR |
88 | kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' |
89 | '/linux/releases/29/Everything/x86_64/os/images/pxeboot' | |
90 | '/vmlinuz') | |
7d7985b1 | 91 | kernel_hash = '23bebd2680757891cf7adedb033532163a792495' |
c1cc73f4 CR |
92 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) |
93 | ||
c1cc73f4 | 94 | self.vm.set_console() |
b50fcd39 | 95 | kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' |
c1cc73f4 CR |
96 | self.vm.add_args('-kernel', kernel_path, |
97 | '-append', kernel_command_line) | |
98 | self.vm.launch() | |
0d1d74e5 CR |
99 | console_pattern = 'Kernel command line: %s' % kernel_command_line |
100 | self.wait_for_console_pattern(console_pattern) | |
f8792047 PMD |
101 | |
102 | def test_mips_malta(self): | |
103 | """ | |
104 | :avocado: tags=arch:mips | |
105 | :avocado: tags=machine:malta | |
106 | :avocado: tags=endian:big | |
107 | """ | |
108 | deb_url = ('http://snapshot.debian.org/archive/debian/' | |
109 | '20130217T032700Z/pool/main/l/linux-2.6/' | |
110 | 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') | |
111 | deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' | |
112 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
113 | kernel_path = self.extract_from_deb(deb_path, | |
114 | '/boot/vmlinux-2.6.32-5-4kc-malta') | |
115 | ||
f8792047 PMD |
116 | self.vm.set_console() |
117 | kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' | |
118 | self.vm.add_args('-kernel', kernel_path, | |
119 | '-append', kernel_command_line) | |
120 | self.vm.launch() | |
121 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
122 | self.wait_for_console_pattern(console_pattern) | |
02c2852b CR |
123 | |
124 | def test_mips64el_malta(self): | |
125 | """ | |
126 | This test requires the ar tool to extract "data.tar.gz" from | |
127 | the Debian package. | |
128 | ||
129 | The kernel can be rebuilt using this Debian kernel source [1] and | |
130 | following the instructions on [2]. | |
131 | ||
132 | [1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/ | |
133 | #linux-source-2.6.32_2.6.32-48 | |
134 | [2] https://kernel-team.pages.debian.net/kernel-handbook/ | |
135 | ch-common-tasks.html#s-common-official | |
136 | ||
137 | :avocado: tags=arch:mips64el | |
138 | :avocado: tags=machine:malta | |
139 | """ | |
140 | deb_url = ('http://snapshot.debian.org/archive/debian/' | |
141 | '20130217T032700Z/pool/main/l/linux-2.6/' | |
142 | 'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb') | |
143 | deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5' | |
144 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
145 | kernel_path = self.extract_from_deb(deb_path, | |
146 | '/boot/vmlinux-2.6.32-5-5kc-malta') | |
147 | ||
02c2852b CR |
148 | self.vm.set_console() |
149 | kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' | |
150 | self.vm.add_args('-kernel', kernel_path, | |
151 | '-append', kernel_command_line) | |
152 | self.vm.launch() | |
153 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
154 | self.wait_for_console_pattern(console_pattern) | |
d4e12161 | 155 | |
89368673 PMD |
156 | def test_mips_malta_cpio(self): |
157 | """ | |
158 | :avocado: tags=arch:mips | |
159 | :avocado: tags=machine:malta | |
160 | :avocado: tags=endian:big | |
161 | """ | |
162 | deb_url = ('http://snapshot.debian.org/archive/debian/' | |
163 | '20160601T041800Z/pool/main/l/linux/' | |
164 | 'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb') | |
165 | deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8' | |
166 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
167 | kernel_path = self.extract_from_deb(deb_path, | |
168 | '/boot/vmlinux-4.5.0-2-4kc-malta') | |
169 | initrd_url = ('https://github.com/groeck/linux-build-test/raw/' | |
170 | '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' | |
171 | 'mips/rootfs.cpio.gz') | |
172 | initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99' | |
173 | initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | |
174 | initrd_path = self.workdir + "rootfs.cpio" | |
f2cd6cf6 | 175 | archive.gzip_uncompress(initrd_path_gz, initrd_path) |
89368673 | 176 | |
89368673 PMD |
177 | self.vm.set_console() |
178 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE | |
179 | + 'console=ttyS0 console=tty ' | |
180 | + 'rdinit=/sbin/init noreboot') | |
181 | self.vm.add_args('-kernel', kernel_path, | |
182 | '-initrd', initrd_path, | |
183 | '-append', kernel_command_line, | |
184 | '-no-reboot') | |
185 | self.vm.launch() | |
186 | self.wait_for_console_pattern('Boot successful.') | |
187 | ||
2b17d81f PMD |
188 | exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', |
189 | 'BogoMIPS') | |
190 | exec_command_and_wait_for_pattern(self, 'uname -a', | |
191 | 'Debian') | |
192 | exec_command_and_wait_for_pattern(self, 'reboot', | |
193 | 'reboot: Restarting system') | |
89368673 | 194 | |
efdb45bf PMD |
195 | @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') |
196 | def test_mips64el_malta_5KEc_cpio(self): | |
197 | """ | |
198 | :avocado: tags=arch:mips64el | |
199 | :avocado: tags=machine:malta | |
200 | :avocado: tags=endian:little | |
201 | """ | |
202 | kernel_url = ('https://github.com/philmd/qemu-testing-blob/' | |
203 | 'raw/9ad2df38/mips/malta/mips64el/' | |
204 | 'vmlinux-3.19.3.mtoman.20150408') | |
205 | kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754' | |
206 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
207 | initrd_url = ('https://github.com/groeck/linux-build-test/' | |
208 | 'raw/8584a59e/rootfs/' | |
209 | 'mipsel64/rootfs.mipsel64r1.cpio.gz') | |
210 | initrd_hash = '1dbb8a396e916847325284dbe2151167' | |
211 | initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5', | |
212 | asset_hash=initrd_hash) | |
213 | initrd_path = self.workdir + "rootfs.cpio" | |
214 | archive.gzip_uncompress(initrd_path_gz, initrd_path) | |
215 | ||
efdb45bf PMD |
216 | self.vm.set_console() |
217 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE | |
218 | + 'console=ttyS0 console=tty ' | |
219 | + 'rdinit=/sbin/init noreboot') | |
220 | self.vm.add_args('-cpu', '5KEc', | |
221 | '-kernel', kernel_path, | |
222 | '-initrd', initrd_path, | |
223 | '-append', kernel_command_line, | |
224 | '-no-reboot') | |
225 | self.vm.launch() | |
226 | wait_for_console_pattern(self, 'Boot successful.') | |
227 | ||
228 | exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', | |
229 | 'MIPS 5KE') | |
230 | exec_command_and_wait_for_pattern(self, 'uname -a', | |
231 | '3.19.3.mtoman.20150408') | |
232 | exec_command_and_wait_for_pattern(self, 'reboot', | |
233 | 'reboot: Restarting system') | |
89368673 | 234 | |
f375ad6a PMD |
235 | def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash): |
236 | kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
237 | kernel_path = self.workdir + "kernel" | |
238 | with lzma.open(kernel_path_xz, 'rb') as f_in: | |
239 | with open(kernel_path, 'wb') as f_out: | |
240 | shutil.copyfileobj(f_in, f_out) | |
241 | ||
f375ad6a PMD |
242 | self.vm.set_console() |
243 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE | |
244 | + 'mem=256m@@0x0 ' | |
245 | + 'console=ttyS0') | |
246 | self.vm.add_args('-no-reboot', | |
247 | '-cpu', 'I7200', | |
248 | '-kernel', kernel_path, | |
249 | '-append', kernel_command_line) | |
250 | self.vm.launch() | |
251 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
252 | self.wait_for_console_pattern(console_pattern) | |
253 | ||
254 | def test_mips_malta32el_nanomips_4k(self): | |
255 | """ | |
256 | :avocado: tags=arch:mipsel | |
257 | :avocado: tags=machine:malta | |
258 | :avocado: tags=endian:little | |
259 | """ | |
260 | kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/' | |
261 | 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' | |
262 | 'generic_nano32r6el_page4k.xz') | |
263 | kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6' | |
264 | self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash) | |
265 | ||
266 | def test_mips_malta32el_nanomips_16k_up(self): | |
267 | """ | |
268 | :avocado: tags=arch:mipsel | |
269 | :avocado: tags=machine:malta | |
270 | :avocado: tags=endian:little | |
271 | """ | |
272 | kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/' | |
273 | 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' | |
274 | 'generic_nano32r6el_page16k_up.xz') | |
275 | kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc' | |
276 | self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash) | |
277 | ||
278 | def test_mips_malta32el_nanomips_64k_dbg(self): | |
279 | """ | |
280 | :avocado: tags=arch:mipsel | |
281 | :avocado: tags=machine:malta | |
282 | :avocado: tags=endian:little | |
283 | """ | |
284 | kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/' | |
285 | 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' | |
286 | 'generic_nano32r6el_page64k_dbg.xz') | |
287 | kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180' | |
288 | self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash) | |
289 | ||
d4e12161 CR |
290 | def test_aarch64_virt(self): |
291 | """ | |
292 | :avocado: tags=arch:aarch64 | |
293 | :avocado: tags=machine:virt | |
294 | """ | |
93bbbdf6 CR |
295 | kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' |
296 | '/linux/releases/29/Everything/aarch64/os/images/pxeboot' | |
297 | '/vmlinuz') | |
d4e12161 CR |
298 | kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493' |
299 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
300 | ||
d4e12161 CR |
301 | self.vm.set_console() |
302 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
303 | 'console=ttyAMA0') | |
304 | self.vm.add_args('-cpu', 'cortex-a53', | |
305 | '-kernel', kernel_path, | |
306 | '-append', kernel_command_line) | |
307 | self.vm.launch() | |
308 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
309 | self.wait_for_console_pattern(console_pattern) | |
1a30892e | 310 | |
27dfbafa TH |
311 | def test_aarch64_xlnx_versal_virt(self): |
312 | """ | |
313 | :avocado: tags=arch:aarch64 | |
314 | :avocado: tags=machine:xlnx-versal-virt | |
315 | :avocado: tags=device:pl011 | |
316 | :avocado: tags=device:arm_gicv3 | |
317 | """ | |
318 | kernel_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/' | |
319 | 'bionic-updates/main/installer-arm64/current/images/' | |
320 | 'netboot/ubuntu-installer/arm64/linux') | |
321 | kernel_hash = '5bfc54cf7ed8157d93f6e5b0241e727b6dc22c50' | |
322 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
323 | ||
324 | initrd_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/' | |
325 | 'bionic-updates/main/installer-arm64/current/images/' | |
326 | 'netboot/ubuntu-installer/arm64/initrd.gz') | |
327 | initrd_hash = 'd385d3e88d53e2004c5d43cbe668b458a094f772' | |
328 | initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | |
329 | ||
330 | self.vm.set_console() | |
331 | self.vm.add_args('-m', '2G', | |
332 | '-kernel', kernel_path, | |
333 | '-initrd', initrd_path) | |
334 | self.vm.launch() | |
335 | self.wait_for_console_pattern('Checked W+X mappings: passed') | |
336 | ||
1a30892e CR |
337 | def test_arm_virt(self): |
338 | """ | |
339 | :avocado: tags=arch:arm | |
340 | :avocado: tags=machine:virt | |
341 | """ | |
93bbbdf6 CR |
342 | kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' |
343 | '/linux/releases/29/Everything/armhfp/os/images/pxeboot' | |
344 | '/vmlinuz') | |
1a30892e CR |
345 | kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4' |
346 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
347 | ||
1a30892e CR |
348 | self.vm.set_console() |
349 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
350 | 'console=ttyAMA0') | |
351 | self.vm.add_args('-kernel', kernel_path, | |
352 | '-append', kernel_command_line) | |
353 | self.vm.launch() | |
354 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
355 | self.wait_for_console_pattern(console_pattern) | |
79182494 | 356 | |
77ead6b8 PMD |
357 | def test_arm_emcraft_sf2(self): |
358 | """ | |
359 | :avocado: tags=arch:arm | |
ba21bde9 | 360 | :avocado: tags=machine:emcraft-sf2 |
77ead6b8 | 361 | :avocado: tags=endian:little |
b6f0a434 | 362 | :avocado: tags=u-boot |
77ead6b8 PMD |
363 | """ |
364 | uboot_url = ('https://raw.githubusercontent.com/' | |
365 | 'Subbaraya-Sundeep/qemu-test-binaries/' | |
70d7857f SS |
366 | 'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot') |
367 | uboot_hash = 'cbb8cbab970f594bf6523b9855be209c08374ae2' | |
77ead6b8 PMD |
368 | uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) |
369 | spi_url = ('https://raw.githubusercontent.com/' | |
370 | 'Subbaraya-Sundeep/qemu-test-binaries/' | |
70d7857f SS |
371 | 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin') |
372 | spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501' | |
77ead6b8 PMD |
373 | spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash) |
374 | ||
77ead6b8 PMD |
375 | self.vm.set_console() |
376 | kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE | |
377 | self.vm.add_args('-kernel', uboot_path, | |
378 | '-append', kernel_command_line, | |
379 | '-drive', 'file=' + spi_path + ',if=mtd,format=raw', | |
380 | '-no-reboot') | |
381 | self.vm.launch() | |
70d7857f SS |
382 | self.wait_for_console_pattern('Enter \'help\' for a list') |
383 | ||
384 | exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15', | |
385 | 'eth0: link becomes ready') | |
386 | exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', | |
387 | '3 packets transmitted, 3 packets received, 0% packet loss') | |
77ead6b8 | 388 | |
92d93612 PMD |
389 | def do_test_arm_raspi2(self, uart_id): |
390 | """ | |
391 | The kernel can be rebuilt using the kernel source referenced | |
392 | and following the instructions on the on: | |
393 | https://www.raspberrypi.org/documentation/linux/kernel/building.md | |
394 | """ | |
395 | serial_kernel_cmdline = { | |
396 | 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0', | |
397 | } | |
398 | deb_url = ('http://archive.raspberrypi.org/debian/' | |
399 | 'pool/main/r/raspberrypi-firmware/' | |
400 | 'raspberrypi-kernel_1.20190215-1_armhf.deb') | |
401 | deb_hash = 'cd284220b32128c5084037553db3c482426f3972' | |
402 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
403 | kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img') | |
404 | dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb') | |
405 | ||
92d93612 PMD |
406 | self.vm.set_console() |
407 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
d02ded08 PZ |
408 | serial_kernel_cmdline[uart_id] + |
409 | ' root=/dev/mmcblk0p2 rootwait ' + | |
410 | 'dwc_otg.fiq_fsm_enable=0') | |
92d93612 PMD |
411 | self.vm.add_args('-kernel', kernel_path, |
412 | '-dtb', dtb_path, | |
d02ded08 PZ |
413 | '-append', kernel_command_line, |
414 | '-device', 'usb-kbd') | |
92d93612 PMD |
415 | self.vm.launch() |
416 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
417 | self.wait_for_console_pattern(console_pattern) | |
d02ded08 PZ |
418 | console_pattern = 'Product: QEMU USB Keyboard' |
419 | self.wait_for_console_pattern(console_pattern) | |
92d93612 PMD |
420 | |
421 | def test_arm_raspi2_uart0(self): | |
422 | """ | |
423 | :avocado: tags=arch:arm | |
424 | :avocado: tags=machine:raspi2 | |
425 | :avocado: tags=device:pl011 | |
426 | """ | |
427 | self.do_test_arm_raspi2(0) | |
428 | ||
017aa60b PMD |
429 | def test_arm_exynos4210_initrd(self): |
430 | """ | |
431 | :avocado: tags=arch:arm | |
432 | :avocado: tags=machine:smdkc210 | |
433 | """ | |
434 | deb_url = ('https://snapshot.debian.org/archive/debian/' | |
435 | '20190928T224601Z/pool/main/l/linux/' | |
436 | 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb') | |
437 | deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82' | |
438 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
439 | kernel_path = self.extract_from_deb(deb_path, | |
440 | '/boot/vmlinuz-4.19.0-6-armmp') | |
441 | dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb' | |
442 | dtb_path = self.extract_from_deb(deb_path, dtb_path) | |
443 | ||
444 | initrd_url = ('https://github.com/groeck/linux-build-test/raw/' | |
445 | '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' | |
446 | 'arm/rootfs-armv5.cpio.gz') | |
447 | initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b' | |
448 | initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | |
449 | initrd_path = os.path.join(self.workdir, 'rootfs.cpio') | |
450 | archive.gzip_uncompress(initrd_path_gz, initrd_path) | |
451 | ||
017aa60b PMD |
452 | self.vm.set_console() |
453 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
454 | 'earlycon=exynos4210,0x13800000 earlyprintk ' + | |
455 | 'console=ttySAC0,115200n8 ' + | |
456 | 'random.trust_cpu=off cryptomgr.notests ' + | |
457 | 'cpuidle.off=1 panic=-1 noreboot') | |
458 | ||
459 | self.vm.add_args('-kernel', kernel_path, | |
460 | '-dtb', dtb_path, | |
461 | '-initrd', initrd_path, | |
462 | '-append', kernel_command_line, | |
463 | '-no-reboot') | |
464 | self.vm.launch() | |
465 | ||
466 | self.wait_for_console_pattern('Boot successful.') | |
467 | # TODO user command, for now the uart is stuck | |
468 | ||
c5ce3153 PMD |
469 | def test_arm_cubieboard_initrd(self): |
470 | """ | |
471 | :avocado: tags=arch:arm | |
472 | :avocado: tags=machine:cubieboard | |
473 | """ | |
474 | deb_url = ('https://apt.armbian.com/pool/main/l/' | |
475 | 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') | |
476 | deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' | |
477 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
478 | kernel_path = self.extract_from_deb(deb_path, | |
479 | '/boot/vmlinuz-4.20.7-sunxi') | |
480 | dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb' | |
481 | dtb_path = self.extract_from_deb(deb_path, dtb_path) | |
482 | initrd_url = ('https://github.com/groeck/linux-build-test/raw/' | |
483 | '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' | |
484 | 'arm/rootfs-armv5.cpio.gz') | |
485 | initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b' | |
486 | initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | |
487 | initrd_path = os.path.join(self.workdir, 'rootfs.cpio') | |
488 | archive.gzip_uncompress(initrd_path_gz, initrd_path) | |
489 | ||
490 | self.vm.set_console() | |
491 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
492 | 'console=ttyS0,115200 ' | |
493 | 'usbcore.nousb ' | |
494 | 'panic=-1 noreboot') | |
495 | self.vm.add_args('-kernel', kernel_path, | |
496 | '-dtb', dtb_path, | |
497 | '-initrd', initrd_path, | |
498 | '-append', kernel_command_line, | |
499 | '-no-reboot') | |
500 | self.vm.launch() | |
501 | self.wait_for_console_pattern('Boot successful.') | |
502 | ||
503 | exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', | |
504 | 'Allwinner sun4i/sun5i') | |
505 | exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', | |
506 | 'system-control@1c00000') | |
507 | exec_command_and_wait_for_pattern(self, 'reboot', | |
508 | 'reboot: Restarting system') | |
509 | ||
e33ee309 PMD |
510 | def test_arm_cubieboard_sata(self): |
511 | """ | |
512 | :avocado: tags=arch:arm | |
513 | :avocado: tags=machine:cubieboard | |
514 | """ | |
515 | deb_url = ('https://apt.armbian.com/pool/main/l/' | |
516 | 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') | |
517 | deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' | |
518 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
519 | kernel_path = self.extract_from_deb(deb_path, | |
520 | '/boot/vmlinuz-4.20.7-sunxi') | |
521 | dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb' | |
522 | dtb_path = self.extract_from_deb(deb_path, dtb_path) | |
523 | rootfs_url = ('https://github.com/groeck/linux-build-test/raw/' | |
524 | '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' | |
525 | 'arm/rootfs-armv5.ext2.gz') | |
526 | rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93' | |
527 | rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) | |
528 | rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') | |
529 | archive.gzip_uncompress(rootfs_path_gz, rootfs_path) | |
530 | ||
531 | self.vm.set_console() | |
532 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
533 | 'console=ttyS0,115200 ' | |
534 | 'usbcore.nousb ' | |
535 | 'root=/dev/sda ro ' | |
536 | 'panic=-1 noreboot') | |
537 | self.vm.add_args('-kernel', kernel_path, | |
538 | '-dtb', dtb_path, | |
539 | '-drive', 'if=none,format=raw,id=disk0,file=' | |
540 | + rootfs_path, | |
541 | '-device', 'ide-hd,bus=ide.0,drive=disk0', | |
542 | '-append', kernel_command_line, | |
543 | '-no-reboot') | |
544 | self.vm.launch() | |
545 | self.wait_for_console_pattern('Boot successful.') | |
546 | ||
547 | exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', | |
548 | 'Allwinner sun4i/sun5i') | |
549 | exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', | |
550 | 'sda') | |
551 | exec_command_and_wait_for_pattern(self, 'reboot', | |
552 | 'reboot: Restarting system') | |
553 | ||
5abe9f0b PMD |
554 | def test_arm_orangepi(self): |
555 | """ | |
556 | :avocado: tags=arch:arm | |
557 | :avocado: tags=machine:orangepi-pc | |
558 | """ | |
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/sun8i-h3-orangepi-pc.dtb' | |
566 | dtb_path = self.extract_from_deb(deb_path, dtb_path) | |
567 | ||
568 | self.vm.set_console() | |
569 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
570 | 'console=ttyS0,115200n8 ' | |
571 | 'earlycon=uart,mmio32,0x1c28000') | |
572 | self.vm.add_args('-kernel', kernel_path, | |
573 | '-dtb', dtb_path, | |
574 | '-append', kernel_command_line) | |
575 | self.vm.launch() | |
576 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
577 | self.wait_for_console_pattern(console_pattern) | |
578 | ||
c40b1ded PMD |
579 | def test_arm_orangepi_initrd(self): |
580 | """ | |
581 | :avocado: tags=arch:arm | |
582 | :avocado: tags=machine:orangepi-pc | |
583 | """ | |
584 | deb_url = ('https://apt.armbian.com/pool/main/l/' | |
585 | 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') | |
586 | deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' | |
587 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
588 | kernel_path = self.extract_from_deb(deb_path, | |
589 | '/boot/vmlinuz-4.20.7-sunxi') | |
590 | dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb' | |
591 | dtb_path = self.extract_from_deb(deb_path, dtb_path) | |
592 | initrd_url = ('https://github.com/groeck/linux-build-test/raw/' | |
593 | '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' | |
594 | 'arm/rootfs-armv7a.cpio.gz') | |
595 | initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c' | |
596 | initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | |
597 | initrd_path = os.path.join(self.workdir, 'rootfs.cpio') | |
598 | archive.gzip_uncompress(initrd_path_gz, initrd_path) | |
599 | ||
600 | self.vm.set_console() | |
601 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
602 | 'console=ttyS0,115200 ' | |
603 | 'panic=-1 noreboot') | |
604 | self.vm.add_args('-kernel', kernel_path, | |
605 | '-dtb', dtb_path, | |
606 | '-initrd', initrd_path, | |
607 | '-append', kernel_command_line, | |
608 | '-no-reboot') | |
609 | self.vm.launch() | |
610 | self.wait_for_console_pattern('Boot successful.') | |
611 | ||
612 | exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', | |
613 | 'Allwinner sun8i Family') | |
614 | exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', | |
615 | 'system-control@1c00000') | |
616 | exec_command_and_wait_for_pattern(self, 'reboot', | |
617 | 'reboot: Restarting system') | |
de2749bc PMD |
618 | |
619 | def test_arm_orangepi_sd(self): | |
620 | """ | |
621 | :avocado: tags=arch:arm | |
622 | :avocado: tags=machine:orangepi-pc | |
623 | """ | |
624 | deb_url = ('https://apt.armbian.com/pool/main/l/' | |
625 | 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') | |
626 | deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' | |
627 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
628 | kernel_path = self.extract_from_deb(deb_path, | |
629 | '/boot/vmlinuz-4.20.7-sunxi') | |
630 | dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb' | |
631 | dtb_path = self.extract_from_deb(deb_path, dtb_path) | |
632 | rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/' | |
633 | 'kci-2019.02/armel/base/rootfs.ext2.xz') | |
634 | rootfs_hash = '692510cb625efda31640d1de0a8d60e26040f061' | |
635 | rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) | |
636 | rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') | |
637 | archive.lzma_uncompress(rootfs_path_xz, rootfs_path) | |
638 | ||
639 | self.vm.set_console() | |
640 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
641 | 'console=ttyS0,115200 ' | |
642 | 'root=/dev/mmcblk0 rootwait rw ' | |
643 | 'panic=-1 noreboot') | |
644 | self.vm.add_args('-kernel', kernel_path, | |
645 | '-dtb', dtb_path, | |
646 | '-drive', 'file=' + rootfs_path + ',if=sd,format=raw', | |
647 | '-append', kernel_command_line, | |
648 | '-no-reboot') | |
649 | self.vm.launch() | |
650 | shell_ready = "/bin/sh: can't access tty; job control turned off" | |
651 | self.wait_for_console_pattern(shell_ready) | |
652 | ||
653 | exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', | |
654 | 'Allwinner sun8i Family') | |
655 | exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', | |
656 | 'mmcblk0') | |
657 | exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', | |
658 | 'eth0: Link is Up') | |
659 | exec_command_and_wait_for_pattern(self, 'udhcpc eth0', | |
660 | 'udhcpc: lease of 10.0.2.15 obtained') | |
661 | exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', | |
662 | '3 packets transmitted, 3 packets received, 0% packet loss') | |
663 | exec_command_and_wait_for_pattern(self, 'reboot', | |
664 | 'reboot: Restarting system') | |
c40b1ded | 665 | |
784b8796 PMD |
666 | @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') |
667 | @skipUnless(P7ZIP_AVAILABLE, '7z not installed') | |
668 | def test_arm_orangepi_bionic(self): | |
669 | """ | |
670 | :avocado: tags=arch:arm | |
671 | :avocado: tags=machine:orangepi-pc | |
672 | """ | |
673 | ||
674 | # This test download a 196MB compressed image and expand it to 932MB... | |
675 | image_url = ('https://dl.armbian.com/orangepipc/archive/' | |
676 | 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z') | |
677 | image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e' | |
678 | image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash) | |
679 | image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img' | |
680 | image_path = os.path.join(self.workdir, image_name) | |
681 | process.run("7z e -o%s %s" % (self.workdir, image_path_7z)) | |
682 | ||
683 | self.vm.set_console() | |
684 | self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw', | |
685 | '-nic', 'user', | |
686 | '-no-reboot') | |
687 | self.vm.launch() | |
688 | ||
689 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
690 | 'console=ttyS0,115200 ' | |
691 | 'loglevel=7 ' | |
692 | 'nosmp ' | |
693 | 'systemd.default_timeout_start_sec=9000 ' | |
694 | 'systemd.mask=armbian-zram-config.service ' | |
695 | 'systemd.mask=armbian-ramlog.service') | |
696 | ||
697 | self.wait_for_console_pattern('U-Boot SPL') | |
698 | self.wait_for_console_pattern('Autoboot in ') | |
699 | exec_command_and_wait_for_pattern(self, ' ', '=>') | |
700 | exec_command_and_wait_for_pattern(self, "setenv extraargs '" + | |
701 | kernel_command_line + "'", '=>') | |
702 | exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...'); | |
703 | ||
704 | self.wait_for_console_pattern('systemd[1]: Set hostname ' + | |
705 | 'to <orangepipc>') | |
706 | self.wait_for_console_pattern('Starting Load Kernel Modules...') | |
707 | ||
921589fb PMD |
708 | @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') |
709 | def test_arm_orangepi_uboot_netbsd9(self): | |
710 | """ | |
711 | :avocado: tags=arch:arm | |
712 | :avocado: tags=machine:orangepi-pc | |
713 | """ | |
714 | # This test download a 304MB compressed image and expand it to 1.3GB... | |
715 | deb_url = ('http://snapshot.debian.org/archive/debian/' | |
716 | '20200108T145233Z/pool/main/u/u-boot/' | |
717 | 'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb') | |
718 | deb_hash = 'f67f404a80753ca3d1258f13e38f2b060e13db99' | |
719 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | |
720 | # We use the common OrangePi PC 'plus' build of U-Boot for our secondary | |
721 | # program loader (SPL). We will then set the path to the more specific | |
722 | # OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt, | |
723 | # before to boot NetBSD. | |
724 | uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin' | |
725 | uboot_path = self.extract_from_deb(deb_path, uboot_path) | |
726 | image_url = ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/' | |
727 | 'evbarm-earmv7hf/binary/gzimg/armv7.img.gz') | |
728 | image_hash = '2babb29d36d8360adcb39c09e31060945259917a' | |
729 | image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash) | |
730 | image_path = os.path.join(self.workdir, 'armv7.img') | |
731 | image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path | |
732 | archive.gzip_uncompress(image_path_gz, image_path) | |
733 | ||
734 | # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc | |
735 | with open(uboot_path, 'rb') as f_in: | |
736 | with open(image_path, 'r+b') as f_out: | |
737 | f_out.seek(8 * 1024) | |
738 | shutil.copyfileobj(f_in, f_out) | |
739 | ||
740 | # Extend image, to avoid that NetBSD thinks the partition | |
741 | # inside the image is larger than device size itself | |
742 | f_out.seek(0, 2) | |
743 | f_out.seek(64 * 1024 * 1024, 1) | |
744 | f_out.write(bytearray([0x00])) | |
745 | ||
746 | self.vm.set_console() | |
747 | self.vm.add_args('-nic', 'user', | |
748 | '-drive', image_drive_args, | |
749 | '-global', 'allwinner-rtc.base-year=2000', | |
750 | '-no-reboot') | |
751 | self.vm.launch() | |
752 | wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1') | |
753 | interrupt_interactive_console_until_pattern(self, | |
754 | 'Hit any key to stop autoboot:', | |
755 | 'switch to partitions #0, OK') | |
756 | ||
757 | exec_command_and_wait_for_pattern(self, '', '=>') | |
758 | cmd = 'setenv bootargs root=ld0a' | |
759 | exec_command_and_wait_for_pattern(self, cmd, '=>') | |
760 | cmd = 'setenv kernel netbsd-GENERIC.ub' | |
761 | exec_command_and_wait_for_pattern(self, cmd, '=>') | |
762 | cmd = 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb' | |
763 | exec_command_and_wait_for_pattern(self, cmd, '=>') | |
764 | cmd = ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; " | |
765 | "fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; " | |
766 | "fdt addr ${fdt_addr_r}; " | |
767 | "bootm ${kernel_addr_r} - ${fdt_addr_r}'") | |
768 | exec_command_and_wait_for_pattern(self, cmd, '=>') | |
769 | ||
770 | exec_command_and_wait_for_pattern(self, 'boot', | |
771 | 'Booting kernel from Legacy Image') | |
772 | wait_for_console_pattern(self, 'Starting kernel ...') | |
773 | wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)') | |
774 | # Wait for user-space | |
775 | wait_for_console_pattern(self, 'Starting root file system check') | |
776 | ||
79182494 CR |
777 | def test_s390x_s390_ccw_virtio(self): |
778 | """ | |
779 | :avocado: tags=arch:s390x | |
ba21bde9 | 780 | :avocado: tags=machine:s390-ccw-virtio |
79182494 | 781 | """ |
93bbbdf6 CR |
782 | kernel_url = ('https://archives.fedoraproject.org/pub/archive' |
783 | '/fedora-secondary/releases/29/Everything/s390x/os/images' | |
784 | '/kernel.img') | |
79182494 CR |
785 | kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313' |
786 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
787 | ||
79182494 CR |
788 | self.vm.set_console() |
789 | kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0' | |
790 | self.vm.add_args('-nodefaults', | |
791 | '-kernel', kernel_path, | |
792 | '-append', kernel_command_line) | |
793 | self.vm.launch() | |
794 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
795 | self.wait_for_console_pattern(console_pattern) | |
b36b5937 CR |
796 | |
797 | def test_alpha_clipper(self): | |
798 | """ | |
799 | :avocado: tags=arch:alpha | |
800 | :avocado: tags=machine:clipper | |
801 | """ | |
802 | kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/' | |
803 | 'installer-alpha/current/images/cdrom/vmlinuz') | |
804 | kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3' | |
805 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
806 | ||
807 | uncompressed_kernel = archive.uncompress(kernel_path, self.workdir) | |
808 | ||
b36b5937 CR |
809 | self.vm.set_console() |
810 | kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' | |
1d77f1b1 | 811 | self.vm.add_args('-nodefaults', |
b36b5937 CR |
812 | '-kernel', uncompressed_kernel, |
813 | '-append', kernel_command_line) | |
814 | self.vm.launch() | |
815 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
816 | self.wait_for_console_pattern(console_pattern) | |
83fa3bc3 CR |
817 | |
818 | def test_ppc64_pseries(self): | |
819 | """ | |
820 | :avocado: tags=arch:ppc64 | |
821 | :avocado: tags=machine:pseries | |
822 | """ | |
93bbbdf6 CR |
823 | kernel_url = ('https://archives.fedoraproject.org/pub/archive' |
824 | '/fedora-secondary/releases/29/Everything/ppc64le/os' | |
825 | '/ppc/ppc64/vmlinuz') | |
83fa3bc3 CR |
826 | kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77' |
827 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | |
828 | ||
83fa3bc3 CR |
829 | self.vm.set_console() |
830 | kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0' | |
831 | self.vm.add_args('-kernel', kernel_path, | |
832 | '-append', kernel_command_line) | |
833 | self.vm.launch() | |
834 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
835 | self.wait_for_console_pattern(console_pattern) | |
f7d85525 PMD |
836 | |
837 | def test_m68k_q800(self): | |
838 | """ | |
839 | :avocado: tags=arch:m68k | |
840 | :avocado: tags=machine:q800 | |
841 | """ | |
f44b5549 PMD |
842 | deb_url = ('https://snapshot.debian.org/archive/debian-ports' |
843 | '/20191021T083923Z/pool-m68k/main' | |
2ecde8b2 CR |
844 | '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb') |
845 | deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1' | |
b67d22aa | 846 | deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) |
f7d85525 | 847 | kernel_path = self.extract_from_deb(deb_path, |
2ecde8b2 | 848 | '/boot/vmlinux-5.3.0-1-m68k') |
f7d85525 | 849 | |
f7d85525 PMD |
850 | self.vm.set_console() |
851 | kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | |
852 | 'console=ttyS0 vga=off') | |
853 | self.vm.add_args('-kernel', kernel_path, | |
854 | '-append', kernel_command_line) | |
855 | self.vm.launch() | |
856 | console_pattern = 'Kernel command line: %s' % kernel_command_line | |
857 | self.wait_for_console_pattern(console_pattern) | |
858 | console_pattern = 'No filesystem could mount root' | |
859 | self.wait_for_console_pattern(console_pattern) | |
b0065e1f | 860 | |
86624046 | 861 | def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0): |
b0065e1f TH |
862 | tar_url = ('https://www.qemu-advent-calendar.org' |
863 | '/2018/download/day' + day + '.tar.xz') | |
864 | file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) | |
865 | archive.extract(file_path, self.workdir) | |
86624046 | 866 | self.vm.set_console(console_index=console) |
b0065e1f TH |
867 | self.vm.add_args('-kernel', |
868 | self.workdir + '/day' + day + '/' + kernel_name) | |
869 | self.vm.launch() | |
870 | self.wait_for_console_pattern('QEMU advent calendar') | |
871 | ||
872 | def test_arm_vexpressa9(self): | |
873 | """ | |
874 | :avocado: tags=arch:arm | |
875 | :avocado: tags=machine:vexpress-a9 | |
876 | """ | |
877 | tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b' | |
878 | self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb') | |
879 | self.do_test_advcal_2018('16', tar_hash, 'winter.zImage') | |
880 | ||
881 | def test_m68k_mcf5208evb(self): | |
882 | """ | |
883 | :avocado: tags=arch:m68k | |
884 | :avocado: tags=machine:mcf5208evb | |
885 | """ | |
886 | tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c' | |
887 | self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf') | |
888 | ||
889 | def test_microblaze_s3adsp1800(self): | |
890 | """ | |
891 | :avocado: tags=arch:microblaze | |
892 | :avocado: tags=machine:petalogix-s3adsp1800 | |
893 | """ | |
894 | tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f' | |
895 | self.do_test_advcal_2018('17', tar_hash, 'ballerina.bin') | |
896 | ||
897 | def test_or1k_sim(self): | |
898 | """ | |
899 | :avocado: tags=arch:or1k | |
900 | :avocado: tags=machine:or1k-sim | |
901 | """ | |
902 | tar_hash = '20334cdaf386108c530ff0badaecc955693027dd' | |
903 | self.do_test_advcal_2018('20', tar_hash, 'vmlinux') | |
904 | ||
905 | def test_nios2_10m50(self): | |
906 | """ | |
907 | :avocado: tags=arch:nios2 | |
908 | :avocado: tags=machine:10m50-ghrd | |
909 | """ | |
910 | tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918' | |
911 | self.do_test_advcal_2018('14', tar_hash, 'vmlinux.elf') | |
912 | ||
913 | def test_ppc64_e500(self): | |
914 | """ | |
915 | :avocado: tags=arch:ppc64 | |
916 | :avocado: tags=machine:ppce500 | |
917 | """ | |
918 | tar_hash = '6951d86d644b302898da2fd701739c9406527fe1' | |
919 | self.vm.add_args('-cpu', 'e5500') | |
920 | self.do_test_advcal_2018('19', tar_hash, 'uImage') | |
921 | ||
922 | def test_ppc_g3beige(self): | |
923 | """ | |
924 | :avocado: tags=arch:ppc | |
925 | :avocado: tags=machine:g3beige | |
926 | """ | |
927 | tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' | |
928 | self.vm.add_args('-M', 'graphics=off') | |
929 | self.do_test_advcal_2018('15', tar_hash, 'invaders.elf') | |
930 | ||
931 | def test_ppc_mac99(self): | |
932 | """ | |
933 | :avocado: tags=arch:ppc | |
934 | :avocado: tags=machine:mac99 | |
935 | """ | |
936 | tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' | |
937 | self.vm.add_args('-M', 'graphics=off') | |
938 | self.do_test_advcal_2018('15', tar_hash, 'invaders.elf') | |
939 | ||
86624046 TH |
940 | def test_sh4_r2d(self): |
941 | """ | |
942 | :avocado: tags=arch:sh4 | |
943 | :avocado: tags=machine:r2d | |
944 | """ | |
945 | tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e' | |
946 | self.vm.add_args('-append', 'console=ttySC1') | |
947 | self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1) | |
948 | ||
b0065e1f TH |
949 | def test_sparc_ss20(self): |
950 | """ | |
951 | :avocado: tags=arch:sparc | |
952 | :avocado: tags=machine:SS-20 | |
953 | """ | |
954 | tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f' | |
955 | self.do_test_advcal_2018('11', tar_hash, 'zImage.elf') | |
956 | ||
957 | def test_xtensa_lx60(self): | |
958 | """ | |
959 | :avocado: tags=arch:xtensa | |
960 | :avocado: tags=machine:lx60 | |
961 | """ | |
962 | tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' | |
963 | self.vm.add_args('-cpu', 'dc233c') | |
964 | self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf') |