summaryrefslogtreecommitdiffstats
path: root/test/tmisc.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-07-05 18:35:03 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-07-05 18:35:03 (GMT)
commit63647cd36336e35cac95c9ed4ab48deadee8ebd0 (patch)
tree90e5be9bc1b17c792d2e3e83b22acef933313f8f /test/tmisc.c
parent7e9d5c2c3727a8d17e81c25ad8106d35f55f329d (diff)
downloadhdf5-63647cd36336e35cac95c9ed4ab48deadee8ebd0.zip
hdf5-63647cd36336e35cac95c9ed4ab48deadee8ebd0.tar.gz
hdf5-63647cd36336e35cac95c9ed4ab48deadee8ebd0.tar.bz2
Merge of recent develop work to 1.10 branch.
Fixes for: * HDFFV-10247 (autotools Fortran long double bug) * HDFFV-10248 (autotools deprecated debug/production tweak) * HDFFV-10250 (-fno-omit-frame-pointer w/ symbols) * Disabled missing parameter warnings in Java constant code * Added H5I_VFL ID checks to tmisc.c * Added 'get a dummy VFD' call to h5test library
Diffstat (limited to 'test/tmisc.c')
-rw-r--r--test/tmisc.c69
1 files changed, 55 insertions, 14 deletions
diff --git a/test/tmisc.c b/test/tmisc.c
index dc69e18..bec80b2 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -29,7 +29,7 @@
#include "hdf5.h"
#include "testhdf5.h"
#include "H5srcdir.h"
-#include "H5Dpkg.h" /* Datasets */
+#include "H5Dpkg.h" /* Datasets */
/* Definitions for misc. test #1 */
#define MISC1_FILE "tmisc1.h5"
@@ -2984,19 +2984,21 @@ test_misc18(void)
static void
test_misc19(void)
{
- hid_t fid; /* File ID */
- hid_t sid; /* 'Space ID */
- hid_t did; /* Dataset ID */
- hid_t tid; /* 'Type ID */
- hid_t aid; /* Attribute ID */
- hid_t plid; /* Property List ID */
- hid_t pcid; /* Property Class ID */
- hid_t gid; /* Group ID */
- hid_t ecid; /* Error Class ID */
- hid_t emid; /* Error Message ID */
- hid_t esid; /* Error Stack ID */
- int rc; /* Reference count */
- herr_t ret; /* Generic return value */
+ hid_t fid = -1; /* File ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t plid = -1; /* Property List ID */
+ hid_t pcid = -1; /* Property Class ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t ecid = -1; /* Error Class ID */
+ hid_t emid = -1; /* Error Message ID */
+ hid_t esid = -1; /* Error Stack ID */
+ hid_t vfdid = -1; /* Virtual File Driver ID */
+ H5FD_class_t *vfd_cls = NULL; /* VFD class */
+ int rc; /* Reference count */
+ herr_t ret; /* Generic return value */
/* Check H5I operations on files */
@@ -3406,6 +3408,45 @@ test_misc19(void)
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Eclose_stack");
+
+/* Check H5I operations on virtual file drivers */
+
+ /* Get a VFD class to register */
+ vfd_cls = h5_get_dummy_vfd_class();
+ CHECK(vfd_cls, NULL, "h5_get_dummy_vfd_class");
+
+ /* Register a virtual file driver */
+ vfdid = H5FDregister(vfd_cls);
+ CHECK(vfdid, FAIL, "H5FDregister");
+
+ /* Check the reference count */
+ rc = H5Iget_ref(vfdid);
+ VERIFY(rc, 1, "H5Iget_ref");
+
+ /* Increment the reference count */
+ rc = H5Iinc_ref(vfdid);
+ VERIFY(rc, 2, "H5Iinc_ref");
+
+ /* Unregister the VFD normally */
+ ret = H5FDunregister(vfdid);
+ CHECK(ret, FAIL, "H5FDunregister");
+
+ /* Check the reference count */
+ rc = H5Iget_ref(vfdid);
+ VERIFY(rc, 1, "H5Iget_ref");
+
+ /* Unregister the VFD by decrementing the reference count */
+ rc = H5Idec_ref(vfdid);
+ VERIFY(rc, 0, "H5Idec_ref");
+
+ /* Try unregistering the VFD again (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5FDunregister(vfdid);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5FDunregister");
+
+ HDfree(vfd_cls);
+
} /* end test_misc19() */
/****************************************************************