Ignore:
Timestamp:
Jan 13, 2000, 7:26:38 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
3e7a0fd
Parents:
53fb837a
Message:

Changed error checking macros for POSIX.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/support/include/tmacros.h

    r53fb837a r85d62357  
    2525#include <stdio.h>
    2626#include <stdlib.h>
     27#include <string.h>
    2728#include <assert.h>
    2829#include <rtems/error.h>
     
    4849  } while ( 0 )
    4950
     51/*
     52 *  These macros properly report errors within the Classic API
     53 */
     54
    5055#define directive_failed( _dirstat, _failmsg )  \
    5156 fatal_directive_status( _dirstat, RTEMS_SUCCESSFUL, _failmsg )
     
    6873    } \
    6974  } while ( 0 )
     75
     76/*
     77 *  These macros properly report errors from the POSIX API
     78 */
     79
     80#define posix_service_failed( _dirstat, _failmsg )  \
     81 fatal_posix_service_status( _dirstat, RTEMS_SUCCESSFUL, _failmsg )
     82
     83#define posix_service_failed_with_level( _dirstat, _failmsg, _level )  \
     84 fatal_posix_service_status_with_level( \
     85      _dirstat, RTEMS_SUCCESSFUL, _failmsg, _level )
     86
     87#define fatal_posix_service_status( _stat, _desired, _msg ) \
     88  fatal_posix_service_status_with_level( _stat, _desired, _msg, 0 )
     89
     90#define fatal_posix_service_status_with_level( _stat, _desired, _msg, _level ) \
     91  do { \
     92    check_dispatch_disable_level( _level ); \
     93    if ( (_stat) != (_desired) ) { \
     94      printf( "\n%s FAILED -- expected (%s) got (%s)\n", \
     95              (_msg), strerror(_desired), strerror(_stat) ); \
     96      fflush(stdout); \
     97      exit( _stat ); \
     98    } \
     99  } while ( 0 )
     100
     101/*
     102 *  Generic integer version of the error reporting
     103 */
     104
     105#define int_service_failed( _dirstat, _failmsg )  \
     106 fatal_int_service_status( _dirstat, RTEMS_SUCCESSFUL, _failmsg )
     107
     108#define int_service_failed_with_level( _dirstat, _failmsg, _level )  \
     109 fatal_int_service_status_with_level( \
     110      _dirstat, RTEMS_SUCCESSFUL, _failmsg, _level )
     111
     112#define fatal_int_service_status( _stat, _desired, _msg ) \
     113  fatal_int_service_status_with_level( _stat, _desired, _msg, 0 )
     114
     115#define fatal_int_service_status_with_level( _stat, _desired, _msg, _level ) \
     116  do { \
     117    check_dispatch_disable_level( _level ); \
     118    if ( (_stat) != (_desired) ) { \
     119      printf( "\n%s FAILED -- expected (%d) got (%d)\n", \
     120              (_msg), (_desired), (_stat) ); \
     121      fflush(stdout); \
     122      exit( _stat ); \
     123    } \
     124  } while ( 0 )
     125
     126
     127/*
     128 *  Print the time
     129 */
    70130
    71131#define sprint_time(_str, _s1, _tb, _s2) \
Note: See TracChangeset for help on using the changeset viewer.