[rtems commit] libtest: Use a destructor
Sebastian Huber
sebh at rtems.org
Tue Aug 18 05:15:14 UTC 2020
Module: rtems
Branch: master
Commit: 13acd90003f5d5b65b0a6cbae510df3bdad4c778
Changeset: http://git.rtems.org/rtems/commit/?id=13acd90003f5d5b65b0a6cbae510df3bdad4c778
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Aug 13 19:00:47 2020 +0200
libtest: Use a destructor
Do not set up a new test steps environment.
Update #3199.
---
cpukit/libtest/t-test-thread-switch.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/cpukit/libtest/t-test-thread-switch.c b/cpukit/libtest/t-test-thread-switch.c
index 6457bbf..dd8d256 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) {
More information about the vc
mailing list