From e6df806a3f46b5488e5e383add9cda43e0059dbe Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Wed, 8 Nov 2017 13:27:25 +1100 Subject: tests: Use ld to map (wrap) printf, puts and putchar to tester functions. - Remove the macro defines and the need for tmacro.h by remapping the symbols using ld's wrap option. - Remove FLUSH_OUTPUT, it was empty. - Move rtems_test_exit to libmisc/testsupport as a function. Update #3199. --- testsuites/support/include/buffer_test_io.h | 28 ---------------------------- testsuites/support/include/tmacros.h | 13 ------------- 2 files changed, 41 deletions(-) (limited to 'testsuites/support/include') diff --git a/testsuites/support/include/buffer_test_io.h b/testsuites/support/include/buffer_test_io.h index 8fbcd68b3e..ea68fea0d8 100644 --- a/testsuites/support/include/buffer_test_io.h +++ b/testsuites/support/include/buffer_test_io.h @@ -11,34 +11,6 @@ extern "C" { #endif -#undef printf -#define printf(...) \ - do { \ - rtems_printf( &rtems_test_printer, __VA_ARGS__ ); \ - } while (0) - -#undef puts -#define puts(_s) \ - do { \ - rtems_printf( &rtems_test_printer, "%s\n", _s ); \ - } while (0) - -#undef putchar -#define putchar(_c) \ - do { \ - rtems_printf( &rtems_test_printer, "%c", _c ); \ - } while (0) - -/* Do not call exit() since it closes stdin, etc and pulls in stdio code */ -#define rtems_test_exit(_s) \ - do { \ - rtems_shutdown_executive(0); \ - } while (0) - -#define FLUSH_OUTPUT() \ - do { \ - } while (0) - #define TEST_BEGIN() rtems_test_begin(rtems_test_name, TEST_STATE) #define TEST_END() rtems_test_end(rtems_test_name) diff --git a/testsuites/support/include/tmacros.h b/testsuites/support/include/tmacros.h index 354d4cf60f..60da7647dc 100644 --- a/testsuites/support/include/tmacros.h +++ b/testsuites/support/include/tmacros.h @@ -64,7 +64,6 @@ extern "C" { "\n_Thread_Dispatch_disable_level is (%i)" \ " not %d detected at %s:%d\n", \ !_Thread_Dispatch_is_enabled(), (_expect), __FILE__, __LINE__ ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( 1 ); \ } \ } while ( 0 ) @@ -84,7 +83,6 @@ extern "C" { __FILE__, \ __LINE__ \ ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( 1 ); \ } \ } while ( 0 ) @@ -107,7 +105,6 @@ extern "C" { if ( (_stat) != (_desired) ) { \ printf( "\n%s FAILED -- expected (%s) got (%s)\n", \ (_msg), rtems_status_text(_desired), rtems_status_text(_stat) ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( _stat ); \ } \ } while ( 0 ) @@ -137,7 +134,6 @@ extern "C" { printf( "\n%s FAILED -- expected (%d - %s) got (%ld %d - %s)\n", \ (_msg), _desired, strerror(_desired), \ statx, errno, strerror(errno) ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( _stat ); \ } @@ -153,7 +149,6 @@ extern "C" { (_msg), _desired, strerror(_desired), _stat, strerror(_stat) ); \ printf( "\n FAILED -- errno (%d - %s)\n", \ errno, strerror(errno) ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( _stat ); \ } \ } while ( 0 ) @@ -166,7 +161,6 @@ extern "C" { check_dispatch_disable_level( 0 ); \ printf( "\n%s FAILED -- expected (-1) got (%p - %d/%s)\n", \ (_msg), _ptr, errno, strerror(errno) ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( -1 ); \ } @@ -178,7 +172,6 @@ extern "C" { check_dispatch_disable_level( 0 ); \ printf( "\n%s FAILED -- expected (-1) got (%" PRId32 " - %d/%s)\n", \ (_msg), _ptr, errno, strerror(errno) ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( -1 ); \ } @@ -202,7 +195,6 @@ extern "C" { if ( (_stat) != (_desired) ) { \ printf( "\n%s FAILED -- expected (%d) got (%d)\n", \ (_msg), (_desired), (_stat) ); \ - FLUSH_OUTPUT(); \ rtems_test_exit( _stat ); \ } \ } while ( 0 ) @@ -229,7 +221,6 @@ extern "C" { #define put_dot( _c ) \ do { \ putchar( _c ); \ - FLUSH_OUTPUT(); \ } while ( 0 ) #define new_line puts( "" ) @@ -240,20 +231,17 @@ extern "C" { #define rtems_test_pause() \ do { \ printf( "\n" ); \ - FLUSH_OUTPUT(); \ } while ( 0 ) #define rtems_test_pause_and_screen_number( _screen ) \ do { \ printf( "\n", (_screen) ); \ - FLUSH_OUTPUT(); \ } while ( 0 ) #else #define rtems_test_pause() \ do { \ char buffer[ 80 ]; \ printf( "" ); \ - FLUSH_OUTPUT(); \ gets( buffer ); \ puts( "" ); \ } while ( 0 ) @@ -262,7 +250,6 @@ extern "C" { do { \ char buffer[ 80 ]; \ printf( "", (_screen) ); \ - FLUSH_OUTPUT(); \ gets( buffer ); \ puts( "" ); \ } while ( 0 ) -- cgit v1.2.3