Skip to contentSkip to conversation

test: hexdump: fix misplaced return

PATCH In review Simon Goldschmidt 3 participants 5 messages Dec 4, 2018 – Dec 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: hexdump: fix misplaced return

One of the hexdump tests in test/lib/hexdump.c returns right at the start of the function without testing anything.

Fix this by moving the 'return 0;' statement to the end of the function.

---

 test/lib/hexdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
test/lib/hexdump.c +2 -2
index e8b3e566e0..567b57686a 100644
@@ -11,8 +11,6 @@
 
 static int lib_test_hex_to_bin(struct unit_test_state *uts)
 {
-	return 0;
-
 	ut_asserteq(0x0, hex_to_bin('0'));
 	ut_asserteq(0x1, hex_to_bin('1'));
 	ut_asserteq(0x2, hex_to_bin('2'));
@@ -30,6 +28,8 @@ static int lib_test_hex_to_bin(struct unit_test_state *uts)
 	ut_asserteq(0xe, hex_to_bin('e'));
 	ut_asserteq(0xf, hex_to_bin('f'));
 	ut_asserteq(-1, hex_to_bin('g'));
+
+	return 0;
 }
 
 DM_TEST(lib_test_hex_to_bin, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 test: hexdump: fix misplaced return

Quoted 11 lines · Simon Goldschmidt

One of the hexdump tests in test/lib/hexdump.c returns right at the start of the function without testing anything.

Fix this by moving the 'return 0;' statement to the end of the function.

---

 test/lib/hexdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

That's one way to make a test pass.

#2 lore raw

PATCH 1/1 test: hexdump: fix misplaced return

Am 05.12.2018 um 13:55 schrieb Simon Glass:

Quoted 11 lines
Quoted 9 lines · Simon Goldschmidt

One of the hexdump tests in test/lib/hexdump.c returns right at the start of the function without testing anything.

Fix this by moving the 'return 0;' statement to the end of the function.

---

Quoted 6 lines
Quoted 2 lines
  test/lib/hexdump.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

That's one way to make a test pass.

Is there a plan to make all tests under test/ run with 'make check'? Seems like this one is not included there?

Simon

#3 lore raw

PATCH 1/1 test: hexdump: fix misplaced return

Quoted 16 lines · Simon Goldschmidt

Am 05.12.2018 um 13:55 schrieb Simon Glass:

Quoted 14 lines
Quoted 11 lines · Simon Goldschmidt

One of the hexdump tests in test/lib/hexdump.c returns right at the start of the function without testing anything.

Fix this by moving the 'return 0;' statement to the end of the function.

---

  test/lib/hexdump.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 3 lines

That's one way to make a test pass.

Is there a plan to make all tests under test/ run with 'make check'? Seems like this one is not included there?

Yes I agree, it needs to be added.

- Simon

#4 lore raw
In reply to Simon Goldschmidt
Quoted 7 lines · Simon Goldschmidt

One of the hexdump tests in test/lib/hexdump.c returns right at the start of the function without testing anything.

Fix this by moving the 'return 0;' statement to the end of the function.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181212/1e69481e/attachment.sig>