예제 #1
0
def test_qspi_boot_images(u_boot_console):
    qspi_pre_commands(u_boot_console)
    if not qspi_detected:
        pytest.skip('QSPI not detected')

    if not test_net.net_set_up:
        pytest.skip('Network not initialized')

    test_net.test_net_dhcp(u_boot_console)
    test_net.test_net_setup_static(u_boot_console)
    test_net.test_net_tftpboot(u_boot_console)

    f = u_boot_console.config.env.get('env__net_tftp_readable_file', None)
    if not f:
        pytest.skip('No TFTP readable file to read')

    addr = f.get('addr', None)
    if not addr:
        addr = u_boot_utils.find_ram_base(u_boot_console)

    map = 0x0
    temp = 0x50000
    expected_write = "OK"
    output = u_boot_console.run_command('imxtract %x boot@1 %x' % (addr, temp))
    assert expected_write in output

    expected_erase = "Erased: OK"
    output = u_boot_console.run_command('sf erase %x +$filesize ' % map)
    assert expected_erase in output

    expected_write = "Written: OK"
    output = u_boot_console.run_command('sf write %x %x $filesize' %
                                        (temp, map))
    assert expected_write in output

    map = u_boot_console.config.buildconfig.get('config_sys_spi_u_boot_offs',
                                                "0x1000")
    map = int(map, 16)
    expected_write = "OK"
    output = u_boot_console.run_command('imxtract %x boot@2 %x' % (addr, temp))
    assert expected_write in output

    expected_erase = "Erased: OK"
    output = u_boot_console.run_command('sf erase %x +$filesize ' % map)
    assert expected_erase in output

    expected_write = "Written: OK"
    output = u_boot_console.run_command('sf write %x %x $filesize' %
                                        (temp, map))
    assert expected_write in output
예제 #2
0
def test_qspi_boot_images(u_boot_console):
    qspi_pre_commands(u_boot_console)
    if not qspi_detected:
        pytest.skip('QSPI not detected')

    if not test_net.net_set_up:
        pytest.skip('Network not initialized')

    test_net.test_net_dhcp(u_boot_console)
    test_net.test_net_setup_static(u_boot_console)
    test_net.test_net_tftpboot(u_boot_console)

    f = u_boot_console.config.env.get('env__net_tftp_readable_file', None)
    if not f:
        pytest.skip('No TFTP readable file to read')

    addr = f.get('addr', None)
    if not addr:
      addr = u_boot_utils.find_ram_base(u_boot_console)

    map = 0x0
    temp = 0x50000
    expected_write = "OK"
    output = u_boot_console.run_command('imxtract %x boot@1 %x' % (addr, temp))
    assert expected_write in output

    expected_erase = "Erased: OK"
    output = u_boot_console.run_command('sf erase %x +$filesize ' % map)
    assert expected_erase in output

    expected_write = "Written: OK"
    output = u_boot_console.run_command('sf write %x %x $filesize' % (temp, map))
    assert expected_write in output

    map = u_boot_console.config.buildconfig.get('config_sys_spi_u_boot_offs', "0x1000")
    map = int(map, 16)
    expected_write = "OK"
    output = u_boot_console.run_command('imxtract %x boot@2 %x' % (addr, temp))
    assert expected_write in output

    expected_erase = "Erased: OK"
    output = u_boot_console.run_command('sf erase %x +$filesize ' % map)
    assert expected_erase in output

    expected_write = "Written: OK"
    output = u_boot_console.run_command('sf write %x %x $filesize' % (temp, map))
    assert expected_write in output
예제 #3
0
def test_net_tftpboot_boot_config2(u_boot_console):
    if not test_net.net_set_up:
        pytest.skip('Network not initialized')

    test_net.test_net_dhcp(u_boot_console)
    test_net.test_net_setup_static(u_boot_console)
    test_net.test_net_tftpboot(u_boot_console)

    f = u_boot_console.config.env.get('env__net_tftp_readable_file', None)
    if not f:
        pytest.skip('No TFTP readable file to read')

    addr = f.get('addr', None)
    if not addr:
        addr = u_boot_utils.find_ram_base(u_boot_console)

    response = u_boot_console.run_command('imi %x' % addr)
    if not "config@2" in response:
        pytest.skip("Second configuration not found")

    timeout = 50000
    with u_boot_console.temporary_timeout(timeout):
        try:
            # wait_for_prompt=False makes the core code not wait for the U-Boot
            # prompt code to be seen, since it won't be on a successful kernel
            # boot
            u_boot_console.run_command('bootm %x#config@2' % addr,
                                       wait_for_prompt=False)
            # You might want to expand wait_for() with options to add extra bad
            # patterns which immediately indicate a failed boot, or add a new
            # "with object" function u_boot_console.enable_check() that can
            # cause extra patterns like the U-Boot console prompt, U-Boot boot
            # error messages, kernel boot error messages, etc. to fail the
            # wait_for().
            u_boot_console.wait_for('login:')
        finally:
            # This forces the console object to be shutdown, so any subsequent
            # test will reset the board back into U-Boot. We want to force this
            # no matter whether the kernel boot passed or failed.
            u_boot_console.drain_console()
            u_boot_console.cleanup_spawn()
예제 #4
0
def test_net_tftpboot_boot_config2(u_boot_console):
    if not test_net.net_set_up:
        pytest.skip('Network not initialized')

    test_net.test_net_dhcp(u_boot_console)
    test_net.test_net_setup_static(u_boot_console)
    test_net.test_net_tftpboot(u_boot_console)

    f = u_boot_console.config.env.get('env__net_tftp_readable_file', None)
    if not f:
        pytest.skip('No TFTP readable file to read')

    addr = f.get('addr', None)
    if not addr:
      addr = u_boot_utils.find_ram_base(u_boot_console)

    response = u_boot_console.run_command('imi %x' % addr)
    if not "config@2" in response:
	pytest.skip("Second configuration not found");

    timeout = 50000
    with u_boot_console.temporary_timeout(timeout):
	try:
	    # wait_for_prompt=False makes the core code not wait for the U-Boot
	    # prompt code to be seen, since it won't be on a successful kernel
	    # boot
	    u_boot_console.run_command('bootm %x#config@2' % addr, wait_for_prompt=False)
	    # You might want to expand wait_for() with options to add extra bad
	    # patterns which immediately indicate a failed boot, or add a new
	    # "with object" function u_boot_console.enable_check() that can
	    # cause extra patterns like the U-Boot console prompt, U-Boot boot
	    # error messages, kernel boot error messages, etc. to fail the
	    # wait_for().
	    u_boot_console.wait_for('login:')
	finally:
	    # This forces the console object to be shutdown, so any subsequent
	    # test will reset the board back into U-Boot. We want to force this
	    # no matter whether the kernel boot passed or failed.
	    u_boot_console.drain_console()
	    u_boot_console.cleanup_spawn()