diff options
author | Chris Johns <chrisj@rtems.org> | 2016-05-20 18:39:50 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2016-05-25 15:47:34 +1000 |
commit | 24d0ee57a4d95f99be6e7e60bd162a30daf0638d (patch) | |
tree | 94239c8cc6b21813ca44b6ca89da73f9038914cc /testsuites | |
parent | psxtests/psxmsgq01: Fix typo (diff) | |
download | rtems-24d0ee57a4d95f99be6e7e60bd162a30daf0638d.tar.bz2 |
cpukit, testsuite: Add rtems_printf and rtems_printer support.
This change adds rtems_printf and related functions and wraps the
RTEMS print plugin support into a user API. All references to the
plugin are removed and replaced with the rtems_printer interface.
Printk and related functions are made to return a valid number of
characters formatted and output.
The function attribute to check printf functions has been added
to rtems_printf and printk. No changes to remove warrnings are part
of this patch set.
The testsuite has been moved over to the rtems_printer. The testsuite
has a mix of rtems_printer access and direct print control via the
tmacros.h header file. The support for begink/endk has been removed
as it served no purpose and only confused the code base. The testsuite
has not been refactored to use rtems_printf. This is future work.
Diffstat (limited to 'testsuites')
51 files changed, 217 insertions, 137 deletions
diff --git a/testsuites/fstests/fsnofs01/init.c b/testsuites/fstests/fsnofs01/init.c index 298ba8d237..ff2c2a8075 100644 --- a/testsuites/fstests/fsnofs01/init.c +++ b/testsuites/fstests/fsnofs01/init.c @@ -495,7 +495,7 @@ static void test_check_access(void) static void Init(rtems_task_argument arg) { - rtems_test_begink(); + TEST_BEGIN(); test_initial_values(); test_location_obtain(); @@ -506,7 +506,7 @@ static void Init(rtems_task_argument arg) test_user_env(); test_check_access(); - rtems_test_endk(); + TEST_END(); exit(0); } diff --git a/testsuites/libtests/block02/init.c b/testsuites/libtests/block02/init.c index f53dacc6d8..863064109b 100644 --- a/testsuites/libtests/block02/init.c +++ b/testsuites/libtests/block02/init.c @@ -24,6 +24,7 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include "tmacros.h" #include <rtems.h> @@ -82,7 +83,7 @@ static void task_low(rtems_task_argument arg) rtems_test_assert(bd->dd == dd_a); - rtems_test_endk(); + TEST_END(); exit(0); } @@ -136,7 +137,7 @@ static rtems_task Init(rtems_task_argument argument) dev_t dev_a = 0; dev_t dev_b = 0; - rtems_test_begink(); + TEST_BEGIN(); sc = rtems_disk_io_initialize(); ASSERT_SC(sc); diff --git a/testsuites/libtests/block03/init.c b/testsuites/libtests/block03/init.c index 1da59f0643..f2a18b9a7c 100644 --- a/testsuites/libtests/block03/init.c +++ b/testsuites/libtests/block03/init.c @@ -24,6 +24,7 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include "tmacros.h" #include <rtems.h> @@ -76,7 +77,7 @@ static void task_low(rtems_task_argument arg) rtems_test_assert(bd->block == 0); - rtems_test_endk(); + TEST_END(); exit(0); } @@ -129,7 +130,7 @@ static rtems_task Init(rtems_task_argument argument) rtems_bdbuf_buffer *bd = NULL; dev_t dev = 0; - rtems_test_begink(); + TEST_BEGIN(); sc = rtems_disk_io_initialize(); ASSERT_SC(sc); diff --git a/testsuites/libtests/block04/init.c b/testsuites/libtests/block04/init.c index 6731556163..3f448c7605 100644 --- a/testsuites/libtests/block04/init.c +++ b/testsuites/libtests/block04/init.c @@ -24,6 +24,7 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include "tmacros.h" #include <rtems.h> @@ -101,7 +102,7 @@ static void task_high(rtems_task_argument arg) printk("H: release done: 0\n"); - rtems_test_endk(); + TEST_END(); exit(0); } @@ -111,7 +112,7 @@ static rtems_task Init(rtems_task_argument argument) rtems_status_code sc = RTEMS_SUCCESSFUL; dev_t dev = 0; - rtems_test_begink(); + TEST_BEGIN(); sc = rtems_disk_io_initialize(); ASSERT_SC(sc); diff --git a/testsuites/libtests/block05/init.c b/testsuites/libtests/block05/init.c index 59889cc556..7cce2acfd0 100644 --- a/testsuites/libtests/block05/init.c +++ b/testsuites/libtests/block05/init.c @@ -24,6 +24,7 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include "tmacros.h" #include <stdarg.h> #include <errno.h> @@ -426,7 +427,7 @@ static rtems_task Init(rtems_task_argument argument) rtems_status_code sc = RTEMS_SUCCESSFUL; unsigned i = 0; - rtems_test_begink(); + TEST_BEGIN(); task_id_init = rtems_task_self(); @@ -505,7 +506,7 @@ static rtems_task Init(rtems_task_argument argument) } } - rtems_test_endk(); + TEST_END(); exit(0); } diff --git a/testsuites/libtests/block06/init.c b/testsuites/libtests/block06/init.c index 22340344db..1b91ad7ab2 100644 --- a/testsuites/libtests/block06/init.c +++ b/testsuites/libtests/block06/init.c @@ -32,7 +32,7 @@ #include <bsp.h> -#include <tmacros.h> +#include "tmacros.h" const char rtems_test_name[] = "BLOCK 6"; diff --git a/testsuites/libtests/block07/init.c b/testsuites/libtests/block07/init.c index f34e412302..cd1b64abae 100644 --- a/testsuites/libtests/block07/init.c +++ b/testsuites/libtests/block07/init.c @@ -27,6 +27,8 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> + +#define TESTS_USE_PRINTK #include "tmacros.h" #include <rtems.h> @@ -102,7 +104,7 @@ static void task_low(rtems_task_argument arg) printk("L: release done: 0\n"); - rtems_test_endk(); + TEST_END(); exit(0); } @@ -164,7 +166,7 @@ static rtems_task Init(rtems_task_argument argument) rtems_bdbuf_buffer *bd = NULL; dev_t dev = 0; - rtems_test_begink(); + TEST_BEGIN(); sc = rtems_disk_io_initialize(); ASSERT_SC(sc); diff --git a/testsuites/libtests/block08/init.c b/testsuites/libtests/block08/init.c index 84e755fc53..83eaf6d534 100644 --- a/testsuites/libtests/block08/init.c +++ b/testsuites/libtests/block08/init.c @@ -19,6 +19,8 @@ #include "config.h" #endif +#include "tmacros.h" + #define CONFIGURE_INIT #include "system.h" @@ -30,10 +32,9 @@ const char rtems_test_name[] = "BLOCK 8"; rtems_task Init(rtems_task_argument argument) { - rtems_test_begin(); + TEST_BEGIN(); run_bdbuf_tests(); - rtems_test_end(); + TEST_END(); exit(0); } - diff --git a/testsuites/libtests/block09/init.c b/testsuites/libtests/block09/init.c index 2d7cc7aec7..45e3b7ad39 100644 --- a/testsuites/libtests/block09/init.c +++ b/testsuites/libtests/block09/init.c @@ -24,6 +24,9 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <assert.h> #include <errno.h> #include <stdlib.h> @@ -176,7 +179,7 @@ static rtems_task Init(rtems_task_argument argument) dev_t dev = 0; rtems_disk_device *dd = NULL; - rtems_test_begink(); + TEST_BEGIN(); sc = rtems_disk_io_initialize(); ASSERT_SC(sc); @@ -224,7 +227,7 @@ static rtems_task Init(rtems_task_argument argument) sc = rtems_disk_release(dd); ASSERT_SC(sc); - rtems_test_endk(); + TEST_END(); exit(0); } diff --git a/testsuites/libtests/block10/init.c b/testsuites/libtests/block10/init.c index fac6781d1a..1cdc91ebb1 100644 --- a/testsuites/libtests/block10/init.c +++ b/testsuites/libtests/block10/init.c @@ -23,6 +23,9 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <assert.h> #include <errno.h> #include <stdlib.h> @@ -402,7 +405,7 @@ static rtems_task Init(rtems_task_argument argument) size_t i_rel = 0; size_t i_p = 0; - rtems_test_begink(); + TEST_BEGIN(); task_id_init = rtems_task_self(); @@ -466,7 +469,7 @@ static rtems_task Init(rtems_task_argument argument) } } - rtems_test_endk(); + TEST_END(); exit(0); } diff --git a/testsuites/libtests/block14/init.c b/testsuites/libtests/block14/init.c index 98282bc931..889e853d75 100644 --- a/testsuites/libtests/block14/init.c +++ b/testsuites/libtests/block14/init.c @@ -118,8 +118,11 @@ 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; @@ -155,7 +158,7 @@ static void test_actions(rtems_disk_device *dd) ); } - rtems_blkdev_print_stats(&dd->stats, 0, 1, 2, rtems_printf_plugin, NULL); + rtems_blkdev_print_stats(&dd->stats, 0, 1, 2, &printer); } static void test(void) diff --git a/testsuites/libtests/capture01/init.c b/testsuites/libtests/capture01/init.c index 7957742702..538583e0e6 100644 --- a/testsuites/libtests/capture01/init.c +++ b/testsuites/libtests/capture01/init.c @@ -33,6 +33,7 @@ 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 @@ -46,6 +47,8 @@ rtems_task Init( rtems_mode old_mode; rtems_name to_name = rtems_build_name('I', 'D', 'L', 'E');; + rtems_print_printer_printf(&rtems_test_printer); + rtems_test_begin(); rtems_task_set_priority(RTEMS_SELF, 20, &old_priority); diff --git a/testsuites/libtests/complex/init.c b/testsuites/libtests/complex/init.c index 658af91ef2..3d542fb815 100644 --- a/testsuites/libtests/complex/init.c +++ b/testsuites/libtests/complex/init.c @@ -27,6 +27,7 @@ #include <rtems/test.h> const char rtems_test_name[] = "COMPLEX"; +rtems_printer rtems_test_printer; #endif #include <stdio.h> @@ -60,11 +61,12 @@ int main( void ) #endif { #if __rtems__ + rtems_print_printer_printf(&rtems_test_printer); rtems_test_begin(); #endif docomplex(); - docomplexf(); + docomplexf(); docomplexl(); #if __rtems__ rtems_test_end(); diff --git a/testsuites/libtests/devnullfatal01/testcase.h b/testsuites/libtests/devnullfatal01/testcase.h index 87a098eb42..14675da509 100644 --- a/testsuites/libtests/devnullfatal01/testcase.h +++ b/testsuites/libtests/devnullfatal01/testcase.h @@ -13,6 +13,8 @@ #define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE #define FATAL_ERROR_EXPECTED_ERROR RTEMS_TOO_MANY +#define TESTS_USE_PRINTK + #include <rtems/devnull.h> #include "tmacros.h" @@ -28,4 +30,3 @@ void force_error() /* A fatal error would be raised in previous call */ /* we will not run this far */ } - diff --git a/testsuites/libtests/exit01/init.c b/testsuites/libtests/exit01/init.c index 6fbad6bbc8..b677c3aab9 100644 --- a/testsuites/libtests/exit01/init.c +++ b/testsuites/libtests/exit01/init.c @@ -16,13 +16,15 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <stdlib.h> /* Use assert() not rtems_test_assert() since it uses exit() */ #include <assert.h> #include <rtems.h> -#include <rtems/test.h> const char rtems_test_name[] = "EXIT 1"; @@ -60,7 +62,7 @@ static void fatal_extension( && error == EXIT_STATUS && counter == 3 ) { - rtems_test_endk(); + TEST_END(); } } @@ -85,7 +87,7 @@ static void Init(rtems_task_argument arg) rtems_status_code sc; rtems_id id; - rtems_test_begink(); + TEST_BEGIN(); sc = rtems_task_create( rtems_build_name('E', 'X', 'I', 'T'), diff --git a/testsuites/libtests/exit02/init.c b/testsuites/libtests/exit02/init.c index 88e08749df..f185d0f72e 100644 --- a/testsuites/libtests/exit02/init.c +++ b/testsuites/libtests/exit02/init.c @@ -16,13 +16,15 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <stdlib.h> /* Use assert() not rtems_test_assert() since it uses exit() */ #include <assert.h> #include <rtems.h> -#include <rtems/test.h> const char rtems_test_name[] = "EXIT 2"; @@ -44,7 +46,7 @@ static void fatal_extension( && !is_internal && error == EXIT_STATUS ) { - rtems_test_endk(); + TEST_END(); } } @@ -63,7 +65,7 @@ static void Init(rtems_task_argument arg) rtems_status_code sc; rtems_id id; - rtems_test_begink(); + TEST_BEGIN(); sc = rtems_task_create( rtems_build_name('E', 'X', 'I', 'T'), diff --git a/testsuites/libtests/math/init.c b/testsuites/libtests/math/init.c index 0d4a97e59f..c045735efa 100644 --- a/testsuites/libtests/math/init.c +++ b/testsuites/libtests/math/init.c @@ -22,11 +22,16 @@ #include "config.h" #endif +/* + * @fixme This test should use the test macros but the include paths are + * are wrong in the build system. + */ #if __rtems__ #include <bsp.h> /* for device driver prototypes */ #include <rtems/test.h> const char rtems_test_name[] = "MATH"; +rtems_printer rtems_test_printer; #endif #include <stdio.h> @@ -58,6 +63,7 @@ int main( void ) #endif { #if __rtems__ + rtems_print_printer_printf(&rtems_test_printer); rtems_test_begin(); #endif @@ -68,4 +74,3 @@ int main( void ) #endif exit( 0 ); } - diff --git a/testsuites/libtests/mathf/init.c b/testsuites/libtests/mathf/init.c index 4cb1994af0..c91e6fe67f 100644 --- a/testsuites/libtests/mathf/init.c +++ b/testsuites/libtests/mathf/init.c @@ -27,6 +27,7 @@ #include <rtems/test.h> const char rtems_test_name[] = "MATHF"; +rtems_printer rtems_test_printer; #endif #include <stdio.h> @@ -58,14 +59,14 @@ int main( void ) #endif { #if __rtems__ + rtems_print_printer_printf(&rtems_test_printer); rtems_test_begin(); #endif - domathf(); + domathf(); #if __rtems__ rtems_test_end(); #endif exit( 0 ); } - diff --git a/testsuites/libtests/mathl/init.c b/testsuites/libtests/mathl/init.c index 0dab9da789..ca26f1178f 100644 --- a/testsuites/libtests/mathl/init.c +++ b/testsuites/libtests/mathl/init.c @@ -27,6 +27,7 @@ #include <rtems/test.h> const char rtems_test_name[] = "MATHL"; +rtems_printer rtems_test_printer; #endif #include <stdio.h> @@ -58,10 +59,11 @@ int main( void ) #endif { #if __rtems__ + rtems_print_printer_printf(&rtems_test_printer); rtems_test_begin(); #endif - domathl(); + domathl(); #if __rtems__ rtems_test_end(); diff --git a/testsuites/libtests/mouse01/init.c b/testsuites/libtests/mouse01/init.c index a002f09452..cc33630efd 100644 --- a/testsuites/libtests/mouse01/init.c +++ b/testsuites/libtests/mouse01/init.c @@ -60,7 +60,7 @@ bool enqueue_next_action( return false; termios_test_driver_set_rx_enqueue_now( true ); - + termios_test_driver_set_rx( &actions[Mouse_Index], to_enqueue ); Mouse_Index += to_enqueue; @@ -95,9 +95,10 @@ void printf_uid_message( struct MW_UID_MESSAGE *uid ) { + rtems_printer printer; + rtems_print_printer_printf( &printer ); uid_print_message_with_plugin( - stdout, - (rtems_printk_plugin_t)fprintf, + &printer, uid ); } @@ -135,16 +136,16 @@ rtems_task Init( TEST_BEGIN(); open_it(); - register_it(); + register_it(); do { more_data = enqueue_next_action( Mouse_Actions, - Mouse_Actions_Size, + Mouse_Actions_Size, Mouse_Actions_Per_Iteration ); receive_uid_message(); } while (more_data); - close_it(); + close_it(); TEST_END(); rtems_test_exit( 0 ); } diff --git a/testsuites/libtests/stackchk/init.c b/testsuites/libtests/stackchk/init.c index cc54bf6609..4e1e41cdfb 100644 --- a/testsuites/libtests/stackchk/init.c +++ b/testsuites/libtests/stackchk/init.c @@ -101,6 +101,6 @@ void Fatal_extension( } else if ( error != rtems_build_name( 'T', 'A', '1', ' ' ) ) { printk( "unexpected fatal error\n" ); } else { - rtems_test_endk(); + TEST_END(); } } diff --git a/testsuites/libtests/stackchk/system.h b/testsuites/libtests/stackchk/system.h index 6d9ce276bb..96f56fb22d 100644 --- a/testsuites/libtests/stackchk/system.h +++ b/testsuites/libtests/stackchk/system.h @@ -11,6 +11,7 @@ * http://www.rtems.org/license/LICENSE. */ +#define TESTS_USE_PRINTK #include <tmacros.h> /* macros */ diff --git a/testsuites/libtests/uid01/init.c b/testsuites/libtests/uid01/init.c index 13ec8bab3e..f8ec4bd25d 100644 --- a/testsuites/libtests/uid01/init.c +++ b/testsuites/libtests/uid01/init.c @@ -69,9 +69,10 @@ void printf_uid_message( struct MW_UID_MESSAGE *uid ) { + rtems_printer printer; + rtems_print_printer_printf( &printer ); uid_print_message_with_plugin( - stdout, - (rtems_printk_plugin_t)fprintf, + &printer, uid ); } @@ -111,12 +112,12 @@ rtems_task Init( /* No message should ever be recieved. With a timeout val of 0, this * call will never return. We use this to check if patch was correct * by passing a number of ticks greater than 0 and less than 1. If - * patch was correct, this call will timeout instead of waiting + * patch was correct, this call will timeout instead of waiting * indefinitely. */ receive_uid_message(); - close_it(); + close_it(); TEST_END(); rtems_test_exit( 0 ); } diff --git a/testsuites/psxtests/psxfatal_support/init.c b/testsuites/psxtests/psxfatal_support/init.c index 350b3a2b19..0f995dc7f7 100644 --- a/testsuites/psxtests/psxfatal_support/init.c +++ b/testsuites/psxtests/psxfatal_support/init.c @@ -11,6 +11,9 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #define CONFIGURE_INIT #include "system.h" @@ -22,7 +25,7 @@ static void print_test_begin_message(void) if (!done) { done = true; - rtems_test_begink(); + TEST_BEGIN(); } } @@ -95,7 +98,6 @@ void Fatal_extension( && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL && error == FATAL_ERROR_EXPECTED_ERROR ) { - rtems_test_endk(); + TEST_END(); } } - diff --git a/testsuites/samples/capture/init.c b/testsuites/samples/capture/init.c index a10ccc5ba2..557e8094c2 100644 --- a/testsuites/samples/capture/init.c +++ b/testsuites/samples/capture/init.c @@ -27,6 +27,7 @@ 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; @@ -46,6 +47,7 @@ rtems_task Init( rtems_task_priority old_priority; rtems_mode old_mode; + rtems_print_printer_printf(&rtems_test_printer); rtems_test_begin(); status = rtems_shell_wait_for_input( diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c index d8fe4507a7..ea9af89940 100644 --- a/testsuites/samples/hello/init.c +++ b/testsuites/samples/hello/init.c @@ -22,11 +22,13 @@ 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 ) { + rtems_print_printer_printf(&rtems_test_printer); rtems_test_begin(); printf( "Hello World\n" ); rtems_test_end(); diff --git a/testsuites/samples/paranoia/init.c b/testsuites/samples/paranoia/init.c index 3718af4cfd..ac7c2148c0 100644 --- a/testsuites/samples/paranoia/init.c +++ b/testsuites/samples/paranoia/init.c @@ -19,6 +19,7 @@ extern int paranoia(int, char **); const char rtems_test_name[] = "PARANOIA"; +rtems_printer rtems_test_printer; char *args[2] = { "paranoia", 0 }; @@ -35,6 +36,7 @@ rtems_task Init( M68KFPSPInstallExceptionHandlers (); #endif + rtems_print_printer_printf(&rtems_test_printer); rtems_test_begin(); paranoia(1, args); rtems_test_end(); diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c index 424e9dffb2..31f77a3bbe 100644 --- a/testsuites/smptests/smp05/init.c +++ b/testsuites/smptests/smp05/init.c @@ -27,7 +27,7 @@ rtems_task Test_task( static void success(void) { - rtems_test_end_with_plugin(locked_printf_plugin, NULL); + rtems_test_end(); rtems_test_exit( 0 ); } @@ -50,7 +50,7 @@ rtems_task Init( rtems_status_code status; locked_print_initialize(); - rtems_test_begin_with_plugin(locked_printf_plugin, NULL); + rtems_test_begin(); if ( rtems_get_processor_count() == 1 ) { success(); diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c index c26669adbe..6acfe21642 100644 --- a/testsuites/smptests/smp07/init.c +++ b/testsuites/smptests/smp07/init.c @@ -18,7 +18,7 @@ const char rtems_test_name[] = "SMP 7"; volatile bool TaskRan = false; volatile bool TSRFired = false; -rtems_id Semaphore; +rtems_id Semaphore; rtems_task Init( rtems_task_argument argument @@ -30,7 +30,7 @@ rtems_task Test_task( static void success(void) { - rtems_test_end_with_plugin(locked_printf_plugin, NULL); + rtems_test_end( ); rtems_test_exit( 0 ); } @@ -63,8 +63,8 @@ rtems_task Test_task( /* Print that the task is up and running. */ locked_printf( - " CPU %" PRIu32 " running Task %s after semaphore release\n", - cpu_num, + " CPU %" PRIu32 " running Task %s after semaphore release\n", + cpu_num, name ); @@ -98,7 +98,7 @@ rtems_task Init( rtems_id Timer; locked_print_initialize(); - rtems_test_begin_with_plugin(locked_printf_plugin, NULL); + rtems_test_begin(); if ( rtems_get_processor_count() == 1 ) { success(); @@ -107,7 +107,7 @@ rtems_task Init( /* Create/verify semaphore */ status = rtems_semaphore_create( rtems_build_name ('S', 'E', 'M', '1'), - 1, + 1, RTEMS_LOCAL | RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_PRIORITY, @@ -157,7 +157,7 @@ rtems_task Init( if ( TSRFired && TaskRan ) break; }; - + /* Validate the timer fired and that the task ran */ if ( !TSRFired ) locked_printf( "*** ERROR TSR DID NOT FIRE ***" ); diff --git a/testsuites/smptests/smpfatal01/init.c b/testsuites/smptests/smpfatal01/init.c index 9346d874db..e7f15973c5 100644 --- a/testsuites/smptests/smpfatal01/init.c +++ b/testsuites/smptests/smpfatal01/init.c @@ -16,8 +16,10 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <rtems.h> -#include <rtems/test.h> #include <rtems/score/percpu.h> #include <rtems/score/smpimpl.h> #include <rtems/score/smpbarrier.h> @@ -62,7 +64,7 @@ static void fatal_extension( assert(state == PER_CPU_STATE_SHUTDOWN); } - rtems_test_endk(); + TEST_END(); } } @@ -79,7 +81,7 @@ static rtems_status_code test_driver_init( uint32_t cpu_count = rtems_get_processor_count(); uint32_t cpu; - rtems_test_begink(); + TEST_BEGIN(); assert(rtems_configuration_get_maximum_processors() == MAX_CPUS); @@ -107,7 +109,7 @@ static rtems_status_code test_driver_init( per_cpu->state = PER_CPU_STATE_SHUTDOWN; } else { - rtems_test_endk(); + TEST_END(); exit(0); } diff --git a/testsuites/smptests/smpfatal02/init.c b/testsuites/smptests/smpfatal02/init.c index c98ff3c31a..71fff0c580 100644 --- a/testsuites/smptests/smpfatal02/init.c +++ b/testsuites/smptests/smpfatal02/init.c @@ -16,8 +16,10 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <rtems.h> -#include <rtems/test.h> #include <rtems/score/percpu.h> #include <rtems/score/smpimpl.h> #include <rtems/score/smpbarrier.h> @@ -67,7 +69,7 @@ static void fatal_extension( assert(state == PER_CPU_STATE_SHUTDOWN); } - rtems_test_endk(); + TEST_END(); } else { assert(source == RTEMS_FATAL_SOURCE_SMP); assert(code == SMP_FATAL_SHUTDOWN); @@ -87,7 +89,7 @@ static rtems_status_code test_driver_init( uint32_t cpu_count = rtems_get_processor_count(); uint32_t cpu; - rtems_test_begink(); + TEST_BEGIN(); assert(rtems_configuration_get_maximum_processors() == MAX_CPUS); @@ -112,7 +114,7 @@ static rtems_status_code test_driver_init( if (cpu_count > 1) { rtems_fatal(RTEMS_FATAL_SOURCE_APPLICATION, 0xdeadbeef); } else { - rtems_test_endk(); + TEST_END(); exit(0); } diff --git a/testsuites/smptests/smpfatal04/init.c b/testsuites/smptests/smpfatal04/init.c index 39ceebfd7b..ebfa849dbd 100644 --- a/testsuites/smptests/smpfatal04/init.c +++ b/testsuites/smptests/smpfatal04/init.c @@ -16,8 +16,10 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <rtems.h> -#include <rtems/test.h> #include <rtems/score/smpimpl.h> #include <assert.h> @@ -36,14 +38,14 @@ static void fatal_extension( rtems_fatal_code code ) { - rtems_test_begink(); + TEST_BEGIN(); if ( source == RTEMS_FATAL_SOURCE_SMP && !is_internal && code == SMP_FATAL_BOOT_PROCESSOR_NOT_ASSIGNED_TO_SCHEDULER ) { - rtems_test_endk(); + TEST_END(); } } diff --git a/testsuites/smptests/smpfatal05/init.c b/testsuites/smptests/smpfatal05/init.c index 37b3deea4f..1e1e535863 100644 --- a/testsuites/smptests/smpfatal05/init.c +++ b/testsuites/smptests/smpfatal05/init.c @@ -16,8 +16,10 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <rtems.h> -#include <rtems/test.h> #include <rtems/score/smpimpl.h> #include <assert.h> @@ -36,14 +38,14 @@ static void fatal_extension( rtems_fatal_code code ) { - rtems_test_begink(); + TEST_BEGIN(); if ( source == RTEMS_FATAL_SOURCE_SMP && !is_internal && code == SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT ) { - rtems_test_endk(); + TEST_END(); } } diff --git a/testsuites/smptests/smpfatal08/init.c b/testsuites/smptests/smpfatal08/init.c index 2de76e45a4..4b7aaf5156 100644 --- a/testsuites/smptests/smpfatal08/init.c +++ b/testsuites/smptests/smpfatal08/init.c @@ -16,8 +16,10 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <rtems.h> -#include <rtems/test.h> #include <rtems/score/smpimpl.h> #include <bsp.h> @@ -93,14 +95,14 @@ static void fatal_extension( rtems_fatal_code code ) { - rtems_test_begink(); + TEST_BEGIN(); if ( source == RTEMS_FATAL_SOURCE_SMP && !is_internal && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED ) { - rtems_test_endk(); + TEST_END(); } } diff --git a/testsuites/sptests/sperror01/init.c b/testsuites/sptests/sperror01/init.c index 4c40be5299..a84eaf9293 100644 --- a/testsuites/sptests/sperror01/init.c +++ b/testsuites/sptests/sperror01/init.c @@ -11,7 +11,9 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include <tmacros.h> + #include "test_support.h" #include "rtems/error.h" #include <errno.h> @@ -32,7 +34,7 @@ static void fatal_extension( && !is_internal && error == ENOMEM ) { - rtems_test_endk(); + TEST_END(); } } diff --git a/testsuites/sptests/sperror02/init.c b/testsuites/sptests/sperror02/init.c index dca2219305..0bb7ceaf34 100644 --- a/testsuites/sptests/sperror02/init.c +++ b/testsuites/sptests/sperror02/init.c @@ -11,7 +11,9 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include <tmacros.h> + #include "test_support.h" #include <errno.h> #include <rtems/error.h> @@ -32,7 +34,7 @@ static void fatal_extension( && !is_internal && error == 1 ) { - rtems_test_endk(); + TEST_END(); } } @@ -44,7 +46,7 @@ rtems_task Init( errno = ENOMEM; rtems_error( - RTEMS_NO_MEMORY | RTEMS_ERROR_ABORT, + RTEMS_NO_MEMORY | RTEMS_ERROR_ABORT, "Dummy: Resources unavailable\n" ); diff --git a/testsuites/sptests/sperror03/init.c b/testsuites/sptests/sperror03/init.c index 818b90755c..aecdb79288 100644 --- a/testsuites/sptests/sperror03/init.c +++ b/testsuites/sptests/sperror03/init.c @@ -11,7 +11,8 @@ #include "config.h" #endif -#include <tmacros.h> +#define TESTS_USE_PRINTK +#include "tmacros.h" #include "test_support.h" const char rtems_test_name[] = "SPERROR 3"; @@ -30,7 +31,7 @@ static void fatal_extension( && !is_internal && error == 0 ) { - rtems_test_endk(); + TEST_END(); } } diff --git a/testsuites/sptests/spextensions01/init.c b/testsuites/sptests/spextensions01/init.c index d8593b9980..091d66f0ab 100644 --- a/testsuites/sptests/spextensions01/init.c +++ b/testsuites/sptests/spextensions01/init.c @@ -16,12 +16,13 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <assert.h> #include <limits.h> #include <stdlib.h> -#include <rtems/test.h> - #include <bsp.h> const char rtems_test_name[] = "SPEXTENSIONS 1"; @@ -199,7 +200,7 @@ static void two_fatal( if (source == RTEMS_FATAL_SOURCE_EXIT) { assert_reverse_order(2); assert(counter == 72); - rtems_test_endk(); + TEST_END(); } } @@ -424,7 +425,7 @@ static void test(void) static void Init(rtems_task_argument arg) { - rtems_test_begink(); + TEST_BEGIN(); test(); diff --git a/testsuites/sptests/spfatal07/testcase.h b/testsuites/sptests/spfatal07/testcase.h index 5ccaaa48d5..7cc9a5f468 100644 --- a/testsuites/sptests/spfatal07/testcase.h +++ b/testsuites/sptests/spfatal07/testcase.h @@ -50,7 +50,7 @@ void force_error() "WARNING - Test not applicable on this target architecture.\n" "WARNING - Only applicable when CPU_ALLOCATE_INTERRUPT_STACK == TRUE.\n" ); - rtems_test_endk(); + TEST_END(); rtems_test_exit(0); #endif } diff --git a/testsuites/sptests/spfatal16/testcase.h b/testsuites/sptests/spfatal16/testcase.h index 65af957b83..743b2be9b5 100644 --- a/testsuites/sptests/spfatal16/testcase.h +++ b/testsuites/sptests/spfatal16/testcase.h @@ -7,7 +7,7 @@ * http://www.rtems.org/license/LICENSE. */ -/* generate fatal errors in termios.c +/* generate fatal errors in termios.c * rtems_semaphore_create( rtems_build_name ('T', 'R', 'r', c),...); */ @@ -25,6 +25,6 @@ void force_error() { /* This fatal error depends on the Termios device configuration */ - rtems_test_endk(); + TEST_END(); rtems_test_exit(0); } diff --git a/testsuites/sptests/spfatal26/init.c b/testsuites/sptests/spfatal26/init.c index 7235f8d25a..4013b948fc 100644 --- a/testsuites/sptests/spfatal26/init.c +++ b/testsuites/sptests/spfatal26/init.c @@ -16,6 +16,7 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include "tmacros.h" #include <limits.h> @@ -51,7 +52,7 @@ static void provoke_aligment_or_data_access_exception( void ) static void Init( rtems_task_argument arg ) { - rtems_test_begink(); + TEST_BEGIN(); provoke_aligment_or_data_access_exception(); @@ -69,7 +70,7 @@ static void fatal_extension( rtems_exception_frame_print( (const rtems_exception_frame *) code ); - rtems_test_endk(); + TEST_END(); } #define CONFIGURE_INITIAL_EXTENSIONS \ diff --git a/testsuites/sptests/spfatal_support/init.c b/testsuites/sptests/spfatal_support/init.c index 1052da4289..f048d4b3c1 100644 --- a/testsuites/sptests/spfatal_support/init.c +++ b/testsuites/sptests/spfatal_support/init.c @@ -22,7 +22,7 @@ static void print_test_begin_message(void) if (!done) { done = true; - rtems_test_begink(); + TEST_BEGIN(); } } @@ -107,7 +107,6 @@ void Fatal_extension( && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL && is_expected_error( error ) ) { - rtems_test_endk(); + TEST_END(); } } - diff --git a/testsuites/sptests/spfatal_support/system.h b/testsuites/sptests/spfatal_support/system.h index 19adb47e7d..0a01e21d70 100644 --- a/testsuites/sptests/spfatal_support/system.h +++ b/testsuites/sptests/spfatal_support/system.h @@ -14,9 +14,11 @@ /* * Some of the fatal error cases require the ability to peek inside RTEMS */ + +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <rtems.h> -#include <rtems/test.h> -#include <tmacros.h> /* functions */ diff --git a/testsuites/sptests/spinternalerror01/init.c b/testsuites/sptests/spinternalerror01/init.c index a1ddc14eae..e864db169a 100644 --- a/testsuites/sptests/spinternalerror01/init.c +++ b/testsuites/sptests/spinternalerror01/init.c @@ -16,11 +16,12 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <bsp.h> #include <bsp/bootcard.h> -#include <rtems/test.h> - const char rtems_test_name[] = "SPINTERNALERROR 1"; #define FATAL_SOURCE 0xdeadbeef @@ -40,14 +41,14 @@ static void fatal_extension( Internal_errors_t error ) { - rtems_test_begink(); + TEST_BEGIN(); if ( source == FATAL_SOURCE && is_internal == FATAL_IS_INTERNAL && error == FATAL_ERROR ) { - rtems_test_endk(); + TEST_END(); } } diff --git a/testsuites/sptests/spprintk/init.c b/testsuites/sptests/spprintk/init.c index eea17adcf2..8086a1ae10 100644 --- a/testsuites/sptests/spprintk/init.c +++ b/testsuites/sptests/spprintk/init.c @@ -13,11 +13,19 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK #include <tmacros.h> -#include <rtems/bspIo.h> +#include <rtems/print.h> const char rtems_test_name[] = "SPPRINTK"; +/* + * Undefined the RTEMS_PRINTF_ATTRIBUTE and make it nothing. The test code + * contained in the file is suppose to be wrong. + */ +#undef RTEMS_PRINTF_ATTRIBUTE +#define RTEMS_PRINTF_ATTRIBUTE(_a, _b) + /* forward declarations to avoid warnings */ rtems_task Init(rtems_task_argument argument); int test_getchar(void); @@ -38,7 +46,7 @@ void do_getchark(void) poll_char = BSP_poll_char; BSP_poll_char = NULL; - + putk( "getchark - NULL getchar method - return -1" ); sc = getchark(); rtems_test_assert( sc == -1 ); @@ -124,7 +132,7 @@ rtems_task Init( rtems_task_argument argument ) { - rtems_test_begink(); + TEST_BEGIN(); do_putk(); putk(""); @@ -134,7 +142,7 @@ rtems_task Init( do_getchark(); - rtems_test_endk(); + TEST_END(); rtems_test_exit( 0 ); } @@ -151,4 +159,3 @@ rtems_task Init( #define CONFIGURE_INIT #include <rtems/confdefs.h> - diff --git a/testsuites/sptests/spprofiling01/init.c b/testsuites/sptests/spprofiling01/init.c index afbe2c74db..60f6bd50ed 100644 --- a/testsuites/sptests/spprofiling01/init.c +++ b/testsuites/sptests/spprofiling01/init.c @@ -115,13 +115,15 @@ 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); - rv = rtems_profiling_report_xml("X", rtems_printf_plugin, NULL, 1, " "); + rtems_print_printer_printf(&printer); + rv = rtems_profiling_report_xml("X", &printer, 1, " "); printf("characters produced by rtems_profiling_report_xml(): %i\n", rv); } diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c index e12f7f3bc1..c598ee5acf 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -16,6 +16,9 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <sys/types.h> #include <sys/stat.h> @@ -29,7 +32,6 @@ #include <rtems/ioimpl.h> #include <rtems/libio_.h> #include <rtems/sysinit.h> -#include <rtems/test.h> #include <rtems/extensionimpl.h> #ifdef RTEMS_POSIX_API @@ -173,7 +175,7 @@ static void next_step(init_step expected) FIRST(RTEMS_SYSINIT_BSP_WORK_AREAS) { - rtems_test_begink(); + TEST_BEGIN(); assert(_Workspace_Area.area_begin == 0); next_step(BSP_WORK_AREAS_PRE); } @@ -674,7 +676,7 @@ static void Init(rtems_task_argument arg) pthread_cleanup_pop(0); #endif /* RTEMS_POSIX_API */ next_step(INIT_TASK); - rtems_test_endk(); + TEST_END(); exit(0); } diff --git a/testsuites/sptests/sptimecounter01/init.c b/testsuites/sptests/sptimecounter01/init.c index d87ffec460..9e396de054 100644 --- a/testsuites/sptests/sptimecounter01/init.c +++ b/testsuites/sptests/sptimecounter01/init.c @@ -16,12 +16,13 @@ #include "config.h" #endif +#define TESTS_USE_PRINTK +#include "tmacros.h" + #include <assert.h> #include <bsp/bootcard.h> -#include <rtems/test.h> - #include <rtems/score/timecounterimpl.h> #include <rtems/score/todimpl.h> #include <rtems/timecounter.h> @@ -54,7 +55,7 @@ void boot_card(const char *cmdline) struct timeval tv; struct timespec ts; - rtems_test_begink(); + TEST_BEGIN(); assert(time(NULL) == TOD_SECONDS_1970_THROUGH_1988); @@ -148,7 +149,7 @@ void boot_card(const char *cmdline) assert(bt.sec == 1); assert(bt.frac == 18446742522092); - rtems_test_endk(); + TEST_END(); _Terminate(RTEMS_FATAL_SOURCE_EXIT, false, 0); } 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; |