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

2023-03-08 Thread Simon Glass
Hi Stephen,

On Tue, 7 Mar 2023 at 16:33,  wrote:
>
> From: Stephen Carlson 
>
> 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 
> ---
>  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 
>  S: Maintained
>  F: drivers/pci/pci_mpc85xx.c
>
> +PCI MPS
> +M: Stephen Carlson 
> +S: Maintained
> +F: cmd/pci_mps.c
> +F: test/py/tests/test_pci_mps.py
> +
>  POWER
>  M: Jaehoon Chung 
>  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 00..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


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

2023-03-07 Thread stcarlso
From: Stephen Carlson 

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 
---
 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 
 S: Maintained
 F: drivers/pci/pci_mpc85xx.c
 
+PCI MPS
+M: Stephen Carlson 
+S: Maintained
+F: cmd/pci_mps.c
+F: test/py/tests/test_pci_mps.py
+
 POWER
 M: Jaehoon Chung 
 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 00..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)
-- 
2.25.1