示例#1
0
def test_bossac_create_with_adafruit(cc, req, bcfg_ini, bcfg_check, bcfg_val,
                                     get_cod_par, sup, runner_config):
    """
    Test SAM-BA extended protocol with Adafruit UF2 variation

    Requirements:
	SDK >= 0.12.0

    Configuration:
	Extended bootloader
	CONFIG_USE_DT_CODE_PARTITION=y
	CONFIG_BOOTLOADER_BOSSA_ADAFRUIT_UF2=y
	with zephyr,code-partition

    Input:
	--bossac-port

    Output:
	--offset
    """
    runner = BossacBinaryRunner(runner_config, port=TEST_BOSSAC_PORT)
    runner.run('flash')
    assert cc.call_args_list == [
        call(x) for x in EXPECTED_COMMANDS_WITH_EXTENDED
    ]
示例#2
0
def test_bossac_create_error_missing_kconfig(cc, req, bcfg_ini, bcfg_check,
                                             bcfg_val, get_cod_par, sup,
                                             runner_config):
    """
    Test SAM-BA offset wrong configuration. No CONFIG_USE_DT_CODE_PARTITION
    Kconfig definition.

    Requirements:
	Any SDK

    Configuration:
	Any bootloader
	CONFIG_USE_DT_CODE_PARTITION=y (missing)
	with zephyr,code-partition

    Input:

    Output:
	Abort
    """
    runner = BossacBinaryRunner(runner_config)
    with pytest.raises(RuntimeError) as rinfo:
        runner.run('flash')
    assert str(rinfo.value) == \
        "There is no CONFIG_USE_DT_CODE_PARTITION Kconfig defined at " \
        + TEST_BOARD_NAME + "_defconfig file.\n This means that" \
        " zephyr,code-partition device tree node should not be defined." \
        " Check Zephyr SAM-BA documentation."
示例#3
0
def test_bossac_create_error_missing_dt_info(cc, req, bcfg_ini, bcfg_check,
                                             bcfg_val, get_cod_par, sup,
                                             runner_config):
    """
    Test SAM-BA offset wrong configuration. No chosen code partition.

    Requirements:
	Any SDK

    Configuration:
	Any bootloader
	CONFIG_USE_DT_CODE_PARTITION=y
	with zephyr,code-partition (missing)

    Input:

    Output:
	Abort
    """
    runner = BossacBinaryRunner(runner_config)
    with pytest.raises(RuntimeError) as rinfo:
        with patch('os.path.isfile', side_effect=os_path_isfile_patch):
            runner.run('flash')
    assert str(rinfo.value) == "The device tree zephyr,code-partition" \
                               " chosen node must be defined."
示例#4
0
def test_bossac_create_with_omit_address(cc, req, bcfg_ini, bcfg_check,
                                         bcfg_val, get_cod_par, sup,
                                         runner_config):
    """
    Test command that will omit offset because CONFIG_FLASH_LOAD_OFFSET is 0.
    This case is valid for ROM bootloaders that define image start at 0 and
    define flash partitions, to use the storage capabilities, for instance.

    Requirements:
	Any SDK

    Configuration:
	ROM bootloader
	CONFIG_USE_DT_CODE_PARTITION=y
	with zephyr,code-partition

    Input:
	--bossac-port

    Output:
	no --offset
    """
    runner = BossacBinaryRunner(runner_config, port=TEST_BOSSAC_PORT)
    runner.run('flash')
    assert cc.call_args_list == [call(x) for x in EXPECTED_COMMANDS]
示例#5
0
def test_bossac_create_with_oldsdk(cc, req, bcfg_ini, bcfg_check, bcfg_val,
                                   get_cod_par, sup, runner_config):
    """
    Test old SDK and ask user to upgrade

    Requirements:
	SDK <= 0.12.0

    Configuration:
	Any bootloader
	CONFIG_USE_DT_CODE_PARTITION=y
	with zephyr,code-partition

    Input:

    Output:
	Abort
    """
    runner = BossacBinaryRunner(runner_config)
    with pytest.raises(RuntimeError) as rinfo:
        with patch('os.path.isfile', side_effect=os_path_isfile_patch):
            runner.run('flash')
    assert str(rinfo.value) == "This version of BOSSA does not support the" \
                               " --offset flag. Please upgrade to a newer" \
                               " Zephyr SDK version >= 0.12.0."
示例#6
0
def test_bossac_create_with_arduino(cc, req, bcfg_ini, bcfg_check, bcfg_val,
                                    get_cod_par, sup, runner_config):
    """
    Test SAM-BA extended protocol with Arduino variation

    Requirements:
	SDK >= 0.12.0

    Configuration:
	Extended bootloader
	CONFIG_USE_DT_CODE_PARTITION=y
	CONFIG_BOOTLOADER_BOSSA_ARDUINO=y
	with zephyr,code-partition

    Input:
	--bossac-port

    Output:
	--offset
    """
    runner = BossacBinaryRunner(runner_config, port=TEST_BOSSAC_PORT)
    with patch('os.path.isfile', side_effect=os_path_isfile_patch):
        runner.run('flash')
    assert cc.call_args_list == [
        call(x) for x in EXPECTED_COMMANDS_WITH_EXTENDED
    ]
示例#7
0
def test_bossac_create_with_adafruit(cc, req, get_cod_par, sup, runner_config,
                                     tmpdir):
    """
    Test SAM-BA extended protocol with Adafruit UF2 variation

    Requirements:
	SDK >= 0.12.0

    Configuration:
	Extended bootloader
	CONFIG_USE_DT_CODE_PARTITION=y
	CONFIG_BOOTLOADER_BOSSA_ADAFRUIT_UF2=y
	with zephyr,code-partition

    Input:
	--bossac-port

    Output:
	--offset
    """
    runner_config = adjust_runner_config(runner_config, tmpdir,
                                         DOTCONFIG_COND4)
    runner = BossacBinaryRunner(runner_config, port=TEST_BOSSAC_PORT)
    with patch('os.path.isfile', side_effect=os_path_isfile_patch):
        runner.run('flash')
    assert cc.call_args_list == [
        call(x) for x in EXPECTED_COMMANDS_WITH_EXTENDED
    ]
示例#8
0
def test_bossac_create_with_legacy(cc, req, get_cod_par, sup,
				   runner_config, tmpdir):
    """
    Test SAM-BA legacy protocol

    Requirements:
	Any SDK

    Configuration:
	Extended bootloader
	CONFIG_USE_DT_CODE_PARTITION=y
	CONFIG_BOOTLOADER_BOSSA_LEGACY=y
	with zephyr,code-partition

    Input:
	--bossac-port

    Output:
	no --offset
    """
    runner_config = adjust_runner_config(runner_config, tmpdir,
                                         DOTCONFIG_COND6)
    runner = BossacBinaryRunner(runner_config, port=TEST_BOSSAC_PORT)
    with patch('os.path.isfile', side_effect=os_path_isfile_patch):
        runner.run('flash')
    assert cc.call_args_list == [call(x) for x in EXPECTED_COMMANDS]
示例#9
0
def test_bossac_init(cc, req, supports, runner_config):
    '''Test commands using a runner created by constructor.'''
    runner = BossacBinaryRunner(runner_config,
                                port=TEST_BOSSAC_PORT,
                                offset=TEST_OFFSET)
    runner.run('flash')
    assert cc.call_args_list == [
        call(x) for x in EXPECTED_COMMANDS_WITH_OFFSET
    ]
示例#10
0
def test_bossac_init(cc, req, bcfg_ini, bcfg_check, bcfg_val, get_cod_par, sup,
                     runner_config):
    """
    Test commands using a runner created by constructor.

    Requirements:
	Any SDK

    Configuration:
	ROM bootloader
	CONFIG_USE_DT_CODE_PARTITION=n
	without zephyr,code-partition

    Input:
	none

    Output:
	no --offset
    """
    runner = BossacBinaryRunner(runner_config, port=TEST_BOSSAC_PORT)
    runner.run('flash')
    assert cc.call_args_list == [call(x) for x in EXPECTED_COMMANDS]
示例#11
0
def test_bossac_init(cc, req, get_cod_par, sup, runner_config, tmpdir):
    """
    Test commands using a runner created by constructor.

    Requirements:
	Any SDK

    Configuration:
	ROM bootloader
	CONFIG_USE_DT_CODE_PARTITION=n
	without zephyr,code-partition

    Input:
	none

    Output:
	no --offset
    """
    runner_config = adjust_runner_config(runner_config, tmpdir, DOTCONFIG_STD)
    runner = BossacBinaryRunner(runner_config, port=TEST_BOSSAC_PORT)
    with patch('os.path.isfile', side_effect=os_path_isfile_patch):
        runner.run('flash')
    assert cc.call_args_list == [call(x) for x in EXPECTED_COMMANDS]