source: rtems/cpukit/libmisc/testsupport/test.h @ 18d0a49

4.115
Last change on this file since 18d0a49 was 18d0a49, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 5, 2015 at 7:44:59 AM

Move test support from sapi to libmisc/testsupport

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 2014 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 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef _RTEMS_TEST_H
16#define _RTEMS_TEST_H
17
18#include <rtems.h>
19#include <rtems/bspIo.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
25/**
26 * @defgroup RTEMSTest Test Support
27 *
28 * @brief Test support functions.
29 *
30 * @{
31 */
32
33/**
34 * @brief Each test must define a test name string.
35 */
36extern const char rtems_test_name[];
37
38/**
39 * @brief Fatal extension for tests.
40 */
41void rtems_test_fatal_extension(
42  rtems_fatal_source source,
43  bool is_internal,
44  rtems_fatal_code code
45);
46
47/**
48 * @brief Initial extension for tests.
49 */
50#define RTEMS_TEST_INITIAL_EXTENSION \
51  { NULL, NULL, NULL, NULL, NULL, NULL, NULL, rtems_test_fatal_extension }
52
53/**
54 * @brief Prints a begin of test message.
55 *
56 * @param[in] printf_func The formatted output function.
57 * @param[in, out] printf_arg The formatted output function argument.
58 *
59 * @returns As specified by printf().
60 */
61int rtems_test_begin_with_plugin(
62  rtems_printk_plugin_t printf_func,
63  void *printf_arg
64);
65
66/**
67 * @brief Prints a begin of test message using printf().
68 *
69 * @returns As specified by printf().
70 */
71static inline int rtems_test_begin(void)
72{
73  return rtems_test_begin_with_plugin(rtems_printf_plugin, NULL);
74}
75
76/**
77 * @brief Prints a begin of test message using printk().
78 *
79 * @returns As specified by printf().
80 */
81static inline int rtems_test_begink(void)
82{
83  return rtems_test_begin_with_plugin(printk_plugin, NULL);
84}
85
86/**
87 * @brief Prints an end of test message.
88 *
89 * @param[in] printf_func The formatted output function.
90 * @param[in, out] printf_arg The formatted output function argument.
91 *
92 * @returns As specified by printf().
93 */
94int rtems_test_end_with_plugin(
95  rtems_printk_plugin_t printf_func,
96  void *printf_arg
97);
98
99/**
100 * @brief Prints an end of test message using printf().
101 *
102 * @returns As specified by printf().
103 */
104static inline int rtems_test_end(void)
105{
106  return rtems_test_end_with_plugin(rtems_printf_plugin, NULL);
107}
108
109/**
110 * @brief Prints an end of test message using printk().
111 *
112 * @returns As specified by printf().
113 */
114static inline int rtems_test_endk(void)
115{
116  return rtems_test_end_with_plugin(printk_plugin, NULL);
117}
118
119/** @} */
120
121#ifdef __cplusplus
122}
123#endif /* __cplusplus */
124
125#endif /* _RTEMS_TEST_H */
Note: See TracBrowser for help on using the repository browser.