Пример #1
0
 def test_ppc_bamboo(self):
     """
     :avocado: tags=arch:ppc
     :avocado: tags=machine:bamboo
     :avocado: tags=cpu:440epb
     :avocado: tags=device:rtl8139
     :avocado: tags=accel:tcg
     """
     self.require_accelerator("tcg")
     tar_url = ('http://landley.net/aboriginal/downloads/binaries/'
                'system-image-powerpc-440fp.tar.gz')
     tar_hash = '53e5f16414b195b82d2c70272f81c2eedb39bad9'
     file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
     archive.extract(file_path, self.workdir)
     self.vm.set_console()
     self.vm.add_args(
         '-kernel', self.workdir + '/system-image-powerpc-440fp/linux',
         '-initrd',
         self.workdir + '/system-image-powerpc-440fp/rootfs.cpio.gz',
         '-nic', 'user,model=rtl8139,restrict=on')
     self.vm.launch()
     wait_for_console_pattern(self, 'Type exit when done')
     exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2',
                                       '10.0.2.2 is alive!')
     exec_command_and_wait_for_pattern(self, 'halt', 'System Halted')
Пример #2
0
    def test_factory_firmware_and_netbsd(self):
        """
        :avocado: tags=arch:ppc
        :avocado: tags=machine:40p
        :avocado: tags=os:netbsd
        :avocado: tags=slowness:high
        :avocado: tags=accel:tcg
        """
        self.require_accelerator("tcg")
        bios_url = ('http://ftpmirror.your.org/pub/misc/'
                    'ftp.software.ibm.com/rs6000/firmware/'
                    '7020-40p/P12H0456.IMG')
        bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03'
        bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash)
        drive_url = ('https://archive.netbsd.org/pub/NetBSD-archive/'
                     'NetBSD-4.0/prep/installation/floppy/generic_com0.fs')
        drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb'
        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash)

        self.vm.set_console()
        self.vm.add_args('-bios', bios_path, '-fda', drive_path)
        self.vm.launch()
        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'
        wait_for_console_pattern(self, os_banner)
        wait_for_console_pattern(self, 'Model: IBM PPS Model 6015')
Пример #3
0
    def test_framebuffer_tux_logo(self):
        """
        Boot Linux and verify the Tux logo is displayed on the framebuffer.
        :avocado: tags=arch:arm
        :avocado: tags=machine:integratorcp
        :avocado: tags=device:pl110
        :avocado: tags=device:framebuffer
        """
        screendump_path = os.path.join(self.workdir, "screendump.pbm")
        tuxlogo_url = ('https://github.com/torvalds/linux/raw/v2.6.12/'
                       'drivers/video/logo/logo_linux_vga16.ppm')
        tuxlogo_hash = '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af'
        tuxlogo_path = self.fetch_asset(tuxlogo_url, asset_hash=tuxlogo_hash)

        self.boot_integratorcp()
        framebuffer_ready = 'Console: switching to colour frame buffer device'
        wait_for_console_pattern(self, framebuffer_ready)
        self.vm.command('human-monitor-command', command_line='stop')
        self.vm.command('human-monitor-command',
                        command_line='screendump %s' % screendump_path)
        logger = logging.getLogger('framebuffer')

        cpu_count = 1
        match_threshold = 0.92
        screendump_bgr = cv2.imread(screendump_path)
        screendump_gray = cv2.cvtColor(screendump_bgr, cv2.COLOR_BGR2GRAY)
        result = cv2.matchTemplate(screendump_gray,
                                   cv2.imread(tuxlogo_path,
                                              0), cv2.TM_CCOEFF_NORMED)
        loc = np.where(result >= match_threshold)
        tux_count = 0
        for tux_count, pt in enumerate(zip(*loc[::-1]), start=1):
            logger.debug('found Tux at position [x, y] = %s', pt)
        self.assertGreaterEqual(tux_count, cpu_count)
Пример #4
0
 def wait_for_console_pattern(self, success_message, vm=None):
     wait_for_console_pattern(
         self,
         success_message,
         failure_message="Kernel panic - not syncing",
         vm=vm,
     )
Пример #5
0
 def test_ppc_7455(self):
     """
     :avocado: tags=cpu:7455
     """
     self.vm.set_console()
     self.vm.launch()
     wait_for_console_pattern(self, '>> OpenBIOS')
     wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
Пример #6
0
 def test_ppc_7451(self):
     """
     :avocado: tags=cpu:7451
     """
     self.require_accelerator("tcg")
     self.vm.set_console()
     self.vm.launch()
     wait_for_console_pattern(self, '>> OpenBIOS')
     wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
Пример #7
0
 def test_integratorcp_console(self):
     """
     Boots the Linux kernel and checks that the console is operational
     :avocado: tags=arch:arm
     :avocado: tags=machine:integratorcp
     :avocado: tags=device:pl011
     """
     self.boot_integratorcp()
     wait_for_console_pattern(self, 'Log in as root')
Пример #8
0
 def do_test_ppc405(self):
     uboot_url = ('https://gitlab.com/huth/u-boot/-/raw/'
                  'taihu-2021-10-09/u-boot-taihu.bin')
     uboot_hash = ('3208940e908a5edc7c03eab072c60f0dcfadc2ab');
     file_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash)
     self.vm.set_console(console_index=1)
     self.vm.add_args('-bios', file_path)
     self.vm.launch()
     wait_for_console_pattern(self, 'AMCC PPC405EP Evaluation Board')
     exec_command_and_wait_for_pattern(self, 'reset', 'AMCC PowerPC 405EP')
Пример #9
0
    def __do_test_n8x0(self):
        kernel_url = ('http://stskeeps.subnetmask.net/meego-n8x0/'
                      'meego-arm-n8x0-1.0.80.20100712.1431-'
                      'vmlinuz-2.6.35~rc4-129.1-n8x0')
        kernel_hash = 'e9d5ab8d7548923a0061b6fbf601465e479ed269'
        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)

        self.vm.set_console(console_index=1)
        self.vm.add_args('-kernel', kernel_path, '-append',
                         'printk.time=0 console=ttyS1')
        self.vm.launch()
        wait_for_console_pattern(self, 'TSC2005 driver initializing')
Пример #10
0
    def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
        """
        Boot Linux kernel and check Tux logo is displayed on the framebuffer.
        """
        screendump_path = os.path.join(self.workdir, 'screendump.pbm')

        kernel_url = ('https://github.com/philmd/qemu-testing-blob/raw/'
                      'a5966ca4b5/mips/malta/mips64el/'
                      'vmlinux-4.7.0-rc1.I6400.gz')
        kernel_hash = '096f50c377ec5072e6a366943324622c312045f6'
        kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
        kernel_path = self.workdir + "vmlinux"
        archive.gzip_uncompress(kernel_path_gz, kernel_path)

        tuxlogo_url = ('https://github.com/torvalds/linux/raw/v2.6.12/'
                       'drivers/video/logo/logo_linux_vga16.ppm')
        tuxlogo_hash = '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af'
        tuxlogo_path = self.fetch_asset(tuxlogo_url, asset_hash=tuxlogo_hash)

        self.vm.set_console()
        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                               'clocksource=GIC console=tty0 console=ttyS0')
        self.vm.add_args('-kernel', kernel_path, '-cpu', 'I6400', '-smp',
                         '%u' % cpu_cores_count, '-vga', 'std', '-append',
                         kernel_command_line)
        self.vm.launch()
        framebuffer_ready = 'Console: switching to colour frame buffer device'
        wait_for_console_pattern(self,
                                 framebuffer_ready,
                                 failure_message='Kernel panic - not syncing')
        self.vm.command('human-monitor-command', command_line='stop')
        self.vm.command('human-monitor-command',
                        command_line='screendump %s' % screendump_path)
        logger = logging.getLogger('framebuffer')

        match_threshold = 0.95
        screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
        tuxlogo_bgr = cv2.imread(tuxlogo_path, cv2.IMREAD_COLOR)
        result = cv2.matchTemplate(screendump_bgr, tuxlogo_bgr,
                                   cv2.TM_CCOEFF_NORMED)
        loc = np.where(result >= match_threshold)
        tuxlogo_count = 0
        h, w = tuxlogo_bgr.shape[:2]
        debug_png = os.getenv('AVOCADO_CV2_SCREENDUMP_PNG_PATH')
        for tuxlogo_count, pt in enumerate(zip(*loc[::-1]), start=1):
            logger.debug('found Tux at position (x, y) = %s', pt)
            cv2.rectangle(screendump_bgr, pt, (pt[0] + w, pt[1] + h),
                          (0, 0, 255), 2)
        if debug_png:
            cv2.imwrite(debug_png, screendump_bgr)
        self.assertGreaterEqual(tuxlogo_count, cpu_cores_count)
Пример #11
0
    def do_test_arm_aspeed(self, image):
        self.vm.set_console()
        self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
                         '-net', 'nic')
        self.vm.launch()

        self.wait_for_console_pattern("U-Boot 2016.07")
        self.wait_for_console_pattern("## Loading kernel from FIT Image at 20080000")
        self.wait_for_console_pattern("Starting kernel ...")
        self.wait_for_console_pattern("Booting Linux on physical CPU 0x0")
        wait_for_console_pattern(self,
                "aspeed-smc 1e620000.spi: read control register: 203b0641")
        self.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ")
        self.wait_for_console_pattern("systemd[1]: Set hostname to")
Пример #12
0
 def test_ppc_mpc8544ds(self):
     """
     :avocado: tags=arch:ppc
     :avocado: tags=machine:mpc8544ds
     """
     tar_url = ('https://www.qemu-advent-calendar.org'
                '/2020/download/day17.tar.gz')
     tar_hash = '7a5239542a7c4257aa4d3b7f6ddf08fb6775c494'
     file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
     archive.extract(file_path, self.workdir)
     self.vm.set_console()
     self.vm.add_args('-kernel', self.workdir + '/creek/creek.bin')
     self.vm.launch()
     wait_for_console_pattern(self, 'QEMU advent calendar 2020',
                              self.panic_message)
Пример #13
0
 def test_sparc64_sun4u(self):
     """
     :avocado: tags=arch:sparc64
     :avocado: tags=machine:sun4u
     """
     tar_url = ('https://www.qemu-advent-calendar.org'
                '/2018/download/day23.tar.xz')
     tar_hash = '142db83cd974ffadc4f75c8a5cad5bcc5722c240'
     file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
     archive.extract(file_path, self.workdir)
     self.vm.set_console()
     self.vm.add_args('-kernel', self.workdir + '/day23/vmlinux',
                      '-append', self.KERNEL_COMMON_COMMAND_LINE)
     self.vm.launch()
     wait_for_console_pattern(self, 'Starting logging: OK')
Пример #14
0
    def test_openbios_and_netbsd(self):
        """
        :avocado: tags=arch:ppc
        :avocado: tags=machine:40p
        """
        drive_url = ('https://ftp.netbsd.org/pub/NetBSD/iso/7.1.2/'
                     'NetBSD-7.1.2-prep.iso')
        drive_hash = 'ac6fa2707d888b36d6fa64de6e7fe48e'
        drive_path = self.fetch_asset(drive_url,
                                      asset_hash=drive_hash,
                                      algorithm='md5')
        self.vm.set_console()
        self.vm.add_args('-cdrom', drive_path, '-boot', 'd')

        self.vm.launch()
        wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9')
Пример #15
0
 def test_arm_canona1100(self):
     """
     :avocado: tags=arch:arm
     :avocado: tags=machine:canon-a1100
     :avocado: tags=device:pflash_cfi02
     """
     tar_url = ('https://www.qemu-advent-calendar.org'
                '/2018/download/day18.tar.xz')
     tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6'
     file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
     archive.extract(file_path, self.workdir)
     self.vm.set_console()
     self.vm.add_args('-bios',
                      self.workdir + '/day18/barebox.canon-a1100.bin')
     self.vm.launch()
     wait_for_console_pattern(self, 'running /env/bin/init')
Пример #16
0
 def test_ast1030_zephyros(self):
     """
     :avocado: tags=arch:arm
     :avocado: tags=machine:ast1030-evb
     """
     tar_url = ('https://github.com/AspeedTech-BMC'
                '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip')
     tar_hash = '4c6a8ce3a8ba76ef1a65dae419ae3409343c4b20'
     tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
     archive.extract(tar_path, self.workdir)
     kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.elf"
     self.vm.set_console()
     self.vm.add_args('-kernel', kernel_file, '-nographic')
     self.vm.launch()
     wait_for_console_pattern(self, "Booting Zephyr OS")
     exec_command_and_wait_for_pattern(self, "help", "Available commands")
Пример #17
0
    def test_microblaze_s3adsp1800(self):
        """
        :avocado: tags=arch:microblaze
        :avocado: tags=machine:petalogix-s3adsp1800
        """

        tar_url = ('https://www.qemu-advent-calendar.org'
                   '/2018/download/day17.tar.xz')
        tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f'
        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
        archive.extract(file_path, self.workdir)
        self.vm.set_console()
        self.vm.add_args('-kernel', self.workdir + '/day17/ballerina.bin')
        self.vm.launch()
        wait_for_console_pattern(
            self, 'This architecture does not have '
            'kernel memory protection')
Пример #18
0
 def test_ppc_virtex_ml507(self):
     """
     :avocado: tags=arch:ppc
     :avocado: tags=machine:virtex-ml507
     """
     tar_url = ('https://www.qemu-advent-calendar.org'
                '/2020/download/hippo.tar.gz')
     tar_hash = '306b95bfe7d147f125aa176a877e266db8ef914a'
     file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
     archive.extract(file_path, self.workdir)
     self.vm.set_console()
     self.vm.add_args('-kernel', self.workdir + '/hippo/hippo.linux',
                      '-dtb', self.workdir + '/hippo/virtex440-ml507.dtb',
                      '-m', '512')
     self.vm.launch()
     wait_for_console_pattern(self, 'QEMU advent calendar 2020',
                              self.panic_message)
Пример #19
0
    def do_test(self, kernel_url, initrd_url, kernel_command_line,
                machine_type):
        """Main test method"""
        self.require_accelerator('kvm')

        # Create socketpair to connect proxy and remote processes
        proxy_sock, remote_sock = socket.socketpair(socket.AF_UNIX,
                                                    socket.SOCK_STREAM)
        os.set_inheritable(proxy_sock.fileno(), True)
        os.set_inheritable(remote_sock.fileno(), True)

        kernel_path = self.fetch_asset(kernel_url)
        initrd_path = self.fetch_asset(initrd_url)

        # Create remote process
        remote_vm = self.get_vm()
        remote_vm.add_args('-machine', 'x-remote')
        remote_vm.add_args('-nodefaults')
        remote_vm.add_args('-device', 'lsi53c895a,id=lsi1')
        remote_vm.add_args(
            '-object', 'x-remote-object,id=robj1,'
            'devid=lsi1,fd=' + str(remote_sock.fileno()))
        remote_vm.launch()

        # Create proxy process
        self.vm.set_console()
        self.vm.add_args('-machine', machine_type)
        self.vm.add_args('-accel', 'kvm')
        self.vm.add_args('-cpu', 'host')
        self.vm.add_args('-object',
                         'memory-backend-memfd,id=sysmem-file,size=2G')
        self.vm.add_args('--numa', 'node,memdev=sysmem-file')
        self.vm.add_args('-m', '2048')
        self.vm.add_args('-kernel', kernel_path, '-initrd', initrd_path,
                         '-append', kernel_command_line)
        self.vm.add_args(
            '-device', 'x-pci-proxy-dev,'
            'id=lsi1,fd=' + str(proxy_sock.fileno()))
        self.vm.launch()
        wait_for_console_pattern(self, 'as init process',
                                 'Kernel panic - not syncing')
        exec_command(self, 'mount -t sysfs sysfs /sys')
        exec_command_and_wait_for_pattern(self,
                                          'cat /sys/bus/pci/devices/*/uevent',
                                          'PCI_ID=1000:0012')
Пример #20
0
    def test_ppc64_pseries(self):
        """
        :avocado: tags=arch:ppc64
        :avocado: tags=machine:pseries
        """
        kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                      '/fedora-secondary/releases/29/Everything/ppc64le/os'
                      '/ppc/ppc64/vmlinuz')
        kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)

        self.vm.set_console()
        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
        self.vm.add_args('-kernel', kernel_path, '-append',
                         kernel_command_line)
        self.vm.launch()
        console_pattern = 'Kernel command line: %s' % kernel_command_line
        wait_for_console_pattern(self, console_pattern, self.panic_message)
Пример #21
0
    def test_leon3_helenos_uimage(self):
        """
        :avocado: tags=arch:sparc
        :avocado: tags=machine:leon3_generic
        :avocado: tags=binfmt:uimage
        """
        kernel_url = ('http://www.helenos.org/releases/'
                      'HelenOS-0.6.0-sparc32-leon3.bin')
        kernel_hash = 'a88c9cfdb8430c66650e5290a08765f9bf049a30'
        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)

        self.vm.set_console()
        self.vm.add_args('-kernel', kernel_path)

        self.vm.launch()

        wait_for_console_pattern(self,
                                 'Copyright (c) 2001-2014 HelenOS project')
        wait_for_console_pattern(self, 'Booting the kernel ...')
Пример #22
0
    def test_uboot(self):
        """
        U-Boot and checks that the console is operational.

        :avocado: tags=arch:rx
        :avocado: tags=machine:gdbsim-r5f562n8
        :avocado: tags=endian:little
        """
        uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz')
        uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb'
        uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash)
        uboot_path = archive.uncompress(uboot_path, self.workdir)

        self.vm.set_console()
        self.vm.add_args('-bios', uboot_path, '-no-reboot')
        self.vm.launch()
        uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty'
        wait_for_console_pattern(self, uboot_version)
        gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'
Пример #23
0
    def launch_xen(self, xen_path):
        """
        Launch Xen with a dom0 guest kernel
        """
        self.log.info("launch with xen_path: %s", xen_path)
        kernel_path = self.fetch_guest_kernel()

        self.vm.set_console()

        xen_command_line = self.XEN_COMMON_COMMAND_LINE
        self.vm.add_args(
            '-machine', 'virtualization=on', '-m', '768', '-kernel', xen_path,
            '-append', xen_command_line, '-device',
            'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0' %
            (kernel_path))

        self.vm.launch()

        console_pattern = 'VFS: Cannot open root device'
        wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:")
Пример #24
0
    def boot_debian_wheezy_image_and_ssh_login(self, endianess, kernel_path):
        image_url, image_hash = self.get_image_info(endianess)
        image_path = self.fetch_asset(image_url, asset_hash=image_hash)

        self.vm.set_console()
        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                               'console=ttyS0 root=/dev/sda1')
        self.vm.add_args('-no-reboot', '-kernel', kernel_path, '-append',
                         kernel_command_line, '-drive',
                         'file=%s,snapshot=on' % image_path, '-netdev',
                         'user,id=vnet,hostfwd=:127.0.0.1:0-:22', '-device',
                         'pcnet,netdev=vnet')
        self.vm.launch()

        self.log.info('VM launched, waiting for sshd')
        console_pattern = 'Starting OpenBSD Secure Shell server: sshd'
        wait_for_console_pattern(self, console_pattern, 'Oops')
        self.log.info('sshd ready')

        self.ssh_connect('root', 'root', False)
Пример #25
0
    def test_pmon_serial_console(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:goldfish_rtc
        """

        pmon_hash = '7c8b45dd81ccfc55ff28f5aa267a41c3'
        pmon_path = self.fetch_asset(
            'https://github.com/loongson-community/pmon/'
            'releases/download/20210112/pmon-3avirt.bin',
            asset_hash=pmon_hash,
            algorithm='md5')

        self.vm.set_console()
        self.vm.add_args('-bios', pmon_path)
        self.vm.launch()
        wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:')
Пример #26
0
    def test_linux_kernel_isa_serial(self):
        """
        :avocado: tags=arch:mips64el
        :avocado: tags=machine:fuloong2e
        :avocado: tags=endian:little
        :avocado: tags=device:bonito64
        :avocado: tags=device:via686b
        """
        # Recovery system for the Yeeloong laptop
        # (enough to test the fuloong2e southbridge, accessing its ISA bus)
        # http://dev.lemote.com/files/resource/download/rescue/rescue-yl
        kernel_hash = 'ec4d1bd89a8439c41033ca63db60160cc6d6f09a'
        kernel_path = self.fetch_asset('file://' + os.getenv('RESCUE_YL_PATH'),
                                       asset_hash=kernel_hash)

        self.vm.set_console()
        self.vm.add_args('-kernel', kernel_path)
        self.vm.launch()
        wait_for_console_pattern(self, 'Linux version 2.6.27.7lemote')
        cpu_revision = 'CPU revision is: 00006302 (ICT Loongson-2)'
        wait_for_console_pattern(self, cpu_revision)
Пример #27
0
    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_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')
        # Wait for VM to shut down gracefully
        self.vm.wait()
Пример #28
0
    def test_linux_sash(self):
        """
        Boots a Linux kernel and checks that the console is operational.

        :avocado: tags=arch:rx
        :avocado: tags=machine:gdbsim-r5f562n7
        :avocado: tags=endian:little
        """
        dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-virt.dtb')
        dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18'
        dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash)
        kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage')
        kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99'
        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)

        self.vm.set_console()
        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon'
        self.vm.add_args('-kernel', kernel_path, '-dtb', dtb_path,
                         '-no-reboot')
        self.vm.launch()
        wait_for_console_pattern(self,
                                 'Sash command shell (version 1.1.1)',
                                 failure_message='Kernel panic - not syncing')
        exec_command_and_wait_for_pattern(self, 'printenv', 'TERM=linux')
Пример #29
0
    def test_openbios_192m(self):
        """
        :avocado: tags=arch:ppc
        :avocado: tags=machine:40p
        """
        self.vm.set_console()
        self.vm.add_args('-m', '192')  # test fw_cfg

        self.vm.launch()
        wait_for_console_pattern(self, '>> OpenBIOS')
        wait_for_console_pattern(self, '>> Memory: 192M')
        wait_for_console_pattern(self, '>> CPU type PowerPC,604')
Пример #30
0
    def test_arm_orangepi_uboot_netbsd9(self):
        """
        :avocado: tags=arch:arm
        :avocado: tags=machine:orangepi-pc
        """
        # This test download a 304MB compressed image and expand it to 1.3GB...
        deb_url = ('http://snapshot.debian.org/archive/debian/'
                   '20200108T145233Z/pool/main/u/u-boot/'
                   'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb')
        deb_hash = 'f67f404a80753ca3d1258f13e38f2b060e13db99'
        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
        # We use the common OrangePi PC 'plus' build of U-Boot for our secondary
        # program loader (SPL). We will then set the path to the more specific
        # OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt,
        # before to boot NetBSD.
        uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin'
        uboot_path = self.extract_from_deb(deb_path, uboot_path)
        image_url = ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/'
                     'evbarm-earmv7hf/binary/gzimg/armv7.img.gz')
        image_hash = '2babb29d36d8360adcb39c09e31060945259917a'
        image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
        image_path = os.path.join(self.workdir, 'armv7.img')
        image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path
        archive.gzip_uncompress(image_path_gz, image_path)

        # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc
        with open(uboot_path, 'rb') as f_in:
            with open(image_path, 'r+b') as f_out:
                f_out.seek(8 * 1024)
                shutil.copyfileobj(f_in, f_out)

                # Extend image, to avoid that NetBSD thinks the partition
                # inside the image is larger than device size itself
                f_out.seek(0, 2)
                f_out.seek(64 * 1024 * 1024, 1)
                f_out.write(bytearray([0x00]))

        self.vm.set_console()
        self.vm.add_args('-nic', 'user', '-drive', image_drive_args, '-global',
                         'allwinner-rtc.base-year=2000', '-no-reboot')
        self.vm.launch()
        wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1')
        interrupt_interactive_console_until_pattern(
            self, 'Hit any key to stop autoboot:',
            'switch to partitions #0, OK')

        exec_command_and_wait_for_pattern(self, '', '=>')
        cmd = 'setenv bootargs root=ld0a'
        exec_command_and_wait_for_pattern(self, cmd, '=>')
        cmd = 'setenv kernel netbsd-GENERIC.ub'
        exec_command_and_wait_for_pattern(self, cmd, '=>')
        cmd = 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb'
        exec_command_and_wait_for_pattern(self, cmd, '=>')
        cmd = ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; "
               "fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; "
               "fdt addr ${fdt_addr_r}; "
               "bootm ${kernel_addr_r} - ${fdt_addr_r}'")
        exec_command_and_wait_for_pattern(self, cmd, '=>')

        exec_command_and_wait_for_pattern(self, 'boot',
                                          'Booting kernel from Legacy Image')
        wait_for_console_pattern(self, 'Starting kernel ...')
        wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)')
        # Wait for user-space
        wait_for_console_pattern(self, 'Starting root file system check')