Skip to contentSkip to conversation

tests: remove debug asserts

PATCH Applied Kent Gibson 2 participants 2 messages May 27, 2020 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: remove debug asserts

Remove asserts that are a hangover from debugging test cases.

---

Those asserts were initially there to debug the test cases when they were failing, and I forgot to remove them. The are not part of the test, as errno is indeterminate unless the function returns -1. And that clearly isn't the case as the asserts immediately prior verify. Having them there can cause spurious test failures and head scratching.

 tests/tests-line.c | 2 --
 1 file changed, 2 deletions(-)
tests/tests-line.c +0 -2
index 97b7df9..334046f 100644
@@ -980,7 +980,6 @@ GPIOD_TEST_CASE(misc_flags_work_together, 0, { 8 })
 
 	ret = gpiod_line_get_value(line);
 	g_assert_cmpint(ret, ==, 1);
-	g_assert_cmpint(errno, ==, 0);
 
 	gpiod_line_release(line);
 
@@ -1001,7 +1000,6 @@ GPIOD_TEST_CASE(misc_flags_work_together, 0, { 8 })
 
 	ret = gpiod_line_get_value(line);
 	g_assert_cmpint(ret, ==, 0);
-	g_assert_cmpint(errno, ==, 0);
 
 	gpiod_line_release(line);
 }
Signature · 1 line
2.26.2
#1 lore raw

śr., 27 maj 2020 o 03:09 Kent Gibson <[email protected]> napisał(a):

Quoted 36 lines

Remove asserts that are a hangover from debugging test cases.

---

Those asserts were initially there to debug the test cases when they were failing, and I forgot to remove them. The are not part of the test, as errno is indeterminate unless the function returns -1. And that clearly isn't the case as the asserts immediately prior verify. Having them there can cause spurious test failures and head scratching.

 tests/tests-line.c | 2 --
 1 file changed, 2 deletions(-)
tests/tests-line.c +0 -3
index 97b7df9..334046f 100644
@@ -980,7 +980,6 @@ GPIOD_TEST_CASE(misc_flags_work_together, 0, { 8 })
 
        ret = gpiod_line_get_value(line);
        g_assert_cmpint(ret, ==, 1);
-       g_assert_cmpint(errno, ==, 0);
 
        gpiod_line_release(line);
 
@@ -1001,7 +1000,6 @@ GPIOD_TEST_CASE(misc_flags_work_together, 0, { 8 })
 
        ret = gpiod_line_get_value(line);
        g_assert_cmpint(ret, ==, 0);
-       g_assert_cmpint(errno, ==, 0);
 
        gpiod_line_release(line);
 }
--
Quoted 2 lines

2.26.2

Applied, thanks!

Bartosz