alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of version 2 of the GNU General Public License as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it would be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 11 | * |
| 12 | * Further, this software is distributed without any warranty that it is |
| 13 | * free of the rightful claim of any third person regarding infringement |
| 14 | * or the like. Any license provided herein, whether implied or |
| 15 | * otherwise, applies only to this software file. Patent licenses, if |
| 16 | * any, provided herein do not apply to combinations of this program with |
| 17 | * other software, or any other product whatsoever. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write the Free Software Foundation, Inc., 59 |
| 21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 22 | * |
| 23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 24 | * Mountain View, CA 94043, or: |
| 25 | * |
| 26 | * http://www.sgi.com |
| 27 | * |
| 28 | * For further information regarding this notice, see: |
| 29 | * |
| 30 | * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ |
| 31 | */ |
| 32 | |
plars | 824e05a | 2002-06-05 16:08:08 +0000 | [diff] [blame] | 33 | /* $Id: test.h,v 1.5 2002/06/05 16:08:08 plars Exp $ */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 34 | |
| 35 | #ifndef __TEST_H__ |
| 36 | #define __TEST_H__ |
| 37 | |
| 38 | #include <stdio.h> |
| 39 | #include <signal.h> |
| 40 | #include <unistd.h> |
plars | 2888451 | 2002-05-21 13:01:00 +0000 | [diff] [blame] | 41 | #include <string.h> |
| 42 | #include <stdlib.h> |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 43 | |
| 44 | #define TPASS 0 /* Test passed flag */ |
| 45 | #define TFAIL 1 /* Test failed flag */ |
| 46 | #define TBROK 2 /* Test broken flag */ |
| 47 | #define TWARN 4 /* Test warning flag */ |
| 48 | #define TRETR 8 /* Test retire flag */ |
| 49 | #define TINFO 16 /* Test information flag */ |
| 50 | #define TCONF 32 /* Test not appropriate for configuration flag */ |
| 51 | |
| 52 | /* |
| 53 | * To determine if you are on a Umk or Unicos system, |
| 54 | * use sysconf(_SC_CRAY_SYSTEM). But since _SC_CRAY_SYSTEM |
| 55 | * is not defined until 90, it will be define here if not already |
| 56 | * defined. |
| 57 | * if ( sysconf(_SC_CRAY_SYSTEM) == 1 ) |
| 58 | * on UMK |
| 59 | * else # returned 0 or -1 |
| 60 | * on Unicos |
| 61 | * This is only being done on CRAY systems. |
| 62 | */ |
| 63 | #ifdef CRAY |
| 64 | #ifndef _SC_CRAY_SYSTEM |
| 65 | #define _SC_CRAY_SYSTEM 140 |
| 66 | #endif /* ! _SC_CRAY_SYSTEM */ |
| 67 | #endif /* CRAY */ |
| 68 | |
| 69 | /* |
| 70 | * Ensure that NUMSIGS is defined. |
| 71 | * It should be defined in signal.h or sys/signal.h on |
| 72 | * UNICOS/mk and IRIX systems. On UNICOS systems, |
| 73 | * it is not defined, thus it is being set to UNICOS's NSIG. |
| 74 | * Note: IRIX's NSIG (signals are 1-(NSIG-1)) |
| 75 | * is not same meaning as UNICOS/UMK's NSIG (signals 1-NSIG) |
| 76 | */ |
| 77 | #ifndef NUMSIGS |
| 78 | #define NUMSIGS NSIG |
| 79 | #endif |
| 80 | |
| 81 | |
| 82 | /* defines for unexpected signal setup routine (set_usig.c) */ |
| 83 | #define FORK 1 /* SIGCLD is to be ignored */ |
| 84 | #define NOFORK 0 /* SIGCLD is to be caught */ |
| 85 | #define DEF_HANDLER 0 /* tells set_usig() to use default signal handler */ |
| 86 | |
| 87 | /* |
| 88 | * The following defines are used to control tst_res and t_result reporting. |
| 89 | */ |
| 90 | |
| 91 | #define TOUTPUT "TOUTPUT" /* The name of the environment variable */ |
| 92 | /* that can be set to one of the following */ |
| 93 | /* strings to control tst_res output */ |
| 94 | /* If not set, TOUT_VERBOSE_S is assumed */ |
| 95 | |
| 96 | #define TOUT_VERBOSE_S "VERBOSE" /* All test cases reported */ |
| 97 | #define TOUT_CONDENSE_S "CONDENSE" /* ranges are used where identical messages*/ |
| 98 | /* occur for sequential test cases */ |
| 99 | #define TOUT_NOPASS_S "NOPASS" /* No pass test cases are reported */ |
| 100 | #define TOUT_DISCARD_S "DISCARD" /* No output is reported */ |
| 101 | |
| 102 | #define TST_NOBUF "TST_NOBUF" /* The name of the environment variable */ |
| 103 | /* that can be set to control whether or not */ |
| 104 | /* tst_res will buffer output into 4096 byte */ |
| 105 | /* blocks of output */ |
| 106 | /* If not set, buffer is done. If set, no */ |
| 107 | /* internal buffering will be done in tst_res */ |
| 108 | /* t_result does not have internal buffering */ |
| 109 | |
| 110 | /* |
| 111 | * The following defines are used to control tst_tmpdir, tst_wildcard and t_mkchdir |
| 112 | */ |
| 113 | |
| 114 | #define TDIRECTORY "TDIRECTORY" /* The name of the environment variable */ |
| 115 | /* that if is set, the value (directory) */ |
| 116 | /* is used by all tests as their working */ |
| 117 | /* directory. tst_rmdir and t_rmdir will */ |
| 118 | /* not attempt to clean up. */ |
| 119 | /* This environment variable should only */ |
| 120 | /* be set when doing system testing since */ |
| 121 | /* tests will collide and break and fail */ |
| 122 | /* because of setting it. */ |
| 123 | |
| 124 | #define TEMPDIR "/tmp" /* This is the default temporary directory. */ |
| 125 | /* The environment variable TMPDIR is */ |
| 126 | /* used prior to this valid by tempnam(3). */ |
| 127 | /* To control the base location of the */ |
| 128 | /* temporary directory, set the TMPDIR */ |
| 129 | /* environment variable to desired path */ |
| 130 | |
| 131 | /* |
| 132 | * The following contains support for error message passing. |
| 133 | * See test_error.c for details. |
| 134 | */ |
| 135 | #define TST_ERR_MESG_SIZE 1023 /* max size of error message */ |
| 136 | #define TST_ERR_FILE_SIZE 511 /* max size of module name used by compiler */ |
| 137 | #define TST_ERR_FUNC_SIZE 127 /* max size of func name */ |
| 138 | |
| 139 | typedef struct { |
| 140 | int te_line; /* line where last error was reported. Use */ |
| 141 | /* "__LINE__" and let compiler do the rest */ |
| 142 | int te_level; /* If set, will prevent current stored */ |
| 143 | /* error to not be overwritten */ |
| 144 | char te_func[TST_ERR_FUNC_SIZE+1]; /* name of function of last error */ |
| 145 | /* Name of function or NULL */ |
| 146 | char te_file[TST_ERR_FILE_SIZE+1]; /* module of last error. Use */ |
| 147 | /* "__FILE__" and let compiler do the rest */ |
| 148 | char te_mesg[TST_ERR_MESG_SIZE+1]; /* string of last error */ |
| 149 | |
| 150 | } _TST_ERROR; |
| 151 | |
| 152 | extern _TST_ERROR Tst_error; /* defined in test_error.c */ |
| 153 | #if __STDC__ |
| 154 | extern void tst_set_error(char *file, int line, char *func, char *fmt, ...); |
| 155 | #else |
| 156 | extern void tst_set_error(); |
| 157 | #endif |
| 158 | extern void tst_clear_error(); |
| 159 | |
| 160 | |
| 161 | /* |
| 162 | * The following define contains the name of an environmental variable |
| 163 | * that can be used to specify the number of iterations. |
| 164 | * It is supported in parse_opts.c and USC_setup.c. |
| 165 | */ |
| 166 | #define USC_ITERATION_ENV "USC_ITERATIONS" |
| 167 | |
| 168 | /* |
| 169 | * The following define contains the name of an environmental variable |
| 170 | * that can be used to specify to iteration until desired time |
| 171 | * in floating point seconds has gone by. |
| 172 | * Supported in USC_setup.c. |
| 173 | */ |
| 174 | #define USC_LOOP_WALLTIME "USC_LOOP_WALLTIME" |
| 175 | |
| 176 | /* |
| 177 | * The following define contains the name of an environmental variable |
| 178 | * that can be used to specify that no functional checks are wanted. |
| 179 | * It is supported in parse_opts.c and USC_setup.c. |
| 180 | */ |
| 181 | #define USC_NO_FUNC_CHECK "USC_NO_FUNC_CHECK" |
| 182 | |
| 183 | /* |
| 184 | * The following define contains the name of an environmental variable |
| 185 | * that can be used to specify the delay between each loop iteration. |
| 186 | * The value is in seconds (fractional numbers are allowed). |
| 187 | * It is supported in parse_opts.c. |
| 188 | */ |
| 189 | #define USC_LOOP_DELAY "USC_LOOP_DELAY" |
| 190 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 191 | /* |
| 192 | * The following prototypes are needed to remove compile errors |
| 193 | * on IRIX systems when compiled with -n32 and -64. |
| 194 | */ |
| 195 | extern void tst_res(int ttype, char *fname, char *arg_fmt, ...); |
| 196 | extern void tst_resm(int ttype, char *arg_fmt, ...); |
| 197 | extern void tst_brk(int ttype, char *fname, void (*func)(), |
| 198 | char *arg_fmt, ...); |
| 199 | extern void tst_brkloop(int ttype, char *fname, void (*func)(), |
| 200 | char *arg_fmt, ...); |
| 201 | extern void tst_brkm(int ttype, void (*func)(), char *arg_fmt, ...); |
| 202 | extern void tst_brkloopm(int ttype, void (*func)(), char *arg_fmt, ...); |
| 203 | |
| 204 | extern int tst_environ(); |
| 205 | extern void tst_exit(); |
| 206 | extern void tst_flush(); |
| 207 | |
| 208 | /* prototypes for the t_res.c functions */ |
| 209 | extern void t_result(char *tcid, int tnum, int ttype, char *tmesg); |
| 210 | extern void tt_exit(); |
| 211 | extern int t_environ(); |
| 212 | extern void t_breakum(char *tcid, int total, int typ, char *msg, void (*fnc)()); |
| 213 | |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 214 | extern void tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()); |
| 215 | extern void tst_tmpdir(); |
| 216 | extern void tst_rmdir(); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 217 | |
robbiew | f3a83d5 | 2002-05-28 16:26:16 +0000 | [diff] [blame] | 218 | extern char * get_high_address(void); |
robbiew | f3a83d5 | 2002-05-28 16:26:16 +0000 | [diff] [blame] | 219 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 220 | #endif /* end of __TEST_H__ */ |