RTEMS
testbeginend.c
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-info.h>
22 #include <rtems/bspIo.h>
23 #include <rtems/version.h>
24 
26  .printer = rtems_printk_printer
27 };
28 
29 static const char* const test_state_strings[] =
30 {
31  "EXPECTED_PASS",
32  "EXPECTED_FAIL",
33  "USER_INPUT",
34  "INDETERMINATE",
35  "BENCHMARK"
36 };
37 
38 int rtems_test_begin(const char* name, const RTEMS_TEST_STATE state)
39 {
40  return rtems_printf(
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 
75 int rtems_test_end(const char* name)
76 {
77  return rtems_printf(
79  "\n*** END OF TEST %s ***\n\n", name
80  );
81 }
82 
83 void rtems_test_exit(int status)
84 {
85  (void) status;
87 }
88 
90  const char* format,
91  ...
92 )
93 {
94  va_list ap;
95  int len;
96  va_start(ap, format);
97  len = rtems_vprintf(
99  format,
100  ap
101  );
102  va_end(ap);
103  return len;
104 }
RTEMS_TEST_STATE
Test states.
Definition: test-info.h:65
int rtems_test_begin(const char *name, const RTEMS_TEST_STATE state)
Prints a begin of test message using printf().
Definition: testbeginend.c:38
int rtems_test_printf(const char *format,...) RTEMS_PRINTFLIKE(1
Prints via the RTEMS printer.
int rtems_test_end(const char *name)
Prints an end of test message using printf().
Definition: testbeginend.c:75
void rtems_test_exit(int status)
Exit the test without calling exit() since it closes stdin, etc and pulls in stdio code...
Definition: testbeginend.c:83
RTEMS_NO_RETURN void rtems_shutdown_executive(uint32_t result)
Shuts down the RTEMS environment.
Version API.
Interface to Kernel Print Methods.
rtems_printer rtems_test_printer
Each test must define a printer.
Definition: testbeginend.c:25
const char * rtems_version(void)
Returns the version string.
Definition: version.c:32