os/ossrv/stdcpp/tsrc/Stdcpp_test/stdcxx/include/driver.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/************************************************************************
sl@0
     2
 *
sl@0
     3
 * driver.h - testsuite driver declarations
sl@0
     4
 *
sl@0
     5
 * $Id: driver.h 287304 2005-09-15 00:41:16Z sebor $
sl@0
     6
 *
sl@0
     7
 ***************************************************************************
sl@0
     8
 *
sl@0
     9
 * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
sl@0
    10
 * Software division. Licensed under the Apache License, Version 2.0 (the
sl@0
    11
 * "License");  you may  not use this file except  in compliance with the
sl@0
    12
 * License.    You    may   obtain   a   copy   of    the   License    at
sl@0
    13
 * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
sl@0
    14
 * applicable law  or agreed to  in writing,  software  distributed under
sl@0
    15
 * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
sl@0
    16
 * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
sl@0
    17
 * for the specific language governing permissions  and limitations under
sl@0
    18
 * the License.
sl@0
    19
 * 
sl@0
    20
 **************************************************************************/
sl@0
    21
sl@0
    22
#ifndef RW_DRIVER_H_INCLUDED
sl@0
    23
#define RW_DRIVER_H_INCLUDED
sl@0
    24
sl@0
    25
#include <testdefs.h>   // for test config macros
sl@0
    26
extern int failures;
sl@0
    27
sl@0
    28
/**
sl@0
    29
 * Initializes the test driver, passes program arguments to it, processes
sl@0
    30
 * command line arguments, any arguments specified in the environment
sl@0
    31
 * variable RWSTD_TESTOPTS, and if successful, invokes the program-supplied
sl@0
    32
 * callback function.
sl@0
    33
 *
sl@0
    34
 * @param argc  The number of non-null elements in the argv array.
sl@0
    35
 * @param argv  A null-terminated array of command line arguments.
sl@0
    36
 *        If (argc == 0) the argument may be null.
sl@0
    37
 * @param filename  The name of the source file name, typically
sl@0
    38
 *        the __FILE__ macro. The argument may be null.
sl@0
    39
 * @param clause  The clause exercised by the program, such as
sl@0
    40
 *        lib.basic.string. The argument may be null.
sl@0
    41
 * @param comment An optional comment describing in more detail
sl@0
    42
 *        the functionality of the program. The argument may be null.
sl@0
    43
 * @param testfun  A pointer to a callback function to call by the
sl@0
    44
 *        driver after successful initialization. The argument must
sl@0
    45
 *        not be null.
sl@0
    46
 * @param optspec An optional character string describing command
sl@0
    47
 *        line options accepted by the program. The argument may
sl@0
    48
 *        be null.
sl@0
    49
 * @param ...  Optional list of handlers of command line options
sl@0
    50
 *         corresponding to the optspec.
sl@0
    51
 *
sl@0
    52
 * @return If initialization is successful, returns the value returned
sl@0
    53
 *         by the callback function. Otherwise, returns the non-zero
sl@0
    54
 *         value returned by the last initialization function or
sl@0
    55
 *         command line option handler.
sl@0
    56
 *
sl@0
    57
 * After the driver has been initialzied the user-supplied callback function
sl@0
    58
 * may call any of the driver diagnostic functions to record and perhaps also
sl@0
    59
 * issue diagnostic messages of varying severity.
sl@0
    60
 *
sl@0
    61
 * There are 10 levels of severity with 0 being the lowest and 9 the highest.
sl@0
    62
 * Diagnostics of all levels of severity come in two states: active and
sl@0
    63
 * inactive. All diagnostics are recorded but normally only active diagnostics
sl@0
    64
 * of severity 4 or above are issued. It is possible to cause diagnostics of
sl@0
    65
 * lower severity levels to be issued via a command line option to the driver.
sl@0
    66
 * Choosing to issue severity 0 diagnostics has the effect of issuing inactive
sl@0
    67
 * diagnostics.
sl@0
    68
 *
sl@0
    69
 * After the callback function returns the driver displays a summary detailing
sl@0
    70
 * the number of recorded diagnostics in each of the two states (active and
sl@0
    71
 * inactive).
sl@0
    72
 * 
sl@0
    73
 */
sl@0
    74
_TEST_EXPORT int
sl@0
    75
rw_test (int           argc,
sl@0
    76
         char*         argv[],
sl@0
    77
         const char*   filename,
sl@0
    78
         const char*   clause,
sl@0
    79
         const char*   comment,
sl@0
    80
         int         (*testfun)(int, char**),
sl@0
    81
         const char*   optspec,
sl@0
    82
         ...);
sl@0
    83
sl@0
    84
/**
sl@0
    85
 * Records and optionally issues a diagnostic of the highest severity 9.
sl@0
    86
 *
sl@0
    87
 * @param expr  A zero value denoting an active diagnostic or any non-zero
sl@0
    88
 *        vaue denoting an inactive diagnostic.
sl@0
    89
 * @param filename  An optional name of the file invoking the function.
sl@0
    90
 *        The argument may be null.
sl@0
    91
 * @param line  When positive, denotes the line number of the location
sl@0
    92
 *        relevant to the diagnostic. Negative values are ignored.
sl@0
    93
 * @param fmtspec  A printf format specifier (with extensions) used
sl@0
    94
 *        to format the text of the diagnostic.
sl@0
    95
 * @param ... Optional list of values to format.
sl@0
    96
 *
sl@0
    97
 * @return  Returns the value of expr passed to it.
sl@0
    98
 *
sl@0
    99
 * Every diagnostic is recorded but only active diagnostics may be issued,
sl@0
   100
 * depending on the setting of the diagnosable severity. The value of the
sl@0
   101
 * first argument determines whether a diagnostc is active or inactive.
sl@0
   102
 * Unlike the remaining diagnostic functions, rw_fatal doesn't return to
sl@0
   103
 * the caller when expr is 0 (i.e., when the diagnostic is active).
sl@0
   104
 * Instead, it causes the driver the exit the process with the staus equal
sl@0
   105
 * to 9, the severity of the diagnostic.
sl@0
   106
 */
sl@0
   107
_TEST_EXPORT int
sl@0
   108
rw_fatal (int         expr,
sl@0
   109
          const char* filename,
sl@0
   110
          int         line,
sl@0
   111
          const char* fmtspec,
sl@0
   112
          ...);
sl@0
   113
sl@0
   114
/**
sl@0
   115
 * Records and optionally issues a diagnostic of severity 8.
sl@0
   116
 *
sl@0
   117
 * @see #rw_fatal
sl@0
   118
 */
sl@0
   119
_TEST_EXPORT int
sl@0
   120
rw_error (int, const char*, int, const char*, ...);
sl@0
   121
sl@0
   122
/**
sl@0
   123
 * Records and optionally issues a diagnostic of severity 7.
sl@0
   124
 *
sl@0
   125
 * @see #rw_fatal
sl@0
   126
 */
sl@0
   127
_TEST_EXPORT int
sl@0
   128
rw_assert (int, const char*, int, const char*, ...);
sl@0
   129
sl@0
   130
/**
sl@0
   131
 * Records and optionally issues a diagnostic of severity 5.
sl@0
   132
 *
sl@0
   133
 * @see #rw_fatal
sl@0
   134
 */
sl@0
   135
_TEST_EXPORT int
sl@0
   136
rw_warn (int, const char*, int, const char*, ...);
sl@0
   137
sl@0
   138
/**
sl@0
   139
 * Records and optionally issues a diagnostic of severity 2.
sl@0
   140
 *
sl@0
   141
 * @see #rw_fatal
sl@0
   142
 */
sl@0
   143
_TEST_EXPORT int
sl@0
   144
rw_note (int, const char*, int, const char*, ...);
sl@0
   145
sl@0
   146
/**
sl@0
   147
 * Records and optionally issues a diagnostic of severity 1.
sl@0
   148
 *
sl@0
   149
 * @see #rw_fatal
sl@0
   150
 */
sl@0
   151
_TEST_EXPORT int
sl@0
   152
rw_info (int, const char*, int, const char*, ...);
sl@0
   153
sl@0
   154
#endif   // RW_DRIVER_H_INCLUDED