diff mbox series

[U-Boot,v1,2/2] test: regmap: check the values read from the regmap

Message ID 20191002092835.1494-3-jjhiblot@ti.com
State Superseded
Delegated to: Simon Glass
Headers show
Series sandbox: Fixes the regmap tests | expand

Commit Message

Jean-Jacques Hiblot Oct. 2, 2019, 9:28 a.m. UTC
The test did reads after writes but didn't check the value.
It probably was because the sandbox didn't implement the writeX/readX
functions.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

---

 test/dm/regmap.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Simon Glass Oct. 11, 2019, 10:22 p.m. UTC | #1
Hi Jean-Jacques,

On Wed, 2 Oct 2019 at 03:28, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>
> The test did reads after writes but didn't check the value.
> It probably was because the sandbox didn't implement the writeX/readX
> functions.
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>
> ---
>
>  test/dm/regmap.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)

I'm going to send an updated version of this patch.

Regards,
Simon
diff mbox series

Patch

diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index 82de295cb8..4cde0d1866 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -104,13 +104,19 @@  static int dm_test_regmap_rw(struct unit_test_state *uts)
 	ut_assertok_ptr(map);
 
 	ut_assertok(regmap_write(map, 0, 0xcacafafa));
-	ut_assertok(regmap_write(map, 3, 0x55aa2211));
+	ut_assertok(regmap_write(map, 5, 0x55aa2211));
 
 	ut_assertok(regmap_read(map, 0, &reg));
-	ut_assertok(regmap_read(map, 3, &reg));
+	ut_asserteq(0xcacafafa, reg);
+	ut_assertok(regmap_read(map, 5, &reg));
+	ut_asserteq(0x55aa2211, reg);
 
 	ut_assertok(regmap_update_bits(map, 0, 0xff00ff00, 0x55aa2211));
-	ut_assertok(regmap_update_bits(map, 3, 0x00ff00ff, 0xcacafada));
+	ut_assertok(regmap_read(map, 0, &reg));
+	ut_asserteq(0x55ca22fa, reg);
+	ut_assertok(regmap_update_bits(map, 5, 0x00ff00ff, 0xcacafada));
+	ut_assertok(regmap_read(map, 5, &reg));
+	ut_asserteq(0x55ca22da, reg);
 
 	return 0;
 }
@@ -138,7 +144,9 @@  static int dm_test_regmap_getset(struct unit_test_state *uts)
 	regmap_set(map, struct layout, val3, 0x55aa2211);
 
 	ut_assertok(regmap_get(map, struct layout, val0, &reg));
+	ut_asserteq(0xcacafafa, reg);
 	ut_assertok(regmap_get(map, struct layout, val3, &reg));
+	ut_asserteq(0x55aa2211, reg);
 
 	return 0;
 }
@@ -159,6 +167,7 @@  static int dm_test_regmap_poll(struct unit_test_state *uts)
 
 	start = get_timer(0);
 
+	ut_assertok(regmap_write(map, 0, 0x0));
 	ut_asserteq(-ETIMEDOUT,
 		    regmap_read_poll_timeout_test(map, 0, reg,
 						  (reg == 0xcacafafa),