Skip to contentSkip to conversation

test/cmd: Make some "ut dm" tests only available on sandbox

PATCH In review Tom Rini 3 participants 10 messages Oct 28, 2024 – Oct 29, 2024

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/3 test/cmd: Make some "ut dm" tests only available on sandbox

Currently, the "dm" suite in unit tests (ut) is only available on sandbox. Make sure that all cmd tests that are part of this suite are only available on sandbox and not attempted to be run on hardware (where it will fail to be able to be started).

---
 test/cmd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
test/cmd/Makefile +3 -3
index 4b487c1d2cb4..fe7a2165af22 100644
@@ -25,16 +25,16 @@ obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
 ifdef CONFIG_CMD_PCI
 obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o
 endif
-obj-$(CONFIG_CMD_PINMUX) += pinmux.o
-obj-$(CONFIG_CMD_PWM) += pwm.o
 obj-$(CONFIG_CMD_SEAMA) += seama.o
 ifdef CONFIG_SANDBOX
 obj-$(CONFIG_CMD_MBR) += mbr.o
+obj-$(CONFIG_CMD_PINMUX) += pinmux.o
+obj-$(CONFIG_CMD_PWM) += pwm.o
 obj-$(CONFIG_CMD_READ) += rw.o
 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
+obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
 ifdef CONFIG_NET
 obj-$(CONFIG_CMD_WGET) += wget.o
 endif
 obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o
 endif
-obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/3 test/hush: Add CONFIG_CONSOLE_RECORD where required

The "dollar" tests require CONFIG_CONSOLE_RECORD to be enabled so guard with that.

---
 test/hush/Makefile | 2 ++
 1 file changed, 2 insertions(+)
test/hush/Makefile +2 -0
index a2d98815e501..4c3a0be857ae 100644
@@ -5,6 +5,8 @@
 
 obj-y += cmd_ut_hush.o
 obj-y += if.o
+ifdef CONFIG_CONSOLE_RECORD
 obj-y += dollar.o
+endif
 obj-y += list.o
 obj-y += loop.o
Signature · 1 line
2.43.0
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] test/hush: Add CONFIG_CONSOLE_RECORD where required

Quoted 13 lines · Tom Rini

The "dollar" tests require CONFIG_CONSOLE_RECORD to be enabled so guard with that.

---
  test/hush/Makefile | 2 ++
  1 file changed, 2 insertions(+)
test/hush/Makefile +0 -0
index a2d98815e501..4c3a0be857ae 100644

test/hush/Makefile line 9

Quoted 5 lines
test/hush/Makefile +1 -0
@@ -5,6 +5,8 @@
 
  obj-y += cmd_ut_hush.o
  obj-y += if.o
+ifdef CONFIG_CONSOLE_RECORD
  obj-y += dollar.o

Or to keep it simpler:

obj-$(CONFIG_CONSOLE_RECORD) += dollar.o

Quoted 3 lines
test/hush/Makefile +1 -0
+endif
  obj-y += list.o
  obj-y += loop.o
author
#3 lore raw

PATCH 3/3 test/lib/uuid: Make lib_test_dynamic_uuid depend on SANDBOX

In reply to Tom Rini

The dynamic UUID test checks for the sandbox specific capsule UUID to be used, so we can only perform this test on sandbox currently.

---
 test/lib/uuid.c | 2 ++
 1 file changed, 2 insertions(+)
test/lib/uuid.c +2 -0
index d00e9563a472..55ef9e7454d7 100644
@@ -84,6 +84,7 @@ static int lib_test_uuid_bits(struct unit_test_state *uts)
 LIB_TEST(lib_test_uuid_bits, 0);
 #endif
 
+#ifdef CONFIG_SANDBOX
 struct dynamic_uuid_test_data {
 	const char *compatible;
 	const u16 *images[4];
@@ -159,3 +160,4 @@ static int lib_test_dynamic_uuid(struct unit_test_state *uts)
 }
 
 LIB_TEST(lib_test_dynamic_uuid, 0);
+#endif
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH 3/3] test/lib/uuid: Make lib_test_dynamic_uuid depend on SANDBOX

Quoted 2 lines · Tom Rini

The dynamic UUID test checks for the sandbox specific capsule UUID to be used, so we can only perform this test on sandbox currently.

The tested function is gen_v5_guid(). This function is used to generated capsule UUIDs. It receives the test data provided in dynamic_uuid_test_data test_data[]:

* compatible string
* image name

The generated UUID is compared to a UUID provided in the test data.

By chance the chosen test data contains the string 'sandbox'.

It is not obvious why this test should depend on running on the sandbox.

Where did it fail for you?

Best regards

Heinrich

Quoted 23 lines
---
  test/lib/uuid.c | 2 ++
  1 file changed, 2 insertions(+)
test/lib/uuid.c +2 -0
index d00e9563a472..55ef9e7454d7 100644
@@ -84,6 +84,7 @@ static int lib_test_uuid_bits(struct unit_test_state *uts)
  LIB_TEST(lib_test_uuid_bits, 0);
  #endif
 
+#ifdef CONFIG_SANDBOX
  struct dynamic_uuid_test_data {
  	const char *compatible;
  	const u16 *images[4];
@@ -159,3 +160,4 @@ static int lib_test_dynamic_uuid(struct unit_test_state *uts)
  }
 
  LIB_TEST(lib_test_dynamic_uuid, 0);
+#endif
author
#5 lore raw

Re: [PATCH 3/3] test/lib/uuid: Make lib_test_dynamic_uuid depend on SANDBOX

Quoted 11 lines · Heinrich Schuchardt
Quoted 2 lines · Tom Rini

The dynamic UUID test checks for the sandbox specific capsule UUID to be used, so we can only perform this test on sandbox currently.

The tested function is gen_v5_guid(). This function is used to generated capsule UUIDs. It receives the test data provided in dynamic_uuid_test_data test_data[]:

* compatible string
* image name

Quoted 7 lines

The generated UUID is compared to a UUID provided in the test data.

By chance the chosen test data contains the string 'sandbox'.

It is not obvious why this test should depend on running on the sandbox.

Where did it fail for you?

On Pi 3, I forget if it was rpi_3 or rpi_arm64_defconfig (with tweaks like enabling CONFIG_UNIT_TEST).

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH 3/3] test/lib/uuid: Make lib_test_dynamic_uuid depend on SANDBOX

Quoted 14 lines · Tom Rini
Quoted 13 lines · Heinrich Schuchardt
Quoted 2 lines · Tom Rini

The dynamic UUID test checks for the sandbox specific capsule UUID to be used, so we can only perform this test on sandbox currently.

The tested function is gen_v5_guid(). This function is used to generated capsule UUIDs. It receives the test data provided in dynamic_uuid_test_data test_data[]:

* compatible string
* image name

The generated UUID is compared to a UUID provided in the test data.

Quoted 9 lines
Quoted 5 lines

By chance the chosen test data contains the string 'sandbox'.

It is not obvious why this test should depend on running on the sandbox.

Where did it fail for you?

On Pi 3, I forget if it was rpi_3 or rpi_arm64_defconfig (with tweaks like enabling CONFIG_UNIT_TEST).

On qemu_arm64_defconfig the tests runs fine:

=> ut lib lib_test_dynamic_uuid
Test: lib_test_dynamic_uuid: uuid.c
Failures: 0

Missing CONFIG_SANDBOX cannot be the cause of the issue that you observed.

Best regards

Heinrich

author
#7 lore raw

Re: [PATCH 3/3] test/lib/uuid: Make lib_test_dynamic_uuid depend on SANDBOX

Quoted 25 lines · Heinrich Schuchardt
Quoted 14 lines · Tom Rini
Quoted 13 lines · Heinrich Schuchardt
Quoted 2 lines · Tom Rini

The dynamic UUID test checks for the sandbox specific capsule UUID to be used, so we can only perform this test on sandbox currently.

The tested function is gen_v5_guid(). This function is used to generated capsule UUIDs. It receives the test data provided in dynamic_uuid_test_data test_data[]:

* compatible string
* image name

The generated UUID is compared to a UUID provided in the test data.

Quoted 9 lines
Quoted 5 lines

By chance the chosen test data contains the string 'sandbox'.

It is not obvious why this test should depend on running on the sandbox.

Where did it fail for you?

On Pi 3, I forget if it was rpi_3 or rpi_arm64_defconfig (with tweaks like enabling CONFIG_UNIT_TEST).

Quoted 7 lines

On qemu_arm64_defconfig the tests runs fine:

=> ut lib lib_test_dynamic_uuid
Test: lib_test_dynamic_uuid: uuid.c
Failures: 0

Missing CONFIG_SANDBOX cannot be the cause of the issue that you observed.

Hunh, OK. Lets for now go with it being related to the 32bit UUID problem:
https://lore.kernel.org/u-boot/[email protected]
and that it was on 32bit Pi only where I saw that failure, as indeed I don't on 64bit Pi now. Thanks!

Signature · 1 line
Tom
Reviewed-by on v1 1/3
#8 lore raw
In reply to Tom Rini
Quoted 6 lines · Tom Rini

Currently, the "dm" suite in unit tests (ut) is only available on sandbox. Make sure that all cmd tests that are part of this suite are only available on sandbox and not attempted to be run on hardware (where it will fail to be able to be started).

Adding a comment to the sources describing that the tests require sandbox drivers would be helpful.

Quoted 28 lines
---
  test/cmd/Makefile | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
test/cmd/Makefile +3 -3
index 4b487c1d2cb4..fe7a2165af22 100644
@@ -25,16 +25,16 @@ obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
  ifdef CONFIG_CMD_PCI
  obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o
  endif
-obj-$(CONFIG_CMD_PINMUX) += pinmux.o
-obj-$(CONFIG_CMD_PWM) += pwm.o
  obj-$(CONFIG_CMD_SEAMA) += seama.o
  ifdef CONFIG_SANDBOX
  obj-$(CONFIG_CMD_MBR) += mbr.o
+obj-$(CONFIG_CMD_PINMUX) += pinmux.o
+obj-$(CONFIG_CMD_PWM) += pwm.o
  obj-$(CONFIG_CMD_READ) += rw.o
  obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
+obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
  ifdef CONFIG_NET
  obj-$(CONFIG_CMD_WGET) += wget.o
  endif
  obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o
  endif
-obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
author
#9 lore raw

Re: (subset) [PATCH 1/3] test/cmd: Make some "ut dm" tests only available on sandbox

In reply to Tom Rini
Quoted 6 lines · Tom Rini

Currently, the "dm" suite in unit tests (ut) is only available on sandbox. Make sure that all cmd tests that are part of this suite are only available on sandbox and not attempted to be run on hardware (where it will fail to be able to be started).

Applied to u-boot/master, thanks!

Signature · 1 line
Tom