summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-26 13:59:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-28 13:33:55 +0200
commit7e1029158ed6f11e36341a57fed07fa3014068da (patch)
treed0be64ad00c2076845354aa33a27e915c9fbdc00 /testsuites
parenttests: Use rtems_print_printer_fprintf_putc() (diff)
downloadrtems-7e1029158ed6f11e36341a57fed07fa3014068da.tar.bz2
tests: Use rtems_test_printer in general
Update #3170. Update #3199.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/libtests/block02/init.c1
-rw-r--r--testsuites/libtests/block03/init.c1
-rw-r--r--testsuites/libtests/block04/init.c1
-rw-r--r--testsuites/libtests/block05/init.c1
-rw-r--r--testsuites/libtests/termios06/init.c1
-rw-r--r--testsuites/sptests/spfatal03/testcase.h2
-rw-r--r--testsuites/sptests/spprintk/init.c1
-rw-r--r--testsuites/support/include/buffer_test_io.h225
-rw-r--r--testsuites/support/include/tmacros.h4
-rw-r--r--testsuites/support/src/locked_print.c2
10 files changed, 59 insertions, 180 deletions
diff --git a/testsuites/libtests/block02/init.c b/testsuites/libtests/block02/init.c
index f7dc3efd0d..3523c5d364 100644
--- a/testsuites/libtests/block02/init.c
+++ b/testsuites/libtests/block02/init.c
@@ -30,6 +30,7 @@
#include "tmacros.h"
#include <rtems.h>
+#include <rtems/bspIo.h>
#include <rtems/ramdisk.h>
#include <rtems/bdbuf.h>
#include <rtems/diskdevs.h>
diff --git a/testsuites/libtests/block03/init.c b/testsuites/libtests/block03/init.c
index f2f6bd9ee4..ea82421e7f 100644
--- a/testsuites/libtests/block03/init.c
+++ b/testsuites/libtests/block03/init.c
@@ -30,6 +30,7 @@
#include "tmacros.h"
#include <rtems.h>
+#include <rtems/bspIo.h>
#include <rtems/ramdisk.h>
#include <rtems/bdbuf.h>
#include <rtems/diskdevs.h>
diff --git a/testsuites/libtests/block04/init.c b/testsuites/libtests/block04/init.c
index 3d674c1107..d9748df609 100644
--- a/testsuites/libtests/block04/init.c
+++ b/testsuites/libtests/block04/init.c
@@ -30,6 +30,7 @@
#include "tmacros.h"
#include <rtems.h>
+#include <rtems/bspIo.h>
#include <rtems/ramdisk.h>
#include <rtems/bdbuf.h>
#include <rtems/diskdevs.h>
diff --git a/testsuites/libtests/block05/init.c b/testsuites/libtests/block05/init.c
index 7a40b50b3c..80e3641820 100644
--- a/testsuites/libtests/block05/init.c
+++ b/testsuites/libtests/block05/init.c
@@ -32,6 +32,7 @@
#include <errno.h>
#include <rtems.h>
+#include <rtems/bspIo.h>
#include <rtems/bdbuf.h>
#include <rtems/diskdevs.h>
diff --git a/testsuites/libtests/termios06/init.c b/testsuites/libtests/termios06/init.c
index 5c39dabacf..c1e04eb6d8 100644
--- a/testsuites/libtests/termios06/init.c
+++ b/testsuites/libtests/termios06/init.c
@@ -22,6 +22,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
+#include <rtems/bspIo.h>
#include <rtems/dumpbuf.h>
#include <rtems/termiostypes.h>
diff --git a/testsuites/sptests/spfatal03/testcase.h b/testsuites/sptests/spfatal03/testcase.h
index 90ed0535b3..b6935657ea 100644
--- a/testsuites/sptests/spfatal03/testcase.h
+++ b/testsuites/sptests/spfatal03/testcase.h
@@ -9,6 +9,8 @@
* http://www.rtems.org/license/LICENSE.
*/
+#include <rtems/bspIo.h>
+
#define CONFIGURE_MAXIMUM_SEMAPHORES 10
#define FATAL_ERROR_TEST_NAME "3"
diff --git a/testsuites/sptests/spprintk/init.c b/testsuites/sptests/spprintk/init.c
index 3d9b00149f..52f0ccdada 100644
--- a/testsuites/sptests/spprintk/init.c
+++ b/testsuites/sptests/spprintk/init.c
@@ -25,6 +25,7 @@
#define TEST_INIT
#define TESTS_USE_PRINTK
+#include <rtems/bspIo.h>
#include <tmacros.h>
const char rtems_test_name[] = "SPPRINTK";
diff --git a/testsuites/support/include/buffer_test_io.h b/testsuites/support/include/buffer_test_io.h
index dff312d132..1ff15f6ca8 100644
--- a/testsuites/support/include/buffer_test_io.h
+++ b/testsuites/support/include/buffer_test_io.h
@@ -5,7 +5,6 @@
#ifndef __BUFFER_TEST_IO_h
#define __BUFFER_TEST_IO_h
-#include <rtems/bspIo.h>
#include <rtems/test.h>
#ifdef __cplusplus
@@ -34,186 +33,56 @@ extern "C" {
#define TEST_STATE_STRING "*** TEST STATE: BENCHMARK\n"
#endif
-/*
- * USE PRINTK TO MINIMIZE SIZE
- */
-#if defined(TESTS_USE_PRINTK)
-
-#include <rtems/print.h>
-
- #undef printf
- #define printf(...) \
- do { \
- printk( __VA_ARGS__); \
- } while (0)
-
- #undef puts
- #define puts(_s) \
- do { \
- printk( "%s\n", _s); \
- } while (0)
-
- #undef putchar
- #define putchar(_c) \
- do { \
- printk( "%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)
-
- #if defined(TEST_STATE_STRING)
- #define TEST_BEGIN() \
- do { \
- printk("\n"); \
- printk(TEST_BEGIN_STRING); \
- printk(TEST_STATE_STRING); \
- } while (0)
- #else
- #define TEST_BEGIN() \
- do { \
- printk("\n"); \
- printk(TEST_BEGIN_STRING); \
- } while (0)
- #endif
-
- #define TEST_END() \
- do { \
- printk( "\n" ); \
- printk(TEST_END_STRING); \
- printk( "\n" ); \
- } while (0)
-
-/*
- * BUFFER TEST OUTPUT
- */
+#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)
+
+#if defined(TEST_STATE_STRING)
+ #define TEST_BEGIN() \
+ do { \
+ rtems_printf( &rtems_test_printer, "\n"); \
+ rtems_printf( &rtems_test_printer, TEST_BEGIN_STRING ); \
+ rtems_printf( &rtems_test_printer, TEST_STATE_STRING ); \
+ } while (0)
#else
-
- #include <stdio.h>
- #include <stdlib.h>
-
- #define TEST_PRINT__FORMAT(_fmtpos, _appos) \
- __attribute__((__format__(__printf__, _fmtpos, _appos)))
-
- #define _TEST_OUTPUT_BUFFER_SIZE 2048
-
- extern char _test_output_buffer[_TEST_OUTPUT_BUFFER_SIZE];
-
- void _test_output_printf(const char *, ...) TEST_PRINT__FORMAT(1, 2);
- void _test_output_append(const char *);
- void _test_output_flush(void);
-
- #define rtems_test_exit(_s) \
- do { \
- fflush(stdout); \
- fflush(stderr); \
- _test_output_flush(); \
- exit(_s); \
- } while (0)
-
- #undef printf
- #define printf(...) _test_output_printf( __VA_ARGS__ )
-
- #undef puts
- #define puts(_string) \
- do { \
- _test_output_append( _string ); \
- _test_output_append( "\n" ); \
- } while (0)
-
- #undef putchar
- #define putchar(_c) \
- do { \
- char _buffer[2]; \
- _buffer[0] = _c; \
- _buffer[1] = '\0'; \
- _test_output_append( _buffer ); \
- } while (0)
-
- /* we write to stderr when there is a pause() */
- #define FLUSH_OUTPUT() _test_output_flush()
-
- #if defined(TEST_STATE_STRING)
- #define TEST_BEGIN() \
- do { \
- _test_output_append( "\n" ); \
- _test_output_printf(TEST_BEGIN_STRING); \
- _test_output_append(TEST_STATE_STRING); \
- _test_output_append( "\n" ); \
- } while (0)
- #else
- #define TEST_BEGIN() \
- do { \
- _test_output_append( "\n" ); \
- _test_output_printf(TEST_BEGIN_STRING); \
- _test_output_append( "\n" ); \
- } while (0)
- #endif
-
- #define TEST_END() \
- do { \
- _test_output_append( "\n" ); \
- _test_output_printf(TEST_END_STRING); \
- _test_output_append( "\n" ); \
- } while (0)
-
- /*
- * Inline the tests this way because adding the code to the support directory
- * requires all the makefile files to changed.
- */
- #if defined(TEST_INIT)
-
- char _test_output_buffer[_TEST_OUTPUT_BUFFER_SIZE];
- int _test_output_buffer_index = 0;
-
- void _test_output_printf(const char* format, ...)
- {
- va_list args;
- char* in;
- size_t size;
- bool lf;
- va_start(args, format);
- in = _test_output_buffer + _test_output_buffer_index;
- size = vsniprintf(in,
- _TEST_OUTPUT_BUFFER_SIZE - _test_output_buffer_index,
- format, args);
- lf = memchr(in, '\n', size);
- _test_output_buffer_index += size;
- if ( lf || _test_output_buffer_index >= (_TEST_OUTPUT_BUFFER_SIZE - 80) )
- _test_output_flush();
- va_end(args);
- }
-
- void _test_output_append(const char *_buffer)
- {
- char* in;
- size_t size;
- bool lf;
- in = _test_output_buffer + _test_output_buffer_index;
- size = strlcpy(in, _buffer, _TEST_OUTPUT_BUFFER_SIZE - _test_output_buffer_index);
- lf = memchr(in, '\n', size);
- if ( lf || _test_output_buffer_index >= (_TEST_OUTPUT_BUFFER_SIZE - 80) )
- _test_output_flush();
- }
-
- void _test_output_flush(void)
- {
- printk( _test_output_buffer );
- _test_output_buffer_index = 0;
- _test_output_buffer[0] = '\0';
- }
-
- #endif
-
+ #define TEST_BEGIN() \
+ do { \
+ rtems_printf( &rtems_test_printer, "\n" ); \
+ rtems_printf( &rtems_test_printer, TEST_BEGIN_STRING ); \
+ } while (0)
#endif
+#define TEST_END() \
+ do { \
+ rtems_printf( &rtems_test_printer, "\n" ); \
+ rtems_printf( &rtems_test_printer, TEST_END_STRING ); \
+ rtems_printf( &rtems_test_printer, "\n" ); \
+ } while (0)
+
#ifdef __cplusplus
};
#endif
diff --git a/testsuites/support/include/tmacros.h b/testsuites/support/include/tmacros.h
index e0418663b5..86dceb9e00 100644
--- a/testsuites/support/include/tmacros.h
+++ b/testsuites/support/include/tmacros.h
@@ -60,7 +60,7 @@ extern "C" {
&& (((!_Thread_Dispatch_is_enabled()) == false && (_expect) != 0) \
|| ((!_Thread_Dispatch_is_enabled()) && (_expect) == 0)) \
) { \
- printk( \
+ printf( \
"\n_Thread_Dispatch_disable_level is (%i)" \
" not %d detected at %s:%d\n", \
!_Thread_Dispatch_is_enabled(), (_expect), __FILE__, __LINE__ ); \
@@ -77,7 +77,7 @@ extern "C" {
#define check_if_allocator_mutex_is_not_owned() \
do { \
if ( _RTEMS_Allocator_is_owner() ) { \
- printk( \
+ printf( \
"\nRTEMS Allocator Mutex is owned by executing thread " \
"and should not be.\n" \
"Detected at %s:%d\n", \
diff --git a/testsuites/support/src/locked_print.c b/testsuites/support/src/locked_print.c
index 29e3bdcf6a..3bbaab0c4f 100644
--- a/testsuites/support/src/locked_print.c
+++ b/testsuites/support/src/locked_print.c
@@ -14,6 +14,8 @@
#include "test_support.h"
#include "tmacros.h"
+#include <rtems/bspIo.h>
+
static rtems_id locked_print_semaphore; /* synchronisation semaphore */
static int locked_printf_plugin(void *context, const char *fmt, va_list ap)