summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-10-22 00:08:12 (GMT)
committerGitHub <noreply@github.com>2023-10-22 00:08:12 (GMT)
commit4dfde6bac7395386379072c532560fbe8a5b6f79 (patch)
tree6e8e5aa1b9c72d5db6b1a1dd4fdbc6d97d4f4fc3
parent4b2d2eccdd8be50814ca2ed5e37e6d77b5a50340 (diff)
downloadhdf5-4dfde6bac7395386379072c532560fbe8a5b6f79.zip
hdf5-4dfde6bac7395386379072c532560fbe8a5b6f79.tar.gz
hdf5-4dfde6bac7395386379072c532560fbe8a5b6f79.tar.bz2
Fix file names in tfile.c (#3743)
Some tests in tfile.c use h5_fileaccess to get a VFD-dependent file name but use the scheme from testhdf5, reusing the FILE1 and FILE8 names. This leads to files like test1.h5.h5 which are unintended and not cleaned up. This changes the filename scheme for a few tests to work with h5test, resulting in more informative names and allowing the files to be cleaned up at the end of the test. The test files have also been added to the `make clean` target for the Autotools.
-rw-r--r--test/Makefile.am2
-rw-r--r--test/tfile.c21
2 files changed, 18 insertions, 5 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 3146e01..fdd83e5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -229,7 +229,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 mdset.h5 compact_dataset.h5 dataset.h5 d
splitter*.h5 splitter.log mirror_rw mirror_ro event_set_[0-9].h5 \
cmpd_dtransform.h5 single_latest.h5 source_file.h5 stdio_file.h5 \
tfile_is_accessible.h5 tfile_is_accessible_non_hdf5.h5 tverbounds_dtype.h5 \
- virtual_file1.h5 flushrefresh_test
+ virtual_file1.h5 tfile_double_open.h5 tfile_incr_filesize.h5 flushrefresh_test
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
diff --git a/test/tfile.c b/test/tfile.c
index 1c5196a..24cc7ce 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -138,9 +138,15 @@
#define NGROUPS 2
#define NDSETS 4
-/* Declaration for test_incr_filesize() */
+/* Declaration for libver bounds tests */
#define FILE8 "tfile8.h5" /* Test file */
+/* Declaration for test_file_double_file_dataset_open() */
+#define FILE_DOUBLE_OPEN "tfile_double_open"
+
+/* Declaration for test_incr_filesize() */
+#define FILE_INCR_FILESIZE "tfile_incr_filesize"
+
/* Files created under 1.6 branch and 1.8 branch--used in test_filespace_compatible() */
static const char *OLD_FILENAME[] = {
"filespace_1_6.h5", /* 1.6 HDF5 file */
@@ -2623,8 +2629,8 @@ test_file_double_file_dataset_open(bool new_format)
if (new_format) {
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
- } /* end if */
- h5_fixname(FILE1, fapl, filename, sizeof filename);
+ }
+ h5_fixname(FILE_DOUBLE_OPEN, fapl, filename, sizeof filename);
/* Create the test file */
fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
@@ -2934,6 +2940,9 @@ test_file_double_file_dataset_open(bool new_format)
ret = H5Tclose(tid1);
CHECK(ret, FAIL, "H5Tclose");
+ /* Delete the test file */
+ h5_delete_test_file(filename, fapl);
+
/* Close FAPL */
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
@@ -7650,7 +7659,7 @@ test_incr_filesize(void)
MESSAGE(5, ("Testing H5Fincrement_filesize() and H5Fget_eoa())\n"));
fapl = h5_fileaccess();
- h5_fixname(FILE8, fapl, filename, sizeof filename);
+ h5_fixname(FILE_INCR_FILESIZE, fapl, filename, sizeof filename);
/* Get the VFD feature flags */
driver_id = H5Pget_driver(fapl);
@@ -7735,6 +7744,9 @@ test_incr_filesize(void)
/* Verify the filesize is the previous stored_eoa + 512 */
VERIFY(filesize, stored_eoa + 512, "file size");
+ /* Delete the test file */
+ h5_delete_test_file(FILE_INCR_FILESIZE, fapl);
+
/* Close the file access property list */
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
@@ -8225,6 +8237,7 @@ cleanup_file(void)
H5Fdelete(FILE5, H5P_DEFAULT);
H5Fdelete(FILE6, H5P_DEFAULT);
H5Fdelete(FILE7, H5P_DEFAULT);
+ H5Fdelete(FILE8, H5P_DEFAULT);
H5Fdelete(DST_FILE, H5P_DEFAULT);
}
H5E_END_TRY