diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-17 21:21:16 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-23 09:27:47 +0200 |
commit | 77814040262f2ae1a479f94d962139d68052b743 (patch) | |
tree | 24775331ece5294692e2b54ae5ed3f3bb5f2b366 | |
parent | 34e4df55901e88454029af8fe57f3c585a43b3ac (diff) |
libtest: Add T_stop()
Update #3199.
-rw-r--r-- | cpukit/include/rtems/test.h | 8 | ||||
-rw-r--r-- | cpukit/libtest/t-test.c | 12 |
2 files changed, 17 insertions, 3 deletions
diff --git a/cpukit/include/rtems/test.h b/cpukit/include/rtems/test.h index 09afc29593..8af810def7 100644 --- a/cpukit/include/rtems/test.h +++ b/cpukit/include/rtems/test.h @@ -95,6 +95,12 @@ typedef struct T_fixture_node { * @{ */ +#ifdef __cplusplus +#define T_NO_RETURN [[ noreturn ]] +#else +#define T_NO_RETURN _Noreturn +#endif + typedef struct T_case_context { const char *name; void (*body)(void); @@ -2243,6 +2249,8 @@ void *T_push_fixture(T_fixture_node *, const T_fixture *); void T_pop_fixture(void); +T_NO_RETURN void T_stop(void); + /** * @brief Gets the scope for nested fixtures. * diff --git a/cpukit/libtest/t-test.c b/cpukit/libtest/t-test.c index e74b4d3495..4c5746fc5c 100644 --- a/cpukit/libtest/t-test.c +++ b/cpukit/libtest/t-test.c @@ -423,8 +423,8 @@ T_add_failure(T_context *ctx) memory_order_relaxed); } -static void -T_stop(T_context *ctx) +T_NO_RETURN static void +T_do_stop(T_context *ctx) { T_fixture_node *node; @@ -445,6 +445,12 @@ T_stop(T_context *ctx) longjmp(ctx->case_begin_context, 1); } +T_NO_RETURN void +T_stop(void) +{ + T_do_stop(&T_instance); +} + void T_plan(unsigned int planned_steps) { T_context *ctx; @@ -568,7 +574,7 @@ T_check_true(bool ok, const T_check_context *t, const char *fmt, ...) } if ((t->flags & T_CHECK_STOP) != 0) { - T_stop(ctx); + T_do_stop(ctx); } } else if ((t->flags & T_CHECK_QUIET) == 0 && ctx->verbosity >= T_VERBOSE) { |