Changeset e6df806 in rtems


Ignore:
Timestamp:
Nov 8, 2017, 2:27:25 AM (19 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
f5b3c024
Parents:
bcd0c06c
git-author:
Chris Johns <chrisj@…> (11/08/17 02:27:25)
git-committer:
Chris Johns <chrisj@…> (11/11/17 05:14:59)
Message:

tests: Use ld to map (wrap) printf, puts and putchar to tester functions.

  • Remove the macro defines and the need for tmacro.h by remapping the symbols using ld's wrap option.
  • Remove FLUSH_OUTPUT, it was empty.
  • Move rtems_test_exit to libmisc/testsupport as a function.

Update #3199.

Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/Makefile.am

    rbcd0c06c re6df806  
    183183libtestsupport_a_SOURCES += testsupport/testextension.c
    184184libtestsupport_a_SOURCES += testsupport/testparallel.c
     185libtestsupport_a_SOURCES += testsupport/testwrappers.c
    185186
    186187## fsmount
  • cpukit/libmisc/testsupport/test.h

    rbcd0c06c re6df806  
    106106
    107107/**
     108 * @brief Exit the test without calling exit() since it closes stdin, etc and
     109 * pulls in stdio code
     110 */
     111void rtems_test_exit(int status);
     112
     113/**
    108114 * @brief Prints via the RTEMS printer.
    109115 *
  • cpukit/libmisc/testsupport/testbeginend.c

    rbcd0c06c re6df806  
    124124}
    125125
     126void rtems_test_exit(int status)
     127{
     128  (void) status;
     129  rtems_shutdown_executive(0);
     130}
     131
    126132int rtems_test_printf(
    127133  const char* format,
  • testsuites/automake/compile.am

    rbcd0c06c re6df806  
    1111##
    1212AM_CPPFLAGS = $(TEST_FLAGS)
    13 AM_CFLAGS =
    14 AM_CXXFLAGS =
     13AM_CFLAGS   = $(TEST_C_FLAGS)
     14AM_CXXFLAGS = $(TEST_CXX_FLAGS)
     15AM_LDFLAGS  = $(TEST_LD_FLAGS)
    1516
    1617CLEANFILES = *.num *.nxe *.elf *.srec* *.bin *.bt *.ralf
  • testsuites/automake/local.am

    rbcd0c06c re6df806  
    33
    44PROJECT_TOOLS = $(PROJECT_RELEASE)/build-tools
     5
     6TEST_LD_FLAGS = -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar
  • testsuites/libtests/rtmonuse/task1.c

    rbcd0c06c re6df806  
    106106        printf( "TA5 - PERIODS CHECK OK (%" PRIu32 ")\n", pass );
    107107
    108         FLUSH_OUTPUT();
    109 
    110108        if ( pass == 10 ) {
    111109          puts( "" );
  • testsuites/sptests/sp14/asr.c

    rbcd0c06c re6df806  
    3333    case RTEMS_SIGNAL_1:
    3434      puts( "ASR - rtems_task_wake_after - yield processor" );
    35       FLUSH_OUTPUT();
    3635      status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
    3736      directive_failed( status, "rtems_task_wake_after yield" );
     
    4544     the_signal_set
    4645  );
    47   FLUSH_OUTPUT();
    4846}
  • testsuites/sptests/sp14/task1.c

    rbcd0c06c re6df806  
    5353  directive_failed( status, "rtems_signal_catch" );
    5454
    55   FLUSH_OUTPUT();
    56 
    57 rtems_test_pause();
     55  rtems_test_pause();
    5856
    5957  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
     
    9997
    10098  puts( "TA1 - rtems_task_mode - enable ASRs" );
    101   FLUSH_OUTPUT();
    10299  status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
    103100  directive_failed( status, "rtems_task_mode" );
  • testsuites/sptests/sp14/task2.c

    rbcd0c06c re6df806  
    4545
    4646  puts( "TA2 - rtems_task_wake_after - yield processor" );
    47   FLUSH_OUTPUT();
    4847  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
    4948  directive_failed( status, "rtems_task_wake_after" );
  • testsuites/support/include/buffer_test_io.h

    rbcd0c06c re6df806  
    1212#endif
    1313
    14 #undef printf
    15 #define printf(...) \
    16   do { \
    17      rtems_printf( &rtems_test_printer, __VA_ARGS__ ); \
    18   } while (0)
    19 
    20 #undef puts
    21 #define puts(_s) \
    22   do { \
    23      rtems_printf( &rtems_test_printer, "%s\n", _s ); \
    24   } while (0)
    25 
    26 #undef putchar
    27 #define putchar(_c) \
    28   do { \
    29      rtems_printf( &rtems_test_printer, "%c", _c ); \
    30   } while (0)
    31 
    32 /* Do not call exit() since it closes stdin, etc and pulls in stdio code */
    33 #define rtems_test_exit(_s) \
    34   do { \
    35     rtems_shutdown_executive(0); \
    36   } while (0)
    37 
    38 #define FLUSH_OUTPUT() \
    39   do { \
    40   } while (0)
    41 
    4214#define TEST_BEGIN() rtems_test_begin(rtems_test_name, TEST_STATE)
    4315#define TEST_END()   rtems_test_end(rtems_test_name)
  • testsuites/support/include/tmacros.h

    rbcd0c06c re6df806  
    6565           " not %d detected at %s:%d\n", \
    6666         !_Thread_Dispatch_is_enabled(), (_expect), __FILE__, __LINE__ ); \
    67       FLUSH_OUTPUT(); \
    6867      rtems_test_exit( 1 ); \
    6968    } \
     
    8584        __LINE__ \
    8685      ); \
    87       FLUSH_OUTPUT(); \
    8886      rtems_test_exit( 1 ); \
    8987    } \
     
    108106      printf( "\n%s FAILED -- expected (%s) got (%s)\n", \
    109107              (_msg), rtems_status_text(_desired), rtems_status_text(_stat) ); \
    110       FLUSH_OUTPUT(); \
    111108      rtems_test_exit( _stat ); \
    112109    } \
     
    138135            (_msg), _desired, strerror(_desired), \
    139136            statx, errno, strerror(errno) ); \
    140     FLUSH_OUTPUT(); \
    141137    rtems_test_exit( _stat ); \
    142138  }
     
    154150      printf( "\n FAILED -- errno (%d - %s)\n", \
    155151              errno, strerror(errno) ); \
    156       FLUSH_OUTPUT(); \
    157152      rtems_test_exit( _stat ); \
    158153    } \
     
    167162    printf( "\n%s FAILED -- expected (-1) got (%p - %d/%s)\n", \
    168163            (_msg), _ptr, errno, strerror(errno) ); \
    169     FLUSH_OUTPUT(); \
    170164    rtems_test_exit( -1 ); \
    171165  }
     
    179173    printf( "\n%s FAILED -- expected (-1) got (%" PRId32 " - %d/%s)\n", \
    180174            (_msg), _ptr, errno, strerror(errno) ); \
    181     FLUSH_OUTPUT(); \
    182175    rtems_test_exit( -1 ); \
    183176  }
     
    203196      printf( "\n%s FAILED -- expected (%d) got (%d)\n", \
    204197              (_msg), (_desired), (_stat) ); \
    205       FLUSH_OUTPUT(); \
    206198      rtems_test_exit( _stat ); \
    207199    } \
     
    230222  do { \
    231223    putchar( _c ); \
    232     FLUSH_OUTPUT(); \
    233224  } while ( 0 )
    234225
     
    241232    do { \
    242233      printf( "<pause>\n" ); \
    243       FLUSH_OUTPUT(); \
    244234  } while ( 0 )
    245235
     
    247237  do { \
    248238    printf( "<pause - screen %d>\n", (_screen) ); \
    249     FLUSH_OUTPUT(); \
    250239  } while ( 0 )
    251240#else
     
    254243    char buffer[ 80 ]; \
    255244    printf( "<pause>" ); \
    256     FLUSH_OUTPUT(); \
    257245    gets( buffer ); \
    258246    puts( "" ); \
     
    263251    char buffer[ 80 ]; \
    264252    printf( "<pause - screen %d>", (_screen) ); \
    265     FLUSH_OUTPUT(); \
    266253    gets( buffer ); \
    267254    puts( "" ); \
Note: See TracChangeset for help on using the changeset viewer.