summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-05-24 20:39:45 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-05-24 20:39:45 (GMT)
commit0afb76228e16e63d72a7dbacdbb894d34fe29722 (patch)
treeea018fcb09a63c6b2a585fc1d1a8cc53bd84c3f6 /test
parente1879a23ae414e5256bcc0170f40784cd698af89 (diff)
downloadhdf5-0afb76228e16e63d72a7dbacdbb894d34fe29722.zip
hdf5-0afb76228e16e63d72a7dbacdbb894d34fe29722.tar.gz
hdf5-0afb76228e16e63d72a7dbacdbb894d34fe29722.tar.bz2
Added code that disallows unregistering the native VOL connector.
Diffstat (limited to 'test')
-rw-r--r--test/vol.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/test/vol.c b/test/vol.c
index 3f6afaa..e5b8243 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -148,8 +148,11 @@ static const H5VL_class_t fake_vol_g = {
static herr_t
test_vol_registration(void)
{
- htri_t is_registered;
- hid_t vol_id = -1, vol_id2 = -1;
+ hid_t native_id = H5I_INVALID_HID;
+ herr_t ret = SUCCEED;
+ htri_t is_registered = FAIL;
+ hid_t vol_id = H5I_INVALID_HID;
+ hid_t vol_id2 = H5I_INVALID_HID;
TESTING("VOL registration");
@@ -157,7 +160,7 @@ test_vol_registration(void)
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
FAIL_STACK_ERROR;
if (is_registered > 0)
- FAIL_PUTS_ERROR("native VOL connector is inappropriately registered");
+ FAIL_PUTS_ERROR("VOL connector is inappropriately registered");
/* Load a VOL interface */
if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0)
@@ -167,7 +170,7 @@ test_vol_registration(void)
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
FAIL_STACK_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Re-register a VOL connector */
if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0)
@@ -177,7 +180,7 @@ test_vol_registration(void)
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
FAIL_STACK_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Unregister the second test/fake VOL ID */
if (H5VLunregister_connector(vol_id2) < 0)
@@ -187,12 +190,21 @@ test_vol_registration(void)
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
FAIL_STACK_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Unregister the original test/fake VOL ID */
if (H5VLunregister_connector(vol_id) < 0)
FAIL_STACK_ERROR;
+ /* Try to unregister the native VOL connector (should fail) */
+ if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME)))
+ FAIL_STACK_ERROR;
+ H5E_BEGIN_TRY {
+ ret = H5VLunregister_connector(native_id);
+ } H5E_END_TRY;
+ if (FAIL != ret)
+ FAIL_PUTS_ERROR("should not be able to unregister the native VOL connector");
+
PASSED();
return SUCCEED;