Changeset 500fcd5 in rtems


Ignore:
Timestamp:
Dec 8, 2009, 5:52:49 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
2317457
Parents:
d35734d
Message:

2009-12-08 Joel Sherrill <joel.sherrill@…>

  • block01/init.c, block02/init.c, block03/init.c, block04/init.c, block05/init.c, block07/init.c, bspcmdline01/init.c, stringto01/init.c, stringto01/stringto_test_template.h, termios01/init.c, termios01/termios_testdriver.c, termios02/init.c: Use rtems_test_assert() consistently instead of system assert(). rtems_test_assert() is designed to integrate into the RTEMS test suite infrastructure.
Location:
testsuites/libtests
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/ChangeLog

    rd35734d r500fcd5  
     12009-12-08      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * block01/init.c, block02/init.c, block03/init.c, block04/init.c,
     4        block05/init.c, block07/init.c, bspcmdline01/init.c,
     5        stringto01/init.c, stringto01/stringto_test_template.h,
     6        termios01/init.c, termios01/termios_testdriver.c, termios02/init.c:
     7        Use rtems_test_assert() consistently instead of system assert().
     8        rtems_test_assert() is designed to integrate into the RTEMS test
     9        suite infrastructure.
     10
    1112009-12-06      Ralf Corsépius <ralf.corsepius@rtems.org>
    212
  • testsuites/libtests/block01/init.c

    rd35734d r500fcd5  
    2323
    2424#include <stdio.h>
    25 #include <assert.h>
     25#include "tmacros.h"
    2626
    2727#include <rtems.h>
     
    2929#include <rtems/diskdevs.h>
    3030
    31 #define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
     31#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
    3232
    33 #define ASSERT_SC_EQ(sc, sc_expected) assert((sc) == (sc_expected))
     33#define ASSERT_SC_EQ(sc, sc_expected) rtems_test_assert((sc) == (sc_expected))
    3434
    3535#define BLOCK_SIZE 512U
     
    5252  ramdisk *const rd = ramdisk_allocate(NULL, BLOCK_SIZE, BLOCK_COUNT, false);
    5353
    54   assert(rd != NULL);
     54  rtems_test_assert(rd != NULL);
    5555
    5656  sc = rtems_disk_io_initialize();
     
    128128
    129129  physical_dd = rtems_disk_obtain(physical_dev);
    130   assert(physical_dd != NULL && physical_dd->uses == 2);
     130  rtems_test_assert(physical_dd != NULL && physical_dd->uses == 2);
    131131
    132132  sc = rtems_disk_release(physical_dd);
     
    134134
    135135  logical_dd = rtems_disk_obtain(logical_dev);
    136   assert(logical_dd != NULL && logical_dd->uses == 1);
     136  rtems_test_assert(logical_dd != NULL && logical_dd->uses == 1);
    137137
    138138  sc = rtems_disk_delete(physical_dev);
     
    143143
    144144  dd = rtems_disk_obtain(physical_dev);
    145   assert(dd == NULL);
     145  rtems_test_assert(dd == NULL);
    146146
    147147  dd = rtems_disk_obtain(logical_dev);
    148   assert(dd == NULL);
     148  rtems_test_assert(dd == NULL);
    149149
    150150  sc = rtems_disk_release(logical_dd);
  • testsuites/libtests/block02/init.c

    rd35734d r500fcd5  
    2020 */
    2121
    22 #include <assert.h>
     22#include "tmacros.h"
    2323
    2424#include <rtems.h>
     
    2727#include <rtems/diskdevs.h>
    2828
    29 #define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
     29#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
    3030
    3131#define PRIORITY_INIT 10
     
    6060  rtems_bdbuf_buffer *bd = NULL;
    6161
    62   assert(!sync_done);
     62  rtems_test_assert(!sync_done);
    6363
    6464  printk("L: try access: A0\n");
     
    6767  ASSERT_SC(sc);
    6868
    69   assert(sync_done);
     69  rtems_test_assert(sync_done);
    7070
    7171  printk("L: access: A0\n");
    7272
    73   assert(bd->dev == dev_a);
     73  rtems_test_assert(bd->dev == dev_a);
    7474
    7575  printk("*** END OF TEST BLOCK 2 ***\n");
     
    8383  rtems_bdbuf_buffer *bd = NULL;
    8484
    85   assert(!sync_done);
     85  rtems_test_assert(!sync_done);
    8686
    8787  printk("H: try access: A0\n");
     
    9090  ASSERT_SC(sc);
    9191
    92   assert(sync_done);
     92  rtems_test_assert(sync_done);
    9393
    9494  printk("H: access: A0\n");
  • testsuites/libtests/block03/init.c

    rd35734d r500fcd5  
    2020 */
    2121
    22 #include <assert.h>
     22#include "tmacros.h"
    2323
    2424#include <rtems.h>
     
    2727#include <rtems/diskdevs.h>
    2828
    29 #define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
     29#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
    3030
    3131#define PRIORITY_INIT 10
     
    5454  rtems_bdbuf_buffer *bd = NULL;
    5555
    56   assert(!sync_done);
     56  rtems_test_assert(!sync_done);
    5757
    5858  printk("L: try access: 0\n");
     
    6161  ASSERT_SC(sc);
    6262
    63   assert(sync_done);
     63  rtems_test_assert(sync_done);
    6464
    6565  printk("L: access: 0\n");
    6666
    67   assert(bd->block == 0);
     67  rtems_test_assert(bd->block == 0);
    6868
    6969  printk("*** END OF TEST BLOCK 3 ***\n");
     
    7777  rtems_bdbuf_buffer *bd = NULL;
    7878
    79   assert(!sync_done);
     79  rtems_test_assert(!sync_done);
    8080
    8181  printk("H: try access: 0\n");
     
    8484  ASSERT_SC(sc);
    8585
    86   assert(sync_done);
     86  rtems_test_assert(sync_done);
    8787
    8888  printk("H: access: 0\n");
  • testsuites/libtests/block04/init.c

    rd35734d r500fcd5  
    2020 */
    2121
    22 #include <assert.h>
     22#include "tmacros.h"
    2323
    2424#include <rtems.h>
     
    2727#include <rtems/diskdevs.h>
    2828
    29 #define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
     29#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
    3030
    3131#define PRIORITY_INIT 10
     
    6767  printk("L: sync done: 0\n");
    6868
    69   assert(false);
     69  rtems_test_assert(false);
    7070}
    7171
  • testsuites/libtests/block05/init.c

    rd35734d r500fcd5  
    2020 */
    2121
    22 #include <assert.h>
     22#include "tmacros.h"
    2323#include <stdarg.h>
    2424#include <errno.h>
     
    2828#include <rtems/diskdevs.h>
    2929
    30 #define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
     30#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
    3131
    3232#define PRIORITY_INIT 1
     
    165165      break;
    166166    default:
    167       assert(false);
     167      rtems_test_assert(false);
    168168      break;
    169169  }
     
    177177      break;
    178178    default:
    179       assert(false);
     179      rtems_test_assert(false);
    180180      break;
    181181  }
    182182
    183183  sc = (*get_bd)(dev, blk_index, &bd);
    184   assert(
     184  rtems_test_assert(
    185185    sc == RTEMS_SUCCESSFUL
    186186      && bd->dev == dev
     
    208208      break;
    209209    default:
    210       assert(false);
     210      rtems_test_assert(false);
    211211      break;
    212212  }
     
    267267        break;
    268268      default:
    269         assert(false);
     269        rtems_test_assert(false);
    270270        break;
    271271    }
     
    311311
    312312  sc = rtems_bdbuf_get(dev_b, 0, &bd);
    313   assert(sc == RTEMS_SUCCESSFUL && bd->dev == dev_b && bd->block == 0);
     313  rtems_test_assert(sc == RTEMS_SUCCESSFUL && bd->dev == dev_b && bd->block == 0);
    314314
    315315  sc = rtems_bdbuf_release(bd);
     
    324324      break;
    325325    default:
    326       assert(false);
     326      rtems_test_assert(false);
    327327      break;
    328328  }
  • testsuites/libtests/block07/init.c

    rd35734d r500fcd5  
    2424#include <sys/stat.h>
    2525#include <fcntl.h>
    26 #include <assert.h>
     26#include "tmacros.h"
    2727
    2828#include <rtems.h>
     
    3131#include <rtems/diskdevs.h>
    3232
    33 #define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
     33#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
    3434
    3535#define PRIORITY_INIT 1
     
    6565  int fd = open("/dev/rda", O_RDWR);
    6666
    67   assert(fd >= 0);
     67  rtems_test_assert(fd >= 0);
    6868
    6969  rv = ioctl(fd, RTEMS_BLKIO_SETBLKSIZE, &new_block_size);
    70   assert(rv == 0);
     70  rtems_test_assert(rv == 0);
    7171
    7272  rv = close(fd);
    73   assert(rv == 0);
     73  rtems_test_assert(rv == 0);
    7474}
    7575
     
    8686  printk("L: access: 0\n");
    8787
    88   assert(bd->group->bds_per_group == 2);
     88  rtems_test_assert(bd->group->bds_per_group == 2);
    8989
    9090  printk("L: release: 0\n");
     
    112112  printk("M: access: 0\n");
    113113
    114   assert(bd->group->bds_per_group == 1);
     114  rtems_test_assert(bd->group->bds_per_group == 1);
    115115
    116116  printk("M: release: 0\n");
     
    138138  printk("H: access: 0\n");
    139139
    140   assert(bd->group->bds_per_group == 1);
     140  rtems_test_assert(bd->group->bds_per_group == 1);
    141141
    142142  printk("H: release: 0\n");
  • testsuites/libtests/bspcmdline01/init.c

    rd35734d r500fcd5  
    2424  puts( "rtems_bsp_cmdline_get_param - name=NULL - returns NULL" );
    2525  p = rtems_bsp_cmdline_get_param( NULL, result, 32 );
    26   assert( p == NULL );
     26  rtems_test_assert( p == NULL );
    2727
    2828  puts( "rtems_bsp_cmdline_get_param - result=NULL - returns NULL" );
    2929  p = rtems_bsp_cmdline_get_param( "name", NULL, 32 );
    30   assert( p == NULL );
     30  rtems_test_assert( p == NULL );
    3131
    3232  puts( "rtems_bsp_cmdline_get_param - length=0 - returns NULL" );
    3333  p = rtems_bsp_cmdline_get_param( "name", result, 0 );
    34   assert( p == NULL );
     34  rtems_test_assert( p == NULL );
    3535
    3636  puts( "rtems_bsp_cmdline_get_param_raw - name=NULL - returns NULL" );
    3737  p = rtems_bsp_cmdline_get_param_raw( NULL );
    38   assert( p == NULL );
     38  rtems_test_assert( p == NULL );
    3939
    4040  bsp_boot_cmdline = NULL;
     
    4242  puts( "rtems_bsp_cmdline_get_param - bsp_boot_cmdline=NULL - returns NULL" );
    4343  p = rtems_bsp_cmdline_get_param( "name", result, 5 );
    44   assert( p == NULL );
     44  rtems_test_assert( p == NULL );
    4545
    4646  puts(
    4747    "rtems_bsp_cmdline_get_param_raw - bsp_boot_cmdline=NULL - returns NULL" );
    4848  p = rtems_bsp_cmdline_get_param_raw( "name" );
    49   assert( p == NULL );
     49  rtems_test_assert( p == NULL );
    5050}
    5151
     
    7878    else
    7979      printf( "rtems_bsp_cmdline_get_param_raw(%s) returned NULL\n", param );
    80     assert( !p );
     80    rtems_test_assert( !p );
    8181  } else {
    8282    if ( p )
     
    8585      printf( "rtems_bsp_cmdline_get_param_raw(%s) returned NULL\n", param );
    8686
    87     assert( p );
     87    rtems_test_assert( p );
    8888  }
    8989
     
    9696    else
    9797      printf( "rtems_bsp_cmdline_get_param_rhs(%s) returned NULL\n", param );
    98     assert( !p );
     98    rtems_test_assert( !p );
    9999  } else {
    100100    if ( !p )
    101101      puts( "ERROR - rtems_bsp_cmdline_get_param_rhs returned NULL" );
    102     assert( p );
     102    rtems_test_assert( p );
    103103    printf(
    104104      "rtems_bsp_cmdline_get_param_rhs(%s) returned (%s) value=(%s)\n",
  • testsuites/libtests/stringto01/init.c

    rd35734d r500fcd5  
    11/*
    2  *  COPYRIGHT (c) 1989-1999.
     2 *  COPYRIGHT (c) 1989-2009.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    1414
    1515#include <stdio.h>
    16 #include <assert.h>
    1716
    1817/* Test pointer conversions */
  • testsuites/libtests/stringto01/stringto_test_template.h

    rd35734d r500fcd5  
    4444    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, NULL, &endptr );
    4545  #endif
    46   assert( status == RTEMS_INVALID_ADDRESS );
     46  rtems_test_assert( status == RTEMS_INVALID_ADDRESS );
    4747
    4848  /* Basic conversion works for return value, return end pointer */
     
    5656    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, NULL );
    5757  #endif
    58   assert( status == RTEMS_SUCCESSFUL );
    59   assert( value == (TEST_STRING_TO_TYPE)GOOD_VALUE );
     58  rtems_test_assert( status == RTEMS_SUCCESSFUL );
     59  rtems_test_assert( value == (TEST_STRING_TO_TYPE)GOOD_VALUE );
    6060
    6161  /* Basic conversion works for return value */
     
    7070    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, &endptr );
    7171  #endif
    72   assert( status == RTEMS_SUCCESSFUL );
    73   assert( endptr );
    74   assert( value == (TEST_STRING_TO_TYPE)GOOD_VALUE );
     72  rtems_test_assert( status == RTEMS_SUCCESSFUL );
     73  rtems_test_assert( endptr );
     74  rtems_test_assert( value == (TEST_STRING_TO_TYPE)GOOD_VALUE );
    7575
    7676  /* Bad conversion works for return value */
     
    8585    status = STRING_TO_NAME_METHOD( BAD_VALUE_STRING, &value, &endptr );
    8686  #endif
    87   assert( status == RTEMS_NOT_DEFINED );
    88   assert( endptr );
     87  rtems_test_assert( status == RTEMS_NOT_DEFINED );
     88  rtems_test_assert( endptr );
    8989
    9090  /* Conversion of empty string */
     
    100100    status = STRING_TO_NAME_METHOD( "", &value, &endptr );
    101101  #endif
    102   assert( status == RTEMS_NOT_DEFINED );
    103   assert( endptr );
    104   assert( value == (TEST_STRING_TO_TYPE)0 );
     102  rtems_test_assert( status == RTEMS_NOT_DEFINED );
     103  rtems_test_assert( endptr );
     104  rtems_test_assert( value == (TEST_STRING_TO_TYPE)0 );
    105105
    106106  /* Conversion of number that is too large */
     
    118118    if ( status != RTEMS_INVALID_NUMBER )
    119119      printf( "ERROR = %s\n", rtems_status_text(status) );
    120     assert( status == RTEMS_INVALID_NUMBER );
    121     assert( endptr );
     120    rtems_test_assert( status == RTEMS_INVALID_NUMBER );
     121    rtems_test_assert( endptr );
    122122  #endif
    123123
     
    133133      status = STRING_TO_NAME_METHOD( TEST_TOO_SMALL_STRING, &value, &endptr );
    134134    #endif
    135     assert( status == RTEMS_INVALID_NUMBER );
    136     assert( endptr );
     135    rtems_test_assert( status == RTEMS_INVALID_NUMBER );
     136    rtems_test_assert( endptr );
    137137  #endif
    138138}
  • testsuites/libtests/termios01/init.c

    rd35734d r500fcd5  
    1111
    1212#include "tmacros.h"
    13 #include <assert.h>
    1413#include <termios.h>
    1514#include <rtems/termiostypes.h>
     
    130129  puts( "termios_baud_to_index(-2) - NOT OK" );
    131130  i = rtems_termios_baud_to_index( -2 );
    132   assert ( i == -1 );
     131  rtems_test_assert( i == -1 );
    133132
    134133  puts( "termios_baud_to_index(572) - NOT OK" );
    135134  i = rtems_termios_baud_to_index( -2 );
    136   assert ( i == -1 );
     135  rtems_test_assert( i == -1 );
    137136
    138137  if ( i != -1 )
     
    161160  puts( "termios_baud_to_number(-2) - NOT OK" );
    162161  i = rtems_termios_baud_to_number( -2 );
    163   assert ( i == -1 );
     162  rtems_test_assert( i == -1 );
    164163
    165164  puts( "termios_baud_to_number(572) - NOT OK" );
    166165  i = rtems_termios_baud_to_number( -2 );
    167   assert ( i == -1 );
     166  rtems_test_assert( i == -1 );
    168167
    169168  for (i=0 ; baud_table[i].constant != -1 ; i++ ) {
     
    195194  puts( "termios_number_to_baud(-2) - NOT OK" );
    196195  i = rtems_termios_number_to_baud( -2 );
    197   assert ( i == -1 );
     196  rtems_test_assert( i == -1 );
    198197
    199198  puts( "termios_number_to_baud(572) - NOT OK" );
    200199  i = rtems_termios_number_to_baud( -2 );
    201   assert ( i == -1 );
     200  rtems_test_assert( i == -1 );
    202201
    203202  for (i=0 ; baud_table[i].constant != -1 ; i++ ) {
  • testsuites/libtests/termios01/termios_testdriver.c

    rd35734d r500fcd5  
    1515#include <rtems/libio.h>
    1616#include <stdlib.h>
    17 #include <assert.h>
    1817#include <termios.h>
    1918#include <rtems/termiostypes.h>
  • testsuites/libtests/termios02/init.c

    rd35734d r500fcd5  
    2424  printf( "tcdrain(12) - EBADF\n" );
    2525  sc = tcdrain(12);
    26   assert( sc == -1 );
    27   assert( errno == EBADF );
     26  rtems_test_assert( sc == -1 );
     27  rtems_test_assert( errno == EBADF );
    2828
    2929  printf( "tcdrain(stdin) - OK\n" );
    3030  sc = tcdrain(0);
    31   assert( !sc );
     31  rtems_test_assert( !sc );
    3232
    3333  printf( "tcdrain(stdout) - OK\n" );
    3434  tcdrain(1);
    35   assert( !sc );
     35  rtems_test_assert( !sc );
    3636
    3737  printf( "tcdrain(stderr) - OK\n" );
    3838  tcdrain(2);
    39   assert( !sc );
     39  rtems_test_assert( !sc );
    4040
    4141  printf( "*** END OF TERMIOS 02 TEST ***\n" );
Note: See TracChangeset for help on using the changeset viewer.