tests/gpio: fix test GPIO_INT_LEVEL bug
According to include/gpio.h, GPIO_INT_LEVEL is 0, which means the branch to test GPIO_INT_LEVEL is always false and GPIO_INT_LEVEL cases will always pass. This patch also fixes another minor bug in main.c. Coverity-CID: 160074 Change-Id: I1fefa978e65bf801f244b4c2960cb87a26b0829e Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
This commit is contained in:
parent
cbeac3e97d
commit
41ffe0240d
2 changed files with 3 additions and 3 deletions
|
@ -42,6 +42,6 @@ void test_main(void)
|
|||
ztest_unit_test(test_gpio_callback_level_high),
|
||||
ztest_unit_test(test_gpio_callback_add_remove),
|
||||
ztest_unit_test(test_gpio_callback_enable_disable),
|
||||
ztest_unit_test(test_gpio_callback_level_high));
|
||||
ztest_unit_test(test_gpio_callback_level_low));
|
||||
ztest_run_test_suite(gpio_basic_test);
|
||||
}
|
||||
|
|
|
@ -85,14 +85,14 @@ static int test_callback(int mode)
|
|||
|
||||
/*= checkpoint: check callback is triggered =*/
|
||||
TC_PRINT("check enabled callback\n");
|
||||
if (mode & GPIO_INT_EDGE) {
|
||||
if ((mode & GPIO_INT_EDGE) == GPIO_INT_EDGE) {
|
||||
if (cb_cnt != 1) {
|
||||
TC_ERROR("not trigger callback correctly\n");
|
||||
goto err_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode & GPIO_INT_LEVEL) {
|
||||
if ((mode & GPIO_INT_LEVEL) == GPIO_INT_LEVEL) {
|
||||
if (cb_cnt != MAX_INT_CNT) {
|
||||
TC_ERROR("not trigger callback correctly\n");
|
||||
goto err_exit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue