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