[PATCH v2] test/py: spi: Add tests for SPI flash device
Simon Glass
sjg at chromium.org
Sun Jul 28 21:36:08 CEST 2024
Hi Love,
On Wed, 24 Jul 2024 at 05:07, Love Kumar <love.kumar at amd.com> wrote:
>
> Add test cases for sf commands to verify various SPI flash operations
> such as erase, write and read. It also adds qspi lock unlock cases.
> This test relies on boardenv_* configurations to run it for different
> SPI flash family such as single SPI, QSPI, and OSPI.
>
> Signed-off-by: Love Kumar <love.kumar at amd.com>
> ---
> Changes in v2:
> - Fix the pylint errors
> - Re-order/organize the tests
> ---
> test/py/tests/test_spi.py | 680 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 680 insertions(+)
> create mode 100644 test/py/tests/test_spi.py
>
How is this test enabled? Can it run in CI?
With nits below:
Reviewed-by: Simon Glass <sjg at chromium.org>
> diff --git a/test/py/tests/test_spi.py b/test/py/tests/test_spi.py
> new file mode 100644
> index 000000000000..4774b4151b4e
> --- /dev/null
> +++ b/test/py/tests/test_spi.py
> @@ -0,0 +1,680 @@
> +# SPDX-License-Identifier: GPL-2.0
> +# (C) Copyright 2024, Advanced Micro Devices, Inc.
> +
> +"""
> +Note: This test relies on boardenv_* containing configuration values to define
> +spi minimum and maximum frequnecies at which the flash part can operate on and
spelling
> +these tests run at 5 different spi frequnecy randomised values in the range.
spelling
> +It also defines the SPI bus number containing the SPI-flash chip, SPI
> +chip-select, SPI mode, SPI flash part name and timeout parameters. If minimum
> +and maximum frequency is not defined, it will run on freq 0 by default.
> +
> +Without the boardenv_* configuration, this test will be automatically skipped.
> +
> +It also relies on configuration values for supported flashes for lock and
> +unlock cases for SPI family flash. It will run lock-unlock cases only for the
> +supported flash parts.
> +
> +Example:
> +env__spi_device_test = {
> + 'bus': 0,
> + 'chip_select': 0,
> + 'min_freq': 10000000,
> + 'max_freq': 100000000,
> + 'mode': 0,
> + 'part_name': 'n25q00a',
> + 'timeout': 100000,
> + 'iteration': 5,
> +}
Can you please describe what these params are?
> +
> +env__spi_lock_unlock = {
> + 'supported_flash': 'mt25qu512a, n25q00a, n25q512ax3',
> +}
> +"""
> +
> +import random
> +import re
> +import pytest
> +import u_boot_utils
> +
[..]
Regards,
Simon
More information about the U-Boot
mailing list