summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-21 14:30:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-22 07:45:49 +0200
commit3d9fd2ce55575e603fa9e781cc66f553e917fd3b (patch)
tree624a3ae7bfd89ac47cd1a4421ba9c55d09a65c1a
parentAdd printer task (diff)
downloadrtems-3d9fd2ce55575e603fa9e781cc66f553e917fd3b.tar.bz2
sptests/sp20: Use printer task
This avoids test failures due to slow output devices.
-rw-r--r--testsuites/sptests/sp20/init.c30
-rw-r--r--testsuites/sptests/sp20/sp20.scn36
-rw-r--r--testsuites/sptests/sp20/system.h4
-rw-r--r--testsuites/sptests/sp20/task1.c64
4 files changed, 88 insertions, 46 deletions
diff --git a/testsuites/sptests/sp20/init.c b/testsuites/sptests/sp20/init.c
index e88c6c2bbb..d3bdab8a4f 100644
--- a/testsuites/sptests/sp20/init.c
+++ b/testsuites/sptests/sp20/init.c
@@ -28,14 +28,40 @@
const char rtems_test_name[] = "SP 20";
+rtems_printer rtems_test_printer;
+
+#define BUFFER_COUNT 20
+
+#define BUFFER_SIZE 100
+
+static rtems_printer_task_context printer_task;
+
+static long buffers[ BUFFER_COUNT ][ BUFFER_SIZE / sizeof(long) ];
+
+void end_of_test( void )
+{
+ rtems_test_printf( TEST_END_STRING );
+ rtems_printer_task_drain( &printer_task );
+ rtems_test_exit( 0 );
+}
+
rtems_task Init(
rtems_task_argument argument
)
{
- uint32_t index;
+ int error;
+ uint32_t index;
rtems_status_code status;
- TEST_BEGIN();
+ rtems_printer_task_set_priority( &printer_task, 254 );
+ rtems_printer_task_set_file_descriptor( &printer_task, 1 );
+ rtems_printer_task_set_buffer_table( &printer_task, &buffers[ 0 ][ 0 ] );
+ rtems_printer_task_set_buffer_count( &printer_task, BUFFER_COUNT );
+ rtems_printer_task_set_buffer_size( &printer_task, BUFFER_SIZE );
+ error = rtems_print_printer_task( &rtems_test_printer, &printer_task );
+ rtems_test_assert( error == 0 );
+
+ rtems_test_printf( TEST_BEGIN_STRING );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
diff --git a/testsuites/sptests/sp20/sp20.scn b/testsuites/sptests/sp20/sp20.scn
index d0726f7e07..f3d7afbb10 100644
--- a/testsuites/sptests/sp20/sp20.scn
+++ b/testsuites/sptests/sp20/sp20.scn
@@ -1,40 +1,40 @@
-*** TEST 20 ***
+*** BEGIN OF TEST SP 20 ***
TA1 - rtems_rate_monotonic_create id = 0x42010001
TA1 - rtems_rate_monotonic_ident id = 0x42010001
-TA1 - (0x2c010001) period 2
+TA1 - (0x42010001) period 2
TA2 - rtems_rate_monotonic_create id = 0x42010002
TA2 - rtems_rate_monotonic_ident id = 0x42010002
-TA2 - (0x2c010002) period 2
+TA2 - (0x42010002) period 2
TA3 - rtems_rate_monotonic_create id = 0x42010003
TA3 - rtems_rate_monotonic_ident id = 0x42010003
-TA3 - (0x2c010003) period 2
+TA3 - (0x42010003) period 2
TA4 - rtems_rate_monotonic_create id = 0x42010004
TA4 - rtems_rate_monotonic_ident id = 0x42010004
-TA4 - (0x2c010004) period 2
+TA4 - (0x42010004) period 2
TA5 - rtems_rate_monotonic_create id = 0x42010005
TA5 - rtems_rate_monotonic_ident id = 0x42010005
-TA5 - (0x2c010005) period 100
+TA5 - (0x42010005) period 100
TA6 - rtems_rate_monotonic_create id = 0x42010006
TA6 - rtems_rate_monotonic_ident id = 0x42010006
-TA6 - (0x2c010006) period 0
+TA6 - (0x42010006) period 0
TA5 - PERIODS CHECK OK (1)
TA5 - PERIODS CHECK OK (2)
TA5 - PERIODS CHECK OK (3)
TA5 - PERIODS CHECK OK (4)
TA5 - PERIODS CHECK OK (5)
-TA6 - Actual: 10 Expected: 10 - OK
-TA6 - Actual: 20 Expected: 20 - OK
-TA6 - Actual: 30 Expected: 30 - OK
-TA6 - Actual: 40 Expected: 40 - OK
-TA6 - Actual: 50 Expected: 50 - OK
-TA6 - Actual: 60 Expected: 60 - OK
-TA6 - Actual: 70 Expected: 70 - OK
-TA6 - Actual: 80 Expected: 80 - OK
-TA6 - Actual: 90 Expected: 90 - OK
-TA6 - Actual: 100 Expected: 100 - OK
+TA6 - Actual: 10 Expected: 10 - OK
+TA6 - Actual: 20 Expected: 20 - OK
+TA6 - Actual: 30 Expected: 30 - OK
+TA6 - Actual: 40 Expected: 40 - OK
+TA6 - Actual: 50 Expected: 50 - OK
+TA6 - Actual: 60 Expected: 60 - OK
+TA6 - Actual: 70 Expected: 70 - OK
+TA6 - Actual: 80 Expected: 80 - OK
+TA6 - Actual: 90 Expected: 90 - OK
+TA6 - Actual: 100 Expected: 100 - OK
TA5 - PERIODS CHECK OK (6)
TA5 - PERIODS CHECK OK (7)
TA5 - PERIODS CHECK OK (8)
TA5 - PERIODS CHECK OK (9)
TA5 - PERIODS CHECK OK (10)
-*** END OF TEST 20 ***
+*** END OF TEST SP 20 ***
diff --git a/testsuites/sptests/sp20/system.h b/testsuites/sptests/sp20/system.h
index 33d07f79b4..dfefe4b6c6 100644
--- a/testsuites/sptests/sp20/system.h
+++ b/testsuites/sptests/sp20/system.h
@@ -38,7 +38,7 @@ void Get_all_counters( void );
#define CONFIGURE_MICROSECONDS_PER_TICK 100000
-#define CONFIGURE_MAXIMUM_TASKS 7
+#define CONFIGURE_MAXIMUM_TASKS 8
#define CONFIGURE_MAXIMUM_PERIODS 10
#define CONFIGURE_INIT_TASK_PRIORITY 10
@@ -58,4 +58,6 @@ TEST_EXTERN struct counters Count; /* iteration counters */
TEST_EXTERN struct counters Temporary_count;
extern rtems_task_priority Priorities[ 7 ];
+void end_of_test( void );
+
/* end of include file */
diff --git a/testsuites/sptests/sp20/task1.c b/testsuites/sptests/sp20/task1.c
index 6edfd233b5..497b4f09ff 100644
--- a/testsuites/sptests/sp20/task1.c
+++ b/testsuites/sptests/sp20/task1.c
@@ -25,6 +25,19 @@ uint32_t Periods[7] = { 0, 2, 2, 2, 2, 100, 0 };
uint32_t Iterations[7] = { 0, 50, 50, 50, 50, 1, TA6_ITERATIONS };
rtems_task_priority Priorities[7] = { 0, 1, 1, 3, 4, 5, 1 };
+static char *name( size_t i, char buf[ 4 ] )
+{
+ rtems_name_to_characters(
+ Task_name[ i ],
+ &buf[ 0 ],
+ &buf[ 1 ],
+ &buf[ 2 ],
+ &buf[ 3 ]
+ );
+ buf[ 3 ] = '\0';
+ return &buf[ 0 ];
+}
+
rtems_task Task_1_through_6(
rtems_task_argument argument
)
@@ -35,22 +48,26 @@ rtems_task Task_1_through_6(
int pass;
uint32_t failed;
rtems_status_code status;
+ char buf[ 4 ];
status = rtems_rate_monotonic_create( argument, &rmid );
directive_failed( status, "rtems_rate_monotonic_create" );
- put_name( Task_name[ argument ], FALSE );
- printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", rmid );
+ rtems_test_printf(
+ "%s - rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n",
+ name( argument, buf ),
+ rmid
+ );
status = rtems_rate_monotonic_ident( argument, &test_rmid );
directive_failed( status, "rtems_rate_monotonic_ident" );
- put_name( Task_name[ argument ], FALSE );
- printf(
- "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
+ rtems_test_printf(
+ "%s - rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
+ name( argument, buf ),
test_rmid
);
if ( rmid != test_rmid ) {
- printf(
+ rtems_test_printf(
"RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n",
rmid,
test_rmid
@@ -58,9 +75,9 @@ rtems_task Task_1_through_6(
rtems_test_exit( 0 );
}
- put_name( Task_name[ argument ], FALSE );
- printf(
- "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
+ rtems_test_printf(
+ "%s - (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
+ name( argument, buf ),
rmid,
Periods[ argument ]
);
@@ -98,12 +115,12 @@ rtems_task Task_1_through_6(
for( index = 1 ; index <= 4 ; index++ ) {
if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
- puts_nocr( "FAIL -- " );
- put_name ( Task_name[ index ], FALSE );
- printf ( " Actual=%" PRIu32 ", Expected=%" PRIu32 "\n",
- Temporary_count.count[ index ],
- Iterations[ index ]
- );
+ rtems_test_printf(
+ "%s - FAIL - Actual=%" PRIu32 ", Expected=%" PRIu32 "\n",
+ name( index, buf ),
+ Temporary_count.count[ index ],
+ Iterations[ index ]
+ );
failed += 1;
}
}
@@ -113,13 +130,10 @@ rtems_task Task_1_through_6(
pass += 1;
- printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
-
- fflush( stdout );
+ rtems_test_printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
if ( pass == 10 ) {
- TEST_END();
- rtems_test_exit( 0 );
+ end_of_test();
}
}
@@ -134,27 +148,27 @@ rtems_task Task_1_through_6(
status = rtems_rate_monotonic_period( rmid, period);
directive_failed( status, "rtems_rate_monotonic_period of TA6" );
time[0] = _Watchdog_Ticks_since_boot; /* timestamp */
- /*printf("%d - %d\n", period, time[0]);*/
+ /*rtems_test_printf("%d - %d\n", period, time[0]);*/
for (index = 1; index <= TA6_ITERATIONS; index++) {
period = (index+1)*TA6_PERIOD_FACTOR;
status = rtems_rate_monotonic_period( rmid, period);
directive_failed( status, "rtems_rate_monotonic_period of TA6" );
time[index] = _Watchdog_Ticks_since_boot; /* timestamp */
- /*printf("%d - %d\n", period, time[index]);*/
+ /*rtems_test_printf("%d - %d\n", period, time[index]);*/
}
for (index = 1; index <= TA6_ITERATIONS; index++) {
rtems_interval meas = time[index] - time[index-1];
period = index*TA6_PERIOD_FACTOR;
- printf(
+ rtems_test_printf(
"TA6 - Actual: %" PRIdrtems_interval
" Expected: %" PRIdrtems_interval,
meas,
period
);
- if (period == meas) printf(" - OK\n");
- else printf(" - FAILED\n");
+ if (period == meas) rtems_test_printf(" - OK\n");
+ else rtems_test_printf(" - FAILED\n");
}
}
rtems_task_suspend(RTEMS_SELF);