diff mbox series

[3/3] test: Add test for new command pci_mps

Message ID 20230308003234.465014-4-stcarlso@linux.microsoft.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Add command to set MPS of all PCI Express devices | expand

Commit Message

Stephen Carlson March 8, 2023, 12:32 a.m. UTC
From: Stephen Carlson <stcarlso@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@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

Comments

Simon Glass March 8, 2023, 5:16 p.m. UTC | #1
Hi Stephen,

On Tue, 7 Mar 2023 at 16:33, <stcarlso@linux.microsoft.com> wrote:
>
> From: Stephen Carlson <stcarlso@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@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@denx.de>
>  S:     Maintained
>  F:     drivers/pci/pci_mpc85xx.c
>
> +PCI MPS
> +M:     Stephen Carlson <stcarlso@linux.microsoft.com>
> +S:     Maintained
> +F:     cmd/pci_mps.c
> +F:     test/py/tests/test_pci_mps.py
> +
>  POWER
>  M:     Jaehoon Chung <jh80.chung@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
> +
> +@pytest.mark.boardspec('sandbox')
> +@pytest.mark.buildconfigspec('cmd_pci')
> +@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
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 3e8e193ecc..83948b6aa7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1242,6 +1242,12 @@  M:	Heiko Schocher <hs@denx.de>
 S:	Maintained
 F:	drivers/pci/pci_mpc85xx.c
 
+PCI MPS
+M:	Stephen Carlson <stcarlso@linux.microsoft.com>
+S:	Maintained
+F:	cmd/pci_mps.c
+F:	test/py/tests/test_pci_mps.py
+
 POWER
 M:	Jaehoon Chung <jh80.chung@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
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_pci')
+@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)