[rtems commit] tests/samples: Use <rtems/test.h>
Sebastian Huber
sebh at rtems.org
Mon Mar 17 08:10:34 UTC 2014
Module: rtems
Branch: master
Commit: 9391f6d6637c752046cdfd89ae2eeea147496e44
Changeset: http://git.rtems.org/rtems/commit/?id=9391f6d6637c752046cdfd89ae2eeea147496e44
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Mar 10 16:31:43 2014 +0100
tests/samples: Use <rtems/test.h>
---
testsuites/samples/base_mp/apptask.c | 2 +-
testsuites/samples/base_mp/init.c | 4 +++-
testsuites/samples/base_mp/system.h | 3 +++
testsuites/samples/base_sp/apptask.c | 2 +-
testsuites/samples/base_sp/init.c | 4 +++-
testsuites/samples/base_sp/system.h | 3 +++
testsuites/samples/capture/init.c | 6 ++++--
testsuites/samples/capture/system.h | 3 +++
testsuites/samples/cdtest/main.cc | 8 +++++---
testsuites/samples/cdtest/system.h | 3 +++
testsuites/samples/fileio/init.c | 6 ++++--
testsuites/samples/fileio/system.h | 4 ++++
testsuites/samples/hello/init.c | 10 ++++++++--
testsuites/samples/iostream/init.cc | 6 ++++--
testsuites/samples/iostream/system.h | 3 +++
testsuites/samples/loopback/init.c | 10 +++++++++-
testsuites/samples/nsecs/init.c | 6 ++++--
testsuites/samples/nsecs/system.h | 4 ++++
testsuites/samples/paranoia/init.c | 6 ++++--
testsuites/samples/paranoia/system.h | 3 +++
testsuites/samples/pppd/init.c | 4 ++++
testsuites/samples/pppd/system.h | 3 +++
testsuites/samples/ticker/init.c | 4 +++-
testsuites/samples/ticker/system.h | 3 +++
testsuites/samples/ticker/tasks.c | 2 +-
testsuites/samples/unlimited/init.c | 8 +++++---
26 files changed, 95 insertions(+), 25 deletions(-)
diff --git a/testsuites/samples/base_mp/apptask.c b/testsuites/samples/base_mp/apptask.c
index a9ddc7f..4af9048 100644
--- a/testsuites/samples/base_mp/apptask.c
+++ b/testsuites/samples/base_mp/apptask.c
@@ -37,6 +37,6 @@ rtems_task Application_task(
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
printf( "This task was invoked with the node argument (%" PRIdrtems_task_argument ")\n", node );
printf( "This task has the id of 0x%" PRIxrtems_id "\n", tid );
- printf( "*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***\n" );
+ TEST_END();
exit( 0 );
}
diff --git a/testsuites/samples/base_mp/init.c b/testsuites/samples/base_mp/init.c
index e2a9b84..e7780ac 100644
--- a/testsuites/samples/base_mp/init.c
+++ b/testsuites/samples/base_mp/init.c
@@ -18,6 +18,8 @@
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "SAMPLE MULTIPROCESSOR APPLICATION";
+
rtems_task Init(
rtems_task_argument argument
)
@@ -26,7 +28,7 @@ rtems_task Init(
rtems_id tid;
rtems_status_code status;
- printf( "\n\n*** SAMPLE MULTIPROCESSOR APPLICATION ***\n" );
+ TEST_BEGIN();
printf( "Creating and starting an application task\n" );
task_name = rtems_build_name( 'T', 'A', '1', ' ' );
status = rtems_task_create( task_name, 1, RTEMS_MINIMUM_STACK_SIZE,
diff --git a/testsuites/samples/base_mp/system.h b/testsuites/samples/base_mp/system.h
index e8210f2..45d8b7f 100644
--- a/testsuites/samples/base_mp/system.h
+++ b/testsuites/samples/base_mp/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
/* functions */
@@ -36,6 +37,8 @@ rtems_task Application_task(
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
/*
* Put the overrides of default configuration parameters here.
*/
diff --git a/testsuites/samples/base_sp/apptask.c b/testsuites/samples/base_sp/apptask.c
index 379e5c3..a7780d0 100644
--- a/testsuites/samples/base_sp/apptask.c
+++ b/testsuites/samples/base_sp/apptask.c
@@ -41,6 +41,6 @@ rtems_task Application_task(
"and has id of 0x%" PRIxrtems_id "\n", argument, tid
);
- printf( "*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***\n" );
+ TEST_END();
exit( 0 );
}
diff --git a/testsuites/samples/base_sp/init.c b/testsuites/samples/base_sp/init.c
index 8ad2eed..5dcbf6d 100644
--- a/testsuites/samples/base_sp/init.c
+++ b/testsuites/samples/base_sp/init.c
@@ -19,6 +19,8 @@
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "SAMPLE SINGLE PROCESSOR APPLICATION";
+
#define ARGUMENT 0
rtems_task Init(
@@ -29,7 +31,7 @@ rtems_task Init(
rtems_id tid;
rtems_status_code status;
- printf( "\n\n*** SAMPLE SINGLE PROCESSOR APPLICATION ***\n" );
+ TEST_BEGIN();
printf( "Creating and starting an application task\n" );
task_name = rtems_build_name( 'T', 'A', '1', ' ' );
diff --git a/testsuites/samples/base_sp/system.h b/testsuites/samples/base_sp/system.h
index aa04d0a..837b52d 100644
--- a/testsuites/samples/base_sp/system.h
+++ b/testsuites/samples/base_sp/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
/* functions */
@@ -33,6 +34,8 @@ rtems_task Application_task(
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
/* end of include file */
diff --git a/testsuites/samples/capture/init.c b/testsuites/samples/capture/init.c
index 67f87dd..40562f4 100644
--- a/testsuites/samples/capture/init.c
+++ b/testsuites/samples/capture/init.c
@@ -28,6 +28,8 @@ rtems_task Init(rtems_task_argument argument);
static void notification(int fd, int seconds_remaining, void *arg);
#endif
+const char rtems_test_name[] = "CAPTURE ENGINE";
+
volatile int can_proceed = 1;
#if !BSP_SMALL_MEMORY
@@ -51,7 +53,7 @@ rtems_task Init(
rtems_task_priority old_priority;
rtems_mode old_mode;
- puts( "\n\n*** TEST CAPTURE ENGINE ***" );
+ rtems_test_begin();
status = rtems_shell_wait_for_input(
STDIN_FILENO,
@@ -78,7 +80,7 @@ rtems_task Init(
rtems_task_delete (RTEMS_SELF);
} else {
- puts( "*** END OF TEST CAPTURE ENGINE ***" );
+ rtems_test_end();
exit( 0 );
}
diff --git a/testsuites/samples/capture/system.h b/testsuites/samples/capture/system.h
index cbc6137..224800a 100644
--- a/testsuites/samples/capture/system.h
+++ b/testsuites/samples/capture/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
/* functions */
@@ -49,6 +50,8 @@ extern void setup_tasks_to_watch(void);
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS (5)
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
/*
diff --git a/testsuites/samples/cdtest/main.cc b/testsuites/samples/cdtest/main.cc
index 5edfc70..23a98fc 100644
--- a/testsuites/samples/cdtest/main.cc
+++ b/testsuites/samples/cdtest/main.cc
@@ -23,6 +23,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
#include <cstdio>
#include <cstdlib>
@@ -31,6 +32,8 @@
#include <iostream>
#endif
+const char rtems_test_name[] = "CONSTRUCTOR/DESTRUCTOR";
+
extern "C"
{
#include <tmacros.h>
@@ -176,12 +179,11 @@ rtems_task main_task(
rtems_task_argument
)
{
- printf( "\n\n*** CONSTRUCTOR/DESTRUCTOR TEST ***\n" );
+ TEST_BEGIN();
cdtest();
- printf( "*** END OF CONSTRUCTOR/DESTRUCTOR TEST ***\n\n\n" );
-
+ TEST_END();
printf( "*** TESTING C++ EXCEPTIONS ***\n\n" );
diff --git a/testsuites/samples/cdtest/system.h b/testsuites/samples/cdtest/system.h
index f9f13c2..90789fc 100644
--- a/testsuites/samples/cdtest/system.h
+++ b/testsuites/samples/cdtest/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
/* functions */
@@ -33,6 +34,8 @@ rtems_task main_task(
#define CONFIGURE_INIT_TASK_ENTRY_POINT main_task
#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'C', 'T', 'O', 'R' )
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
/* end of include file */
diff --git a/testsuites/samples/fileio/init.c b/testsuites/samples/fileio/init.c
index 75d16a4..80da4ab 100644
--- a/testsuites/samples/fileio/init.c
+++ b/testsuites/samples/fileio/init.c
@@ -32,6 +32,8 @@
#include <rtems/nvdisk-sram.h>
#include <rtems/shell.h>
+const char rtems_test_name[] = "FILE I/O";
+
#if FILEIO_BUILD
/**
@@ -1220,7 +1222,7 @@ Init (rtems_task_argument ignored)
rtems_id Task_id;
rtems_status_code status;
- puts( "\n\n*** TEST FILE I/O SAMPLE ***" );
+ TEST_BEGIN();
status = rtems_shell_wait_for_input(
STDIN_FILENO,
@@ -1244,7 +1246,7 @@ Init (rtems_task_argument ignored)
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "delete" );
} else {
- puts( "*** END OF TEST FILE I/O SAMPLE ***" );
+ TEST_END();
rtems_test_exit( 0 );
}
diff --git a/testsuites/samples/fileio/system.h b/testsuites/samples/fileio/system.h
index 1e575b6..726a507 100644
--- a/testsuites/samples/fileio/system.h
+++ b/testsuites/samples/fileio/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
#include "tmacros.h"
/* functions */
@@ -72,6 +73,9 @@ rtems_task Init(
#define CONFIGURE_MALLOC_STATISTICS
#define CONFIGURE_UNIFIED_WORK_AREAS
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
/* end of include file */
diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c
index 8a44a88..3949c8d 100644
--- a/testsuites/samples/hello/init.c
+++ b/testsuites/samples/hello/init.c
@@ -11,6 +11,8 @@
#include "config.h"
#endif
+#include <rtems/test.h>
+
#include <bsp.h> /* for device driver prototypes */
#include <stdio.h>
@@ -19,13 +21,15 @@
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "HELLO WORLD";
+
rtems_task Init(
rtems_task_argument ignored
)
{
- printf( "\n\n*** HELLO WORLD TEST ***\n" );
+ rtems_test_begin();
printf( "Hello World\n" );
- printf( "*** END OF HELLO WORLD TEST ***\n" );
+ rtems_test_end();
exit( 0 );
}
@@ -39,5 +43,7 @@ rtems_task Init(
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/samples/iostream/init.cc b/testsuites/samples/iostream/init.cc
index c3dbec4..770d26f 100644
--- a/testsuites/samples/iostream/init.cc
+++ b/testsuites/samples/iostream/init.cc
@@ -29,6 +29,8 @@
#include <stdlib.h>
+const char rtems_test_name[] = "HELLO WORLD";
+
rtems_task Init(
rtems_task_argument ignored
)
@@ -36,9 +38,9 @@ rtems_task Init(
#if BSP_SMALL_MEMORY
printf ("NO STDC++. MEMORY TOO SMALL");
#else
- std::cout << "\n\n*** HELLO WORLD TEST ***" << std::endl;
+ std::cout << "\n\n*** " << rtems_test_name << " TEST ***" << std::endl;
std::cout << "Hello World" << std::endl;
- std::cout << "*** END OF HELLO WORLD TEST ***" << std::endl;
+ std::cout << "*** END OF " << rtems_test_name << " TEST ***" << std::endl;
#endif
exit( 0 );
}
diff --git a/testsuites/samples/iostream/system.h b/testsuites/samples/iostream/system.h
index cf144cc..ebe5380 100644
--- a/testsuites/samples/iostream/system.h
+++ b/testsuites/samples/iostream/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
/* configuration information */
@@ -33,6 +34,8 @@
/* Only remove when this macro is removed from confdefs.h. It tests it. */
#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
/* end of include file */
diff --git a/testsuites/samples/loopback/init.c b/testsuites/samples/loopback/init.c
index 398dbe7..c01d138 100644
--- a/testsuites/samples/loopback/init.c
+++ b/testsuites/samples/loopback/init.c
@@ -8,8 +8,12 @@
#include "config.h"
#endif
+#include <rtems/test.h>
+
#include <bsp.h>
+const char rtems_test_name[] = "LOOPBACK";
+
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
@@ -33,6 +37,8 @@
#define CONFIGURE_INIT
rtems_task Init(rtems_task_argument argument);
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
#if !BSP_SMALL_MEMORY
@@ -241,6 +247,8 @@ Init (rtems_task_argument ignored)
{
rtems_status_code sc;
+ rtems_test_begin();
+
sc = rtems_semaphore_create(rtems_build_name('P','m','t','x'),
1,
RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY|
@@ -275,7 +283,7 @@ Init (rtems_task_argument ignored)
spawnTask(clientTask, 120, 6);
rtems_task_wake_after(500);
- puts( "*** END OF LOOPBACK TEST ***" );
+ rtems_test_end();
exit( 0 );
}
#else
diff --git a/testsuites/samples/nsecs/init.c b/testsuites/samples/nsecs/init.c
index fe5390d..e9fff63 100644
--- a/testsuites/samples/nsecs/init.c
+++ b/testsuites/samples/nsecs/init.c
@@ -34,6 +34,8 @@
#include "tmacros.h"
#include "pritime.h"
+const char rtems_test_name[] = "NANOSECOND CLOCK";
+
static char *my_ctime( time_t t )
{
static char b[32];
@@ -62,7 +64,7 @@ rtems_task Init(
rtems_time_of_day time;
int index;
- puts( "\n\n*** NANOSECOND CLOCK TEST ***" );
+ TEST_BEGIN();
time.year = 2007;
time.month = 03;
@@ -137,7 +139,7 @@ rtems_task Init(
sleep(1);
- puts( "*** END OF NANOSECOND CLOCK TEST ***" );
+ TEST_END();
exit(0);
}
diff --git a/testsuites/samples/nsecs/system.h b/testsuites/samples/nsecs/system.h
index a9d2ac6..25f7d31 100644
--- a/testsuites/samples/nsecs/system.h
+++ b/testsuites/samples/nsecs/system.h
@@ -1,6 +1,8 @@
#ifndef SYSTEM_H
#define SYSTEM_H
+#include <rtems/test.h>
+
#include <bsp.h> /* for device driver prototypes */
extern void dummy_function_empty_body_to_force_call(void);
@@ -12,5 +14,7 @@ extern void dummy_function_empty_body_to_force_call(void);
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
#endif
diff --git a/testsuites/samples/paranoia/init.c b/testsuites/samples/paranoia/init.c
index bd23c33..9a2f65e 100644
--- a/testsuites/samples/paranoia/init.c
+++ b/testsuites/samples/paranoia/init.c
@@ -18,6 +18,8 @@
extern int paranoia(int, char **);
+const char rtems_test_name[] = "PARANOIA";
+
char *args[2] = { "paranoia", 0 };
rtems_task Init(
@@ -37,9 +39,9 @@ rtems_task Init(
M68KFPSPInstallExceptionHandlers ();
#endif
- printf( "\n\n*** PARANOIA TEST ***\n" );
+ rtems_test_begin();
paranoia(1, args);
- printf( "*** END OF PARANOIA TEST ***\n" );
+ rtems_test_end();
#endif /* BSP_SMALL_MEMORY */
exit( 0 );
}
diff --git a/testsuites/samples/paranoia/system.h b/testsuites/samples/paranoia/system.h
index 3b522d1..aaadb35 100644
--- a/testsuites/samples/paranoia/system.h
+++ b/testsuites/samples/paranoia/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
/* functions */
@@ -34,6 +35,8 @@ rtems_task Init(
#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE)
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
/* end of include file */
diff --git a/testsuites/samples/pppd/init.c b/testsuites/samples/pppd/init.c
index 4519ad6..44b2760 100644
--- a/testsuites/samples/pppd/init.c
+++ b/testsuites/samples/pppd/init.c
@@ -24,11 +24,15 @@
#include "netconfig.h"
#endif
+const char rtems_test_name[] = "PPPD";
+
rtems_task Init(rtems_task_argument argument)
{
#if BSP_SMALL_MEMORY
printf("NO NETWORKING. MEMORY TOO SMALL");
#else
+ rtems_test_begin();
+
/* initialize network */
rtems_bsdnet_initialize_network();
rtems_pppd_initialize();
diff --git a/testsuites/samples/pppd/system.h b/testsuites/samples/pppd/system.h
index 5e70ddb..a2282ac 100644
--- a/testsuites/samples/pppd/system.h
+++ b/testsuites/samples/pppd/system.h
@@ -2,6 +2,7 @@
#define SYSTEM_H
#include <rtems.h>
+#include <rtems/test.h>
#include <rtems/console.h>
#include <rtems/clockdrv.h>
@@ -40,6 +41,8 @@ extern int pppdapp_initialize(void);
RTEMS_NO_ASR | \
RTEMS_INTERRUPT_LEVEL(0))
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
#endif
diff --git a/testsuites/samples/ticker/init.c b/testsuites/samples/ticker/init.c
index d9366f8..3df984c 100644
--- a/testsuites/samples/ticker/init.c
+++ b/testsuites/samples/ticker/init.c
@@ -14,6 +14,8 @@
#define CONFIGURE_INIT
#include "system.h"
+const char rtems_test_name[] = "CLOCK TICK";
+
/*
* Keep the names and IDs in global variables so another task can use them.
*/
@@ -28,7 +30,7 @@ rtems_task Init(
rtems_status_code status;
rtems_time_of_day time;
- puts( "\n\n*** CLOCK TICK TEST ***" );
+ TEST_BEGIN();
time.year = 1988;
time.month = 12;
diff --git a/testsuites/samples/ticker/system.h b/testsuites/samples/ticker/system.h
index f5ac4d8..98add53 100644
--- a/testsuites/samples/ticker/system.h
+++ b/testsuites/samples/ticker/system.h
@@ -12,6 +12,7 @@
*/
#include <rtems.h>
+#include <rtems/test.h>
#include <inttypes.h>
#include "tmacros.h"
@@ -48,6 +49,8 @@ extern rtems_name Task_name[ 4 ]; /* array of task names */
#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
#include <rtems/confdefs.h>
/*
diff --git a/testsuites/samples/ticker/tasks.c b/testsuites/samples/ticker/tasks.c
index bdff3a3..146a80b 100644
--- a/testsuites/samples/ticker/tasks.c
+++ b/testsuites/samples/ticker/tasks.c
@@ -37,7 +37,7 @@ rtems_task Test_task(
for ( ; ; ) {
status = rtems_clock_get_tod( &time );
if ( time.second >= 35 ) {
- puts( "*** END OF CLOCK TICK TEST ***" );
+ TEST_END();
rtems_test_exit( 0 );
}
put_name( Task_name[ task_index ], FALSE );
diff --git a/testsuites/samples/unlimited/init.c b/testsuites/samples/unlimited/init.c
index a4eb167..3b79af2 100644
--- a/testsuites/samples/unlimited/init.c
+++ b/testsuites/samples/unlimited/init.c
@@ -18,6 +18,8 @@
#include <stdio.h>
#include <stdlib.h>
+const char rtems_test_name[] = "UNLIMITED TASK";
+
rtems_id task_id[MAX_TASKS];
rtems_task Init(
@@ -28,14 +30,14 @@ rtems_task Init(
rtems_mode old_mode;
uint32_t task;
+ TEST_BEGIN();
+
/* lower the task priority to allow created tasks to execute */
rtems_task_set_priority(
RTEMS_SELF, RTEMS_MAXIMUM_PRIORITY - 1, &old_priority);
rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode);
- printf( "\n*** UNLIMITED TASK TEST ***\n" );
-
/*
* Invalid state if the task id is 0
*/
@@ -47,7 +49,7 @@ rtems_task Init(
test2();
test3();
- printf( "\n*** END OF UNLIMITED TASK TEST ***\n" );
+ TEST_END();
exit( 0 );
}
More information about the vc
mailing list