summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-13 19:00:47 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-18 07:08:51 +0200
commit13acd90003f5d5b65b0a6cbae510df3bdad4c778 (patch)
tree713738d043f5001d97fd5e47f919ee1bd8097dd0
parent72960bc7d4c8f7eb7687827d1c1545b1eb5fdb71 (diff)
downloadrtems-13acd90003f5d5b65b0a6cbae510df3bdad4c778.tar.bz2
libtest: Use a destructor
Do not set up a new test steps environment. Update #3199.
-rw-r--r--cpukit/libtest/t-test-thread-switch.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/cpukit/libtest/t-test-thread-switch.c b/cpukit/libtest/t-test-thread-switch.c
index 6457bbfd06..dd8d256c93 100644
--- a/cpukit/libtest/t-test-thread-switch.c
+++ b/cpukit/libtest/t-test-thread-switch.c
@@ -49,7 +49,7 @@ typedef struct {
RTEMS_INTERRUPT_LOCK_MEMBER(lock)
T_thread_switch_log *active;
User_extensions_Control ext;
- T_fixture_node node;
+ T_destructor dtor;
} T_thread_switch_context;
static void T_thread_switch_recorder(Thread_Control *, Thread_Control *);
@@ -66,19 +66,14 @@ static T_thread_switch_context T_thread_switch_instance = {
};
static void
-T_thread_switch_teardown(void *arg)
+T_thread_switch_destroy(T_destructor *dtor)
{
T_thread_switch_context *ctx;
- ctx = arg;
+ ctx = RTEMS_CONTAINER_OF(dtor, T_thread_switch_context, dtor);
_User_extensions_Remove_set(&ctx->ext);
}
-static const T_fixture T_thread_switch_fixture = {
- .teardown = T_thread_switch_teardown,
- .initial_context = &T_thread_switch_instance
-};
-
static void
T_thread_switch_recorder(Thread_Control *executing, Thread_Control *heir)
{
@@ -125,9 +120,9 @@ T_thread_switch_record(T_thread_switch_log *log)
ctx = &T_thread_switch_instance;
- if (ctx->node.fixture == NULL) {
+ if (_Chain_Is_node_off_chain(&ctx->ext.Node)) {
_User_extensions_Add_set(&ctx->ext);
- T_push_fixture(&ctx->node, &T_thread_switch_fixture);
+ T_add_destructor(&ctx->dtor, T_thread_switch_destroy);
}
if (log != NULL) {