summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-12-10 22:30:07 (GMT)
committerGitHub <noreply@github.com>2020-12-10 22:30:07 (GMT)
commitebe9a3966fcbd3e154d43dd31ba9b219c575e781 (patch)
tree6611d5c941849e6bb9087967a63736ae9eff183c /test
parentff04956a6cbdda015cb6c5239d7d6007976fd2a4 (diff)
downloadhdf5-ebe9a3966fcbd3e154d43dd31ba9b219c575e781.zip
hdf5-ebe9a3966fcbd3e154d43dd31ba9b219c575e781.tar.gz
hdf5-ebe9a3966fcbd3e154d43dd31ba9b219c575e781.tar.bz2
Merge VOL framework versioning to 1.12 (#154)
* Enforce VOL framework version compatibility when registering connectors. Also add a version for the connector itself, some refactoring on the register calls, and move the logic for matching / rejecting a VOL connector class from the plugin module to the VOL module. (#151) * Revise VOL framework version compatibility for the 1.12 release branch
Diffstat (limited to 'test')
-rw-r--r--test/h5test.c1
-rw-r--r--test/null_vol_connector.c2
-rw-r--r--test/vol.c21
3 files changed, 21 insertions, 3 deletions
diff --git a/test/h5test.c b/test/h5test.c
index dbd1a90..7a4bf2d 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -2039,6 +2039,7 @@ h5_get_dummy_vol_class(void)
/* Fill in the minimum parameters to make a VOL connector class that
* can be registered.
*/
+ vol_class->version = H5VL_VERSION;
vol_class->name = "dummy";
return vol_class;
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index 095169c..400064c 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -26,7 +26,7 @@
/* The VOL class struct */
static const H5VL_class_t null_vol_g = {
- 0, /* version */
+ H5VL_VERSION, /* VOL class struct version */
NULL_VOL_CONNECTOR_VALUE, /* value */
NULL_VOL_CONNECTOR_NAME, /* name */
0, /* capability flags */
diff --git a/test/vol.c b/test/vol.c
index b662cb8..6076fca 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -42,7 +42,7 @@ const char *FILENAME[] = {"native_vol_test", NULL};
* functionality.
*/
static const H5VL_class_t fake_vol_g = {
- 0, /* version */
+ H5VL_VERSION, /* VOL class struct version */
FAKE_VOL_VALUE, /* value */
FAKE_VOL_NAME, /* name */
0, /* capability flags */
@@ -181,6 +181,7 @@ test_vol_registration(void)
htri_t is_registered = FAIL;
hid_t vol_id = H5I_INVALID_HID;
hid_t vol_id2 = H5I_INVALID_HID;
+ H5VL_class_t *bad_fake_vol_class = NULL;
TESTING("VOL registration");
@@ -204,6 +205,19 @@ test_vol_registration(void)
if (H5Pclose(lapl_id) < 0)
TEST_ERROR;
+ /* Test registering a VOL connector with an incompatible version # */
+ if (NULL == (bad_fake_vol_class = HDmalloc(sizeof(H5VL_class_t))))
+ TEST_ERROR;
+ HDmemcpy(bad_fake_vol_class, &fake_vol_g, sizeof(H5VL_class_t));
+ bad_fake_vol_class->version = H5VL_VERSION + 1;
+ H5E_BEGIN_TRY {
+ vol_id = H5VLregister_connector(bad_fake_vol_class, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if (H5I_INVALID_HID != vol_id)
+ FAIL_PUTS_ERROR("should not be able to register a connector with an incompatible version #");
+ HDfree(bad_fake_vol_class);
+ bad_fake_vol_class = NULL;
+
/* Load a VOL interface
* The vipl_id does nothing without a VOL that needs it, but we do need to
* test creating a property list of that class and passing it along as a
@@ -277,8 +291,11 @@ error:
H5Pclose(vipl_id);
}
H5E_END_TRY;
- return FAIL;
+ if (bad_fake_vol_class)
+ HDfree(bad_fake_vol_class);
+
+ return FAIL;
} /* end test_vol_registration() */
/*-------------------------------------------------------------------------