diff options
Diffstat (limited to 'testsuites/support')
-rw-r--r-- | testsuites/support/include/buffer_test_io.h | 16 | ||||
-rw-r--r-- | testsuites/support/include/test_support.h | 2 | ||||
-rw-r--r-- | testsuites/support/src/locked_print.c | 42 |
3 files changed, 32 insertions, 28 deletions
diff --git a/testsuites/support/include/buffer_test_io.h b/testsuites/support/include/buffer_test_io.h index e5fbd2b0f3..0ae3909d4d 100644 --- a/testsuites/support/include/buffer_test_io.h +++ b/testsuites/support/include/buffer_test_io.h @@ -24,7 +24,7 @@ extern "C" { */ #if defined(TESTS_USE_PRINTK) -#include <rtems/bspIo.h> +#include <rtems/print.h> #undef printf #define printf(...) \ @@ -54,9 +54,9 @@ extern "C" { do { \ } while (0) - #define TEST_BEGIN() rtems_test_begink() + #define TEST_BEGIN() printk(TEST_BEGIN_STRING) - #define TEST_END() rtems_test_endk() + #define TEST_END() printk(TEST_END_STRING) /* * BUFFER TEST OUTPUT @@ -156,9 +156,9 @@ extern "C" { fflush(stdout); \ } while (0) - #define TEST_BEGIN() rtems_test_begin() + #define TEST_BEGIN() printf(TEST_BEGIN_STRING) - #define TEST_END() rtems_test_end() + #define TEST_END() printf(TEST_END_STRING) /* * USE IPRINT @@ -205,11 +205,9 @@ extern "C" { fflush(stdout); \ } while (0) - #define TEST_BEGIN() \ - rtems_test_begin_with_plugin((rtems_printk_plugin_t) fiprintf, stderr) + #define TEST_BEGIN() fiprintf( stderr, TEST_BEGIN_STRING) - #define TEST_END() \ - rtems_test_end_with_plugin((rtems_printk_plugin_t) fiprintf, stderr) + #define TEST_END() fiprintf( stderr, TEST_END_STRING) #endif diff --git a/testsuites/support/include/test_support.h b/testsuites/support/include/test_support.h index 7c459ff1d9..d6870b2ded 100644 --- a/testsuites/support/include/test_support.h +++ b/testsuites/support/include/test_support.h @@ -74,8 +74,6 @@ int locked_printf(const char *fmt, ...); int locked_vprintf(const char *fmt, va_list ap); -int locked_printf_plugin(void *context, const char *fmt, ...); - void locked_printk(const char *fmt, ...); #ifdef __cplusplus diff --git a/testsuites/support/src/locked_print.c b/testsuites/support/src/locked_print.c index 8414479061..7c0df667f8 100644 --- a/testsuites/support/src/locked_print.c +++ b/testsuites/support/src/locked_print.c @@ -1,4 +1,4 @@ -/* +/* * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * @@ -14,7 +14,23 @@ #include "test_support.h" #include "tmacros.h" -static rtems_id locked_print_semaphore; /* synchronisation semaphore */ +static rtems_id locked_print_semaphore; /* synchronisation semaphore */ + +rtems_printer rtems_test_printer; + +static int locked_printf_plugin(void *context, const char *fmt, ...) +{ + int rv; + va_list ap; + + (void) context; + + va_start(ap, fmt); + rv = locked_vprintf(fmt, ap); + va_end(ap); + + return rv; +} void locked_print_initialize(void) { @@ -29,7 +45,7 @@ void locked_print_initialize(void) /* Create/verify synchronisation semaphore */ sc = rtems_semaphore_create( rtems_build_name ('S', 'E', 'M', '1'), - 1, + 1, RTEMS_LOCAL | RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | @@ -38,6 +54,12 @@ void locked_print_initialize(void) &locked_print_semaphore ); directive_failed( sc, "rtems_semaphore_create" ); + + /* + * Set up the printer to use the locked printf printer. + */ + rtems_test_printer.context = NULL; + rtems_test_printer.context = locked_printf_plugin; } int locked_vprintf(const char *fmt, va_list ap) @@ -60,20 +82,6 @@ int locked_vprintf(const char *fmt, va_list ap) return rv; } -int locked_printf_plugin(void *context, const char *fmt, ...) -{ - int rv; - va_list ap; - - (void) context; - - va_start(ap, fmt); - rv = locked_vprintf(fmt, ap); - va_end(ap); - - return rv; -} - int locked_printf(const char *fmt, ...) { int rv; |