summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/h5test.c20
-rw-r--r--test/h5test.h17
-rw-r--r--test/testhdf5.c30
-rw-r--r--test/ttsafe.c36
4 files changed, 44 insertions, 59 deletions
diff --git a/test/h5test.c b/test/h5test.c
index a361bcc..87a8a0b 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -796,3 +796,23 @@ h5_get_file_size(const char *filename)
return(0);
} /* end get_file_size() */
+
+/*
+ * Setup a test function. It must have no parameters and returns void.
+ */
+void
+InitTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr)
+{
+ if (Index >= MAXNUMOFTESTS) {
+ printf("Uh-oh, too many tests added, increase MAXNUMOFTEST!\n");
+ exit(-1);
+ } /* end if */
+ HDstrcpy(Test[Index].Description, TheDescr);
+ HDstrcpy(Test[Index].Name, TheName);
+ Test[Index].Call = TheCall;
+ Test[Index].Cleanup = Cleanup;
+ Test[Index].NumErrors = -1;
+ Test[Index].SkipFlag = 0;
+ Index++;
+}
+
diff --git a/test/h5test.h b/test/h5test.h
index 5084c6f..acaa197 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -62,6 +62,21 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
+/*
+ * Definitions for the InitTest().
+ */
+#define MAXNUMOFTESTS 50
+extern int Index;
+typedef struct TestStruct {
+ int NumErrors;
+ char Description[64];
+ int SkipFlag;
+ char Name[16];
+ void (*Call)(void);
+ void (*Cleanup)(void);
+} TestStruct;
+extern TestStruct Test[];
+
#ifdef __cplusplus
extern "C" {
@@ -74,6 +89,8 @@ H5TEST_DLL hid_t h5_fileaccess(void);
H5TEST_DLL void h5_no_hwconv(void);
H5TEST_DLL void h5_reset(void);
H5TEST_DLL void h5_show_hostname(void);
+H5TEST_DLL void InitTest(const char *TheName, void (*TheCall) (void),
+ void (*Cleanup) (void), const char *TheDescr);
#ifdef H5_HAVE_PARALLEL
int h5_set_info_object(void);
void h5_dump_info_object(MPI_Info info);
diff --git a/test/testhdf5.c b/test/testhdf5.c
index 1fd2f34..58eacbe 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -38,12 +38,11 @@
*/
#include <stdarg.h>
+#include "h5test.h"
#define MAXNUMOFTESTS 30
#define HDF5_TEST_MASTER
-/* Internal Variables */
-static int Index = 0;
/* Global variables */
int num_errs = 0;
@@ -52,35 +51,12 @@ int Verbosity;
/* ANY new test needs to have a prototype in tproto.h */
#include "testhdf5.h"
-struct TestStruct {
- int NumErrors;
- char Description[64];
- int SkipFlag;
- char Name[16];
- void (*Call) (void);
- void (*Cleanup) (void);
-} Test[MAXNUMOFTESTS];
+struct TestStruct Test[MAXNUMOFTESTS];
+int Index = 0;
-static void InitTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr);
static void usage(void);
static void
-InitTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr)
-{
- if (Index >= MAXNUMOFTESTS) {
- print_func("Uh-oh, too many tests added, increase MAXNUMOFTEST!\n");
- exit(-1);
- } /* end if */
- HDstrcpy(Test[Index].Description, TheDescr);
- HDstrcpy(Test[Index].Name, TheName);
- Test[Index].Call = TheCall;
- Test[Index].Cleanup = Cleanup;
- Test[Index].NumErrors = -1;
- Test[Index].SkipFlag = 0;
- Index++;
-}
-
-static void
usage(void)
{
int i;
diff --git a/test/ttsafe.c b/test/ttsafe.c
index 8d95d3e..276b757 100644
--- a/test/ttsafe.c
+++ b/test/ttsafe.c
@@ -42,6 +42,7 @@
#include <stdarg.h>
+#include "h5test.h"
#include "ttsafe.h"
#ifndef H5_HAVE_THREADSAFE
@@ -52,49 +53,20 @@ int main(void)
}
#else
-#define MAXNUMOFTESTS 50
#define HDF5_TEST_MASTER
#define MAX_NUM_NAME 1000
#define NAME_OFFSET 6 /* offset for "name<num>" */
-/* Internal Variables */
-static int Index = 0;
-
/* Global variables */
int num_errs = 0;
int Verbosity;
/* ANY new test needs to have a prototype in tproto.h */
-struct TestStruct {
- int NumErrors;
- char Description[64];
- int SkipFlag;
- char Name[16];
- void (*Call)(void);
- void (*Cleanup)(void);
-} Test[MAXNUMOFTESTS];
-
-static void InitTest(const char *TheName, void (*TheCall) (void),
- void (*Cleanup) (void), const char *TheDescr);
-static void usage(void);
+TestStruct Test[MAXNUMOFTESTS];
+int Index = 0;
-static void InitTest(const char *TheName, void (*TheCall) (void),
- void (*Cleanup) (void), const char *TheDescr)
-{
- if (Index >= MAXNUMOFTESTS) {
- print_func("Uh-oh, too many tests added, increase MAXNUMOFTEST!\n");
- exit(-1);
- }
-
- HDstrcpy(Test[Index].Description, TheDescr);
- HDstrcpy(Test[Index].Name, TheName);
- Test[Index].Call = TheCall;
- Test[Index].Cleanup = Cleanup;
- Test[Index].NumErrors = -1;
- Test[Index].SkipFlag = 0;
- Index++;
-}
+static void usage(void);
static void usage(void)
{