summaryrefslogtreecommitdiffstats
path: root/test/tmisc.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-09-04 02:04:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-09-04 02:04:45 (GMT)
commit303d35202ab14f20dd393893bca92bb078813ed7 (patch)
tree6525eb7e6109b2d1580887fa2694bab2dfb18223 /test/tmisc.c
parent8c174d260d4605ff75c37969d519913a67c6f93d (diff)
downloadhdf5-303d35202ab14f20dd393893bca92bb078813ed7.zip
hdf5-303d35202ab14f20dd393893bca92bb078813ed7.tar.gz
hdf5-303d35202ab14f20dd393893bca92bb078813ed7.tar.bz2
[svn-r7441] Purpose:
Bug fix Description: The VFL driver ID in a file's access proprty list wasn't being reference counted correctly, causing the VFL driver to get prematurely closed after several calls to "H5Pget_access_plist->H5Pclose". Solution: Increment VFL driver ID reference count when copy of file's access property list is made in H5Pget_access_plist() Platforms tested: FreeBSD 4.9 (sleipnir) h5committest
Diffstat (limited to 'test/tmisc.c')
-rw-r--r--test/tmisc.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/tmisc.c b/test/tmisc.c
index ec804b1..6dcef6f 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -191,6 +191,9 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
#define MISC14_DSET3_NAME "Dataset3"
#define MISC14_METADATA_SIZE 4096
+/* Definitions for misc. test #15 */
+#define MISC15_FILE "tmisc15.h5"
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -2568,6 +2571,56 @@ test_misc14(void)
/****************************************************************
**
+** test_misc15(): Test that checking a file's access property list
+** more than once correctly increments internal reference counts.
+**
+****************************************************************/
+static void
+test_misc15(void)
+{
+ hid_t file; /* File ID */
+ hid_t fapl; /* File access property list */
+ herr_t ret; /* Generic return value */
+
+ /* Create the file & get it's FAPL */
+ file = H5Fcreate(MISC15_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ fapl = H5Fget_access_plist(file);
+ CHECK(fapl, FAIL, "H5Fget_access_plist");
+
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Open the file & get it's FAPL again */
+ file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(file, FAIL, "H5Fopen");
+
+ fapl = H5Fget_access_plist(file);
+ CHECK(fapl, FAIL, "H5Fget_access_plist");
+
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Verify that the file is still OK */
+ ret = H5Fis_hdf5(MISC15_FILE);
+ CHECK(ret, FAIL, "H5Fis_hdf5");
+
+ file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(file, FAIL, "H5Fopen");
+
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* end test_misc15() */
+
+/****************************************************************
+**
** test_misc(): Main misc. test routine.
**
****************************************************************/
@@ -2591,6 +2644,7 @@ test_misc(void)
test_misc12(); /* Test VL-strings in chunked datasets operating correctly */
test_misc13(); /* Test that a user block can be insert in front of file contents */
test_misc14(); /* Test that deleted dataset's data is removed from sieve buffer correctly */
+ test_misc15(); /* Test that checking a file's access property list more than once works */
} /* test_misc() */
@@ -2629,4 +2683,5 @@ cleanup_misc(void)
HDremove(MISC13_FILE_1);
HDremove(MISC13_FILE_2);
HDremove(MISC14_FILE);
+ HDremove(MISC15_FILE);
}