Skip to content

Commit

Permalink
Call abort instead of exit on test failure.
Browse files Browse the repository at this point in the history
This raises a signal, so we can more easily catch it with gdb.
  • Loading branch information
iphydf committed Aug 26, 2018
1 parent 80f8458 commit 64ddb7f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions auto_tests/check_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static inline int srunner_ntests_failed(SRunner *r)
#define ck_assert(ok) do { \
if (!(ok)) { \
fprintf(stderr, "%s:%d: failed `%s'\n", __FILE__, __LINE__, #ok); \
exit(EXIT_FAILURE); \
abort(); \
} \
} while (0)

Expand All @@ -53,15 +53,15 @@ static inline int srunner_ntests_failed(SRunner *r)
fprintf(stderr, "%s:%d: failed `%s': ", __FILE__, __LINE__, #ok); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
exit(EXIT_FAILURE); \
abort(); \
} \
} while (0)

#define ck_abort_msg(...) do { \
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
exit(EXIT_FAILURE); \
abort(); \
} while (0)

#endif // CHECK_COMPAT_H

0 comments on commit 64ddb7f

Please sign in to comment.