tests: Use rtems_test_printer

Update #3170.
Update #3199.
This commit is contained in:
Sebastian Huber
2017-10-26 13:59:07 +02:00
parent 7bec7f2715
commit 73d892d8a8
7 changed files with 21 additions and 39 deletions

View File

@@ -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) static void test_actions(rtems_disk_device *dd)
{ {
rtems_printer printer;
int i; int i;
rtems_print_printer_printf(&printer);
for (i = 0; i < ACTION_COUNT; ++i) { for (i = 0; i < ACTION_COUNT; ++i) {
const test_action *action = &actions [i]; const test_action *action = &actions [i];
rtems_status_code sc; 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) static void test(void)

View File

@@ -25,14 +25,11 @@
static void test(void) static void test(void)
{ {
rtems_printer printer;
rtems_print_printer_fprintf(&printer, stdout);
rtems_test_assert(rtems_debugger_start("test", "something", 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_register_test_remote() == 0);
rtems_test_assert(rtems_debugger_start("test", "something", rtems_test_assert(rtems_debugger_start("test", "something",
3, 10, &printer) == 0); 3, 10, &rtems_test_printer) == 0);
rtems_debugger_set_verbose(true); rtems_debugger_set_verbose(true);
rtems_test_assert(rtems_debugger_remote_debug(true) == 0); rtems_test_assert(rtems_debugger_remote_debug(true) == 0);

View File

@@ -97,10 +97,8 @@ void printf_uid_message(
struct MW_UID_MESSAGE *uid struct MW_UID_MESSAGE *uid
) )
{ {
rtems_printer printer;
rtems_print_printer_printf( &printer );
uid_print_message_with_plugin( uid_print_message_with_plugin(
&printer, &rtems_test_printer,
uid uid
); );
} }

View File

@@ -69,12 +69,13 @@ static void test_untar_check_mode(const char* file, int mode)
void test_untar_from_memory(void) void test_untar_from_memory(void)
{ {
rtems_status_code sc; rtems_status_code sc;
rtems_printer printer;
rtems_print_printer_printf(&printer);
printf("Untaring from memory - "); 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) { if (sc != RTEMS_SUCCESSFUL) {
printf ("error: untar failed: %s\n", rtems_status_text (sc)); printf ("error: untar failed: %s\n", rtems_status_text (sc));
exit(1); exit(1);
@@ -146,7 +147,6 @@ void test_untar_from_file(void)
void test_untar_chunks_from_memory(void) void test_untar_chunks_from_memory(void)
{ {
rtems_status_code sc; rtems_status_code sc;
rtems_printer printer;
int rv; int rv;
Untar_ChunkContext ctx; Untar_ChunkContext ctx;
unsigned long counter = 0; unsigned long counter = 0;
@@ -155,8 +155,6 @@ void test_untar_chunks_from_memory(void)
puts( "" ); puts( "" );
rtems_print_printer_printf(&printer);
/* make a directory to untar it into */ /* make a directory to untar it into */
rv = mkdir( "/dest2", 0777 ); rv = mkdir( "/dest2", 0777 );
rtems_test_assert( rv == 0 ); rtems_test_assert( rv == 0 );
@@ -167,7 +165,12 @@ void test_untar_chunks_from_memory(void)
printf( "Untaring chunks from memory - " ); printf( "Untaring chunks from memory - " );
Untar_ChunkContext_Init(&ctx); Untar_ChunkContext_Init(&ctx);
do { 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); rtems_test_assert(sc == RTEMS_SUCCESSFUL);
counter ++; counter ++;
} while (counter < buflen); } while (counter < buflen);
@@ -191,7 +194,6 @@ void test_untar_chunks_from_memory(void)
void test_untar_unzip_tgz(void) void test_untar_unzip_tgz(void)
{ {
int status; int status;
rtems_printer printer;
int rv; int rv;
Untar_GzChunkContext ctx; Untar_GzChunkContext ctx;
size_t i = 0; size_t i = 0;
@@ -203,8 +205,6 @@ void test_untar_unzip_tgz(void)
rtems_test_assert( buflen != 0 ); rtems_test_assert( buflen != 0 );
rtems_print_printer_printf(&printer);
/* make a directory to untar it into */ /* make a directory to untar it into */
rv = mkdir( "/dest3", 0777 ); rv = mkdir( "/dest3", 0777 );
rtems_test_assert( rv == 0 ); rtems_test_assert( rv == 0 );
@@ -217,7 +217,7 @@ void test_untar_unzip_tgz(void)
status = Untar_GzChunkContext_Init(&ctx, &inflate_buffer, 1); status = Untar_GzChunkContext_Init(&ctx, &inflate_buffer, 1);
rtems_test_assert(status == UNTAR_SUCCESSFUL); rtems_test_assert(status == UNTAR_SUCCESSFUL);
for(i = 0; i < buflen; i++) { 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); rtems_test_assert(status == UNTAR_SUCCESSFUL);
} }
printf( "successful\n" ); printf( "successful\n" );
@@ -240,7 +240,6 @@ void test_untar_unzip_txz(void)
{ {
#if HAVE_XZ #if HAVE_XZ
int status; int status;
rtems_printer printer;
int rv; int rv;
Untar_XzChunkContext ctx; Untar_XzChunkContext ctx;
size_t i = 0; size_t i = 0;
@@ -252,8 +251,6 @@ void test_untar_unzip_txz(void)
rtems_test_assert( buflen != 0 ); rtems_test_assert( buflen != 0 );
rtems_print_printer_printf(&printer);
/* make a directory to untar it into */ /* make a directory to untar it into */
rv = mkdir( "/dest4", 0777 ); rv = mkdir( "/dest4", 0777 );
rtems_test_assert( rv == 0 ); rtems_test_assert( rv == 0 );
@@ -270,7 +267,7 @@ void test_untar_unzip_txz(void)
8 * 1024, &inflate_buffer, 1); 8 * 1024, &inflate_buffer, 1);
rtems_test_assert(status == UNTAR_SUCCESSFUL); rtems_test_assert(status == UNTAR_SUCCESSFUL);
for(i = 0; i < buflen; i++) { 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); rtems_test_assert(status == UNTAR_SUCCESSFUL);
} }
printf( "successful\n" ); printf( "successful\n" );

View File

@@ -71,10 +71,8 @@ void printf_uid_message(
struct MW_UID_MESSAGE *uid struct MW_UID_MESSAGE *uid
) )
{ {
rtems_printer printer;
rtems_print_printer_printf( &printer );
uid_print_message_with_plugin( uid_print_message_with_plugin(
&printer, &rtems_test_printer,
uid uid
); );
} }

View File

@@ -20,7 +20,6 @@
#include <rtems.h> #include <rtems.h>
#include <rtems/cpuuse.h> #include <rtems/cpuuse.h>
#include <rtems/printer.h>
#include "tmacros.h" #include "tmacros.h"
@@ -73,7 +72,6 @@ static void t2(rtems_task_argument arg)
static void test(test_context *ctx) static void test(test_context *ctx)
{ {
rtems_status_code sc; rtems_status_code sc;
rtems_printer printer;
ctx->one_tick_busy = rtems_test_get_one_tick_busy_count(); 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]); sc = rtems_task_suspend(ctx->task[1]);
rtems_test_assert(sc == RTEMS_SUCCESSFUL); rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_print_printer_printf(&printer); rtems_cpu_usage_report_with_plugin(&rtems_test_printer);
rtems_cpu_usage_report_with_plugin(&printer); rtems_rate_monotonic_report_statistics_with_plugin(&rtems_test_printer);
rtems_rate_monotonic_report_statistics_with_plugin(&printer);
} }
static void Init(rtems_task_argument arg) static void Init(rtems_task_argument arg)

View File

@@ -117,15 +117,13 @@ static void test_iterate(void)
static void test_report_xml(void) static void test_report_xml(void)
{ {
rtems_printer printer;
rtems_status_code sc; rtems_status_code sc;
int rv; int rv;
sc = rtems_task_wake_after(3); sc = rtems_task_wake_after(3);
rtems_test_assert(sc == RTEMS_SUCCESSFUL); rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_print_printer_printf(&printer); rv = rtems_profiling_report_xml("X", &rtems_test_printer, 1, " ");
rv = rtems_profiling_report_xml("X", &printer, 1, " ");
printf("characters produced by rtems_profiling_report_xml(): %i\n", rv); printf("characters produced by rtems_profiling_report_xml(): %i\n", rv);
} }