]> git.ipfire.org Git - pakfire.git/commitdiff
tests: Show return code on failed assertions as well as errno
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Oct 2024 09:56:16 +0000 (09:56 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Oct 2024 09:56:16 +0000 (09:56 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/testsuite.h

index bce62c1d9a9d50b8fbbd81dda58c73ab0c2ff41b..a7e2e44d3896bf196b2f340ad09a92dffd5b8e4c 100644 (file)
@@ -136,9 +136,10 @@ ERROR:
 
 #define ASSERT_SUCCESS(expr) \
        do { \
-               if ((expr)) { \
-                       LOG_ERROR("Failed assertion: %s (errno = %s) at %s:%d %s\n", \
-                               #expr, strerror(errno), __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+               int r = expr; \
+               if (r) { \
+                       LOG_ERROR("Failed assertion: %s (r = %d, errno = %s) at %s:%d %s\n", \
+                               #expr, r, strerror(errno), __FILE__, __LINE__, __PRETTY_FUNCTION__); \
                        goto FAIL; \
                } \
        } while (0)