diff options
Diffstat (limited to 'test/vol.c')
-rw-r--r-- | test/vol.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -42,9 +42,10 @@ 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, /* connector version */ 0, /* capability flags */ NULL, /* initialize */ NULL, /* terminate */ @@ -181,6 +182,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 +206,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 +292,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() */ /*------------------------------------------------------------------------- |