summaryrefslogtreecommitdiffstats
path: root/cpukit/libtest
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-18 16:05:42 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-23 09:27:47 +0200
commit35d9af6901647871612cc278ba28792e23708357 (patch)
treed1755e65e804af95d0396495fa39e50eecc04fca /cpukit/libtest
parentlibtest: Add T_stop() (diff)
downloadrtems-35d9af6901647871612cc278ba28792e23708357.tar.bz2
libtest: Add T_CHECK_FMT
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.
Diffstat (limited to 'cpukit/libtest')
-rw-r--r--cpukit/libtest/t-test-checks-eno.c8
-rw-r--r--cpukit/libtest/t-test-checks-psx.c8
-rw-r--r--cpukit/libtest/t-test-checks.c192
-rw-r--r--cpukit/libtest/t-test-rtems-context.c6
-rw-r--r--cpukit/libtest/t-test-rtems-fds.c3
-rw-r--r--cpukit/libtest/t-test-rtems-heap.c4
-rw-r--r--cpukit/libtest/t-test-rtems-objs.c3
-rw-r--r--cpukit/libtest/t-test-rtems-posix-keys.c3
-rw-r--r--cpukit/libtest/t-test-rtems.c8
-rw-r--r--cpukit/libtest/t-test.c100
10 files changed, 171 insertions, 164 deletions
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);
}
}