2 * Support for running the test output through a buffer
4 * buffer_test_io.h,v 1.1 2002/08/02 00:51:52 joel Exp
7 #ifndef __BUFFER_TEST_IO_h
8 #define __BUFFER_TEST_IO_h
17 * Uncomment this to get buffered test output. When commented out,
18 * test output behaves as it always has and is printed ASAP.
21 /* #define TESTS_BUFFER_OUTPUT */
23 #if !defined(TESTS_BUFFER_OUTPUT)
25 #define rtems_test_exit(_s) \
30 #define FLUSH_OUTPUT() \
35 #else /* buffer test output */
37 #define _TEST_OUTPUT_BUFFER_SIZE 2048
38 extern char _test_output_buffer[_TEST_OUTPUT_BUFFER_SIZE];
39 void _test_output_append(char *);
40 void _test_output_flush(void);
42 #define rtems_test_exit(_s) \
44 _test_output_flush(); \
52 sprintf( _buffer, __VA_ARGS__); \
53 _test_output_append( _buffer ); \
57 #define puts(_string) \
60 sprintf( _buffer, "%s\n", _string ); \
61 _test_output_append( _buffer ); \
70 _test_output_append( _buffer ); \
73 /* we write to stderr when there is a pause() */
74 #define FLUSH_OUTPUT() _test_output_flush()
76 #if defined(TEST_INIT) || defined(CONFIGURE_INIT)
78 char _test_output_buffer[_TEST_OUTPUT_BUFFER_SIZE];
79 int _test_output_buffer_index = 0;
81 void _test_output_append(char *_buffer)
85 for ( p=_buffer ; *p ; p++ ) {
86 _test_output_buffer[_test_output_buffer_index++] = *p;
87 _test_output_buffer[_test_output_buffer_index] = '\0';
90 fprintf( stderr, "BUFFER -- %s", _test_output_buffer );
91 _test_output_buffer_index = 0;
92 _test_output_buffer[0] = '\0';
95 if ( _test_output_buffer_index >= (_TEST_OUTPUT_BUFFER_SIZE - 80) )
103 void _test_output_flush(void)
105 fprintf( stderr, "%s", _test_output_buffer );
106 _test_output_buffer_index = 0;
110 #endif /* TEST_INIT */
111 #endif /* TESTS_BUFFER_OUTPUT */