diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/tattr.c | 21 | ||||
-rw-r--r-- | test/testhdf5.c | 42 | ||||
-rw-r--r-- | test/testhdf5.h | 11 | ||||
-rw-r--r-- | test/tfile.c | 24 | ||||
-rw-r--r-- | test/th5s.c | 22 | ||||
-rw-r--r-- | test/theap.c | 25 | ||||
-rw-r--r-- | test/tmeta.c | 22 | ||||
-rw-r--r-- | test/tohdr.c | 27 | ||||
-rw-r--r-- | test/tstab.c | 26 |
9 files changed, 207 insertions, 13 deletions
diff --git a/test/tattr.c b/test/tattr.c index 36dbdcf..4f4e7b4 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1231,3 +1231,24 @@ test_attr(void) test_attr_delete(); /* Test H5A code for deleting attributes */ } /* test_attr() */ + +/*------------------------------------------------------------------------- + * Function: cleanup_attr + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_attr(void) +{ + remove(FILE); +} + diff --git a/test/testhdf5.c b/test/testhdf5.c index d4d9f89..374fd40 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -132,6 +132,37 @@ print_func(const char *format,...) return (ret_value); } + +/*------------------------------------------------------------------------- + * Function: cleanup + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +cleanup(void) +{ + if (!getenv ("HDF5_NOCLEANUP")) { + MESSAGE(2, ("\nCleaning Up temp files...\n\n")); + /* call individual cleanup routines in each source module */ + cleanup_metadata(); + cleanup_file(); + cleanup_heap(); + cleanup_ohdr(); + cleanup_stab(); + cleanup_h5s(); + cleanup_attr(); + } +} + int main(int argc, char *argv[]) { @@ -282,15 +313,8 @@ main(int argc, char *argv[]) } /* end for */ print_func("\n\n"); } /* end if */ - if (CleanUp) { - MESSAGE(2, ("\nCleaning Up...\n\n")); -#if !(defined DOS386 | defined WIN386) - system("rm -f *.h5 *.tmp"); -#else /* OLD_WAY */ - remove("*.h5"); - remove("*.tmp"); -#endif /* OLD_WAY */ - } /* end if */ + if (CleanUp) + cleanup(); exit(0); return (0); } /* end main() */ diff --git a/test/testhdf5.h b/test/testhdf5.h index 6f4355b..04ee954 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -139,4 +139,13 @@ void test_h5s(void); void test_h5d(void); void test_attr(void); -#endif /* HDF5TEST_H */ +/* Prototypes for the cleanup routines */ +void cleanup_metadata(void); +void cleanup_file(void); +void cleanup_heap(void); +void cleanup_ohdr(void); +void cleanup_stab(void); +void cleanup_h5s(void); +void cleanup_attr(void); + +#endif /* HDF5cleanup_H */ diff --git a/test/tfile.c b/test/tfile.c index 028c509..d1a6f00 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -301,3 +301,27 @@ test_file(void) test_file_create(); /* Test file creation (also creation templates) */ test_file_open(); /* Test file opening */ } /* test_file() */ + + +/*------------------------------------------------------------------------- + * Function: cleanup_file + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_file(void) +{ + remove(FILE1); + remove(FILE2); + remove(FILE3); +} + diff --git a/test/th5s.c b/test/th5s.c index 3ac55db..be866af 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -424,3 +424,25 @@ test_h5s(void) test_h5s_compound_scalar_write(); /* Test compound datatype scalar H5S writing code */ test_h5s_compound_scalar_read(); /* Test compound datatype scalar H5S reading code */ } /* test_h5s() */ + + +/*------------------------------------------------------------------------- + * Function: cleanup_h5s + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_h5s(void) +{ + remove(FILE); +} + diff --git a/test/theap.c b/test/theap.c index e355ded..c4ebe0a 100644 --- a/test/theap.c +++ b/test/theap.c @@ -23,6 +23,7 @@ #include <H5Fprivate.h> #include <H5HLprivate.h> +#define FILE "theap.h5" #define NOBJS 40 /*------------------------------------------------------------------------- @@ -55,7 +56,7 @@ test_heap(void) MESSAGE(5, ("Testing Heaps\n")); /* Create the file */ - fid = H5Fcreate("theap.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); f = H5I_object(fid); CHECK(f, NULL, "H5I_object"); @@ -88,3 +89,25 @@ test_heap(void) /* Close the file */ H5Fclose(fid); } + + +/*------------------------------------------------------------------------- + * Function: cleanup_heap + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_heap(void) +{ + remove(FILE); +} + diff --git a/test/tmeta.c b/test/tmeta.c index 1ff8954..601964e 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -122,3 +122,25 @@ test_metadata(void) num_errs++; } /* end if */ } /* test_metadata() */ + + +/*------------------------------------------------------------------------- + * Function: cleanup_metadata + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_metadata(void) +{ + /* no file to clean */ +} + diff --git a/test/tohdr.c b/test/tohdr.c index 386a667..4b249de 100644 --- a/test/tohdr.c +++ b/test/tohdr.c @@ -14,6 +14,7 @@ * *------------------------------------------------------------------------- */ + #include <testhdf5.h> #include <H5private.h> @@ -24,6 +25,8 @@ #include <H5Gprivate.h> #include <H5Oprivate.h> +#define TEST_FILE "tohdr.h5" + /* * This file needs to access private datatypes from the H5G package. */ @@ -59,7 +62,7 @@ test_ohdr(void) MESSAGE(5, ("Testing Object Headers\n")); /* create the file */ - fid = H5Fcreate("tohdr.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); f = H5I_object(fid); CHECK(f, NULL, "H5I_object"); @@ -170,3 +173,25 @@ test_ohdr(void) H5O_close(&oh_ent); H5Fclose(fid); } + + +/*------------------------------------------------------------------------- + * Function: cleanup_ohdr + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_ohdr(void) +{ + remove(TEST_FILE); +} + diff --git a/test/tstab.c b/test/tstab.c index 21b9be4..5ddad69 100644 --- a/test/tstab.c +++ b/test/tstab.c @@ -24,6 +24,8 @@ #include <H5Gprivate.h> #include <H5Oprivate.h> +#define TEST_FILE "tstab2.h5" + /* * This file needs to access private datatypes from the H5G package. */ @@ -92,7 +94,7 @@ test_2(void) #endif /* create the file */ - fid = H5Fcreate("tstab2.h5", H5F_ACC_TRUNC, create_plist, access_plist); + fid = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, create_plist, access_plist); CHECK(fid, FAIL, "H5Fcreate"); f = H5I_object(fid); CHECK(f, NULL, "H5I_object"); @@ -149,3 +151,25 @@ test_stab(void) { test_2(); } + + +/*------------------------------------------------------------------------- + * Function: cleanup_stab + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_stab(void) +{ + remove(TEST_FILE); +} + |