summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2000-09-10 00:08:27 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2000-09-10 00:08:27 (GMT)
commitdd4203674a35d499e8c21980048e4149032cfdf9 (patch)
treee55e30e9419bca1fa2d096ed4840f54fb51fb2c2
parent32bdf68ff8c0aeac735f28c4712261990f81612c (diff)
downloadhdf5-dd4203674a35d499e8c21980048e4149032cfdf9.zip
hdf5-dd4203674a35d499e8c21980048e4149032cfdf9.tar.gz
hdf5-dd4203674a35d499e8c21980048e4149032cfdf9.tar.bz2
[svn-r2531] Description:
The "FILENAME" declared extern in h5test.h is not always used. It was used in h5_cleanup to remove temporary files created during tests. Not all tests codes have used this routine. Indeed, quite a few of test programs do "#define FILENAME ". Also, h5_cleanup needs to work in tandem with h5_fixname. h5_fixname accepts an explicite base_name argument instead of using the global variable FILENAME. That is cleaner. Solution: Added char *base_name[] as a new argument to h5_cleanup, in the same style as h5_fixname. Removed "extern char *FILENAME..." from use. Also, undo some unnecessary declaration of "char *FILENAME" from some tests which don't use it at all (yet). Platforms tested: modi4-64(irix64), arabica(solari2.7), eirene(linux) (arabica could not launch tests automatically. I had to hack in LD_LIBRARY_PATH to make them run.)
-rw-r--r--test/big.c10
-rw-r--r--test/bittests.c4
-rw-r--r--test/cmpd_dset.c2
-rw-r--r--test/dpss_read.c4
-rw-r--r--test/dpss_write.c4
-rw-r--r--test/dsets.c2
-rw-r--r--test/dtypes.c2
-rw-r--r--test/enum.c2
-rw-r--r--test/extend.c2
-rw-r--r--test/external.c2
-rw-r--r--test/fillval.c2
-rw-r--r--test/flush2.c2
-rw-r--r--test/gass_append.c4
-rw-r--r--test/gass_read.c4
-rw-r--r--test/gass_write.c4
-rw-r--r--test/gheap.c2
-rw-r--r--test/h5test.c18
-rw-r--r--test/h5test.h9
-rw-r--r--test/hyperslab.c4
-rw-r--r--test/istore.c2
-rw-r--r--test/lheap.c2
-rw-r--r--test/links.c2
-rw-r--r--test/mount.c2
-rw-r--r--test/mtime.c2
-rw-r--r--test/ohdr.c2
-rw-r--r--test/srb_append.c4
-rw-r--r--test/srb_read.c4
-rw-r--r--test/srb_write.c4
-rw-r--r--test/stab.c2
-rw-r--r--test/testhdf5.c4
-rw-r--r--test/ttsafe.c4
-rw-r--r--test/unlink.c2
32 files changed, 34 insertions, 85 deletions
diff --git a/test/big.c b/test/big.c
index 66d5870..b0938ff 100644
--- a/test/big.c
+++ b/test/big.c
@@ -386,23 +386,23 @@ main (void)
if (sizeof(long_long)<8 || 0==GB8LL) {
puts("Test skipped because sizeof(long_long) is too small. This");
puts("hardware apparently doesn't support 64-bit integer types.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
exit(0);
}
if (!is_sparse()) {
puts("Test skipped because file system does not support holes.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
exit(0);
}
if (!enough_room(fapl)) {
puts("Test skipped because of quota (file size or num open files).");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
exit(0);
}
if (sizeof(hsize_t)<=4) {
puts("Test skipped because the hdf5 library was configured with the");
puts("--disable-hsizet flag in order to work around a compiler bug.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
exit(0);
}
@@ -410,7 +410,7 @@ main (void)
if (writer(fapl, WRT_N)) goto error;
if (reader(fapl)) goto error;
puts("All big tests passed.");
- if (h5_cleanup(fapl)) remove(DNAME);
+ if (h5_cleanup(FILENAME, fapl)) remove(DNAME);
return 0;
error:
diff --git a/test/bittests.c b/test/bittests.c
index 492691d..2c8daef 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -9,10 +9,6 @@
*/
#include <h5test.h>
-const char *FILENAME[] = {
- NULL
-};
-
#define H5T_PACKAGE
#include <H5Tpkg.h>
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 4ccd060..062707e 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -702,7 +702,7 @@ main (int argc, char *argv[])
H5Dclose (dataset);
H5Fclose (file);
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
puts("All compound dataset tests passed.");
return 0;
diff --git a/test/dpss_read.c b/test/dpss_read.c
index c7f4807..e2cd1c0 100644
--- a/test/dpss_read.c
+++ b/test/dpss_read.c
@@ -18,10 +18,6 @@
#include <h5test.h>
#include <strings.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_GRIDSTORAGE
int main(void)
{
diff --git a/test/dpss_write.c b/test/dpss_write.c
index 9386195..0fdb7e0 100644
--- a/test/dpss_write.c
+++ b/test/dpss_write.c
@@ -17,10 +17,6 @@
*/
#include <h5test.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_GRIDSTORAGE
int main(void)
{
diff --git a/test/dsets.c b/test/dsets.c
index 2a84173..412d209 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -854,7 +854,7 @@ main(void)
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
printf("All dataset tests passed.\n");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/dtypes.c b/test/dtypes.c
index 4555753..1bf7a7c 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -3665,7 +3665,7 @@ main(void)
nerrors += test_compound_1();
nerrors += test_transient (fapl);
nerrors += test_named (fapl);
- h5_cleanup (fapl); /*must happen before first reset*/
+ h5_cleanup(FILENAME, fapl); /*must happen before first reset*/
reset_hdf5();
nerrors += test_conv_str_1();
diff --git a/test/enum.c b/test/enum.c
index 8091c07..dce0fa8 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -371,7 +371,7 @@ main(void)
if (nerrors) goto error;
puts("All enum tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/extend.c b/test/extend.c
index 25f7ee7..ae9fee0 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -133,7 +133,7 @@ main (void)
if (H5Fclose (file)<0) goto error;
PASSED();
printf("All extend tests passed.\n");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/external.c b/test/external.c
index 6ccc8b0..0ea5498 100644
--- a/test/external.c
+++ b/test/external.c
@@ -842,7 +842,7 @@ main (void)
if (H5Fclose(file)<0) goto error;
puts("All external storage tests passed.");
- if (h5_cleanup(fapl)) {
+ if (h5_cleanup(FILENAME, fapl)) {
remove("extern_1a.raw");
remove("extern_1b.raw");
remove("extern_2a.raw");
diff --git a/test/fillval.c b/test/fillval.c
index 28fa576..f5f9700 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -736,7 +736,7 @@ main(int argc, char *argv[])
if (nerrors) goto error;
puts("All fill value tests passed.");
- if (h5_cleanup(fapl)) remove(FILE_NAME_RAW);
+ if (h5_cleanup(FILENAME, fapl)) remove(FILE_NAME_RAW);
return 0;
error:
diff --git a/test/flush2.c b/test/flush2.c
index 3430163..ffdae59 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -91,7 +91,7 @@ main(void)
if (H5Dclose(dset)<0) goto error;
if (H5Fclose(file)<0) goto error;
PASSED();
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/gass_append.c b/test/gass_append.c
index 8b20394..30ad6b0 100644
--- a/test/gass_append.c
+++ b/test/gass_append.c
@@ -17,10 +17,6 @@
*/
#include <h5test.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_GASS
int main(void)
{
diff --git a/test/gass_read.c b/test/gass_read.c
index afefae4..74a39cd 100644
--- a/test/gass_read.c
+++ b/test/gass_read.c
@@ -18,10 +18,6 @@
#include <h5test.h>
#include <strings.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_GASS
int main(void)
{
diff --git a/test/gass_write.c b/test/gass_write.c
index ec51411..a4cb44f 100644
--- a/test/gass_write.c
+++ b/test/gass_write.c
@@ -17,10 +17,6 @@
*/
#include <h5test.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_GASS
int main(void)
{
diff --git a/test/gheap.c b/test/gheap.c
index 1cae524..85e09be 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -404,7 +404,7 @@ main (void)
if (nerrors) goto error;
puts("All global heap tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/h5test.c b/test/h5test.c
index e052c40..0e4b785 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -96,9 +96,9 @@ h5_errors(void UNUSED *client_data)
/*-------------------------------------------------------------------------
* Function: h5_cleanup
*
- * Purpose: Cleanup temporary test files. The list of test files is in
- * `extern const char *FILENAMES[]' -- these are only the base
- * names. The file access property list is also closed.
+ * Purpose: Cleanup temporary test files.
+ * base_name contains the list of test file names.
+ * The file access property list is also closed.
*
* Return: Non-zero if cleanup actions were performed; zero otherwise.
*
@@ -106,11 +106,14 @@ h5_errors(void UNUSED *client_data)
* May 28, 1998
*
* Modifications:
+ * Albert Cheng, 2000-09-09
+ * Added the explicite base_name argument to replace the
+ * global variable FILENAME.
*
*-------------------------------------------------------------------------
*/
int
-h5_cleanup(hid_t fapl)
+h5_cleanup(const char *base_name[], hid_t fapl)
{
char filename[1024];
char temp[2048];
@@ -119,8 +122,8 @@ h5_cleanup(hid_t fapl)
hid_t driver;
if (!getenv("HDF5_NOCLEANUP")) {
- for (i=0; FILENAME[i]; i++) {
- if (NULL==h5_fixname(FILENAME[i], fapl, filename,
+ for (i=0; base_name[i]; i++) {
+ if (NULL==h5_fixname(base_name[i], fapl, filename,
sizeof filename)) {
continue;
}
@@ -201,7 +204,8 @@ h5_reset(void)
* counting the null terminator). The full name is created by
* prepending the contents of HDF5_PREFIX (separated from the
* base name by a slash) and appending a file extension based on
- * the driver supplied.
+ * the driver supplied, resulting in something like
+ * `ufs:/u/matzke/test.h5'.
*
* Return: Success: The FULLNAME pointer.
*
diff --git a/test/h5test.h b/test/h5test.h
index 874a5f6..1dc00c6 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -23,13 +23,6 @@
/*
- * This array should contain a list of file base names created by the test.
- * The base name is a word like `test' which will have a prefix and suffix
- * added to result in something like `ufs:/u/matzke/test.h5'
- */
-extern const char *FILENAME[];
-
-/*
* This contains the filename prefix specificied as command line option for
* the parallel test files.
*/
@@ -60,7 +53,7 @@ extern char *paraprefix;
extern "C" {
#endif
-int h5_cleanup(hid_t fapl);
+int h5_cleanup(const char *base_name[], hid_t fapl);
herr_t h5_errors(void *client_data);
char *h5_fixname(const char *base_name, hid_t fapl, char *fullname,
size_t size);
diff --git a/test/hyperslab.c b/test/hyperslab.c
index b87ce7d..114336a 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -15,10 +15,6 @@
#include <H5MMprivate.h>
#include <H5Vprivate.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef HAVE_FUNCTION
#undef __FUNCTION__
#define __FUNCTION__ ""
diff --git a/test/istore.c b/test/istore.c
index b04e0f3..1fa84b5 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -624,6 +624,6 @@ main(int argc, char *argv[])
}
printf("All i-store tests passed.\n");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
}
diff --git a/test/lheap.c b/test/lheap.c
index 85f5338..a92b066 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -119,7 +119,7 @@ main(void)
puts("All local heap tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/links.c b/test/links.c
index ce4dcad..3a1d659 100644
--- a/test/links.c
+++ b/test/links.c
@@ -249,6 +249,6 @@ main(void)
exit(1);
}
printf("All link tests passed.\n");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
}
diff --git a/test/mount.c b/test/mount.c
index e5887a0..de06d65 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -1051,7 +1051,7 @@ main(void)
if (nerrors) goto error;
puts("All mount tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/mtime.c b/test/mtime.c
index 6cf50fe..5c5992b 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -105,7 +105,7 @@ main(void)
/* All looks good */
PASSED();
puts("All modification time tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
}
diff --git a/test/ohdr.c b/test/ohdr.c
index 6fcffe0..114ac02 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -267,7 +267,7 @@ main(void)
PASSED();
puts("All object header tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/srb_append.c b/test/srb_append.c
index 9cd6130..497f51b 100644
--- a/test/srb_append.c
+++ b/test/srb_append.c
@@ -51,10 +51,6 @@
*/
#include <h5test.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_SRB
int main(void)
{
diff --git a/test/srb_read.c b/test/srb_read.c
index e20085c..1b4794b 100644
--- a/test/srb_read.c
+++ b/test/srb_read.c
@@ -50,10 +50,6 @@
*/
#include <h5test.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_SRB
int main(void)
{
diff --git a/test/srb_write.c b/test/srb_write.c
index 1de3595..ebc50c6 100644
--- a/test/srb_write.c
+++ b/test/srb_write.c
@@ -51,10 +51,6 @@
#include <h5test.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_SRB
int main(void)
{
diff --git a/test/stab.c b/test/stab.c
index 9e84494..46c9ca9 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -192,7 +192,7 @@ main(void)
/* Cleanup */
puts("All symbol table tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
diff --git a/test/testhdf5.c b/test/testhdf5.c
index 16349d1..ea88a7c 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -58,10 +58,6 @@ int Verbosity;
/* ANY new test needs to have a prototype in tproto.h */
#include <testhdf5.h>
-const char *FILENAME[] = {
- NULL
-};
-
struct TestStruct {
int NumErrors;
char Description[64];
diff --git a/test/ttsafe.c b/test/ttsafe.c
index ae21c5a..6920321 100644
--- a/test/ttsafe.c
+++ b/test/ttsafe.c
@@ -45,10 +45,6 @@ static char RcsId[] = "@(#)$Revision$";
#include <stdarg.h>
#include <ttsafe.h>
-const char *FILENAME[] = {
- NULL
-};
-
#ifndef H5_HAVE_THREADSAFE
int main(void)
{
diff --git a/test/unlink.c b/test/unlink.c
index ca66c74..84802b3 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -321,7 +321,7 @@ main(void)
exit(1);
}
puts("All unlink tests passed.");
- h5_cleanup(fapl);
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
return 1;