xref: /openbmc/qemu/tests/avocado/replay_kernel.py (revision 6c848c19)
1# Record/replay test that boots a Linux kernel
2#
3# Copyright (c) 2020 ISP RAS
4#
5# Author:
6#  Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
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
11import os
12import lzma
13import shutil
14import logging
15import time
16
17from avocado import skip
18from avocado import skipUnless
19from avocado import skipUnless
20from avocado_qemu import wait_for_console_pattern
21from avocado.utils import archive
22from avocado.utils import process
23from boot_linux_console import LinuxKernelTest
24
25class ReplayKernelBase(LinuxKernelTest):
26    """
27    Boots a Linux kernel in record mode and checks that the console
28    is operational and the kernel command line is properly passed
29    from QEMU to the kernel.
30    Then replays the same scenario and verifies, that QEMU correctly
31    terminates.
32    """
33
34    timeout = 120
35    KERNEL_COMMON_COMMAND_LINE = 'printk.time=1 panic=-1 '
36
37    def run_vm(self, kernel_path, kernel_command_line, console_pattern,
38               record, shift, args, replay_path):
39        # icount requires TCG to be available
40        self.require_accelerator('tcg')
41
42        logger = logging.getLogger('replay')
43        start_time = time.time()
44        vm = self.get_vm()
45        vm.set_console()
46        if record:
47            logger.info('recording the execution...')
48            mode = 'record'
49        else:
50            logger.info('replaying the execution...')
51            mode = 'replay'
52        vm.add_args('-icount', 'shift=%s,rr=%s,rrfile=%s' %
53                    (shift, mode, replay_path),
54                    '-kernel', kernel_path,
55                    '-append', kernel_command_line,
56                    '-net', 'none',
57                    '-no-reboot')
58        if args:
59            vm.add_args(*args)
60        vm.launch()
61        self.wait_for_console_pattern(console_pattern, vm)
62        if record:
63            vm.shutdown()
64            logger.info('finished the recording with log size %s bytes'
65                        % os.path.getsize(replay_path))
66        else:
67            vm.wait()
68            logger.info('successfully finished the replay')
69        elapsed = time.time() - start_time
70        logger.info('elapsed time %.2f sec' % elapsed)
71        return elapsed
72
73    def run_rr(self, kernel_path, kernel_command_line, console_pattern,
74               shift=7, args=None):
75        replay_path = os.path.join(self.workdir, 'replay.bin')
76        t1 = self.run_vm(kernel_path, kernel_command_line, console_pattern,
77                         True, shift, args, replay_path)
78        t2 = self.run_vm(kernel_path, kernel_command_line, console_pattern,
79                         False, shift, args, replay_path)
80        logger = logging.getLogger('replay')
81        logger.info('replay overhead {:.2%}'.format(t2 / t1 - 1))
82
83class ReplayKernelNormal(ReplayKernelBase):
84
85    def test_i386_pc(self):
86        """
87        :avocado: tags=arch:i386
88        :avocado: tags=machine:pc
89        """
90        kernel_url = ('https://storage.tuxboot.com/20230331/i386/bzImage')
91        kernel_hash = 'a3e5b32a354729e65910f5a1ffcda7c14a6c12a55e8213fb86e277f1b76ed956'
92        kernel_path = self.fetch_asset(kernel_url,
93                                       asset_hash=kernel_hash,
94                                       algorithm = "sha256")
95
96        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
97        console_pattern = 'VFS: Cannot open root device'
98
99        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
100
101    def test_x86_64_pc(self):
102        """
103        :avocado: tags=arch:x86_64
104        :avocado: tags=machine:pc
105        """
106        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
107                      '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
108                      '/vmlinuz')
109        kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
110        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
111
112        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
113        console_pattern = 'VFS: Cannot open root device'
114
115        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
116
117    def test_mips_malta(self):
118        """
119        :avocado: tags=arch:mips
120        :avocado: tags=machine:malta
121        :avocado: tags=endian:big
122        """
123        deb_url = ('http://snapshot.debian.org/archive/debian/'
124                   '20130217T032700Z/pool/main/l/linux-2.6/'
125                   'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb')
126        deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04'
127        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
128        kernel_path = self.extract_from_deb(deb_path,
129                                            '/boot/vmlinux-2.6.32-5-4kc-malta')
130        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
131        console_pattern = 'Kernel command line: %s' % kernel_command_line
132
133        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
134
135    def test_mips64el_malta(self):
136        """
137        This test requires the ar tool to extract "data.tar.gz" from
138        the Debian package.
139
140        The kernel can be rebuilt using this Debian kernel source [1] and
141        following the instructions on [2].
142
143        [1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/
144            #linux-source-2.6.32_2.6.32-48
145        [2] https://kernel-team.pages.debian.net/kernel-handbook/
146            ch-common-tasks.html#s-common-official
147
148        :avocado: tags=arch:mips64el
149        :avocado: tags=machine:malta
150        """
151        deb_url = ('http://snapshot.debian.org/archive/debian/'
152                   '20130217T032700Z/pool/main/l/linux-2.6/'
153                   'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb')
154        deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5'
155        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
156        kernel_path = self.extract_from_deb(deb_path,
157                                            '/boot/vmlinux-2.6.32-5-5kc-malta')
158        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
159        console_pattern = 'Kernel command line: %s' % kernel_command_line
160        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
161
162    def test_aarch64_virt(self):
163        """
164        :avocado: tags=arch:aarch64
165        :avocado: tags=machine:virt
166        :avocado: tags=cpu:cortex-a53
167        """
168        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
169                      '/linux/releases/29/Everything/aarch64/os/images/pxeboot'
170                      '/vmlinuz')
171        kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493'
172        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
173
174        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
175                               'console=ttyAMA0')
176        console_pattern = 'VFS: Cannot open root device'
177
178        self.run_rr(kernel_path, kernel_command_line, console_pattern)
179
180    def test_arm_virt(self):
181        """
182        :avocado: tags=arch:arm
183        :avocado: tags=machine:virt
184        """
185        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
186                      '/linux/releases/29/Everything/armhfp/os/images/pxeboot'
187                      '/vmlinuz')
188        kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
189        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
190
191        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
192                               'console=ttyAMA0')
193        console_pattern = 'VFS: Cannot open root device'
194
195        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1)
196
197    def test_arm_cubieboard_initrd(self):
198        """
199        :avocado: tags=arch:arm
200        :avocado: tags=machine:cubieboard
201        """
202        deb_url = ('https://apt.armbian.com/pool/main/l/'
203                   'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
204        deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
205        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
206        kernel_path = self.extract_from_deb(deb_path,
207                                            '/boot/vmlinuz-5.10.16-sunxi')
208        dtb_path = '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
209        dtb_path = self.extract_from_deb(deb_path, dtb_path)
210        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
211                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
212                      'arm/rootfs-armv5.cpio.gz')
213        initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
214        initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
215        initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
216        archive.gzip_uncompress(initrd_path_gz, initrd_path)
217
218        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
219                               'console=ttyS0,115200 '
220                               'usbcore.nousb '
221                               'panic=-1 noreboot')
222        console_pattern = 'Boot successful.'
223        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1,
224                    args=('-dtb', dtb_path,
225                          '-initrd', initrd_path,
226                          '-no-reboot'))
227
228    def test_s390x_s390_ccw_virtio(self):
229        """
230        :avocado: tags=arch:s390x
231        :avocado: tags=machine:s390-ccw-virtio
232        """
233        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
234                      '/fedora-secondary/releases/29/Everything/s390x/os/images'
235                      '/kernel.img')
236        kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313'
237        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
238
239        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0'
240        console_pattern = 'Kernel command line: %s' % kernel_command_line
241        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=9)
242
243    def test_alpha_clipper(self):
244        """
245        :avocado: tags=arch:alpha
246        :avocado: tags=machine:clipper
247        """
248        kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/'
249                      'installer-alpha/20090123lenny10/images/cdrom/vmlinuz')
250        kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3'
251        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
252
253        uncompressed_kernel = archive.uncompress(kernel_path, self.workdir)
254
255        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
256        console_pattern = 'Kernel command line: %s' % kernel_command_line
257        self.run_rr(uncompressed_kernel, kernel_command_line, console_pattern, shift=9,
258            args=('-nodefaults', ))
259
260    def test_ppc64_pseries(self):
261        """
262        :avocado: tags=arch:ppc64
263        :avocado: tags=machine:pseries
264        :avocado: tags=accel:tcg
265        """
266        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
267                      '/fedora-secondary/releases/29/Everything/ppc64le/os'
268                      '/ppc/ppc64/vmlinuz')
269        kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
270        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
271
272        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
273        console_pattern = 'VFS: Cannot open root device'
274        self.run_rr(kernel_path, kernel_command_line, console_pattern)
275
276    def test_ppc64_powernv(self):
277        """
278        :avocado: tags=arch:ppc64
279        :avocado: tags=machine:powernv
280        :avocado: tags=accel:tcg
281        """
282        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
283                      '/fedora-secondary/releases/29/Everything/ppc64le/os'
284                      '/ppc/ppc64/vmlinuz')
285        kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
286        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
287
288        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + \
289                              'console=tty0 console=hvc0'
290        console_pattern = 'VFS: Cannot open root device'
291        self.run_rr(kernel_path, kernel_command_line, console_pattern)
292
293    def test_m68k_q800(self):
294        """
295        :avocado: tags=arch:m68k
296        :avocado: tags=machine:q800
297        """
298        deb_url = ('https://snapshot.debian.org/archive/debian-ports'
299                   '/20191021T083923Z/pool-m68k/main'
300                   '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
301        deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
302        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
303        kernel_path = self.extract_from_deb(deb_path,
304                                            '/boot/vmlinux-5.3.0-1-m68k')
305
306        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
307                               'console=ttyS0 vga=off')
308        console_pattern = 'No filesystem could mount root'
309        self.run_rr(kernel_path, kernel_command_line, console_pattern)
310
311    def do_test_advcal_2018(self, file_path, kernel_name, args=None):
312        archive.extract(file_path, self.workdir)
313
314        for entry in os.scandir(self.workdir):
315            if entry.name.startswith('day') and entry.is_dir():
316                kernel_path = os.path.join(entry.path, kernel_name)
317                break
318
319        kernel_command_line = ''
320        console_pattern = 'QEMU advent calendar'
321        self.run_rr(kernel_path, kernel_command_line, console_pattern,
322                    args=args)
323
324    def test_arm_vexpressa9(self):
325        """
326        :avocado: tags=arch:arm
327        :avocado: tags=machine:vexpress-a9
328        """
329        tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b'
330        tar_url = ('https://qemu-advcal.gitlab.io'
331                   '/qac-best-of-multiarch/download/day16.tar.xz')
332        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
333        dtb_path = self.workdir + '/day16/vexpress-v2p-ca9.dtb'
334        self.do_test_advcal_2018(file_path, 'winter.zImage',
335                                 args=('-dtb', dtb_path))
336
337    def test_m68k_mcf5208evb(self):
338        """
339        :avocado: tags=arch:m68k
340        :avocado: tags=machine:mcf5208evb
341        """
342        tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
343        tar_url = ('https://qemu-advcal.gitlab.io'
344                   '/qac-best-of-multiarch/download/day07.tar.xz')
345        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
346        self.do_test_advcal_2018(file_path, 'sanity-clause.elf')
347
348    def test_microblaze_s3adsp1800(self):
349        """
350        :avocado: tags=arch:microblaze
351        :avocado: tags=machine:petalogix-s3adsp1800
352        """
353        tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f'
354        tar_url = ('https://qemu-advcal.gitlab.io'
355                   '/qac-best-of-multiarch/download/day17.tar.xz')
356        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
357        self.do_test_advcal_2018(file_path, 'ballerina.bin')
358
359    def test_ppc64_e500(self):
360        """
361        :avocado: tags=arch:ppc64
362        :avocado: tags=machine:ppce500
363        :avocado: tags=cpu:e5500
364        """
365        tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
366        tar_url = ('https://qemu-advcal.gitlab.io'
367                   '/qac-best-of-multiarch/download/day19.tar.xz')
368        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
369        self.do_test_advcal_2018(file_path, 'uImage')
370
371    def test_or1k_sim(self):
372        """
373        :avocado: tags=arch:or1k
374        :avocado: tags=machine:or1k-sim
375        """
376        tar_hash = '20334cdaf386108c530ff0badaecc955693027dd'
377        tar_url = ('https://qemu-advcal.gitlab.io'
378                   '/qac-best-of-multiarch/download/day20.tar.xz')
379        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
380        self.do_test_advcal_2018(file_path, 'vmlinux')
381
382    def test_nios2_10m50(self):
383        """
384        :avocado: tags=arch:nios2
385        :avocado: tags=machine:10m50-ghrd
386        """
387        tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918'
388        tar_url = ('https://qemu-advcal.gitlab.io'
389                   '/qac-best-of-multiarch/download/day14.tar.xz')
390        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
391        self.do_test_advcal_2018(file_path, 'vmlinux.elf')
392
393    def test_ppc_g3beige(self):
394        """
395        :avocado: tags=arch:ppc
396        :avocado: tags=machine:g3beige
397        """
398        tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
399        tar_url = ('https://qemu-advcal.gitlab.io'
400                   '/qac-best-of-multiarch/download/day15.tar.xz')
401        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
402        self.do_test_advcal_2018(file_path, 'invaders.elf',
403                                 args=('-M', 'graphics=off'))
404
405    def test_ppc_mac99(self):
406        """
407        :avocado: tags=arch:ppc
408        :avocado: tags=machine:mac99
409        """
410        tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
411        tar_url = ('https://qemu-advcal.gitlab.io'
412                   '/qac-best-of-multiarch/download/day15.tar.xz')
413        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
414        self.do_test_advcal_2018(file_path, 'invaders.elf',
415                                 args=('-M', 'graphics=off'))
416
417    def test_sparc_ss20(self):
418        """
419        :avocado: tags=arch:sparc
420        :avocado: tags=machine:SS-20
421        """
422        tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
423        tar_url = ('https://qemu-advcal.gitlab.io'
424                   '/qac-best-of-multiarch/download/day11.tar.xz')
425        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
426        self.do_test_advcal_2018(file_path, 'zImage.elf')
427
428    def test_xtensa_lx60(self):
429        """
430        :avocado: tags=arch:xtensa
431        :avocado: tags=machine:lx60
432        :avocado: tags=cpu:dc233c
433        """
434        tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
435        tar_url = ('https://qemu-advcal.gitlab.io'
436                   '/qac-best-of-multiarch/download/day02.tar.xz')
437        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
438        self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf')
439
440@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
441class ReplayKernelSlow(ReplayKernelBase):
442    # Override the timeout, because this kernel includes an inner
443    # loop which is executed with TB recompilings during replay,
444    # making it very slow.
445    timeout = 180
446
447    def test_mips_malta_cpio(self):
448        """
449        :avocado: tags=arch:mips
450        :avocado: tags=machine:malta
451        :avocado: tags=endian:big
452        :avocado: tags=slowness:high
453        """
454        deb_url = ('http://snapshot.debian.org/archive/debian/'
455                   '20160601T041800Z/pool/main/l/linux/'
456                   'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb')
457        deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8'
458        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
459        kernel_path = self.extract_from_deb(deb_path,
460                                            '/boot/vmlinux-4.5.0-2-4kc-malta')
461        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
462                      '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
463                      'mips/rootfs.cpio.gz')
464        initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
465        initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
466        initrd_path = self.workdir + "rootfs.cpio"
467        archive.gzip_uncompress(initrd_path_gz, initrd_path)
468
469        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
470                               'console=ttyS0 console=tty '
471                               'rdinit=/sbin/init noreboot')
472        console_pattern = 'Boot successful.'
473        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
474                    args=('-initrd', initrd_path))
475
476    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
477    def test_mips64el_malta_5KEc_cpio(self):
478        """
479        :avocado: tags=arch:mips64el
480        :avocado: tags=machine:malta
481        :avocado: tags=endian:little
482        :avocado: tags=slowness:high
483        :avocado: tags=cpu:5KEc
484        """
485        kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
486                      'raw/9ad2df38/mips/malta/mips64el/'
487                      'vmlinux-3.19.3.mtoman.20150408')
488        kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
489        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
490        initrd_url = ('https://github.com/groeck/linux-build-test/'
491                      'raw/8584a59e/rootfs/'
492                      'mipsel64/rootfs.mipsel64r1.cpio.gz')
493        initrd_hash = '1dbb8a396e916847325284dbe2151167'
494        initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
495                                          asset_hash=initrd_hash)
496        initrd_path = self.workdir + "rootfs.cpio"
497        archive.gzip_uncompress(initrd_path_gz, initrd_path)
498
499        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
500                               'console=ttyS0 console=tty '
501                               'rdinit=/sbin/init noreboot')
502        console_pattern = 'Boot successful.'
503        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
504                    args=('-initrd', initrd_path))
505
506    def do_test_mips_malta32el_nanomips(self, kernel_path_xz):
507        kernel_path = self.workdir + "kernel"
508        with lzma.open(kernel_path_xz, 'rb') as f_in:
509            with open(kernel_path, 'wb') as f_out:
510                shutil.copyfileobj(f_in, f_out)
511
512        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
513                               'mem=256m@@0x0 '
514                               'console=ttyS0')
515        console_pattern = 'Kernel command line: %s' % kernel_command_line
516        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
517
518    def test_mips_malta32el_nanomips_4k(self):
519        """
520        :avocado: tags=arch:mipsel
521        :avocado: tags=machine:malta
522        :avocado: tags=endian:little
523        :avocado: tags=cpu:I7200
524        """
525        kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
526                      'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
527                      'generic_nano32r6el_page4k.xz')
528        kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
529        kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
530        self.do_test_mips_malta32el_nanomips(kernel_path_xz)
531
532    def test_mips_malta32el_nanomips_16k_up(self):
533        """
534        :avocado: tags=arch:mipsel
535        :avocado: tags=machine:malta
536        :avocado: tags=endian:little
537        :avocado: tags=cpu:I7200
538        """
539        kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
540                      'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
541                      'generic_nano32r6el_page16k_up.xz')
542        kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
543        kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
544        self.do_test_mips_malta32el_nanomips(kernel_path_xz)
545
546    def test_mips_malta32el_nanomips_64k_dbg(self):
547        """
548        :avocado: tags=arch:mipsel
549        :avocado: tags=machine:malta
550        :avocado: tags=endian:little
551        :avocado: tags=cpu:I7200
552        """
553        kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
554                      'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
555                      'generic_nano32r6el_page64k_dbg.xz')
556        kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
557        kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
558        self.do_test_mips_malta32el_nanomips(kernel_path_xz)
559