diff options
Diffstat (limited to 'testsuites/tmtests/tmfine01/init.c')
-rw-r--r-- | testsuites/tmtests/tmfine01/init.c | 120 |
1 files changed, 84 insertions, 36 deletions
diff --git a/testsuites/tmtests/tmfine01/init.c b/testsuites/tmtests/tmfine01/init.c index a93e2d3470..c05894f6da 100644 --- a/testsuites/tmtests/tmfine01/init.c +++ b/testsuites/tmtests/tmfine01/init.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* - * Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved. + * Copyright (C) 2015, 2024 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,6 +55,8 @@ typedef struct { typedef struct { rtems_test_parallel_context base; + const char *test_sep; + const char *counter_sep; rtems_id master; rtems_id sema; rtems_id mq[CPU_COUNT]; @@ -89,24 +91,46 @@ static rtems_interval test_init( } static void test_fini( - const char *name, + test_context *ctx, + const char *type, + const char *description, uint32_t *counters, size_t active_workers ) { + const char *value_sep; size_t i; - printf(" <%s activeWorker=\"%zu\">\n", name, active_workers); + if (active_workers == 1) { + printf( + "%s{\n" + " \"type\": \"%s\",\n" + " \"description\": \"%s\",\n" + " \"counter\": [", + ctx->test_sep, + type, + description + ); + ctx->test_sep = ", "; + ctx->counter_sep = "\n "; + } + + printf("%s[", ctx->counter_sep); + ctx->counter_sep = "],\n "; + value_sep = ""; for (i = 0; i < active_workers; ++i) { printf( - " <Counter worker=\"%zu\">%" PRIu32 "</Counter>\n", - i, + "%s%" PRIu32, + value_sep, counters[i] ); + value_sep = ", "; } - printf(" </%s>\n", name); + if (active_workers == rtems_scheduler_get_processor_maximum()) { + printf("]\n ]\n }"); + } } static void test_self_event_body( @@ -150,7 +174,9 @@ static void test_self_event_fini( test_context *ctx = (test_context *) base; test_fini( - "SelfEvent", + ctx, + "event", + "Send Event to Self", &ctx->self_event_ops[active_workers - 1][0], active_workers ); @@ -201,7 +227,9 @@ static void test_all_to_one_event_fini( test_context *ctx = (test_context *) base; test_fini( - "AllToOneEvent", + ctx, + "event", + "Send Event to One", &ctx->all_to_one_event_ops[active_workers - 1][0], active_workers ); @@ -242,7 +270,9 @@ static void test_one_mutex_fini( test_context *ctx = (test_context *) base; test_fini( - "OneMutex", + ctx, + "contested-mutex", + "Obtain/Release Contested Classic Inheritance Mutex", &ctx->one_mutex_ops[active_workers - 1][0], active_workers ); @@ -296,7 +326,9 @@ static void test_many_mutex_fini( test_context *ctx = (test_context *) base; test_fini( - "ManyMutex", + ctx, + "private-mutex", + "Obtain/Release Private Classic Inheritance Mutex", &ctx->many_mutex_ops[active_workers - 1][0], active_workers ); @@ -347,7 +379,9 @@ static void test_self_msg_fini( test_context *ctx = (test_context *) base; test_fini( - "SelfMsg", + ctx, + "message", + "Send Message to Self", &ctx->self_msg_ops[active_workers - 1][0], active_workers ); @@ -401,7 +435,9 @@ static void test_many_to_one_msg_fini( test_context *ctx = (test_context *) base; test_fini( - "ManyToOneMsg", + ctx, + "message", + "Send Message to One Receiver", &ctx->many_to_one_msg_ops[active_workers - 1][0], active_workers ); @@ -439,7 +475,9 @@ static void test_many_sys_lock_mutex_fini( test_context *ctx = (test_context *) base; test_fini( - "ManySysLockMutex", + ctx, + "private-mutex", + "Obtain/Release Private <sys/lock.h> Mutex", &ctx->many_sys_lock_mutex_ops[active_workers - 1][0], active_workers ); @@ -493,7 +531,9 @@ static void test_many_classic_ceiling_fini( test_context *ctx = (test_context *) base; test_fini( - "ManyClassicCeilingMutex", + ctx, + "private-mutex", + "Obtain/Release Private Classic Ceiling Mutex", &ctx->many_classic_ceiling_ops[active_workers - 1][0], active_workers ); @@ -548,7 +588,9 @@ static void test_many_classic_mrsp_fini( test_context *ctx = (test_context *) base; test_fini( - "ManyClassicMrsPMutex", + ctx, + "private-mutex", + "Obtain/Release Private Classic MrsP Mutex", &ctx->many_classic_mrsp_ops[active_workers - 1][0], active_workers ); @@ -591,7 +633,9 @@ static void test_many_pthread_spinlock_fini( test_context *ctx = (test_context *) base; test_fini( - "ManyPthreadSpinlock", + ctx, + "private-mutex", + "Obtain/Release Private Pthread Spinlock", &ctx->many_pthread_spinlock_ops[active_workers - 1][0], active_workers ); @@ -645,7 +689,9 @@ static void test_many_pthread_mutex_inherit_fini( test_context *ctx = (test_context *) base; test_fini( - "ManyPthreadMutexInherit", + ctx, + "private-mutex", + "Obtain/Release Private Pthread Inheritance Mutex", &ctx->many_pthread_mutex_inherit_ops[active_workers - 1][0], active_workers ); @@ -705,7 +751,9 @@ static void test_many_pthread_mutex_protect_fini( test_context *ctx = (test_context *) base; test_fini( - "ManyPthreadMutexProtect", + ctx, + "private-mutex", + "Obtain/Release Private Pthread Ceiling Mutex", &ctx->many_pthread_mutex_protect_ops[active_workers - 1][0], active_workers ); @@ -729,11 +777,6 @@ static const rtems_test_parallel_job test_jobs[] = { .cascade = true }, { .init = test_init, - .body = test_many_mutex_body, - .fini = test_many_mutex_fini, - .cascade = true - }, { - .init = test_init, .body = test_self_msg_body, .fini = test_self_msg_fini, .cascade = true @@ -744,33 +787,38 @@ static const rtems_test_parallel_job test_jobs[] = { .cascade = true }, { .init = test_init, + .body = test_many_pthread_spinlock_body, + .fini = test_many_pthread_spinlock_fini, + .cascade = true + }, { + .init = test_init, .body = test_many_sys_lock_mutex_body, .fini = test_many_sys_lock_mutex_fini, .cascade = true }, { .init = test_init, - .body = test_many_classic_ceiling_body, - .fini = test_many_classic_ceiling_fini, + .body = test_many_pthread_mutex_inherit_body, + .fini = test_many_pthread_mutex_inherit_fini, .cascade = true }, { .init = test_init, - .body = test_many_classic_mrsp_body, - .fini = test_many_classic_mrsp_fini, + .body = test_many_mutex_body, + .fini = test_many_mutex_fini, .cascade = true }, { .init = test_init, - .body = test_many_pthread_spinlock_body, - .fini = test_many_pthread_spinlock_fini, + .body = test_many_pthread_mutex_protect_body, + .fini = test_many_pthread_mutex_protect_fini, .cascade = true }, { .init = test_init, - .body = test_many_pthread_mutex_inherit_body, - .fini = test_many_pthread_mutex_inherit_fini, + .body = test_many_classic_ceiling_body, + .fini = test_many_classic_ceiling_fini, .cascade = true }, { .init = test_init, - .body = test_many_pthread_mutex_protect_body, - .fini = test_many_pthread_mutex_protect_fini, + .body = test_many_classic_mrsp_body, + .fini = test_many_classic_mrsp_fini, .cascade = true } }; @@ -778,7 +826,6 @@ static const rtems_test_parallel_job test_jobs[] = { static void Init(rtems_task_argument arg) { test_context *ctx = &test_instance; - const char *test = "TestTimeFine01"; rtems_status_code sc; size_t i; @@ -806,8 +853,9 @@ static void Init(rtems_task_argument arg) rtems_test_assert(sc == RTEMS_SUCCESSFUL); } - printf("<%s>\n", test); + printf("*** BEGIN OF JSON DATA ***\n[\n "); + ctx->test_sep = ""; rtems_test_parallel( &ctx->base, NULL, @@ -815,7 +863,7 @@ static void Init(rtems_task_argument arg) RTEMS_ARRAY_SIZE(test_jobs) ); - printf("</%s>\n", test); + printf("\n]\n*** END OF JSON DATA ***\n"); TEST_END(); rtems_test_exit(0); |