diff options
Diffstat (limited to '')
-rw-r--r-- | testsuites/tmtests/tmtimer01/init.c | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/testsuites/tmtests/tmtimer01/init.c b/testsuites/tmtests/tmtimer01/init.c index c95ca80f3a..1a37b5192c 100644 --- a/testsuites/tmtests/tmtimer01/init.c +++ b/testsuites/tmtests/tmtimer01/init.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (C) 2016, 2024 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H @@ -95,13 +108,14 @@ static void test_fire_and_cancel( rtems_test_assert(sc2 == RTEMS_SUCCESSFUL); printf( - "<%s unit=\"ns\">%" PRIu64 "</%s>", + ",\n \"%s\": %" PRIu64, name, - rtems_counter_ticks_to_nanoseconds(d), - name + rtems_counter_ticks_to_nanoseconds(d) ); } +static const char *sep = "\n "; + static void test_case(test_context *ctx, size_t j, size_t k) { rtems_status_code sc; @@ -117,13 +131,17 @@ static void test_case(test_context *ctx, size_t j, size_t k) rtems_test_assert(sc == RTEMS_SUCCESSFUL); } - printf(" <Sample>\n <ActiveTimers>%zu</ActiveTimers>", j); - - test_fire_and_cancel(ctx, j, 0, "First"); - test_fire_and_cancel(ctx, j, j / 2, "Middle"); - test_fire_and_cancel(ctx, j, j + 1, "Last"); + printf( + "%s{\n" + " \"active-timers\": %zu", + sep, + j + ); + sep = "\n }, "; - printf("\n </Sample>\n"); + test_fire_and_cancel(ctx, j, 0, "first"); + test_fire_and_cancel(ctx, j, j / 2, "middle"); + test_fire_and_cancel(ctx, j, j + 1, "last"); } static void test(void) @@ -168,7 +186,13 @@ static void test(void) timer_count = n; } - printf("<TMTimer01 timerCount=\"%zu\">\n", timer_count); + printf( + "*** BEGIN OF JSON DATA ***\n" + "{\n" + " \"timer-count\": %zu,\n" + " \"samples\": [", + timer_count + ); k = 0; j = 0; @@ -181,7 +205,7 @@ static void test(void) test_case(ctx, n - 2, k); - printf("</TMTimer01>\n"); + printf("\n }\n ]\n}\n*** END OF JSON DATA ***\n"); } static void Init(rtems_task_argument arg) |