[PATCH 1/9] tests: Move rtems_test_printer definition

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Oct 26 11:59:05 UTC 2017


Statically initialize it to use printk().

Update #3170.
Update #3199.
---
 cpukit/include/rtems/bspIo.h              | 6 ++++++
 cpukit/libcsupport/src/printk_plugin.c    | 4 ++--
 cpukit/libmisc/testsupport/testbeginend.c | 7 ++++++-
 testsuites/libtests/capture01/init.c      | 1 -
 testsuites/libtests/complex/init.c        | 1 -
 testsuites/libtests/math/init.c           | 1 -
 testsuites/libtests/mathf/init.c          | 1 -
 testsuites/libtests/mathl/init.c          | 1 -
 testsuites/samples/capture/init.c         | 1 -
 testsuites/samples/hello/init.c           | 1 -
 testsuites/samples/loopback/init.c        | 1 -
 testsuites/samples/paranoia/init.c        | 1 -
 testsuites/samples/pppd/init.c            | 1 -
 testsuites/sptests/sp20/init.c            | 2 --
 testsuites/support/src/locked_print.c     | 2 --
 15 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index 8ab46afecd..d49fe3a228 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -94,6 +94,12 @@ extern int getchark(void);
  */
 extern int vprintk(const char *fmt, va_list ap);
 
+int rtems_printk_printer(
+  void *ignored,
+  const char *format,
+  va_list ap
+);
+
 /**
  * @brief Kernel Print
  *
diff --git a/cpukit/libcsupport/src/printk_plugin.c b/cpukit/libcsupport/src/printk_plugin.c
index 3b4a911eb2..9676b83978 100644
--- a/cpukit/libcsupport/src/printk_plugin.c
+++ b/cpukit/libcsupport/src/printk_plugin.c
@@ -21,7 +21,7 @@
 #include <rtems/printer.h>
 #include <rtems/bspIo.h>
 
-static int printk_plugin(
+int rtems_printk_printer(
   void *ignored,
   const char *format,
   va_list ap
@@ -37,5 +37,5 @@ void rtems_print_printer_printk(
 )
 {
   printer->context = NULL;
-  printer->printer = printk_plugin;
+  printer->printer = rtems_printk_printer;
 }
diff --git a/cpukit/libmisc/testsupport/testbeginend.c b/cpukit/libmisc/testsupport/testbeginend.c
index cc00c8f0a9..ff64851c02 100644
--- a/cpukit/libmisc/testsupport/testbeginend.c
+++ b/cpukit/libmisc/testsupport/testbeginend.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2014, 2017 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -17,6 +17,11 @@
 #endif
 
 #include <rtems/test.h>
+#include <rtems/bspIo.h>
+
+rtems_printer rtems_test_printer = {
+  .printer = rtems_printk_printer
+};
 
 int rtems_test_begin(void)
 {
diff --git a/testsuites/libtests/capture01/init.c b/testsuites/libtests/capture01/init.c
index 8062cbbd75..6d5d095527 100644
--- a/testsuites/libtests/capture01/init.c
+++ b/testsuites/libtests/capture01/init.c
@@ -35,7 +35,6 @@
 rtems_task Init(rtems_task_argument argument);
 
 const char rtems_test_name[] = "CAPTURE 1";
-rtems_printer rtems_test_printer;
 
 rtems_task Init(
   rtems_task_argument ignored
diff --git a/testsuites/libtests/complex/init.c b/testsuites/libtests/complex/init.c
index c4295e6589..7e21b2c92e 100644
--- a/testsuites/libtests/complex/init.c
+++ b/testsuites/libtests/complex/init.c
@@ -27,7 +27,6 @@
 #include <rtems/test.h>
 
 const char rtems_test_name[] = "COMPLEX";
-rtems_printer rtems_test_printer;
 #endif
 
 #include <stdio.h>
diff --git a/testsuites/libtests/math/init.c b/testsuites/libtests/math/init.c
index 732979394e..b3d56c41c6 100644
--- a/testsuites/libtests/math/init.c
+++ b/testsuites/libtests/math/init.c
@@ -31,7 +31,6 @@
 #include <rtems/test.h>
 
 const char rtems_test_name[] = "MATH";
-rtems_printer rtems_test_printer;
 #endif
 
 #include <stdio.h>
diff --git a/testsuites/libtests/mathf/init.c b/testsuites/libtests/mathf/init.c
index 0737686aec..671e881fef 100644
--- a/testsuites/libtests/mathf/init.c
+++ b/testsuites/libtests/mathf/init.c
@@ -27,7 +27,6 @@
 #include <rtems/test.h>
 
 const char rtems_test_name[] = "MATHF";
-rtems_printer rtems_test_printer;
 #endif
 
 #include <stdio.h>
diff --git a/testsuites/libtests/mathl/init.c b/testsuites/libtests/mathl/init.c
index 0f0672dab6..98a6f458a4 100644
--- a/testsuites/libtests/mathl/init.c
+++ b/testsuites/libtests/mathl/init.c
@@ -27,7 +27,6 @@
 #include <rtems/test.h>
 
 const char rtems_test_name[] = "MATHL";
-rtems_printer rtems_test_printer;
 #endif
 
 #include <stdio.h>
diff --git a/testsuites/samples/capture/init.c b/testsuites/samples/capture/init.c
index 4893274254..24f04c50a2 100644
--- a/testsuites/samples/capture/init.c
+++ b/testsuites/samples/capture/init.c
@@ -29,7 +29,6 @@ rtems_task Init(rtems_task_argument argument);
 static void notification(int fd, int seconds_remaining, void *arg);
 
 const char rtems_test_name[] = "CAPTURE ENGINE";
-rtems_printer rtems_test_printer;
 
 volatile int can_proceed = 1;
 
diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c
index 5460da9f9e..ba379fbaa0 100644
--- a/testsuites/samples/hello/init.c
+++ b/testsuites/samples/hello/init.c
@@ -23,7 +23,6 @@
 rtems_task Init(rtems_task_argument argument);
 
 const char rtems_test_name[] = "HELLO WORLD";
-rtems_printer rtems_test_printer;
 
 rtems_task Init(
   rtems_task_argument ignored
diff --git a/testsuites/samples/loopback/init.c b/testsuites/samples/loopback/init.c
index 6c6a6148aa..3ff8fbd41e 100644
--- a/testsuites/samples/loopback/init.c
+++ b/testsuites/samples/loopback/init.c
@@ -13,7 +13,6 @@
 #include <bsp.h>
 
 const char rtems_test_name[] = "LOOPBACK";
-rtems_printer rtems_test_printer;
 
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
diff --git a/testsuites/samples/paranoia/init.c b/testsuites/samples/paranoia/init.c
index 60aaefc2bb..4326db3b6f 100644
--- a/testsuites/samples/paranoia/init.c
+++ b/testsuites/samples/paranoia/init.c
@@ -21,7 +21,6 @@
 extern int paranoia(int, char **);
 
 const char rtems_test_name[] = "PARANOIA";
-rtems_printer rtems_test_printer;
 
 char *args[2] = { "paranoia", 0 };
 
diff --git a/testsuites/samples/pppd/init.c b/testsuites/samples/pppd/init.c
index e8bd7c37ca..d689ff1e71 100644
--- a/testsuites/samples/pppd/init.c
+++ b/testsuites/samples/pppd/init.c
@@ -26,7 +26,6 @@
 #include "netconfig.h"
 
 const char rtems_test_name[] = "PPPD";
-rtems_printer rtems_test_printer;
 
 static void notification(int fd, int seconds_remaining, void *arg)
 {
diff --git a/testsuites/sptests/sp20/init.c b/testsuites/sptests/sp20/init.c
index 0ffd75a32c..8b831ba339 100644
--- a/testsuites/sptests/sp20/init.c
+++ b/testsuites/sptests/sp20/init.c
@@ -30,8 +30,6 @@
 
 const char rtems_test_name[] = "SP 20";
 
-rtems_printer rtems_test_printer;
-
 #define BUFFER_COUNT 20
 
 #define BUFFER_SIZE 100
diff --git a/testsuites/support/src/locked_print.c b/testsuites/support/src/locked_print.c
index bbe0578a7f..29e3bdcf6a 100644
--- a/testsuites/support/src/locked_print.c
+++ b/testsuites/support/src/locked_print.c
@@ -16,8 +16,6 @@
 
 static rtems_id locked_print_semaphore;      /* synchronisation semaphore */
 
-rtems_printer rtems_test_printer;
-
 static int locked_printf_plugin(void *context, const char *fmt, va_list ap)
 {
   (void) context;
-- 
2.12.3



More information about the devel mailing list