source: rtems/testsuites/support/include/buffer_test_io.h @ 7e102915

5
Last change on this file since 7e102915 was 7e102915, checked in by Sebastian Huber <sebastian.huber@…>, on Oct 26, 2017 at 11:59:09 AM

tests: Use rtems_test_printer in general

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  Support for running the test output through a buffer
3 */
4
5#ifndef __BUFFER_TEST_IO_h
6#define __BUFFER_TEST_IO_h
7
8#include <rtems/test.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14/*
15 * Test states. No state string is an expected pass.
16 */
17#if (TEST_STATE_EXPECTED_FAIL && TEST_STATE_USER_INPUT) || \
18    (TEST_STATE_EXPECTED_FAIL && TEST_STATE_INDETERMINATE) || \
19    (TEST_STATE_EXPECTED_FAIL && TEST_STATE_BENCHMARK) || \
20    (TEST_STATE_USER_INPUT    && TEST_STATE_INDETERMINATE) || \
21    (TEST_STATE_USER_INPUT    && TEST_STATE_BENCHMARK) || \
22    (TEST_STATE_INDETERMINATE && TEST_STATE_BENCHMARK)
23  #error Test states must be unique
24#endif
25
26#if TEST_STATE_EXPECTED_FAIL
27  #define TEST_STATE_STRING "*** TEST STATE: EXPECTED-FAIL\n"
28#elif TEST_STATE_USER_INPUT
29  #define TEST_STATE_STRING "*** TEST STATE: USER_INPUT\n"
30#elif TEST_STATE_INDETERMINATE
31  #define TEST_STATE_STRING "*** TEST STATE: INDETERMINATE\n"
32#elif TEST_STATE_BENCHMARK
33  #define TEST_STATE_STRING "*** TEST STATE: BENCHMARK\n"
34#endif
35
36#undef printf
37#define printf(...) \
38  do { \
39     rtems_printf( &rtems_test_printer, __VA_ARGS__ ); \
40  } while (0)
41
42#undef puts
43#define puts(_s) \
44  do { \
45     rtems_printf( &rtems_test_printer, "%s\n", _s ); \
46  } while (0)
47
48#undef putchar
49#define putchar(_c) \
50  do { \
51     rtems_printf( &rtems_test_printer, "%c", _c ); \
52  } while (0)
53
54/* Do not call exit() since it closes stdin, etc and pulls in stdio code */
55#define rtems_test_exit(_s) \
56  do { \
57    rtems_shutdown_executive(0); \
58  } while (0)
59
60#define FLUSH_OUTPUT() \
61  do { \
62  } while (0)
63
64#if defined(TEST_STATE_STRING)
65  #define TEST_BEGIN() \
66  do { \
67    rtems_printf( &rtems_test_printer, "\n"); \
68    rtems_printf( &rtems_test_printer, TEST_BEGIN_STRING ); \
69    rtems_printf( &rtems_test_printer, TEST_STATE_STRING ); \
70  } while (0)
71#else
72  #define TEST_BEGIN() \
73  do { \
74    rtems_printf( &rtems_test_printer, "\n" ); \
75    rtems_printf( &rtems_test_printer, TEST_BEGIN_STRING ); \
76  } while (0)
77#endif
78
79#define TEST_END() \
80  do { \
81     rtems_printf( &rtems_test_printer, "\n" ); \
82     rtems_printf( &rtems_test_printer, TEST_END_STRING ); \
83     rtems_printf( &rtems_test_printer, "\n" ); \
84  } while (0)
85
86#ifdef __cplusplus
87};
88#endif
89
90#endif
Note: See TracBrowser for help on using the repository browser.