[PATCH 3/3] test: Add test for new command pci_mps
Simon Glass
sjg at chromium.org
Wed Mar 8 18:16:48 CET 2023
Hi Stephen,
On Tue, 7 Mar 2023 at 16:33, <stcarlso at linux.microsoft.com> wrote:
>
> From: Stephen Carlson <stcarlso at linux.microsoft.com>
>
> Adds a test for the new pci_mps command to ensure that it can set the
> Maximum Payload Size (MPS) of all devices to 256 bytes in the sandbox
> environment. Enables the pci_mps command in the sandbox environment so
> that this test can be run.
>
> Signed-off-by: Stephen Carlson <stcarlso at linux.microsoft.com>
> ---
> MAINTAINERS | 6 ++++++
> configs/sandbox_defconfig | 1 +
> test/py/tests/test_pci_mps.py | 13 +++++++++++++
> 3 files changed, 20 insertions(+)
> create mode 100644 test/py/tests/test_pci_mps.py
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3e8e193ecc..83948b6aa7 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1242,6 +1242,12 @@ M: Heiko Schocher <hs at denx.de>
> S: Maintained
> F: drivers/pci/pci_mpc85xx.c
>
> +PCI MPS
> +M: Stephen Carlson <stcarlso at linux.microsoft.com>
> +S: Maintained
> +F: cmd/pci_mps.c
> +F: test/py/tests/test_pci_mps.py
> +
> POWER
> M: Jaehoon Chung <jh80.chung at samsung.com>
> S: Maintained
> diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> index 34c342b6f5..cd6bb8e2c4 100644
> --- a/configs/sandbox_defconfig
> +++ b/configs/sandbox_defconfig
> @@ -77,6 +77,7 @@ CONFIG_CMD_MMC=y
> CONFIG_CMD_MUX=y
> CONFIG_CMD_OSD=y
> CONFIG_CMD_PCI=y
> +CONFIG_CMD_PCI_MPS=y
> CONFIG_CMD_READ=y
> CONFIG_CMD_REMOTEPROC=y
> CONFIG_CMD_SPI=y
> diff --git a/test/py/tests/test_pci_mps.py b/test/py/tests/test_pci_mps.py
> new file mode 100644
> index 0000000000..8d33490f9f
> --- /dev/null
> +++ b/test/py/tests/test_pci_mps.py
> @@ -0,0 +1,13 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +
> +import pytest
> +
> + at pytest.mark.boardspec('sandbox')
> + at pytest.mark.buildconfigspec('cmd_pci')
> + at pytest.mark.buildconfigspec('cmd_pci_mps')
> +def test_pci_mps_safe(u_boot_console):
> + """Tests that PCI MPS can be set to safe mode and uses 256 bytes."""
> +
> + response = u_boot_console.run_command('pci e; pci_mps s')
> + expected_response = 'to 256B'
> + assert(expected_response in response)
> --
Can you please use C for this test? See [1]. For an example, see test/dm/acpi.c
Regards,
Simon
[1] https://u-boot.readthedocs.io/en/latest/develop/tests_writing.html#test-types
More information about the U-Boot
mailing list