source: rtems/cpukit/libmisc/testsupport/testbeginend.c @ 168277e7

Last change on this file since 168277e7 was 168277e7, checked in by Sebastian Huber <sebastian.huber@…>, on Jan 19, 2018 at 9:44:35 AM

tests: Change TEST BUILD to use define names

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 * Copyright (c) 2014, 2018 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
25rtems_printer rtems_test_printer = {
26  .printer = rtems_printk_printer
27};
28
29static const char* const test_state_strings[] =
30{
31  "EXPECTED-PASS",
32  "EXPECTED-FAIL",
33  "USER_INPUT",
34  "INDETERMINATE",
35  "BENCHMARK"
36};
37
38int rtems_test_begin(const char* name, const RTEMS_TEST_STATE state)
39{
40  return rtems_printf(
41    &rtems_test_printer,
42    "\n\n*** BEGIN OF TEST %s ***\n"
43    "*** TEST VERSION: %s\n"
44    "*** TEST STATE: %s\n"
45    "*** TEST BUILD:"
46#if RTEMS_DEBUG
47    " RTEMS_DEBUG"
48#endif
49#if RTEMS_MULTIPROCESSING
50    " RTEMS_MULTIPROCESSING"
51#endif
52#if RTEMS_NETWORKING
53    " RTEMS_NETWORKING"
54#endif
55#if RTEMS_PARAVIRT
56    " RTEMS_PARAVIRT"
57#endif
58#if RTEMS_POSIX_API
59    " RTEMS_POSIX_API"
60#endif
61#if RTEMS_PROFILING
62    " RTEMS_PROFILING"
63#endif
64#if RTEMS_SMP
65    " RTEMS_SMP"
66#endif
67    "\n"
68    "*** TEST TOOLS: " __VERSION__ "\n",
69    name,
70    rtems_version(),
71    test_state_strings[state]
72  );
73}
74
75int rtems_test_end(const char* name)
76{
77  return rtems_printf(
78    &rtems_test_printer,
79    "\n*** END OF TEST %s ***\n\n", name
80  );
81}
82
83void rtems_test_exit(int status)
84{
85  (void) status;
86  rtems_shutdown_executive(0);
87}
88
89int rtems_test_printf(
90  const char* format,
91  ...
92)
93{
94  va_list ap;
95  int len;
96  va_start(ap, format);
97  len = rtems_vprintf(
98    &rtems_test_printer,
99    format,
100    ap
101  );
102  va_end(ap);
103  return len;
104}
Note: See TracBrowser for help on using the repository browser.