From: Bartosz Golaszewski Date: Fri, 29 Sep 2017 15:22:16 +0000 (+0200) Subject: tests: use TEST_ASSERT_ERRNO_IS() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=920d8e8947876c15f522e34e31ffa854fb29374b;p=qemu-gpiodev%2Flibgpiod.git tests: use TEST_ASSERT_ERRNO_IS() Use the new assert macro wherever we're checking the errno value. Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/tests-chip.c b/tests/tests-chip.c index c3a1e6f..7861d1e 100644 --- a/tests/tests-chip.c +++ b/tests/tests-chip.c @@ -32,7 +32,7 @@ static void chip_open_nonexistent(void) chip = gpiod_chip_open("/dev/nonexistent_gpiochip"); TEST_ASSERT_NULL(chip); - TEST_ASSERT_EQ(errno, ENOENT); + TEST_ASSERT_ERRNO_IS(ENOENT); } TEST_DEFINE(chip_open_nonexistent, "gpiod_chip_open() - nonexistent chip", @@ -44,7 +44,7 @@ static void chip_open_notty(void) chip = gpiod_chip_open("/dev/null"); TEST_ASSERT_NULL(chip); - TEST_ASSERT_EQ(errno, ENOTTY); + TEST_ASSERT_ERRNO_IS(ENOTTY); } TEST_DEFINE(chip_open_notty, "gpiod_chip_open() - notty", diff --git a/tests/tests-line.c b/tests/tests-line.c index 57520a6..b68578f 100644 --- a/tests/tests-line.c +++ b/tests/tests-line.c @@ -61,7 +61,7 @@ static void line_request_already_requested(void) status = gpiod_line_request_input(line, TEST_CONSUMER); TEST_ASSERT_NOTEQ(status, 0); - TEST_ASSERT_EQ(errno, EBUSY); + TEST_ASSERT_ERRNO_IS(EBUSY); } TEST_DEFINE(line_request_already_requested, "gpiod_line_request() - already requested", @@ -246,7 +246,7 @@ static void line_request_bulk_different_chips(void) status = gpiod_line_request_bulk(&bulk, &req, NULL); TEST_ASSERT_NOTEQ(status, 0); - TEST_ASSERT_EQ(errno, EINVAL); + TEST_ASSERT_ERRNO_IS(EINVAL); } TEST_DEFINE(line_request_bulk_different_chips, "gpiod_line_request_bulk() - different chips", diff --git a/tests/tests-simple-api.c b/tests/tests-simple-api.c index 579cdd4..dba5731 100644 --- a/tests/tests-simple-api.c +++ b/tests/tests-simple-api.c @@ -99,7 +99,7 @@ static void simple_get_value_multiple_max_lines(void) GPIOD_REQUEST_MAX_LINES + 1, false); TEST_ASSERT_NOTEQ(ret, 0); - TEST_ASSERT_EQ(errno, EINVAL); + TEST_ASSERT_ERRNO_IS(EINVAL); } TEST_DEFINE(simple_get_value_multiple_max_lines, "gpiod_simple_get_value_multiple() exceed max lines", @@ -115,7 +115,7 @@ static void simple_set_value_multiple_max_lines(void) GPIOD_REQUEST_MAX_LINES + 1, false, NULL, NULL); TEST_ASSERT_NOTEQ(ret, 0); - TEST_ASSERT_EQ(errno, EINVAL); + TEST_ASSERT_ERRNO_IS(EINVAL); } TEST_DEFINE(simple_set_value_multiple_max_lines, "gpiod_simple_set_value_multiple() exceed max lines",