On Monday, October 28, 2019, Philippe Mathieu-Daudé <phi...@redhat.com>
wrote:

> From: Philippe Mathieu-Daudé <f4...@amsat.org>
>
> This tests boots a Linux kernel on a Malta machine up to a
> busybox shell on the serial console. Few commands are executed
> before halting the machine (via reboot).
>
>

A very nice test.

Reviewed-by: Aleksandar Markovic <amarko...@wavecomp.com>


> We use the Fedora 24 kernel extracted from the image at:
> https://fedoraproject.org/wiki/Architectures/MIPS
> and the initrd cpio image from the kerneltests project:
> https://kerneltests.org/
>
> If MIPS is a target being built, "make check-acceptance" will
> automatically include this test by the use of the "arch:mips" tags.
>
> Alternatively, this test can be run using:
>
>   $ AVOCADO_ALLOW_UNTRUSTED_CODE=yes \
>     avocado --show=console run -t arch:mips64el \
>       tests/acceptance/boot_linux_console.py
>   console: [    0.000000] Linux version 3.19.3.mtoman.20150408
> (mtoman@debian-co3-1) (gcc version 5.0.0 20150316 (Red Hat 5.0.0-0.20)
> (GCC) ) #3 Wed Apr 8 14:32:50 UTC 2015
>   console: [    0.000000] Early serial console at I/O port 0x3f8 (options
> '38400n8')
>   console: [    0.000000] bootconsole [uart0] enabled
>   console: [    0.000000] CPU0 revision is: 00018900 (MIPS 5KE)
>   console: [    0.000000] Checking for the multiply/shift bug... no.
>   console: [    0.000000] Checking for the daddiu bug... no.
>   [...]
>   console: Boot successful.
>   console: cat /proc/cpuinfo
>   console: / # cat /proc/cpuinfo
>   console: system type            : MIPS Malta
>   console: machine                        : Unknown
>   console: processor              : 0
>   console: cpu model              : MIPS 5KE V0.0
>   console: : 1616.89
>   console: wait instruction       : nouname -a
>   console: microsecond timers     : yes
>   console: tlb_entries            : 32
>   console: extra interrupt vector : yes
>   console: hardware watchpoint    : yes, count: 1, address/irw mask:
> [0x0ff8]
>   console: isa                    : mips1 mips2 mips3 mips4 mips5 mips32r1
> mips32r2 mips64r1 mips64r2
>   console: ASEs implemented       :
>   console: shadow register sets   : 1
>   console: kscratch registers     : 0
>   console: package                        : 0
>   console: core                   : 0
>   console: VCED exceptions                : not available
>   console: VCEI exceptions                : not available
>   console: / #
>   console: / # uname -a
>   console: Linux buildroot 3.19.3.mtoman.20150408 #3 Wed Apr 8 14:32:50
> UTC 2015 mips64 GNU/Linux
>   console: reboot
>   console: / #
>   console: / # reboot
>   console: / #
>   console: / # reboot: Restarting system
>   PASS (7.04 s)
>   JOB TIME   : 7.20 s
>
> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
> ---
>  tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/tests/acceptance/boot_linux_console.py
> b/tests/acceptance/boot_linux_console.py
> index 489df4862c..959d4557c9 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -168,6 +168,47 @@ class BootLinuxConsole(MachineTest):
>          exec_command_and_wait_for_pattern(self, 'reboot',
>                                                  'reboot: Restarting
> system')
>
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted
> code')
> +    def test_mips64el_malta_5KEc_cpio(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=machine:malta
> +        :avocado: tags=endian:little
> +        """
> +        kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
> +                      'raw/9ad2df38/mips/malta/mips64el/'
> +                      'vmlinux-3.19.3.mtoman.20150408')
> +        kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
> +        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
> +        initrd_url = ('https://github.com/groeck/linux-build-test/'
> +                      'raw/8584a59e/rootfs/'
> +                      'mipsel64/rootfs.mipsel64r1.cpio.gz')
> +        initrd_hash = '1dbb8a396e916847325284dbe2151167'
> +        initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
> +                                          asset_hash=initrd_hash)
> +        initrd_path = self.workdir + "rootfs.cpio"
> +        archive.gzip_uncompress(initrd_path_gz, initrd_path)
> +
> +        self.vm.set_machine('malta')
> +        self.vm.set_console()
> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
> +                               + 'console=ttyS0 console=tty '
> +                               + 'rdinit=/sbin/init noreboot')
> +        self.vm.add_args('-cpu', '5KEc',
> +                         '-kernel', kernel_path,
> +                         '-initrd', initrd_path,
> +                         '-append', kernel_command_line,
> +                         '-no-reboot')
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'Boot successful.')
> +
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
> +                                                'MIPS 5KE')
> +        exec_command_and_wait_for_pattern(self, 'uname -a',
> +                                                '3.19.3.mtoman.20150408')
> +        exec_command_and_wait_for_pattern(self, 'reboot',
> +                                                'reboot: Restarting
> system')
> +
>      def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
>          kernel_path_xz = self.fetch_asset(kernel_url,
> asset_hash=kernel_hash)
>          kernel_path = self.workdir + "kernel"
> --
> 2.21.0
>
>
>

Reply via email to