From 2233216c653247dd9cc06ce7db6f61f464299906 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 25 Mar 2015 15:11:45 +0100 Subject: test_expire: Use right assertion macro for standard functions Documentation to macro assert_return_code says: Assert that the return_code is greater than or equal to 0. The function prints an error message to standard error and terminates the test by calling fail() if the return code is smaller than 0. If the function you check sets an errno if it fails you can pass it to the function and it will be printed as part of the error message. So in case of error we will see more verbose message. Reviewed-by: Pavel Reichl --- src/tests/cmocka/test_expire_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tests/cmocka/test_expire_common.c b/src/tests/cmocka/test_expire_common.c index 1698bd80e..5d3ea02f3 100644 --- a/src/tests/cmocka/test_expire_common.c +++ b/src/tests/cmocka/test_expire_common.c @@ -117,7 +117,8 @@ void expire_test_tz(const char* tz, if (tz) { ret = setenv("TZ", tz, 1); - assert_false(ret == -1); + + assert_return_code(ret, errno); } test_func(test_in, _test_out); @@ -125,6 +126,6 @@ void expire_test_tz(const char* tz, /* restore */ if (orig_tz != NULL) { ret = setenv("TZ", orig_tz, 1); - assert_false(ret == -1); + assert_return_code(ret, errno); } } -- cgit