[PATCH 3/9] tests: Use rtems_test_printer

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


Update #3170.
Update #3199.
---
 testsuites/libtests/block14/init.c       |  5 +----
 testsuites/libtests/debugger01/init.c    |  7 ++-----
 testsuites/libtests/mouse01/init.c       |  4 +---
 testsuites/libtests/tar01/init.c         | 29 +++++++++++++----------------
 testsuites/libtests/uid01/init.c         |  4 +---
 testsuites/smptests/smpschededf01/init.c |  7 ++-----
 testsuites/sptests/spprofiling01/init.c  |  4 +---
 7 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/testsuites/libtests/block14/init.c b/testsuites/libtests/block14/init.c
index fcbb1b5f66..d7cd640e25 100644
--- a/testsuites/libtests/block14/init.c
+++ b/testsuites/libtests/block14/init.c
@@ -120,11 +120,8 @@ static int test_disk_ioctl(rtems_disk_device *dd, uint32_t req, void *arg)
 
 static void test_actions(rtems_disk_device *dd)
 {
-  rtems_printer printer;
   int i;
 
-  rtems_print_printer_printf(&printer);
-
   for (i = 0; i < ACTION_COUNT; ++i) {
     const test_action *action = &actions [i];
     rtems_status_code sc;
@@ -160,7 +157,7 @@ static void test_actions(rtems_disk_device *dd)
     );
   }
 
-  rtems_blkdev_print_stats(&dd->stats, 0, 1, 2, &printer);
+  rtems_blkdev_print_stats(&dd->stats, 0, 1, 2, &rtems_test_printer);
 }
 
 static void test(void)
diff --git a/testsuites/libtests/debugger01/init.c b/testsuites/libtests/debugger01/init.c
index e7db8fe15d..1bb28d4992 100644
--- a/testsuites/libtests/debugger01/init.c
+++ b/testsuites/libtests/debugger01/init.c
@@ -25,14 +25,11 @@
 
 static void test(void)
 {
-  rtems_printer printer;
-
-  rtems_print_printer_fprintf(&printer, stdout);
   rtems_test_assert(rtems_debugger_start("test", "something",
-                                         3, 10, &printer) < 0);
+                                         3, 10, &rtems_test_printer) < 0);
   rtems_test_assert(rtems_debugger_register_test_remote() == 0);
   rtems_test_assert(rtems_debugger_start("test", "something",
-                                         3, 10, &printer) == 0);
+                                         3, 10, &rtems_test_printer) == 0);
   rtems_debugger_set_verbose(true);
   rtems_test_assert(rtems_debugger_remote_debug(true) == 0);
 
diff --git a/testsuites/libtests/mouse01/init.c b/testsuites/libtests/mouse01/init.c
index 145887a15a..24d6a2e0cc 100644
--- a/testsuites/libtests/mouse01/init.c
+++ b/testsuites/libtests/mouse01/init.c
@@ -97,10 +97,8 @@ void printf_uid_message(
   struct MW_UID_MESSAGE *uid
 )
 {
-  rtems_printer printer;
-  rtems_print_printer_printf( &printer );
   uid_print_message_with_plugin(
-    &printer,
+    &rtems_test_printer,
     uid
   );
 }
diff --git a/testsuites/libtests/tar01/init.c b/testsuites/libtests/tar01/init.c
index ffc49b68c1..8f3d69094c 100644
--- a/testsuites/libtests/tar01/init.c
+++ b/testsuites/libtests/tar01/init.c
@@ -69,12 +69,13 @@ static void test_untar_check_mode(const char* file, int mode)
 void test_untar_from_memory(void)
 {
   rtems_status_code sc;
-  rtems_printer     printer;
-
-  rtems_print_printer_printf(&printer);
 
   printf("Untaring from memory - ");
-  sc = Untar_FromMemory_Print((void *)TARFILE_START, TARFILE_SIZE, &printer);
+  sc = Untar_FromMemory_Print(
+    (void *)TARFILE_START,
+    TARFILE_SIZE,
+    &rtems_test_printer
+  );
   if (sc != RTEMS_SUCCESSFUL) {
     printf ("error: untar failed: %s\n", rtems_status_text (sc));
     exit(1);
@@ -146,7 +147,6 @@ void test_untar_from_file(void)
 void test_untar_chunks_from_memory(void)
 {
   rtems_status_code sc;
-  rtems_printer     printer;
   int rv;
   Untar_ChunkContext ctx;
   unsigned long counter = 0;
@@ -155,8 +155,6 @@ void test_untar_chunks_from_memory(void)
 
   puts( "" );
 
-  rtems_print_printer_printf(&printer);
-
   /* make a directory to untar it into */
   rv = mkdir( "/dest2", 0777 );
   rtems_test_assert( rv == 0 );
@@ -167,7 +165,12 @@ void test_untar_chunks_from_memory(void)
   printf( "Untaring chunks from memory - " );
   Untar_ChunkContext_Init(&ctx);
   do {
-    sc = Untar_FromChunk_Print(&ctx, &buffer[counter], (size_t)1 , &printer);
+    sc = Untar_FromChunk_Print(
+      &ctx,
+      &buffer[counter],
+      (size_t)1 ,
+      &rtems_test_printer
+    );
     rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     counter ++;
   } while (counter < buflen);
@@ -191,7 +194,6 @@ void test_untar_chunks_from_memory(void)
 void test_untar_unzip_tgz(void)
 {
   int status;
-  rtems_printer     printer;
   int rv;
   Untar_GzChunkContext ctx;
   size_t i = 0;
@@ -203,8 +205,6 @@ void test_untar_unzip_tgz(void)
 
   rtems_test_assert( buflen != 0 );
 
-  rtems_print_printer_printf(&printer);
-
   /* make a directory to untar it into */
   rv = mkdir( "/dest3", 0777 );
   rtems_test_assert( rv == 0 );
@@ -217,7 +217,7 @@ void test_untar_unzip_tgz(void)
   status = Untar_GzChunkContext_Init(&ctx, &inflate_buffer, 1);
   rtems_test_assert(status == UNTAR_SUCCESSFUL);
   for(i = 0; i < buflen; i++) {
-    status = Untar_FromGzChunk_Print(&ctx, &buffer[i], 1, &printer);
+    status = Untar_FromGzChunk_Print(&ctx, &buffer[i], 1, &rtems_test_printer);
     rtems_test_assert(status == UNTAR_SUCCESSFUL);
   }
   printf( "successful\n" );
@@ -240,7 +240,6 @@ void test_untar_unzip_txz(void)
 {
 #if HAVE_XZ
   int status;
-  rtems_printer     printer;
   int rv;
   Untar_XzChunkContext ctx;
   size_t i = 0;
@@ -252,8 +251,6 @@ void test_untar_unzip_txz(void)
 
   rtems_test_assert( buflen != 0 );
 
-  rtems_print_printer_printf(&printer);
-
   /* make a directory to untar it into */
   rv = mkdir( "/dest4", 0777 );
   rtems_test_assert( rv == 0 );
@@ -270,7 +267,7 @@ void test_untar_unzip_txz(void)
                                      8 * 1024, &inflate_buffer, 1);
   rtems_test_assert(status == UNTAR_SUCCESSFUL);
   for(i = 0; i < buflen; i++) {
-    status = Untar_FromXzChunk_Print(&ctx, &buffer[i], 1, &printer);
+    status = Untar_FromXzChunk_Print(&ctx, &buffer[i], 1, &rtems_test_printer);
     rtems_test_assert(status == UNTAR_SUCCESSFUL);
   }
   printf( "successful\n" );
diff --git a/testsuites/libtests/uid01/init.c b/testsuites/libtests/uid01/init.c
index 56eba61a94..90490fa48c 100644
--- a/testsuites/libtests/uid01/init.c
+++ b/testsuites/libtests/uid01/init.c
@@ -71,10 +71,8 @@ void printf_uid_message(
   struct MW_UID_MESSAGE *uid
 )
 {
-  rtems_printer printer;
-  rtems_print_printer_printf( &printer );
   uid_print_message_with_plugin(
-    &printer,
+    &rtems_test_printer,
     uid
   );
 }
diff --git a/testsuites/smptests/smpschededf01/init.c b/testsuites/smptests/smpschededf01/init.c
index 2bfcadfef8..b162196c4c 100644
--- a/testsuites/smptests/smpschededf01/init.c
+++ b/testsuites/smptests/smpschededf01/init.c
@@ -20,7 +20,6 @@
 
 #include <rtems.h>
 #include <rtems/cpuuse.h>
-#include <rtems/printer.h>
 
 #include "tmacros.h"
 
@@ -73,7 +72,6 @@ static void t2(rtems_task_argument arg)
 static void test(test_context *ctx)
 {
   rtems_status_code sc;
-  rtems_printer printer;
 
   ctx->one_tick_busy = rtems_test_get_one_tick_busy_count();
 
@@ -117,9 +115,8 @@ static void test(test_context *ctx)
   sc = rtems_task_suspend(ctx->task[1]);
   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
 
-  rtems_print_printer_printf(&printer);
-  rtems_cpu_usage_report_with_plugin(&printer);
-  rtems_rate_monotonic_report_statistics_with_plugin(&printer);
+  rtems_cpu_usage_report_with_plugin(&rtems_test_printer);
+  rtems_rate_monotonic_report_statistics_with_plugin(&rtems_test_printer);
 }
 
 static void Init(rtems_task_argument arg)
diff --git a/testsuites/sptests/spprofiling01/init.c b/testsuites/sptests/spprofiling01/init.c
index 5e7e7411d3..a70343b21f 100644
--- a/testsuites/sptests/spprofiling01/init.c
+++ b/testsuites/sptests/spprofiling01/init.c
@@ -117,15 +117,13 @@ static void test_iterate(void)
 
 static void test_report_xml(void)
 {
-  rtems_printer printer;
   rtems_status_code sc;
   int rv;
 
   sc = rtems_task_wake_after(3);
   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
 
-  rtems_print_printer_printf(&printer);
-  rv = rtems_profiling_report_xml("X", &printer, 1, "  ");
+  rv = rtems_profiling_report_xml("X", &rtems_test_printer, 1, "  ");
   printf("characters produced by rtems_profiling_report_xml(): %i\n", rv);
 }
 
-- 
2.12.3




More information about the devel mailing list