Changeset 3d9fd2ce in rtems


Ignore:
Timestamp:
06/21/16 12:30:13 (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
655ce0fb
Parents:
22c3a54b
git-author:
Sebastian Huber <sebastian.huber@…> (06/21/16 12:30:13)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/22/16 05:45:49)
Message:

sptests/sp20: Use printer task

This avoids test failures due to slow output devices.

Location:
testsuites/sptests/sp20
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/sp20/init.c

    r22c3a54b r3d9fd2ce  
    2929const char rtems_test_name[] = "SP 20";
    3030
     31rtems_printer rtems_test_printer;
     32
     33#define BUFFER_COUNT 20
     34
     35#define BUFFER_SIZE 100
     36
     37static rtems_printer_task_context printer_task;
     38
     39static long buffers[ BUFFER_COUNT ][ BUFFER_SIZE / sizeof(long) ];
     40
     41void end_of_test( void )
     42{
     43  rtems_test_printf( TEST_END_STRING );
     44  rtems_printer_task_drain( &printer_task );
     45  rtems_test_exit( 0 );
     46}
     47
    3148rtems_task Init(
    3249  rtems_task_argument argument
    3350)
    3451{
    35   uint32_t    index;
     52  int               error;
     53  uint32_t          index;
    3654  rtems_status_code status;
    3755
    38   TEST_BEGIN();
     56  rtems_printer_task_set_priority( &printer_task, 254 );
     57  rtems_printer_task_set_file_descriptor( &printer_task, 1 );
     58  rtems_printer_task_set_buffer_table( &printer_task, &buffers[ 0 ][ 0 ] );
     59  rtems_printer_task_set_buffer_count( &printer_task, BUFFER_COUNT );
     60  rtems_printer_task_set_buffer_size( &printer_task, BUFFER_SIZE );
     61  error = rtems_print_printer_task( &rtems_test_printer, &printer_task );
     62  rtems_test_assert( error == 0 );
     63
     64  rtems_test_printf( TEST_BEGIN_STRING );
    3965
    4066  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
  • testsuites/sptests/sp20/sp20.scn

    r22c3a54b r3d9fd2ce  
    1 *** TEST 20 ***
     1*** BEGIN OF TEST SP 20 ***
    22TA1 - rtems_rate_monotonic_create id = 0x42010001
    33TA1 - rtems_rate_monotonic_ident id = 0x42010001
    4 TA1 - (0x2c010001) period 2
     4TA1 - (0x42010001) period 2
    55TA2 - rtems_rate_monotonic_create id = 0x42010002
    66TA2 - rtems_rate_monotonic_ident id = 0x42010002
    7 TA2 - (0x2c010002) period 2
     7TA2 - (0x42010002) period 2
    88TA3 - rtems_rate_monotonic_create id = 0x42010003
    99TA3 - rtems_rate_monotonic_ident id = 0x42010003
    10 TA3 - (0x2c010003) period 2
     10TA3 - (0x42010003) period 2
    1111TA4 - rtems_rate_monotonic_create id = 0x42010004
    1212TA4 - rtems_rate_monotonic_ident id = 0x42010004
    13 TA4 - (0x2c010004) period 2
     13TA4 - (0x42010004) period 2
    1414TA5 - rtems_rate_monotonic_create id = 0x42010005
    1515TA5 - rtems_rate_monotonic_ident id = 0x42010005
    16 TA5 - (0x2c010005) period 100
     16TA5 - (0x42010005) period 100
    1717TA6 - rtems_rate_monotonic_create id = 0x42010006
    1818TA6 - rtems_rate_monotonic_ident id = 0x42010006
    19 TA6 - (0x2c010006) period 0
     19TA6 - (0x42010006) period 0
    2020TA5 - PERIODS CHECK OK (1)
    2121TA5 - PERIODS CHECK OK (2)
     
    2323TA5 - PERIODS CHECK OK (4)
    2424TA5 - PERIODS CHECK OK (5)
    25 TA6 - Actual: 10  Expected: 10 - OK
    26 TA6 - Actual: 20  Expected: 20 - OK
    27 TA6 - Actual: 30  Expected: 30 - OK
    28 TA6 - Actual: 40  Expected: 40 - OK
    29 TA6 - Actual: 50  Expected: 50 - OK
    30 TA6 - Actual: 60  Expected: 60 - OK
    31 TA6 - Actual: 70  Expected: 70 - OK
    32 TA6 - Actual: 80  Expected: 80 - OK
    33 TA6 - Actual: 90  Expected: 90 - OK
    34 TA6 - Actual: 100  Expected: 100 - OK
     25TA6 - Actual: 10 Expected: 10 - OK
     26TA6 - Actual: 20 Expected: 20 - OK
     27TA6 - Actual: 30 Expected: 30 - OK
     28TA6 - Actual: 40 Expected: 40 - OK
     29TA6 - Actual: 50 Expected: 50 - OK
     30TA6 - Actual: 60 Expected: 60 - OK
     31TA6 - Actual: 70 Expected: 70 - OK
     32TA6 - Actual: 80 Expected: 80 - OK
     33TA6 - Actual: 90 Expected: 90 - OK
     34TA6 - Actual: 100 Expected: 100 - OK
    3535TA5 - PERIODS CHECK OK (6)
    3636TA5 - PERIODS CHECK OK (7)
     
    3838TA5 - PERIODS CHECK OK (9)
    3939TA5 - PERIODS CHECK OK (10)
    40 *** END OF TEST 20 ***
     40*** END OF TEST SP 20 ***
  • testsuites/sptests/sp20/system.h

    r22c3a54b r3d9fd2ce  
    3939#define CONFIGURE_MICROSECONDS_PER_TICK 100000
    4040
    41 #define CONFIGURE_MAXIMUM_TASKS               7
     41#define CONFIGURE_MAXIMUM_TASKS               8
    4242#define CONFIGURE_MAXIMUM_PERIODS             10
    4343
     
    5959extern rtems_task_priority Priorities[ 7 ];
    6060
     61void end_of_test( void );
     62
    6163/* end of include file */
  • testsuites/sptests/sp20/task1.c

    r22c3a54b r3d9fd2ce  
    2626rtems_task_priority Priorities[7] = { 0,   1,   1,   3,   4,   5, 1 };
    2727
     28static char *name( size_t i, char buf[ 4 ] )
     29{
     30  rtems_name_to_characters(
     31    Task_name[ i ],
     32    &buf[ 0 ],
     33    &buf[ 1 ],
     34    &buf[ 2 ],
     35    &buf[ 3 ]
     36  );
     37  buf[ 3 ] = '\0';
     38  return &buf[ 0 ];
     39}
     40
    2841rtems_task Task_1_through_6(
    2942  rtems_task_argument argument
     
    3649  uint32_t          failed;
    3750  rtems_status_code status;
     51  char              buf[ 4 ];
    3852
    3953  status = rtems_rate_monotonic_create( argument, &rmid );
    4054  directive_failed( status, "rtems_rate_monotonic_create" );
    41   put_name( Task_name[ argument ], FALSE );
    42   printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", rmid );
     55  rtems_test_printf(
     56    "%s - rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n",
     57    name( argument, buf ),
     58    rmid
     59  );
    4360
    4461  status = rtems_rate_monotonic_ident( argument, &test_rmid );
    4562  directive_failed( status, "rtems_rate_monotonic_ident" );
    46   put_name( Task_name[ argument ], FALSE );
    47   printf(
    48     "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
     63  rtems_test_printf(
     64    "%s - rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
     65    name( argument, buf ),
    4966    test_rmid
    5067  );
    5168
    5269  if ( rmid != test_rmid ) {
    53     printf(
     70    rtems_test_printf(
    5471      "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n",
    5572       rmid,
     
    5976  }
    6077
    61   put_name( Task_name[ argument ], FALSE );
    62   printf(
    63     "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
     78  rtems_test_printf(
     79    "%s - (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
     80    name( argument, buf ),
    6481    rmid,
    6582    Periods[ argument ]
     
    99116        for( index = 1 ; index <= 4 ; index++ ) {
    100117          if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
    101             puts_nocr( "FAIL -- " );
    102             put_name ( Task_name[ index ], FALSE );
    103             printf   ( " Actual=%" PRIu32 ", Expected=%" PRIu32 "\n",
    104                        Temporary_count.count[ index ],
    105                        Iterations[ index ]
    106                      );
     118            rtems_test_printf(
     119              "%s - FAIL - Actual=%" PRIu32 ", Expected=%" PRIu32 "\n",
     120              name( index, buf ),
     121              Temporary_count.count[ index ],
     122              Iterations[ index ]
     123            );
    107124            failed += 1;
    108125          }
     
    114131        pass += 1;
    115132
    116         printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
    117 
    118         fflush( stdout );
     133        rtems_test_printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
    119134
    120135        if ( pass == 10 ) {
    121           TEST_END();
    122           rtems_test_exit( 0 );
     136          end_of_test();
    123137        }
    124138
     
    135149        directive_failed( status, "rtems_rate_monotonic_period of TA6" );
    136150        time[0] = _Watchdog_Ticks_since_boot; /* timestamp */
    137         /*printf("%d - %d\n", period, time[0]);*/
     151        /*rtems_test_printf("%d - %d\n", period, time[0]);*/
    138152
    139153        for (index = 1; index <= TA6_ITERATIONS; index++) {
     
    142156          directive_failed( status, "rtems_rate_monotonic_period of TA6" );
    143157          time[index] = _Watchdog_Ticks_since_boot; /* timestamp */
    144           /*printf("%d - %d\n", period, time[index]);*/
     158          /*rtems_test_printf("%d - %d\n", period, time[index]);*/
    145159        }
    146160
     
    148162          rtems_interval meas = time[index] - time[index-1];
    149163          period = index*TA6_PERIOD_FACTOR;
    150           printf(
     164          rtems_test_printf(
    151165            "TA6 - Actual: %" PRIdrtems_interval
    152166              " Expected: %" PRIdrtems_interval,
     
    154168            period
    155169          );
    156           if (period == meas) printf(" - OK\n");
    157           else                printf(" - FAILED\n");
     170          if (period == meas) rtems_test_printf(" - OK\n");
     171          else                rtems_test_printf(" - FAILED\n");
    158172        }
    159173      }
Note: See TracChangeset for help on using the changeset viewer.