[PATCH 11/33] libtest: Add T_CHECK_FMT
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Jul 21 15:04:28 UTC 2020
Rename internal function T_check_true() to T_check() and use the new
flag T_CHECK_FMT to indicate if a format string is present. This is a
preparation step to make the format string optional.
Make the check context the first parameter.
The API remains the same.
Update #3199.
---
cpukit/include/rtems/test.h | 338 ++++++++++++-----------
cpukit/libtest/t-test-checks-eno.c | 8 +-
cpukit/libtest/t-test-checks-psx.c | 8 +-
cpukit/libtest/t-test-checks.c | 192 ++++++-------
cpukit/libtest/t-test-rtems-context.c | 6 +-
cpukit/libtest/t-test-rtems-fds.c | 3 +-
cpukit/libtest/t-test-rtems-heap.c | 4 +-
cpukit/libtest/t-test-rtems-objs.c | 3 +-
cpukit/libtest/t-test-rtems-posix-keys.c | 3 +-
cpukit/libtest/t-test-rtems.c | 8 +-
cpukit/libtest/t-test.c | 100 +++----
11 files changed, 343 insertions(+), 330 deletions(-)
diff --git a/cpukit/include/rtems/test.h b/cpukit/include/rtems/test.h
index 8af810def7..c0227b5465 100644
--- a/cpukit/include/rtems/test.h
+++ b/cpukit/include/rtems/test.h
@@ -114,7 +114,9 @@ void T_case_register(T_case_context *);
#define T_CHECK_QUIET 2U
-#define T_CHECK_STEP_FLAG 4U
+#define T_CHECK_FMT 4U
+
+#define T_CHECK_STEP_FLAG 8U
#define T_CHECK_STEP_TO_FLAGS(step) ((unsigned int)(step) << 8)
@@ -133,13 +135,15 @@ typedef struct {
const char *msg;
} T_check_context_msg;
-void T_check_true(bool, const T_check_context *, const char *, ...);
+void T_check(const T_check_context *, bool, ...);
+
+extern const T_check_context T_special;
#define T_flags_true(a, flags, ...) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_true(a, &T_check_instance, __VA_ARGS__); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check(&T_check_instance, a, __VA_ARGS__); \
}
#define T_flags_eq(a, e, flags, ...) \
@@ -148,484 +152,486 @@ void T_check_true(bool, const T_check_context *, const char *, ...);
#define T_flags_ne(a, e, flags, ...) \
T_flags_true((a) != (e), flags, __VA_ARGS__)
-void T_check_eq_ptr(const void *, const T_check_context_msg *, const void *);
+void T_check_eq_ptr(const T_check_context_msg *, const void *, const void *);
#define T_flags_eq_ptr(a, e, flags, sa, se) \
{ \
static const T_check_context_msg T_check_instance = { \
- { T_FILE_NAME, __LINE__, flags }, sa " == " se }; \
- T_check_eq_ptr(a, &T_check_instance, e); \
+ { T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }, \
+ sa " == " se }; \
+ T_check_eq_ptr(&T_check_instance, a, e); \
}
-void T_check_ne_ptr(const void *, const T_check_context_msg *, const void *);
+void T_check_ne_ptr(const T_check_context_msg *, const void *, const void *);
#define T_flags_ne_ptr(a, e, flags, sa, se) \
{ \
static const T_check_context_msg T_check_instance = { \
- { T_FILE_NAME, __LINE__, flags }, sa " != " se }; \
- T_check_ne_ptr(a, &T_check_instance, e); \
+ { T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }, \
+ sa " != " se }; \
+ T_check_ne_ptr(&T_check_instance, a, e); \
}
-void T_check_null(const void *, const T_check_context_msg *);
+void T_check_null(const T_check_context_msg *, const void *);
#define T_flags_null(a, flags, sa) \
{ \
static const T_check_context_msg T_check_instance = { \
- { T_FILE_NAME, __LINE__, flags }, sa }; \
- T_check_null(a, &T_check_instance); \
+ { T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }, sa }; \
+ T_check_null(&T_check_instance, a); \
}
-void T_check_not_null(const void *, const T_check_context_msg *);
+void T_check_not_null(const T_check_context_msg *, const void *);
#define T_flags_not_null(a, flags, sa) \
{ \
static const T_check_context_msg T_check_instance = { \
- { T_FILE_NAME, __LINE__, flags }, sa }; \
- T_check_not_null(a, &T_check_instance); \
+ { T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }, sa }; \
+ T_check_not_null(&T_check_instance, a); \
}
-void T_check_eq_mem(const void *, const T_check_context_msg *, const void *,
+void T_check_eq_mem(const T_check_context_msg *, const void *, const void *,
size_t);
#define T_flags_eq_mem(a, e, n, flags, sa, se, sn) \
{ \
static const T_check_context_msg T_check_instance = { \
- { T_FILE_NAME, __LINE__, flags }, \
+ { T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }, \
"memcmp(" sa ", " se ", " sn ") == 0" }; \
- T_check_eq_mem(a, &T_check_instance, e, n); \
+ T_check_eq_mem(&T_check_instance, a, e, n); \
}
-void T_check_ne_mem(const void *, const T_check_context_msg *, const void *,
+void T_check_ne_mem(const T_check_context_msg *, const void *, const void *,
size_t);
#define T_flags_ne_mem(a, e, n, flags, sa, se, sn) \
{ \
static const T_check_context_msg T_check_instance = { \
- { T_FILE_NAME, __LINE__, flags }, \
+ { T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }, \
"memcmp(" sa ", " se ", " sn ") != 0" }; \
- T_check_ne_mem(a, &T_check_instance, e, n); \
+ T_check_ne_mem(&T_check_instance, a, e, n); \
}
-void T_check_eq_str(const char *, const T_check_context *, const char *);
+void T_check_eq_str(const T_check_context *, const char *, const char *);
#define T_flags_eq_str(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_str(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_str(&T_check_instance, a, e); \
}
-void T_check_ne_str(const char *, const T_check_context *, const char *);
+void T_check_ne_str(const T_check_context *, const char *, const char *);
#define T_flags_ne_str(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_str(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_str(&T_check_instance, a, e); \
}
-void T_check_eq_nstr(const char *, const T_check_context *, const char *,
+void T_check_eq_nstr(const T_check_context *, const char *, const char *,
size_t);
#define T_flags_eq_nstr(a, e, n, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_nstr(a, &T_check_instance, e, n); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_nstr(&T_check_instance, a, e, n); \
}
-void T_check_ne_nstr(const char *, const T_check_context *, const char *,
+void T_check_ne_nstr(const T_check_context *, const char *, const char *,
size_t);
#define T_flags_ne_nstr(a, e, n, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_nstr(a, &T_check_instance, e, n); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_nstr(&T_check_instance, a, e, n); \
}
-void T_check_eq_char(char, const T_check_context *, char);
+void T_check_eq_char(const T_check_context *, char, char);
#define T_flags_eq_char(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_char(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_char(&T_check_instance, a, e); \
}
-void T_check_ne_char(char, const T_check_context *, char);
+void T_check_ne_char(const T_check_context *, char, char);
#define T_flags_ne_char(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_char(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_char(&T_check_instance, a, e); \
}
-void T_check_eq_int(int, const T_check_context *, int);
+void T_check_eq_int(const T_check_context *, int, int);
#define T_flags_eq_int(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_int(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_int(&T_check_instance, a, e); \
}
-void T_check_ne_int(int, const T_check_context *, int);
+void T_check_ne_int(const T_check_context *, int, int);
#define T_flags_ne_int(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_int(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_int(&T_check_instance, a, e); \
}
-void T_check_ge_int(int, const T_check_context *, int);
+void T_check_ge_int(const T_check_context *, int, int);
#define T_flags_ge_int(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ge_int(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ge_int(&T_check_instance, a, e); \
}
-void T_check_gt_int(int, const T_check_context *, int);
+void T_check_gt_int(const T_check_context *, int, int);
#define T_flags_gt_int(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_gt_int(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_gt_int(&T_check_instance, a, e); \
}
-void T_check_le_int(int, const T_check_context *, int);
+void T_check_le_int(const T_check_context *, int, int);
#define T_flags_le_int(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_le_int(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_le_int(&T_check_instance, a, e); \
}
-void T_check_lt_int(int, const T_check_context *, int);
+void T_check_lt_int(const T_check_context *, int, int);
#define T_flags_lt_int(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_lt_int(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_lt_int(&T_check_instance, a, e); \
}
-void T_check_eq_uint(unsigned int, const T_check_context *, unsigned int);
+void T_check_eq_uint(const T_check_context *, unsigned int, unsigned int);
#define T_flags_eq_uint(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_uint(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_uint(&T_check_instance, a, e); \
}
-void T_check_ne_uint(unsigned int, const T_check_context *, unsigned int);
+void T_check_ne_uint(const T_check_context *, unsigned int, unsigned int);
#define T_flags_ne_uint(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_uint(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_uint(&T_check_instance, a, e); \
}
-void T_check_ge_uint(unsigned int, const T_check_context *, unsigned int);
+void T_check_ge_uint(const T_check_context *, unsigned int, unsigned int);
#define T_flags_ge_uint(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ge_uint(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ge_uint(&T_check_instance, a, e); \
}
-void T_check_gt_uint(unsigned int, const T_check_context *, unsigned int);
+void T_check_gt_uint(const T_check_context *, unsigned int, unsigned int);
#define T_flags_gt_uint(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_gt_uint(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_gt_uint(&T_check_instance, a, e); \
}
-void T_check_le_uint(unsigned int, const T_check_context *, unsigned int);
+void T_check_le_uint(const T_check_context *, unsigned int, unsigned int);
#define T_flags_le_uint(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_le_uint(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_le_uint(&T_check_instance, a, e); \
}
-void T_check_lt_uint(unsigned int, const T_check_context *, unsigned int);
+void T_check_lt_uint(const T_check_context *, unsigned int, unsigned int);
#define T_flags_lt_uint(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_lt_uint(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_lt_uint(&T_check_instance, a, e); \
}
-void T_check_eq_long(long, const T_check_context *, long);
+void T_check_eq_long(const T_check_context *, long, long);
#define T_flags_eq_long(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_long(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_long(&T_check_instance, a, e); \
}
-void T_check_ne_long(long, const T_check_context *, long);
+void T_check_ne_long(const T_check_context *, long, long);
#define T_flags_ne_long(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_long(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_long(&T_check_instance, a, e); \
}
-void T_check_ge_long(long, const T_check_context *, long);
+void T_check_ge_long(const T_check_context *, long, long);
#define T_flags_ge_long(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ge_long(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ge_long(&T_check_instance, a, e); \
}
-void T_check_gt_long(long, const T_check_context *, long);
+void T_check_gt_long(const T_check_context *, long, long);
#define T_flags_gt_long(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_gt_long(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_gt_long(&T_check_instance, a, e); \
}
-void T_check_le_long(long, const T_check_context *, long);
+void T_check_le_long(const T_check_context *, long, long);
#define T_flags_le_long(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_le_long(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_le_long(&T_check_instance, a, e); \
}
-void T_check_lt_long(long, const T_check_context *, long);
+void T_check_lt_long(const T_check_context *, long, long);
#define T_flags_lt_long(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_lt_long(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_lt_long(&T_check_instance, a, e); \
}
-void T_check_eq_ulong(unsigned long, const T_check_context *, unsigned long);
+void T_check_eq_ulong(const T_check_context *, unsigned long, unsigned long);
#define T_flags_eq_ulong(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_ulong(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_ulong(&T_check_instance, a, e); \
}
-void T_check_ne_ulong(unsigned long, const T_check_context *, unsigned long);
+void T_check_ne_ulong(const T_check_context *, unsigned long, unsigned long);
#define T_flags_ne_ulong(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_ulong(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_ulong(&T_check_instance, a, e); \
}
-void T_check_ge_ulong(unsigned long, const T_check_context *, unsigned long);
+void T_check_ge_ulong(const T_check_context *, unsigned long, unsigned long);
#define T_flags_ge_ulong(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ge_ulong(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ge_ulong(&T_check_instance, a, e); \
}
-void T_check_gt_ulong(unsigned long, const T_check_context *, unsigned long);
+void T_check_gt_ulong(const T_check_context *, unsigned long, unsigned long);
#define T_flags_gt_ulong(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_gt_ulong(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_gt_ulong(&T_check_instance, a, e); \
}
-void T_check_le_ulong(unsigned long, const T_check_context *, unsigned long);
+void T_check_le_ulong(const T_check_context *, unsigned long, unsigned long);
#define T_flags_le_ulong(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_le_ulong(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_le_ulong(&T_check_instance, a, e); \
}
-void T_check_lt_ulong(unsigned long, const T_check_context *, unsigned long);
+void T_check_lt_ulong(const T_check_context *, unsigned long, unsigned long);
#define T_flags_lt_ulong(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_lt_ulong(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_lt_ulong(&T_check_instance, a, e); \
}
-void T_check_eq_ll(long long, const T_check_context *, long long);
+void T_check_eq_ll(const T_check_context *, long long, long long);
#define T_flags_eq_ll(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_ll(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_ll(&T_check_instance, a, e); \
}
-void T_check_ne_ll(long long, const T_check_context *, long long);
+void T_check_ne_ll(const T_check_context *, long long, long long);
#define T_flags_ne_ll(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_ll(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_ll(&T_check_instance, a, e); \
}
-void T_check_ge_ll(long long, const T_check_context *, long long);
+void T_check_ge_ll(const T_check_context *, long long, long long);
#define T_flags_ge_ll(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ge_ll(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ge_ll(&T_check_instance, a, e); \
}
-void T_check_gt_ll(long long, const T_check_context *, long long);
+void T_check_gt_ll(const T_check_context *, long long, long long);
#define T_flags_gt_ll(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_gt_ll(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_gt_ll(&T_check_instance, a, e); \
}
-void T_check_le_ll(long long, const T_check_context *, long long);
+void T_check_le_ll(const T_check_context *, long long, long long);
#define T_flags_le_ll(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_le_ll(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_le_ll(&T_check_instance, a, e); \
}
-void T_check_lt_ll(long long, const T_check_context *, long long);
+void T_check_lt_ll(const T_check_context *, long long, long long);
#define T_flags_lt_ll(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_lt_ll(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_lt_ll(&T_check_instance, a, e); \
}
-void T_check_eq_ull(unsigned long long, const T_check_context *,
+void T_check_eq_ull(const T_check_context *, unsigned long long,
unsigned long long);
#define T_flags_eq_ull(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eq_ull(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eq_ull(&T_check_instance, a, e); \
}
-void T_check_ne_ull(unsigned long long, const T_check_context *,
+void T_check_ne_ull(const T_check_context *, unsigned long long,
unsigned long long);
#define T_flags_ne_ull(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ne_ull(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ne_ull(&T_check_instance, a, e); \
}
-void T_check_ge_ull(unsigned long long, const T_check_context *,
+void T_check_ge_ull(const T_check_context *, unsigned long long,
unsigned long long);
#define T_flags_ge_ull(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_ge_ull(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_ge_ull(&T_check_instance, a, e); \
}
-void T_check_gt_ull(unsigned long long, const T_check_context *,
+void T_check_gt_ull(const T_check_context *, unsigned long long,
unsigned long long);
#define T_flags_gt_ull(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_gt_ull(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_gt_ull(&T_check_instance, a, e); \
}
-void T_check_le_ull(unsigned long long, const T_check_context *,
+void T_check_le_ull(const T_check_context *, unsigned long long,
unsigned long long);
#define T_flags_le_ull(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_le_ull(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_le_ull(&T_check_instance, a, e); \
}
-void T_check_lt_ull(unsigned long long, const T_check_context *,
+void T_check_lt_ull(const T_check_context *, unsigned long long,
unsigned long long);
#define T_flags_lt_ull(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_lt_ull(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_lt_ull(&T_check_instance, a, e); \
}
-void T_check_eno(int, const T_check_context *, int);
+void T_check_eno(const T_check_context *, int, int);
#define T_flags_eno(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eno(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eno(&T_check_instance, a, e); \
}
-void T_check_eno_success(int, const T_check_context *);
+void T_check_eno_success(const T_check_context *, int);
#define T_flags_eno_success(a, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_eno_success(a, &T_check_instance); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_eno_success(&T_check_instance, a); \
}
-void T_check_psx_error(int, const T_check_context *, int);
+void T_check_psx_error(const T_check_context *, int, int);
#define T_flags_psx_error(a, eno, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_psx_error(a, &T_check_instance, eno); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_psx_error(&T_check_instance, a, eno); \
}
-void T_check_psx_success(int, const T_check_context *);
+void T_check_psx_success(const T_check_context *, int);
#define T_flags_psx_success(a, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_psx_success(a, &T_check_instance); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_psx_success(&T_check_instance, a); \
}
/** @} */
@@ -2064,22 +2070,22 @@ const char *T_strerror(int);
/** @} */
#ifdef __rtems__
-void T_check_rsc(uint32_t, const T_check_context *, uint32_t);
+void T_check_rsc(const T_check_context *, uint32_t, uint32_t);
#define T_flags_rsc(a, e, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_rsc(a, &T_check_instance, e); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_rsc(&T_check_instance, a, e); \
}
-void T_check_rsc_success(uint32_t, const T_check_context *);
+void T_check_rsc_success(const T_check_context *, uint32_t);
#define T_flags_rsc_success(a, flags) \
{ \
static const T_check_context T_check_instance = { \
- T_FILE_NAME, __LINE__, flags }; \
- T_check_rsc_success(a, &T_check_instance); \
+ T_FILE_NAME, __LINE__, (flags) | T_CHECK_FMT }; \
+ T_check_rsc_success(&T_check_instance, a); \
}
/**
diff --git a/cpukit/libtest/t-test-checks-eno.c b/cpukit/libtest/t-test-checks-eno.c
index d18a3bd273..b80f1d110c 100644
--- a/cpukit/libtest/t-test-checks-eno.c
+++ b/cpukit/libtest/t-test-checks-eno.c
@@ -134,12 +134,12 @@ const char *T_strerror(int eno)
}
}
-void T_check_eno(int a, const T_check_context *t, int e)
+void T_check_eno(const T_check_context *t, int a, int e)
{
- T_check_true(a == e, t, "%s == %s", T_strerror(a), T_strerror(e));
+ T_check(t, a == e, "%s == %s", T_strerror(a), T_strerror(e));
}
-void T_check_eno_success(int a, const T_check_context *t)
+void T_check_eno_success(const T_check_context *t, int a)
{
- T_check_eno(a, t, 0);
+ T_check_eno(t, a, 0);
}
diff --git a/cpukit/libtest/t-test-checks-psx.c b/cpukit/libtest/t-test-checks-psx.c
index e14ce65246..fe2b375b8f 100644
--- a/cpukit/libtest/t-test-checks-psx.c
+++ b/cpukit/libtest/t-test-checks-psx.c
@@ -2,16 +2,16 @@
#include <errno.h>
-void T_check_psx_error(int a, const T_check_context *t, int eeno)
+void T_check_psx_error(const T_check_context *t, int a, int eeno)
{
int aeno;
aeno = errno;
- T_check_true(a == -1 && aeno == eeno, t, "%i == -1, %s == %s", a,
+ T_check(t, a == -1 && aeno == eeno, "%i == -1, %s == %s", a,
T_strerror(aeno), T_strerror(eeno));
}
-void T_check_psx_success(int a, const T_check_context *t)
+void T_check_psx_success(const T_check_context *t, int a)
{
- T_check_true(a == 0, t, "%i == 0, %s", a, T_strerror(errno));
+ T_check(t, a == 0, "%i == 0, %s", a, T_strerror(errno));
}
diff --git a/cpukit/libtest/t-test-checks.c b/cpukit/libtest/t-test-checks.c
index 7824fa54c1..c86596521b 100644
--- a/cpukit/libtest/t-test-checks.c
+++ b/cpukit/libtest/t-test-checks.c
@@ -30,299 +30,299 @@
#include <inttypes.h>
void
-T_check_eq_ptr(const void *a, const T_check_context_msg *t, const void *e)
+T_check_eq_ptr(const T_check_context_msg *t, const void *a, const void *e)
{
- T_check_true(a == e, &t->base, "%s", t->msg);
+ T_check(&t->base, a == e, "%s", t->msg);
}
void
-T_check_ne_ptr(const void *a, const T_check_context_msg *t, const void *e)
+T_check_ne_ptr(const T_check_context_msg *t, const void *a, const void *e)
{
- T_check_true(a != e, &t->base, "%s", t->msg);
+ T_check(&t->base, a != e, "%s", t->msg);
}
void
-T_check_null(const void *a, const T_check_context_msg *t)
+T_check_null(const T_check_context_msg *t, const void *a)
{
- T_check_true(a == NULL, &t->base, "%s == NULL", t->msg);
+ T_check(&t->base, a == NULL, "%s == NULL", t->msg);
}
void
-T_check_not_null(const void *a, const T_check_context_msg *t)
+T_check_not_null(const T_check_context_msg *t, const void *a)
{
- T_check_true(a != NULL, &t->base, "%s != NULL", t->msg);
+ T_check(&t->base, a != NULL, "%s != NULL", t->msg);
}
void
-T_check_eq_mem(const void *a, const T_check_context_msg *t, const void *e,
+T_check_eq_mem(const T_check_context_msg *t, const void *a, const void *e,
size_t n)
{
- T_check_true(memcmp(a, e, n) == 0, &t->base, "%s", t->msg);
+ T_check(&t->base, memcmp(a, e, n) == 0, "%s", t->msg);
}
void
-T_check_ne_mem(const void *a, const T_check_context_msg *t, const void *e,
+T_check_ne_mem(const T_check_context_msg *t, const void *a, const void *e,
size_t n)
{
- T_check_true(memcmp(a, e, n) != 0, &t->base, "%s", t->msg);
+ T_check(&t->base, memcmp(a, e, n) != 0, "%s", t->msg);
}
void
-T_check_eq_str(const char *a, const T_check_context *t, const char *e)
+T_check_eq_str(const T_check_context *t, const char *a, const char *e)
{
- T_check_true(strcmp(a, e) == 0, t, "\"%s\" == \"%s\"", a, e);
+ T_check(t, strcmp(a, e) == 0, "\"%s\" == \"%s\"", a, e);
}
void
-T_check_ne_str(const char *a, const T_check_context *t, const char *e)
+T_check_ne_str(const T_check_context *t, const char *a, const char *e)
{
- T_check_true(strcmp(a, e) != 0, t, "\"%s\" != \"%s\"", a, e);
+ T_check(t, strcmp(a, e) != 0, "\"%s\" != \"%s\"", a, e);
}
void
-T_check_eq_nstr(const char *a, const T_check_context *t, const char *e, size_t n)
+T_check_eq_nstr(const T_check_context *t, const char *a, const char *e, size_t n)
{
- T_check_true(strncmp(a, e, n) == 0, t, "\"%.*s\" == \"%.*s\"", (int)n, a,
+ T_check(t, strncmp(a, e, n) == 0, "\"%.*s\" == \"%.*s\"", (int)n, a,
(int)n, e);
}
void
-T_check_ne_nstr(const char *a, const T_check_context *t, const char *e, size_t n)
+T_check_ne_nstr(const T_check_context *t, const char *a, const char *e, size_t n)
{
- T_check_true(strncmp(a, e, n) != 0, t, "\"%.*s\" != \"%.*s\"", (int)n, a,
+ T_check(t, strncmp(a, e, n) != 0, "\"%.*s\" != \"%.*s\"", (int)n, a,
(int)n, e);
}
void
-T_check_eq_char(char a, const T_check_context *t, char e)
+T_check_eq_char(const T_check_context *t, char a, char e)
{
- T_check_true(a == e, t, "'%c' == '%c'", a, e);
+ T_check(t, a == e, "'%c' == '%c'", a, e);
}
void
-T_check_ne_char(char a, const T_check_context *t, char e)
+T_check_ne_char(const T_check_context *t, char a, char e)
{
- T_check_true(a != e, t, "'%c' != '%c'", a, e);
+ T_check(t, a != e, "'%c' != '%c'", a, e);
}
void
-T_check_eq_int(int a, const T_check_context *t, int e)
+T_check_eq_int(const T_check_context *t, int a, int e)
{
- T_check_true(a == e, t, "%i == %i", a, e);
+ T_check(t, a == e, "%i == %i", a, e);
}
void
-T_check_ne_int(int a, const T_check_context *t, int e)
+T_check_ne_int(const T_check_context *t, int a, int e)
{
- T_check_true(a != e, t, "%i != %i", a, e);
+ T_check(t, a != e, "%i != %i", a, e);
}
void
-T_check_ge_int(int a, const T_check_context *t, int e)
+T_check_ge_int(const T_check_context *t, int a, int e)
{
- T_check_true(a >= e, t, "%i >= %i", a, e);
+ T_check(t, a >= e, "%i >= %i", a, e);
}
void
-T_check_gt_int(int a, const T_check_context *t, int e)
+T_check_gt_int(const T_check_context *t, int a, int e)
{
- T_check_true(a > e, t, "%i > %i", a, e);
+ T_check(t, a > e, "%i > %i", a, e);
}
void
-T_check_le_int(int a, const T_check_context *t, int e)
+T_check_le_int(const T_check_context *t, int a, int e)
{
- T_check_true(a <= e, t, "%i <= %i", a, e);
+ T_check(t, a <= e, "%i <= %i", a, e);
}
void
-T_check_lt_int(int a, const T_check_context *t, int e)
+T_check_lt_int(const T_check_context *t, int a, int e)
{
- T_check_true(a < e, t, "%i < %i", a, e);
+ T_check(t, a < e, "%i < %i", a, e);
}
void
-T_check_eq_uint(unsigned int a, const T_check_context *t, unsigned int e)
+T_check_eq_uint(const T_check_context *t, unsigned int a, unsigned int e)
{
- T_check_true(a == e, t, "%u == %u", a, e);
+ T_check(t, a == e, "%u == %u", a, e);
}
void
-T_check_ne_uint(unsigned int a, const T_check_context *t, unsigned int e)
+T_check_ne_uint(const T_check_context *t, unsigned int a, unsigned int e)
{
- T_check_true(a != e, t, "%u != %u", a, e);
+ T_check(t, a != e, "%u != %u", a, e);
}
void
-T_check_ge_uint(unsigned int a, const T_check_context *t, unsigned int e)
+T_check_ge_uint(const T_check_context *t, unsigned int a, unsigned int e)
{
- T_check_true(a >= e, t, "%u >= %u", a, e);
+ T_check(t, a >= e, "%u >= %u", a, e);
}
void
-T_check_gt_uint(unsigned int a, const T_check_context *t, unsigned int e)
+T_check_gt_uint(const T_check_context *t, unsigned int a, unsigned int e)
{
- T_check_true(a > e, t, "%u > %u", a, e);
+ T_check(t, a > e, "%u > %u", a, e);
}
void
-T_check_le_uint(unsigned int a, const T_check_context *t, unsigned int e)
+T_check_le_uint(const T_check_context *t, unsigned int a, unsigned int e)
{
- T_check_true(a <= e, t, "%u <= %u", a, e);
+ T_check(t, a <= e, "%u <= %u", a, e);
}
void
-T_check_lt_uint(unsigned int a, const T_check_context *t, unsigned int e)
+T_check_lt_uint(const T_check_context *t, unsigned int a, unsigned int e)
{
- T_check_true(a < e, t, "%u < %u", a, e);
+ T_check(t, a < e, "%u < %u", a, e);
}
void
-T_check_eq_long(long a, const T_check_context *t, long e)
+T_check_eq_long(const T_check_context *t, long a, long e)
{
- T_check_true(a == e, t, "%li == %li", a, e);
+ T_check(t, a == e, "%li == %li", a, e);
}
void
-T_check_ne_long(long a, const T_check_context *t, long e)
+T_check_ne_long(const T_check_context *t, long a, long e)
{
- T_check_true(a != e, t, "%li != %li", a, e);
+ T_check(t, a != e, "%li != %li", a, e);
}
void
-T_check_ge_long(long a, const T_check_context *t, long e)
+T_check_ge_long(const T_check_context *t, long a, long e)
{
- T_check_true(a >= e, t, "%li >= %li", a, e);
+ T_check(t, a >= e, "%li >= %li", a, e);
}
void
-T_check_gt_long(long a, const T_check_context *t, long e)
+T_check_gt_long(const T_check_context *t, long a, long e)
{
- T_check_true(a > e, t, "%li > %li", a, e);
+ T_check(t, a > e, "%li > %li", a, e);
}
void
-T_check_le_long(long a, const T_check_context *t, long e)
+T_check_le_long(const T_check_context *t, long a, long e)
{
- T_check_true(a <= e, t, "%li <= %li", a, e);
+ T_check(t, a <= e, "%li <= %li", a, e);
}
void
-T_check_lt_long(long a, const T_check_context *t, long e)
+T_check_lt_long(const T_check_context *t, long a, long e)
{
- T_check_true(a < e, t, "%li < %li", a, e);
+ T_check(t, a < e, "%li < %li", a, e);
}
void
-T_check_eq_ulong(unsigned long a, const T_check_context *t, unsigned long e)
+T_check_eq_ulong(const T_check_context *t, unsigned long a, unsigned long e)
{
- T_check_true(a == e, t, "%lu == %lu", a, e);
+ T_check(t, a == e, "%lu == %lu", a, e);
}
void
-T_check_ne_ulong(unsigned long a, const T_check_context *t, unsigned long e)
+T_check_ne_ulong(const T_check_context *t, unsigned long a, unsigned long e)
{
- T_check_true(a != e, t, "%lu != %lu", a, e);
+ T_check(t, a != e, "%lu != %lu", a, e);
}
void
-T_check_ge_ulong(unsigned long a, const T_check_context *t, unsigned long e)
+T_check_ge_ulong(const T_check_context *t, unsigned long a, unsigned long e)
{
- T_check_true(a >= e, t, "%lu >= %lu", a, e);
+ T_check(t, a >= e, "%lu >= %lu", a, e);
}
void
-T_check_gt_ulong(unsigned long a, const T_check_context *t, unsigned long e)
+T_check_gt_ulong(const T_check_context *t, unsigned long a, unsigned long e)
{
- T_check_true(a > e, t, "%lu > %lu", a, e);
+ T_check(t, a > e, "%lu > %lu", a, e);
}
void
-T_check_le_ulong(unsigned long a, const T_check_context *t, unsigned long e)
+T_check_le_ulong(const T_check_context *t, unsigned long a, unsigned long e)
{
- T_check_true(a <= e, t, "%lu <= %lu", a, e);
+ T_check(t, a <= e, "%lu <= %lu", a, e);
}
void
-T_check_lt_ulong(unsigned long a, const T_check_context *t, unsigned long e)
+T_check_lt_ulong(const T_check_context *t, unsigned long a, unsigned long e)
{
- T_check_true(a < e, t, "%lu < %lu", a, e);
+ T_check(t, a < e, "%lu < %lu", a, e);
}
void
-T_check_eq_ll(long long a, const T_check_context *t, long long e)
+T_check_eq_ll(const T_check_context *t, long long a, long long e)
{
- T_check_true(a == e, t, "%lli == %lli", a, e);
+ T_check(t, a == e, "%lli == %lli", a, e);
}
void
-T_check_ne_ll(long long a, const T_check_context *t, long long e)
+T_check_ne_ll(const T_check_context *t, long long a, long long e)
{
- T_check_true(a != e, t, "%lli != %lli", a, e);
+ T_check(t, a != e, "%lli != %lli", a, e);
}
void
-T_check_ge_ll(long long a, const T_check_context *t, long long e)
+T_check_ge_ll(const T_check_context *t, long long a, long long e)
{
- T_check_true(a >= e, t, "%lli >= %lli", a, e);
+ T_check(t, a >= e, "%lli >= %lli", a, e);
}
void
-T_check_gt_ll(long long a, const T_check_context *t, long long e)
+T_check_gt_ll(const T_check_context *t, long long a, long long e)
{
- T_check_true(a > e, t, "%lli > %lli", a, e);
+ T_check(t, a > e, "%lli > %lli", a, e);
}
void
-T_check_le_ll(long long a, const T_check_context *t, long long e)
+T_check_le_ll(const T_check_context *t, long long a, long long e)
{
- T_check_true(a <= e, t, "%lli <= %lli", a, e);
+ T_check(t, a <= e, "%lli <= %lli", a, e);
}
void
-T_check_lt_ll(long long a, const T_check_context *t, long long e)
+T_check_lt_ll(const T_check_context *t, long long a, long long e)
{
- T_check_true(a < e, t, "%lli < %lli", a, e);
+ T_check(t, a < e, "%lli < %lli", a, e);
}
void
-T_check_eq_ull(unsigned long long a, const T_check_context *t,
+T_check_eq_ull(const T_check_context *t, unsigned long long a,
unsigned long long e)
{
- T_check_true(a == e, t, "%llu == %llu", a, e);
+ T_check(t, a == e, "%llu == %llu", a, e);
}
void
-T_check_ne_ull(unsigned long long a, const T_check_context *t,
+T_check_ne_ull(const T_check_context *t, unsigned long long a,
unsigned long long e)
{
- T_check_true(a != e, t, "%llu != %llu", a, e);
+ T_check(t, a != e, "%llu != %llu", a, e);
}
void
-T_check_ge_ull(unsigned long long a, const T_check_context *t,
+T_check_ge_ull(const T_check_context *t, unsigned long long a,
unsigned long long e)
{
- T_check_true(a >= e, t, "%llu >= %llu", a, e);
+ T_check(t, a >= e, "%llu >= %llu", a, e);
}
void
-T_check_gt_ull(unsigned long long a, const T_check_context *t,
+T_check_gt_ull(const T_check_context *t, unsigned long long a,
unsigned long long e)
{
- T_check_true(a > e, t, "%llu > %llu", a, e);
+ T_check(t, a > e, "%llu > %llu", a, e);
}
void
-T_check_le_ull(unsigned long long a, const T_check_context *t,
+T_check_le_ull(const T_check_context *t, unsigned long long a,
unsigned long long e)
{
- T_check_true(a <= e, t, "%llu <= %llu", a, e);
+ T_check(t, a <= e, "%llu <= %llu", a, e);
}
void
-T_check_lt_ull(unsigned long long a, const T_check_context *t,
+T_check_lt_ull(const T_check_context *t, unsigned long long a,
unsigned long long e)
{
- T_check_true(a < e, t, "%llu < %llu", a, e);
+ T_check(t, a < e, "%llu < %llu", a, e);
}
diff --git a/cpukit/libtest/t-test-rtems-context.c b/cpukit/libtest/t-test-rtems-context.c
index 10f7322d92..5fce029f7c 100644
--- a/cpukit/libtest/t-test-rtems-context.c
+++ b/cpukit/libtest/t-test-rtems-context.c
@@ -41,15 +41,15 @@ T_do_check_task_context(void)
uint32_t v;
v = _Per_CPU_Get_snapshot()->thread_dispatch_disable_level;
- T_check_true(v == 0, NULL,
+ T_check(&T_special, v == 0,
"Wrong thread dispatch disabled level (%" PRIu32 ")", v);
v = _Per_CPU_Get_snapshot()->isr_nest_level;
- T_check_true(v == 0, NULL,
+ T_check(&T_special, v == 0,
"Wrong ISR nest level (%" PRIu32 ")", v);
v = _ISR_Get_level();
- T_check_true(v == 0, NULL,
+ T_check(&T_special, v == 0,
"Wrong ISR level (%" PRIu32 ")", v);
}
diff --git a/cpukit/libtest/t-test-rtems-fds.c b/cpukit/libtest/t-test-rtems-fds.c
index 57957925ad..8d3ac882e9 100644
--- a/cpukit/libtest/t-test-rtems-fds.c
+++ b/cpukit/libtest/t-test-rtems-fds.c
@@ -61,7 +61,8 @@ T_check_open_fds(void)
if (delta != 0) {
T_open_fds = open_fds;
- T_check_true(false, NULL, "file descriptor leak (%+i)", delta);
+ T_check(&T_special, false, "file descriptor leak (%+i)",
+ delta);
}
}
diff --git a/cpukit/libtest/t-test-rtems-heap.c b/cpukit/libtest/t-test-rtems-heap.c
index 6d3204ab33..9b9e8a73ec 100644
--- a/cpukit/libtest/t-test-rtems-heap.c
+++ b/cpukit/libtest/t-test-rtems-heap.c
@@ -79,7 +79,7 @@ T_heap_case_end(void)
where = "workspace";
}
- T_check_true(ok, NULL, "memory leak in %s", where);
+ T_check(&T_special, ok, "memory leak in %s", where);
memcpy(&ctx->workspace_info, &info, sizeof(info));
}
@@ -88,7 +88,7 @@ T_heap_case_end(void)
ok = memcmp(&info, &ctx->heap_info, sizeof(info)) == 0;
if (!ok) {
- T_check_true(ok, NULL, "memory leak in heap");
+ T_check(&T_special, ok, "memory leak in heap");
memcpy(&ctx->heap_info, &info, sizeof(info));
}
}
diff --git a/cpukit/libtest/t-test-rtems-objs.c b/cpukit/libtest/t-test-rtems-objs.c
index 72447fd22f..ed7222e98e 100644
--- a/cpukit/libtest/t-test-rtems-objs.c
+++ b/cpukit/libtest/t-test-rtems-objs.c
@@ -76,7 +76,8 @@ T_objects_check(Objects_APIs api, uint16_t cls,
if (delta != 0) {
*expected = count;
- T_check_true(false, NULL, "%s leak (%" PRIi32 ")", name, delta);
+ T_check(&T_special, false, "%s leak (%" PRIi32 ")", name,
+ delta);
}
}
diff --git a/cpukit/libtest/t-test-rtems-posix-keys.c b/cpukit/libtest/t-test-rtems-posix-keys.c
index 0769f68ba8..3046fbb6c8 100644
--- a/cpukit/libtest/t-test-rtems-posix-keys.c
+++ b/cpukit/libtest/t-test-rtems-posix-keys.c
@@ -93,7 +93,8 @@ T_posix_keys_case_end(void)
if (delta != 0) {
T_posix_key_value_count = count;
- T_check_true(false, NULL, "POSIX key value pair leak (%zi)", delta);
+ T_check(&T_special, false, "POSIX key value pair leak (%zi)",
+ delta);
}
}
diff --git a/cpukit/libtest/t-test-rtems.c b/cpukit/libtest/t-test-rtems.c
index f8e2b4b747..8ca5a089df 100644
--- a/cpukit/libtest/t-test-rtems.c
+++ b/cpukit/libtest/t-test-rtems.c
@@ -38,14 +38,14 @@ T_putchar_default(int c, void *arg)
}
void
-T_check_rsc(uint32_t a, const T_check_context *t, uint32_t e)
+T_check_rsc(const T_check_context *t, uint32_t a, uint32_t e)
{
- T_check_true(a == e, t, "%s == %s", rtems_status_text(a),
+ T_check(t, a == e, "%s == %s", rtems_status_text(a),
rtems_status_text(e));
}
void
-T_check_rsc_success(uint32_t a, const T_check_context *t)
+T_check_rsc_success(const T_check_context *t, uint32_t a)
{
- T_check_rsc(a, t, RTEMS_SUCCESSFUL);
+ T_check_rsc(t, a, RTEMS_SUCCESSFUL);
}
diff --git a/cpukit/libtest/t-test.c b/cpukit/libtest/t-test.c
index 4c5746fc5c..999b8770d0 100644
--- a/cpukit/libtest/t-test.c
+++ b/cpukit/libtest/t-test.c
@@ -86,6 +86,12 @@ typedef struct {
static T_context T_instance;
+const T_check_context T_special = {
+ .file = "*",
+ .line = -1,
+ .flags = T_CHECK_FMT | T_CHECK_QUIET
+};
+
typedef struct {
char *s;
size_t n;
@@ -462,7 +468,8 @@ void T_plan(unsigned int planned_steps)
success = atomic_compare_exchange_strong_explicit(&ctx->planned_steps,
&expected, planned_steps, memory_order_relaxed,
memory_order_relaxed);
- T_check_true(success, NULL, "planned steps (%u) already set", expected);
+ T_check(&T_special, success, "planned steps (%u) already set",
+ expected);
}
void
@@ -529,68 +536,65 @@ T_file(const T_check_context *t)
}
void
-T_check_true(bool ok, const T_check_context *t, const char *fmt, ...)
+T_check(const T_check_context *t, bool ok, ...)
{
T_context *ctx;
va_list ap;
char scope[T_SCOPE_SIZE];
+ unsigned int step;
ctx = &T_instance;
- if (t != NULL) {
- unsigned int step;
+ if ((t->flags & T_CHECK_QUIET) == 0) {
+ step = T_fetch_add_step(ctx);
+ } else {
+ step = UINT_MAX;
+ }
- if ((t->flags & T_CHECK_QUIET) == 0) {
- step = T_fetch_add_step(ctx);
- } else {
- step = UINT_MAX;
- }
+ if ((t->flags & T_CHECK_STEP_FLAG) != 0 &&
+ step != T_CHECK_STEP_FROM_FLAGS(t->flags)) {
+ T_add_failure(ctx);
+ T_printf("F:%u:%i:%s:%s:%i:planned step (%u)\n", step,
+ T_cpu(), T_scope(ctx, scope), T_file(t), t->line,
+ T_CHECK_STEP_FROM_FLAGS(t->flags));
+ } else if (!ok) {
+ T_add_failure(ctx);
+
+ if (ctx->verbosity >= T_NORMAL) {
+ if ((t->flags & T_CHECK_QUIET) == 0) {
+ T_printf("F:%u:%i:%s:%s:%i",
+ step, T_cpu(), T_scope(ctx, scope),
+ T_file(t), t->line);
+ } else if (t->line >= 0) {
+ T_printf("F:*:%i:%s:%s:%i", T_cpu(),
+ T_scope(ctx, scope), T_file(t),
+ t->line);
+ } else {
+ T_printf("F:*:%i:%s:%s:*", T_cpu(),
+ T_scope(ctx, scope), T_file(t));
+ }
+
+ if ((t->flags & T_CHECK_FMT) != 0) {
+ const char *fmt;
- if ((t->flags & T_CHECK_STEP_FLAG) != 0 &&
- step != T_CHECK_STEP_FROM_FLAGS(t->flags)) {
- T_add_failure(ctx);
- T_printf("F:%u:%i:%s:%s:%i:planned step (%u)\n", step,
- T_cpu(), T_scope(ctx, scope), T_file(t), t->line,
- T_CHECK_STEP_FROM_FLAGS(t->flags));
- } else if (!ok) {
- T_add_failure(ctx);
-
- if (ctx->verbosity >= T_NORMAL) {
- if ((t->flags & T_CHECK_QUIET) == 0) {
- T_printf("F:%u:%i:%s:%s:%i:",
- step, T_cpu(), T_scope(ctx, scope),
- T_file(t), t->line);
- } else {
- T_printf("F:*:%i:%s:%s:%i:", T_cpu(),
- T_scope(ctx, scope), T_file(t),
- t->line);
- }
-
- va_start(ap, fmt);
+ T_printf(":");
+
+ va_start(ap, ok);
+ fmt = va_arg(ap, const char *);
T_vprintf(fmt, ap);
va_end(ap);
-
- T_printf("\n");
}
- if ((t->flags & T_CHECK_STOP) != 0) {
- T_do_stop(ctx);
- }
- } else if ((t->flags & T_CHECK_QUIET) == 0 &&
- ctx->verbosity >= T_VERBOSE) {
- T_printf("P:%u:%i:%s:%s:%i\n", step, T_cpu(),
- T_scope(ctx, scope), T_file(t), t->line);
+ T_printf("\n");
}
- } else if (!ok) {
- T_add_failure(ctx);
-
- T_printf("F:*:%i:%s:*:*:", T_cpu(), T_scope(ctx, scope));
- va_start(ap, fmt);
- T_vprintf(fmt, ap);
- va_end(ap);
-
- T_printf("\n");
+ if ((t->flags & T_CHECK_STOP) != 0) {
+ T_do_stop(ctx);
+ }
+ } else if ((t->flags & T_CHECK_QUIET) == 0 &&
+ ctx->verbosity >= T_VERBOSE) {
+ T_printf("P:%u:%i:%s:%s:%i\n", step, T_cpu(),
+ T_scope(ctx, scope), T_file(t), t->line);
}
}
--
2.26.2
More information about the devel
mailing list