source: rtems/cpukit/libmisc/testsupport/testbeginend.c @ f387e8f

Last change on this file since f387e8f was f387e8f, checked in by Joel Sherrill <joel@…>, on Jan 16, 2018 at 7:47:53 PM

testsupport/testbeginend.c: Fix redefined warning

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 * Copyright (c) 2014, 2017 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * Copyright (c) 2017 Chris Johns <chrisj@rtems.org>. All rights reserved.
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18  #include "config.h"
19#endif
20
21#include <rtems/test.h>
22#include <rtems/bspIo.h>
23#include <rtems/version.h>
24
25#if RTEMS_POSIX
26  #define TEST_BUILD_DEFAULT ""
27  #define TEST_BUILD_POSIX   "posix "
28#else
29  #define TEST_BUILD_POSIX
30#endif
31#if RTEMS_SMP
32  #define TEST_BUILD_DEFAULT ""
33  #define TEST_BUILD_SMP     "smp "
34#else
35  #define TEST_BUILD_SMP
36#endif
37#if RTEMS_MULTIPROCESSING
38  #define TEST_BUILD_DEFAULT ""
39  #define TEST_BUILD_MP      "mp "
40#else
41  #define TEST_BUILD_MP
42#endif
43#if RTEMS_PARAVIRT
44  #define TEST_BUILD_DEFAULT  ""
45  #define TEST_BUILD_PARAVIRT "paravirt "
46#else
47  #define TEST_BUILD_PARAVIRT
48#endif
49#if RTEMS_NETWORKING
50  #define TEST_BUILD_DEFAULT    ""
51  #define TEST_BUILD_NETWORKING "legacy-net "
52#else
53  #define TEST_BUILD_NETWORKING
54#endif
55#if RTEMS_DEBUG
56  #define TEST_BUILD_DEFAULT ""
57  #define TEST_BUILD_DEBUG   "debug "
58#else
59  #define TEST_BUILD_DEBUG
60#endif
61#if RTEMS_PROFILING
62  #define TEST_BUILD_DEFAULT   ""
63  #define TEST_BUILD_PROFILING "profiling "
64#else
65  #define TEST_BUILD_PROFILING
66#endif
67#ifndef TEST_BUILD_DEFAULT
68#define TEST_BUILD_DEFAULT "default"
69#endif
70
71#define TEST_BUILD_STRING \
72         TEST_BUILD_DEFAULT \
73         TEST_BUILD_POSIX \
74         TEST_BUILD_SMP \
75         TEST_BUILD_MP \
76         TEST_BUILD_PARAVIRT \
77         TEST_BUILD_NETWORKING \
78         TEST_BUILD_DEBUG \
79         TEST_BUILD_PROFILING
80
81rtems_printer rtems_test_printer = {
82  .printer = rtems_printk_printer
83};
84
85static const char* const test_state_strings[] =
86{
87  "EXPECTED-PASS",
88  "EXPECTED-FAIL",
89  "USER_INPUT",
90  "INDETERMINATE",
91  "BENCHMARK"
92};
93
94int rtems_test_begin(const char* name, const RTEMS_TEST_STATE state)
95{
96  int l;
97  l = rtems_printf(
98    &rtems_test_printer,
99    "\n\n*** BEGIN OF TEST %s ***\n", name
100  );
101  l += rtems_printf(
102    &rtems_test_printer,
103    "*** TEST VERSION: %s\n", rtems_version()
104  );
105  l += rtems_printf(
106    &rtems_test_printer,
107    "*** TEST STATE: %s\n", test_state_strings[state]
108  );
109  l += rtems_printf(
110    &rtems_test_printer,
111    "*** TEST BUILD: %s\n", TEST_BUILD_STRING
112  );
113  l += rtems_printf(
114    &rtems_test_printer,
115    "*** TEST TOOLS: " __VERSION__ "\n"
116  );
117  return l;
118}
119
120int rtems_test_end(const char* name)
121{
122  return rtems_printf(
123    &rtems_test_printer,
124    "\n*** END OF TEST %s ***\n\n", name
125  );
126}
127
128void rtems_test_exit(int status)
129{
130  (void) status;
131  rtems_shutdown_executive(0);
132}
133
134int rtems_test_printf(
135  const char* format,
136  ...
137)
138{
139  va_list ap;
140  int len;
141  va_start(ap, format);
142  len = rtems_vprintf(
143    &rtems_test_printer,
144    format,
145    ap
146  );
147  va_end(ap);
148  return len;
149}
Note: See TracBrowser for help on using the repository browser.