tests/drivers/gpio_basic_api: improve test validation diagnostic

The test verifies that the output pin appears to be shorted to the
input pin by confirming output low and high read low and high.
Failure should block progress through the test as subsequent tests
will not pass.

Replace the use of k_panic() to halt the test with an infinite loop
that doesn't splatter the console with stack traces and register
dumps.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2019-10-03 08:29:18 -05:00 committed by Carles Cufí
commit d74e4f2d2a

View file

@ -81,8 +81,10 @@ static int setup(void)
zassert_equal(rc, 0,
"get raw low failed");
if (raw_in() != false) {
printk("FATAL: output low does not read low\n");
k_panic();
TC_PRINT("FATAL output pin not wired to input pin? (out low => in high)\n");
while (true) {
k_sleep(K_FOREVER);
}
}
zassert_equal(v1 & BIT(PIN_IN), 0,
@ -96,8 +98,10 @@ static int setup(void)
zassert_equal(rc, 0,
"get raw high failed");
if (raw_in() != true) {
printk("FATAL: output high does not read high\n");
k_panic();
TC_PRINT("FATAL output pin not wired to input pin? (out high => in low)\n");
while (true) {
k_sleep(K_FOREVER);
}
}
zassert_not_equal(v1 & BIT(PIN_IN), 0,
"out high does not read low");