summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-11-08 13:27:25 +1100
committerChris Johns <chrisj@rtems.org>2017-11-11 16:14:59 +1100
commite6df806a3f46b5488e5e383add9cda43e0059dbe (patch)
tree560dabf7fec58d1d33cfaf419842ddbd085d8c16 /testsuites
parenttests: Use rtems_test_begin and rtems_test_end. (diff)
downloadrtems-e6df806a3f46b5488e5e383add9cda43e0059dbe.tar.bz2
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.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/automake/compile.am5
-rw-r--r--testsuites/automake/local.am2
-rw-r--r--testsuites/libtests/rtmonuse/task1.c2
-rw-r--r--testsuites/sptests/sp14/asr.c2
-rw-r--r--testsuites/sptests/sp14/task1.c5
-rw-r--r--testsuites/sptests/sp14/task2.c1
-rw-r--r--testsuites/support/include/buffer_test_io.h28
-rw-r--r--testsuites/support/include/tmacros.h13
8 files changed, 6 insertions, 52 deletions
diff --git a/testsuites/automake/compile.am b/testsuites/automake/compile.am
index d5545c5a2f..ee1f77381a 100644
--- a/testsuites/automake/compile.am
+++ b/testsuites/automake/compile.am
@@ -10,7 +10,8 @@ STRIP = @STRIP@
##
AM_CPPFLAGS = $(TEST_FLAGS)
-AM_CFLAGS =
-AM_CXXFLAGS =
+AM_CFLAGS = $(TEST_C_FLAGS)
+AM_CXXFLAGS = $(TEST_CXX_FLAGS)
+AM_LDFLAGS = $(TEST_LD_FLAGS)
CLEANFILES = *.num *.nxe *.elf *.srec* *.bin *.bt *.ralf
diff --git a/testsuites/automake/local.am b/testsuites/automake/local.am
index aaf86ac44c..31299028d6 100644
--- a/testsuites/automake/local.am
+++ b/testsuites/automake/local.am
@@ -2,3 +2,5 @@ preinstall:
.PHONY: preinstall
PROJECT_TOOLS = $(PROJECT_RELEASE)/build-tools
+
+TEST_LD_FLAGS = -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar
diff --git a/testsuites/libtests/rtmonuse/task1.c b/testsuites/libtests/rtmonuse/task1.c
index 9e8cf8fce7..b0db7fe4be 100644
--- a/testsuites/libtests/rtmonuse/task1.c
+++ b/testsuites/libtests/rtmonuse/task1.c
@@ -105,8 +105,6 @@ rtems_task Task_1_through_5(
printf( "TA5 - PERIODS CHECK OK (%" PRIu32 ")\n", pass );
- FLUSH_OUTPUT();
-
if ( pass == 10 ) {
puts( "" );
rtems_rate_monotonic_report_statistics();
diff --git a/testsuites/sptests/sp14/asr.c b/testsuites/sptests/sp14/asr.c
index e9187cc778..4239a34183 100644
--- a/testsuites/sptests/sp14/asr.c
+++ b/testsuites/sptests/sp14/asr.c
@@ -32,7 +32,6 @@ rtems_asr Process_asr(
case RTEMS_SIGNAL_0:
case RTEMS_SIGNAL_1:
puts( "ASR - rtems_task_wake_after - yield processor" );
- FLUSH_OUTPUT();
status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
directive_failed( status, "rtems_task_wake_after yield" );
break;
@@ -44,5 +43,4 @@ rtems_asr Process_asr(
"ASR - EXIT - signal => %08" PRIxrtems_signal_set "\n",
the_signal_set
);
- FLUSH_OUTPUT();
}
diff --git a/testsuites/sptests/sp14/task1.c b/testsuites/sptests/sp14/task1.c
index e71070d368..7a8559d875 100644
--- a/testsuites/sptests/sp14/task1.c
+++ b/testsuites/sptests/sp14/task1.c
@@ -52,9 +52,7 @@ rtems_task Task_1(
status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR );
directive_failed( status, "rtems_signal_catch" );
- FLUSH_OUTPUT();
-
-rtems_test_pause();
+ rtems_test_pause();
puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
@@ -98,7 +96,6 @@ rtems_test_pause();
);
puts( "TA1 - rtems_task_mode - enable ASRs" );
- FLUSH_OUTPUT();
status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
directive_failed( status, "rtems_task_mode" );
diff --git a/testsuites/sptests/sp14/task2.c b/testsuites/sptests/sp14/task2.c
index 9e1714fe87..da14dc8ce3 100644
--- a/testsuites/sptests/sp14/task2.c
+++ b/testsuites/sptests/sp14/task2.c
@@ -44,7 +44,6 @@ rtems_task Task_2(
directive_failed( status, "rtems_signal_send" );
puts( "TA2 - rtems_task_wake_after - yield processor" );
- FLUSH_OUTPUT();
status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
directive_failed( status, "rtems_task_wake_after" );
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( "<pause>\n" ); \
- FLUSH_OUTPUT(); \
} while ( 0 )
#define rtems_test_pause_and_screen_number( _screen ) \
do { \
printf( "<pause - screen %d>\n", (_screen) ); \
- FLUSH_OUTPUT(); \
} while ( 0 )
#else
#define rtems_test_pause() \
do { \
char buffer[ 80 ]; \
printf( "<pause>" ); \
- FLUSH_OUTPUT(); \
gets( buffer ); \
puts( "" ); \
} while ( 0 )
@@ -262,7 +250,6 @@ extern "C" {
do { \
char buffer[ 80 ]; \
printf( "<pause - screen %d>", (_screen) ); \
- FLUSH_OUTPUT(); \
gets( buffer ); \
puts( "" ); \
} while ( 0 )