diff mbox series

[4/4] tests/avocado: Add boot_linux_console test for loongson3-virt

Message ID 20230521102307.87081-5-jiaxun.yang@flygoat.com (mailing list archive)
State New, archived
Headers show
Series hw/mips/loongson3_virt: Wire up loongarch_ipi device | expand

Commit Message

Jiaxun Yang May 21, 2023, 10:23 a.m. UTC
Test loongson3-virt machine againt debian kernel and cpio rootfs.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 tests/avocado/boot_linux_console.py | 46 +++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
diff mbox series

Patch

diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
index c0675809e641..fdb479448e47 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -191,6 +191,52 @@  def test_mips64el_fuloong2e(self):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_mips64el_loongson3_virt_cpio(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=endian:little
+        :avocado: tags=machine:loongson3-virt
+        :avocado: tags=cpu:Loongson-3A1000
+        :avocado: tags=device:liointc
+        :avocado: tags=device:loongarch_ipi
+        :avocado: tags=device:goldfish_rtc
+        """
+        deb_url = ('http://snapshot.debian.org/archive/debian/'
+                   '20230501T024743Z/pool/main/l/linux/'
+                   'linux-image-5.10.0-22-loongson-3_5.10.178-3_mips64el.deb')
+        deb_hash = 'af4fcc721b727df0bef31057325e4cc02725ae0c'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        kernel_path = self.extract_from_deb(deb_path,
+                                        '/boot/vmlinuz-5.10.0-22-loongson-3')
+        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_console()
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
+                               + 'console=ttyS0,115200 '
+                               + 'rdinit=/sbin/init noreboot')
+        self.vm.add_args('-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',
+                                                'ICT Loongson-3')
+        exec_command_and_wait_for_pattern(self, 'uname -a',
+                                                '5.10.0-22-loongson-3')
+        exec_command_and_wait_for_pattern(self, 'reboot',
+                                                'reboot: Restarting system')
+        # Wait for VM to shut down gracefully
+        self.vm.wait()
+
     def test_mips_malta_cpio(self):
         """
         :avocado: tags=arch:mips