xref: /openbmc/qemu/tests/avocado/replay_kernel.py (revision f49986ae)
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    # See https://gitlab.com/qemu-project/qemu/-/issues/2010
86    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test sometimes gets stuck')
87    def test_x86_64_pc(self):
88        """
89        :avocado: tags=arch:x86_64
90        :avocado: tags=machine:pc
91        :avocado: tags=flaky
92        """
93        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
94                      '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
95                      '/vmlinuz')
96        kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
97        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
98
99        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
100        console_pattern = 'VFS: Cannot open root device'
101
102        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
103
104    def test_mips_malta(self):
105        """
106        :avocado: tags=arch:mips
107        :avocado: tags=machine:malta
108        :avocado: tags=endian:big
109        """
110        deb_url = ('http://snapshot.debian.org/archive/debian/'
111                   '20130217T032700Z/pool/main/l/linux-2.6/'
112                   'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb')
113        deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04'
114        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
115        kernel_path = self.extract_from_deb(deb_path,
116                                            '/boot/vmlinux-2.6.32-5-4kc-malta')
117        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
118        console_pattern = 'Kernel command line: %s' % kernel_command_line
119
120        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
121
122    # See https://gitlab.com/qemu-project/qemu/-/issues/2013
123    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
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        :avocado: tags=flaky
140        """
141        deb_url = ('http://snapshot.debian.org/archive/debian/'
142                   '20130217T032700Z/pool/main/l/linux-2.6/'
143                   'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb')
144        deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5'
145        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
146        kernel_path = self.extract_from_deb(deb_path,
147                                            '/boot/vmlinux-2.6.32-5-5kc-malta')
148        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
149        console_pattern = 'Kernel command line: %s' % kernel_command_line
150        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
151
152    def test_aarch64_virt(self):
153        """
154        :avocado: tags=arch:aarch64
155        :avocado: tags=machine:virt
156        :avocado: tags=cpu:cortex-a53
157        """
158        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
159                      '/linux/releases/29/Everything/aarch64/os/images/pxeboot'
160                      '/vmlinuz')
161        kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493'
162        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
163
164        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
165                               'console=ttyAMA0')
166        console_pattern = 'VFS: Cannot open root device'
167
168        self.run_rr(kernel_path, kernel_command_line, console_pattern)
169
170    def test_arm_virt(self):
171        """
172        :avocado: tags=arch:arm
173        :avocado: tags=machine:virt
174        """
175        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
176                      '/linux/releases/29/Everything/armhfp/os/images/pxeboot'
177                      '/vmlinuz')
178        kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
179        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
180
181        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
182                               'console=ttyAMA0')
183        console_pattern = 'VFS: Cannot open root device'
184
185        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1)
186
187    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
188
189    def test_arm_cubieboard_initrd(self):
190        """
191        :avocado: tags=arch:arm
192        :avocado: tags=machine:cubieboard
193        :avocado: tags=flaky
194        """
195        deb_url = ('https://apt.armbian.com/pool/main/l/'
196                   'linux-5.10.16-sunxi/linux-image-current-sunxi_21.02.2_armhf.deb')
197        deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
198        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
199        kernel_path = self.extract_from_deb(deb_path,
200                                            '/boot/vmlinuz-5.10.16-sunxi')
201        dtb_path = '/usr/lib/linux-image-current-sunxi/sun4i-a10-cubieboard.dtb'
202        dtb_path = self.extract_from_deb(deb_path, dtb_path)
203        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
204                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
205                      'arm/rootfs-armv5.cpio.gz')
206        initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
207        initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
208        initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
209        archive.gzip_uncompress(initrd_path_gz, initrd_path)
210
211        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
212                               'console=ttyS0,115200 '
213                               'usbcore.nousb '
214                               'panic=-1 noreboot')
215        console_pattern = 'Boot successful.'
216        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1,
217                    args=('-dtb', dtb_path,
218                          '-initrd', initrd_path,
219                          '-no-reboot'))
220
221    def test_s390x_s390_ccw_virtio(self):
222        """
223        :avocado: tags=arch:s390x
224        :avocado: tags=machine:s390-ccw-virtio
225        """
226        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
227                      '/fedora-secondary/releases/29/Everything/s390x/os/images'
228                      '/kernel.img')
229        kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313'
230        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
231
232        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0'
233        console_pattern = 'Kernel command line: %s' % kernel_command_line
234        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=9)
235
236    def test_alpha_clipper(self):
237        """
238        :avocado: tags=arch:alpha
239        :avocado: tags=machine:clipper
240        """
241        kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/'
242                      'installer-alpha/20090123lenny10/images/cdrom/vmlinuz')
243        kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3'
244        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
245
246        uncompressed_kernel = archive.uncompress(kernel_path, self.workdir)
247
248        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
249        console_pattern = 'Kernel command line: %s' % kernel_command_line
250        self.run_rr(uncompressed_kernel, kernel_command_line, console_pattern, shift=9,
251            args=('-nodefaults', ))
252
253    def test_ppc64_pseries(self):
254        """
255        :avocado: tags=arch:ppc64
256        :avocado: tags=machine:pseries
257        :avocado: tags=accel:tcg
258        """
259        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
260                      '/fedora-secondary/releases/29/Everything/ppc64le/os'
261                      '/ppc/ppc64/vmlinuz')
262        kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
263        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
264
265        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
266        console_pattern = 'VFS: Cannot open root device'
267        self.run_rr(kernel_path, kernel_command_line, console_pattern)
268
269    def test_ppc64_powernv(self):
270        """
271        :avocado: tags=arch:ppc64
272        :avocado: tags=machine:powernv
273        :avocado: tags=accel:tcg
274        """
275        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
276                      '/fedora-secondary/releases/29/Everything/ppc64le/os'
277                      '/ppc/ppc64/vmlinuz')
278        kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
279        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
280
281        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + \
282                              'console=tty0 console=hvc0'
283        console_pattern = 'VFS: Cannot open root device'
284        self.run_rr(kernel_path, kernel_command_line, console_pattern)
285
286    def test_m68k_q800(self):
287        """
288        :avocado: tags=arch:m68k
289        :avocado: tags=machine:q800
290        """
291        deb_url = ('https://snapshot.debian.org/archive/debian-ports'
292                   '/20191021T083923Z/pool-m68k/main'
293                   '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
294        deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
295        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
296        kernel_path = self.extract_from_deb(deb_path,
297                                            '/boot/vmlinux-5.3.0-1-m68k')
298
299        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
300                               'console=ttyS0 vga=off')
301        console_pattern = 'No filesystem could mount root'
302        self.run_rr(kernel_path, kernel_command_line, console_pattern)
303
304    def do_test_advcal_2018(self, file_path, kernel_name, args=None):
305        archive.extract(file_path, self.workdir)
306
307        for entry in os.scandir(self.workdir):
308            if entry.name.startswith('day') and entry.is_dir():
309                kernel_path = os.path.join(entry.path, kernel_name)
310                break
311
312        kernel_command_line = ''
313        console_pattern = 'QEMU advent calendar'
314        self.run_rr(kernel_path, kernel_command_line, console_pattern,
315                    args=args)
316
317    def test_arm_vexpressa9(self):
318        """
319        :avocado: tags=arch:arm
320        :avocado: tags=machine:vexpress-a9
321        """
322        tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b'
323        tar_url = ('https://qemu-advcal.gitlab.io'
324                   '/qac-best-of-multiarch/download/day16.tar.xz')
325        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
326        dtb_path = self.workdir + '/day16/vexpress-v2p-ca9.dtb'
327        self.do_test_advcal_2018(file_path, 'winter.zImage',
328                                 args=('-dtb', dtb_path))
329
330    def test_m68k_mcf5208evb(self):
331        """
332        :avocado: tags=arch:m68k
333        :avocado: tags=machine:mcf5208evb
334        """
335        tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
336        tar_url = ('https://qemu-advcal.gitlab.io'
337                   '/qac-best-of-multiarch/download/day07.tar.xz')
338        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
339        self.do_test_advcal_2018(file_path, 'sanity-clause.elf')
340
341    @skip("Test currently broken") # Console stuck as of 5.2-rc1
342    def test_microblaze_s3adsp1800(self):
343        """
344        :avocado: tags=arch:microblaze
345        :avocado: tags=machine:petalogix-s3adsp1800
346        """
347        tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f'
348        tar_url = ('https://qemu-advcal.gitlab.io'
349                   '/qac-best-of-multiarch/download/day17.tar.xz')
350        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
351        self.do_test_advcal_2018(file_path, 'ballerina.bin')
352
353    def test_ppc64_e500(self):
354        """
355        :avocado: tags=arch:ppc64
356        :avocado: tags=machine:ppce500
357        :avocado: tags=cpu:e5500
358        """
359        tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
360        tar_url = ('https://qemu-advcal.gitlab.io'
361                   '/qac-best-of-multiarch/download/day19.tar.xz')
362        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
363        self.do_test_advcal_2018(file_path, 'uImage')
364
365    def test_or1k_sim(self):
366        """
367        :avocado: tags=arch:or1k
368        :avocado: tags=machine:or1k-sim
369        """
370        tar_hash = '20334cdaf386108c530ff0badaecc955693027dd'
371        tar_url = ('https://qemu-advcal.gitlab.io'
372                   '/qac-best-of-multiarch/download/day20.tar.xz')
373        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
374        self.do_test_advcal_2018(file_path, 'vmlinux')
375
376    @skip("nios2 emulation is buggy under record/replay")
377    def test_nios2_10m50(self):
378        """
379        :avocado: tags=arch:nios2
380        :avocado: tags=machine:10m50-ghrd
381        """
382        tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918'
383        tar_url = ('https://qemu-advcal.gitlab.io'
384                   '/qac-best-of-multiarch/download/day14.tar.xz')
385        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
386        self.do_test_advcal_2018(file_path, 'vmlinux.elf')
387
388    def test_ppc_g3beige(self):
389        """
390        :avocado: tags=arch:ppc
391        :avocado: tags=machine:g3beige
392        """
393        tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
394        tar_url = ('https://qemu-advcal.gitlab.io'
395                   '/qac-best-of-multiarch/download/day15.tar.xz')
396        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
397        self.do_test_advcal_2018(file_path, 'invaders.elf',
398                                 args=('-M', 'graphics=off'))
399
400    def test_ppc_mac99(self):
401        """
402        :avocado: tags=arch:ppc
403        :avocado: tags=machine:mac99
404        """
405        tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
406        tar_url = ('https://qemu-advcal.gitlab.io'
407                   '/qac-best-of-multiarch/download/day15.tar.xz')
408        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
409        self.do_test_advcal_2018(file_path, 'invaders.elf',
410                                 args=('-M', 'graphics=off'))
411
412    def test_sparc_ss20(self):
413        """
414        :avocado: tags=arch:sparc
415        :avocado: tags=machine:SS-20
416        """
417        tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
418        tar_url = ('https://qemu-advcal.gitlab.io'
419                   '/qac-best-of-multiarch/download/day11.tar.xz')
420        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
421        self.do_test_advcal_2018(file_path, 'zImage.elf')
422
423    def test_xtensa_lx60(self):
424        """
425        :avocado: tags=arch:xtensa
426        :avocado: tags=machine:lx60
427        :avocado: tags=cpu:dc233c
428        """
429        tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
430        tar_url = ('https://qemu-advcal.gitlab.io'
431                   '/qac-best-of-multiarch/download/day02.tar.xz')
432        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
433        self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf')
434
435@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
436class ReplayKernelSlow(ReplayKernelBase):
437    # Override the timeout, because this kernel includes an inner
438    # loop which is executed with TB recompilings during replay,
439    # making it very slow.
440    timeout = 180
441
442    def test_mips_malta_cpio(self):
443        """
444        :avocado: tags=arch:mips
445        :avocado: tags=machine:malta
446        :avocado: tags=endian:big
447        :avocado: tags=slowness:high
448        """
449        deb_url = ('http://snapshot.debian.org/archive/debian/'
450                   '20160601T041800Z/pool/main/l/linux/'
451                   'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb')
452        deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8'
453        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
454        kernel_path = self.extract_from_deb(deb_path,
455                                            '/boot/vmlinux-4.5.0-2-4kc-malta')
456        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
457                      '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
458                      'mips/rootfs.cpio.gz')
459        initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
460        initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
461        initrd_path = self.workdir + "rootfs.cpio"
462        archive.gzip_uncompress(initrd_path_gz, initrd_path)
463
464        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
465                               'console=ttyS0 console=tty '
466                               'rdinit=/sbin/init noreboot')
467        console_pattern = 'Boot successful.'
468        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
469                    args=('-initrd', initrd_path))
470
471    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
472    def test_mips64el_malta_5KEc_cpio(self):
473        """
474        :avocado: tags=arch:mips64el
475        :avocado: tags=machine:malta
476        :avocado: tags=endian:little
477        :avocado: tags=slowness:high
478        :avocado: tags=cpu:5KEc
479        """
480        kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
481                      'raw/9ad2df38/mips/malta/mips64el/'
482                      'vmlinux-3.19.3.mtoman.20150408')
483        kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
484        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
485        initrd_url = ('https://github.com/groeck/linux-build-test/'
486                      'raw/8584a59e/rootfs/'
487                      'mipsel64/rootfs.mipsel64r1.cpio.gz')
488        initrd_hash = '1dbb8a396e916847325284dbe2151167'
489        initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
490                                          asset_hash=initrd_hash)
491        initrd_path = self.workdir + "rootfs.cpio"
492        archive.gzip_uncompress(initrd_path_gz, initrd_path)
493
494        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
495                               'console=ttyS0 console=tty '
496                               'rdinit=/sbin/init noreboot')
497        console_pattern = 'Boot successful.'
498        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
499                    args=('-initrd', initrd_path))
500
501    def do_test_mips_malta32el_nanomips(self, kernel_path_xz):
502        kernel_path = self.workdir + "kernel"
503        with lzma.open(kernel_path_xz, 'rb') as f_in:
504            with open(kernel_path, 'wb') as f_out:
505                shutil.copyfileobj(f_in, f_out)
506
507        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
508                               'mem=256m@@0x0 '
509                               'console=ttyS0')
510        console_pattern = 'Kernel command line: %s' % kernel_command_line
511        self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
512
513    def test_mips_malta32el_nanomips_4k(self):
514        """
515        :avocado: tags=arch:mipsel
516        :avocado: tags=machine:malta
517        :avocado: tags=endian:little
518        :avocado: tags=cpu:I7200
519        """
520        kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
521                      'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
522                      'generic_nano32r6el_page4k.xz')
523        kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
524        kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
525        self.do_test_mips_malta32el_nanomips(kernel_path_xz)
526
527    def test_mips_malta32el_nanomips_16k_up(self):
528        """
529        :avocado: tags=arch:mipsel
530        :avocado: tags=machine:malta
531        :avocado: tags=endian:little
532        :avocado: tags=cpu:I7200
533        """
534        kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
535                      'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
536                      'generic_nano32r6el_page16k_up.xz')
537        kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
538        kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
539        self.do_test_mips_malta32el_nanomips(kernel_path_xz)
540
541    def test_mips_malta32el_nanomips_64k_dbg(self):
542        """
543        :avocado: tags=arch:mipsel
544        :avocado: tags=machine:malta
545        :avocado: tags=endian:little
546        :avocado: tags=cpu:I7200
547        """
548        kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
549                      'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
550                      'generic_nano32r6el_page64k_dbg.xz')
551        kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
552        kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
553        self.do_test_mips_malta32el_nanomips(kernel_path_xz)
554