Hi Qianfan,

The tests look good to me and are working OK:

ARMBIAN_ARTIFACTS_CACHED=yes AVOCADO_ALLOW_LARGE_STORAGE=yes
./build/tests/venv/bin/avocado --show=app,console run -t machine:bpim2u
tests/avocado/boot_linux_console.py
 (1/4)
tests/avocado/boot_linux_console.py:BootLinuxConsole.test_arm_bpim2u:
/console: [    0.000000] Booting Linux on physical CPU 0x0
console: [    0.000000] Linux version 5.10.16-sunxi (root@beast)
(arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture
8.3-2019.03 (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile
Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #21.02.2 SMP Sun
Feb 14 21:12:17 CET 2021
console: [    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7),
cr=50c5387d
...
PASS (15.77 s)
RESULTS    : PASS 4 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 |
CANCEL 0
JOB TIME   : 62.90 s

So for me:

Tested-by: Niek Linnenbank <nieklinnenb...@gmail.com>


On Tue, Mar 28, 2023 at 7:49 AM <qianfangui...@163.com> wrote:

> From: qianfan Zhao <qianfangui...@163.com>
>
> Add test case for booting from initrd and sd card.
>
> Signed-off-by: qianfan Zhao <qianfangui...@163.com>
> ---
>  tests/avocado/boot_linux_console.py | 176 ++++++++++++++++++++++++++++
>  1 file changed, 176 insertions(+)
>
> diff --git a/tests/avocado/boot_linux_console.py
> b/tests/avocado/boot_linux_console.py
> index 574609bf43..d17417828c 100644
> --- a/tests/avocado/boot_linux_console.py
> +++ b/tests/avocado/boot_linux_console.py
> @@ -760,6 +760,182 @@ def test_arm_quanta_gsj_initrd(self):
>          self.wait_for_console_pattern(
>                  'Give root password for system maintenance')
>
> +    def test_arm_bpim2u(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:bpim2u
> +        :avocado: tags=accel:tcg
> +        """
> +        deb_url = ('
> https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
> +                   'linux-image-current-sunxi_21.02.2_armhf.deb')
> +        deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        kernel_path = self.extract_from_deb(deb_path,
> +                                            '/boot/vmlinuz-5.10.16-sunxi')
> +        dtb_path = ('/usr/lib/linux-image-current-sunxi/'
> +                    'sun8i-r40-bananapi-m2-ultra.dtb')
> +        dtb_path = self.extract_from_deb(deb_path, dtb_path)
> +
> +        self.vm.set_console()
> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> +                               'console=ttyS0,115200n8 '
> +                               'earlycon=uart,mmio32,0x1c28000')
> +        self.vm.add_args('-kernel', kernel_path,
> +                         '-dtb', dtb_path,
> +                         '-append', kernel_command_line)
> +        self.vm.launch()
> +        console_pattern = 'Kernel command line: %s' % kernel_command_line
> +        self.wait_for_console_pattern(console_pattern)
> +
> +    def test_arm_bpim2u_initrd(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=accel:tcg
> +        :avocado: tags=machine:bpim2u
> +        """
> +        deb_url = ('
> https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
> +                   'linux-image-current-sunxi_21.02.2_armhf.deb')
> +        deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        kernel_path = self.extract_from_deb(deb_path,
> +                                            '/boot/vmlinuz-5.10.16-sunxi')
> +        dtb_path = ('/usr/lib/linux-image-current-sunxi/'
> +                    'sun8i-r40-bananapi-m2-ultra.dtb')
> +        dtb_path = self.extract_from_deb(deb_path, dtb_path)
> +        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
> +                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
> +                      'arm/rootfs-armv7a.cpio.gz')
> +        initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
> +        initrd_path_gz = self.fetch_asset(initrd_url,
> asset_hash=initrd_hash)
> +        initrd_path = os.path.join(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 '
> +                               'panic=-1 noreboot')
> +        self.vm.add_args('-kernel', kernel_path,
> +                         '-dtb', dtb_path,
> +                         '-initrd', initrd_path,
> +                         '-append', kernel_command_line,
> +                         '-no-reboot')
> +        self.vm.launch()
> +        self.wait_for_console_pattern('Boot successful.')
> +
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
> +                                                'Allwinner sun8i Family')
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
> +                                                'system-control@1c00000')
> +        exec_command_and_wait_for_pattern(self, 'reboot',
> +                                                'reboot: Restarting
> system')
> +        # Wait for VM to shut down gracefully
> +        self.vm.wait()
> +
> +    def test_arm_bpim2u_gmac(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=accel:tcg
> +        :avocado: tags=machine:bpim2u
> +        :avocado: tags=device:sd
> +        """
> +        self.require_netdev('user')
> +
> +        deb_url = ('
> https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
> +                   'linux-image-current-sunxi_21.02.2_armhf.deb')
> +        deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        kernel_path = self.extract_from_deb(deb_path,
> +                                            '/boot/vmlinuz-5.10.16-sunxi')
> +        dtb_path = ('/usr/lib/linux-image-current-sunxi/'
> +                    'sun8i-r40-bananapi-m2-ultra.dtb')
> +        dtb_path = self.extract_from_deb(deb_path, dtb_path)
> +        rootfs_url = ('
> http://storage.kernelci.org/images/rootfs/buildroot/'
> +
> 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz')
> +        rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a'
> +        rootfs_path_xz = self.fetch_asset(rootfs_url,
> asset_hash=rootfs_hash)
> +        rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
> +        archive.lzma_uncompress(rootfs_path_xz, rootfs_path)
> +        image_pow2ceil_expand(rootfs_path)
> +
> +        self.vm.set_console()
> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> +                               'console=ttyS0,115200 '
> +                               'root=/dev/mmcblk0 rootwait rw '
> +                               'panic=-1 noreboot')
> +        self.vm.add_args('-kernel', kernel_path,
> +                         '-dtb', dtb_path,
> +                         '-drive', 'file=' + rootfs_path +
> ',if=sd,format=raw',
> +                         '-net', 'nic,model=gmac,netdev=host_gmac',
> +                         '-netdev', 'user,id=host_gmac',
> +                         '-append', kernel_command_line,
> +                         '-no-reboot')
> +        self.vm.launch()
> +        shell_ready = "/bin/sh: can't access tty; job control turned off"
> +        self.wait_for_console_pattern(shell_ready)
> +
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
> +                                                'Allwinner sun8i Family')
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
> +                                                'mmcblk0')
> +        exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
> +                                                 'eth0: Link is Up')
> +        exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
> +            'udhcpc: lease of 10.0.2.15 obtained')
> +        exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
> +            '3 packets transmitted, 3 packets received, 0% packet loss')
> +        exec_command_and_wait_for_pattern(self, 'reboot',
> +                                                'reboot: Restarting
> system')
> +        # Wait for VM to shut down gracefully
> +        self.vm.wait()
> +
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage
> limited')
> +    def test_arm_bpim2u_openwrt_22_03_3(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:bpim2u
> +        :avocado: tags=device:sd
> +        """
> +
> +        # This test download a 8.9 MiB compressed image and expand it
> +        # to 127 MiB.
> +        image_url = ('
> https://downloads.openwrt.org/releases/22.03.3/targets/'
> +                     'sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-'
> +                     'sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz')
> +        image_hash = ('5b41b4e11423e562c6011640f9a7cd3b'
> +                      'dd0a3d42b83430f7caa70a432e6cd82c')
> +        image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash,
> +                                         algorithm='sha256')
> +        image_path = archive.extract(image_path_gz, self.workdir)
> +        image_pow2ceil_expand(image_path)
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-drive', 'file=' + image_path +
> ',if=sd,format=raw',
> +                         '-nic', 'user',
> +                         '-no-reboot')
> +        self.vm.launch()
> +
> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> +                               'usbcore.nousb '
> +                               'noreboot')
> +
> +        self.wait_for_console_pattern('U-Boot SPL')
> +
> +        interrupt_interactive_console_until_pattern(
> +                self, 'Hit any key to stop autoboot:', '=>')
> +        exec_command_and_wait_for_pattern(self, "setenv extraargs '" +
> +                                                kernel_command_line +
> "'", '=>')
> +        exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel
> ...');
> +
> +        self.wait_for_console_pattern(
> +            'Please press Enter to activate this console.')
> +
> +        exec_command_and_wait_for_pattern(self, ' ', 'root@')
> +
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
> +                                                'Allwinner sun8i Family')
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
> +                                                'system-control@1c00000')
> +
>      def test_arm_orangepi(self):
>          """
>          :avocado: tags=arch:arm
> --
> 2.25.1
>
>

-- 
Niek Linnenbank

Reply via email to