summaryrefslogtreecommitdiffstats
path: root/cpukit/libtest/t-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libtest/t-test.c')
-rw-r--r--cpukit/libtest/t-test.c51
1 files changed, 46 insertions, 5 deletions
diff --git a/cpukit/libtest/t-test.c b/cpukit/libtest/t-test.c
index 0935a5ceb1..1230505edf 100644
--- a/cpukit/libtest/t-test.c
+++ b/cpukit/libtest/t-test.c
@@ -1,7 +1,16 @@
-/*
- * SPDX-License-Identifier: BSD-2-Clause
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestFrameworkImpl
*
- * Copyright (C) 2018, 2020 embedded brains GmbH
+ * @brief This source file contains the core implementation of RTEMS Test
+ * Framework.
+ */
+
+/*
+ * Copyright (C) 2018, 2023 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,7 +46,7 @@
#include <stdatomic.h>
#ifdef __rtems__
-#include <rtems/score/io.h>
+#include <rtems/dev/io.h>
#include <rtems/score/percpu.h>
#include <rtems/score/smp.h>
#include <rtems/score/threadimpl.h>
@@ -47,7 +56,7 @@
#include "t-test-printf.h"
#endif /* __rtems__ */
-#define T_LINE_SIZE 128
+#define T_LINE_SIZE 256
typedef struct {
pthread_spinlock_t lock;
@@ -63,6 +72,7 @@ typedef struct {
T_fixture_node *fixtures;
T_fixture_node case_fixture;
LIST_HEAD(, T_destructor) destructors;
+ T_remark remarks;
T_time case_begin_time;
atomic_uint planned_steps;
atomic_uint steps;
@@ -922,6 +932,23 @@ T_call_destructors(const T_context *ctx)
#endif
}
+static void
+T_make_remarks(T_context *ctx)
+{
+ T_remark *remark;
+
+ remark = ctx->remarks.next;
+
+ while (remark != &ctx->remarks) {
+ T_remark *current;
+
+ current = remark;
+ remark = current->next;
+ current->next = NULL;
+ T_do_log(ctx, T_QUIET, "R:%s\n", current->remark);
+ }
+}
+
static T_context *
T_do_run_initialize(const T_config *config)
{
@@ -973,6 +1000,7 @@ T_do_case_begin(T_context *ctx, const T_case_context *tc)
ctx->current_case = tc;
ctx->fixtures = &ctx->case_fixture;
LIST_INIT(&ctx->destructors);
+ ctx->remarks.next = &ctx->remarks;
atomic_store_explicit(&ctx->planned_steps, UINT_MAX,
memory_order_relaxed);
atomic_store_explicit(&ctx->steps, 0, memory_order_relaxed);
@@ -1024,6 +1052,7 @@ T_do_case_end(T_context *ctx, const T_case_context *tc)
T_call_destructors(ctx);
config = ctx->config;
T_actions_backward(config, T_EVENT_CASE_END, tc->name);
+ T_make_remarks(ctx);
planned_steps = atomic_fetch_add_explicit(&ctx->planned_steps,
0, memory_order_relaxed);
@@ -1284,6 +1313,18 @@ T_pop_fixture(void)
T_do_pop_fixture(&T_instance);
}
+void
+T_add_remark(T_remark *remark)
+{
+ if (remark->next == NULL) {
+ T_context *ctx;
+
+ ctx = &T_instance;
+ remark->next = ctx->remarks.next;
+ ctx->remarks.next = remark;
+ }
+}
+
size_t
T_get_scope(const char * const * const *desc, char *buf, size_t n,
const size_t *second_indices)