00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _H5TEST_H
00023 #define _H5TEST_H
00024
00025 #include "hdf5.h"
00026 #include "H5private.h"
00027
00028 #ifdef H5_STDC_HEADERS
00029 # include <signal.h>
00030 # include <stdarg.h>
00031 #endif
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #define VERBO_NONE 0
00055 #define VERBO_DEF 3
00056 #define VERBO_LO 5
00057 #define VERBO_MED 7
00058 #define VERBO_HI 9
00059
00060
00061
00062
00063
00064
00065
00066
00067 #define HDGetTestVerbosity() (TestVerbosity)
00068
00069 #define VERBOSE_NONE (HDGetTestVerbosity()==VERBO_NONE)
00070 #define VERBOSE_DEF (HDGetTestVerbosity()>=VERBO_DEF)
00071 #define VERBOSE_LO (HDGetTestVerbosity()>=VERBO_LO)
00072 #define VERBOSE_MED (HDGetTestVerbosity()>=VERBO_MED)
00073 #define VERBOSE_HI (HDGetTestVerbosity()>=VERBO_HI)
00074
00075
00076
00077
00078 #define SKIPTEST 1
00079 #define ONLYTEST 2
00080 #define BEGINTEST 3
00081
00082
00083
00084
00085
00086 H5_DLLVAR char *paraprefix;
00087 #ifdef H5_HAVE_PARALLEL
00088 extern MPI_Info h5_io_info_g;
00089 #endif
00090
00091
00092
00093
00094 #define AT() printf (" at %s:%d in %s()...\n", \
00095 __FILE__, __LINE__, __FUNCTION__);
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 #define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);}
00107 #define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);}
00108 #define PASSED() {puts(" PASSED");fflush(stdout);}
00109 #define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
00110 #define H5_WARNING() {puts("*WARNING*");fflush(stdout);}
00111 #define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
00112 #define TEST_ERROR {H5_FAILED(); AT(); goto error;}
00113 #define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;}
00114 #define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \
00115 goto error;}
00116 #define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); puts(s); goto error;}
00117
00118
00119
00120
00121 #define alarm_seconds 1200
00122 #define ALARM_ON HDalarm(alarm_seconds)
00123 #define ALARM_OFF HDalarm(0)
00124
00125 #define ALARM_SET(N) HDalarm((N)>0 ? N : alarm_seconds)
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 #define FLT_ABS_EQUAL(X,Y) ((float)fabs(X-Y)<FLT_EPSILON)
00138 #define DBL_ABS_EQUAL(X,Y) (fabs(X-Y)<DBL_EPSILON)
00139 #define LDBL_ABS_EQUAL(X,Y) (fabsl(X-Y)<LDBL_EPSILON)
00140
00141 #define FLT_REL_EQUAL(X,Y,M) (fabsf((Y-X)/X<M)
00142 #define DBL_REL_EQUAL(X,Y,M) (fabs((Y-X)/X)<M)
00143 #define LDBL_REL_EQUAL(X,Y,M) (fabsl((Y-X)/X)<M)
00144
00145 #ifdef __cplusplus
00146 extern "C" {
00147 #endif
00148
00149
00150 H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
00151 H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname,
00152 size_t size);
00153 H5TEST_DLL hid_t h5_fileaccess(void);
00154 H5TEST_DLL void h5_no_hwconv(void);
00155 H5TEST_DLL const char *h5_rmprefix(const char *filename);
00156 H5TEST_DLL void h5_reset(void);
00157 H5TEST_DLL void h5_show_hostname(void);
00158 H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl);
00159 H5TEST_DLL int print_func(const char *format, ...);
00160 H5TEST_DLL int h5_make_local_copy(char *origfilename, char *local_copy_name);
00161
00162
00163 H5TEST_DLL void TestUsage(void);
00164 H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void),
00165 void (*Cleanup) (void), const char *TheDescr,
00166 const void *Parameters);
00167 H5TEST_DLL void TestInfo(const char *ProgName);
00168 H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]);
00169 H5TEST_DLL void PerformTests(void);
00170 H5TEST_DLL void TestSummary(void);
00171 H5TEST_DLL void TestCleanup(void);
00172 H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]));
00173 H5TEST_DLL int GetTestVerbosity(void);
00174 H5TEST_DLL int SetTestVerbosity(int newval);
00175 H5TEST_DLL int GetTestSummary(void);
00176 H5TEST_DLL int GetTestCleanup(void);
00177 H5TEST_DLL int SetTestNoCleanup(void);
00178 H5TEST_DLL int GetTestExpress(void);
00179 H5TEST_DLL int SetTestExpress(int newval);
00180 H5TEST_DLL void ParseTestVerbosity(char *argv);
00181 H5TEST_DLL int GetTestNumErrs(void);
00182 H5TEST_DLL void IncTestNumErrs(void);
00183 H5TEST_DLL const void *GetTestParameters(void);
00184 H5TEST_DLL int TestErrPrintf(const char *format, ...);
00185 H5TEST_DLL void SetTest(const char *testname, int action);
00186
00187 #ifdef H5_HAVE_FILTER_SZIP
00188 H5TEST_DLL int h5_szip_can_encode(void);
00189 #endif
00190
00191 #ifdef H5_HAVE_PARALLEL
00192 H5TEST_DLL int h5_set_info_object(void);
00193 H5TEST_DLL void h5_dump_info_object(MPI_Info info);
00194 H5TEST_DLL char* getenv_all(MPI_Comm comm, int root, const char* name);
00195 #endif
00196
00197
00198 H5TEST_DLLVAR int TestVerbosity;
00199
00200 #ifdef __cplusplus
00201 }
00202 #endif
00203 #endif