diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/use_common.c | 38 | ||||
-rw-r--r-- | test/vol.c | 34 | ||||
-rw-r--r-- | test/vol_plugin.c | 83 |
3 files changed, 119 insertions, 36 deletions
diff --git a/test/use_common.c b/test/use_common.c index 9effa06..4111b24 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -343,44 +343,45 @@ int write_uc_file(hbool_t tosend, hid_t fid) count[1]=dims[1]; count[2]=dims[2]; for (i=0; i<UC_opts.nplanes; i++){ - /* fill buffer with value i+1 */ - bufptr = buffer; - for (j=0; j<dims[1]; j++) - for (k=0; k<dims[2]; k++) - *bufptr++ = (UC_CTYPE)i; + /* fill buffer with value i+1 */ + bufptr = buffer; + for (j=0; j<dims[1]; j++) + for (k=0; k<dims[2]; k++) + *bufptr++ = (UC_CTYPE)i; /* Cork the dataset's metadata in the cache, if SWMR is enabled */ - if(UC_opts.use_swmr) + if(UC_opts.use_swmr) { if(H5Odisable_mdc_flushes(dsid) < 0) { HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n"); return -1; } + } - /* extend the dataset by one for new plane */ - dims[0]=i+1; + /* extend the dataset by one for new plane */ + dims[0]=i+1; if(H5Dset_extent(dsid, dims) < 0){ HDfprintf(stderr, "H5Dset_extent failed\n"); return -1; - } + } /* Get the dataset's dataspace */ if((f_sid = H5Dget_space(dsid)) < 0){ HDfprintf(stderr, "H5Dset_extent failed\n"); return -1; - } + } - start[0]=i; + start[0]=i; /* Choose the next plane to write */ if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){ HDfprintf(stderr, "Failed H5Sselect_hyperslab\n"); return -1; - } + } /* Write plane to the dataset */ if(H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){ HDfprintf(stderr, "Failed H5Dwrite\n"); return -1; - } + } /* Uncork the dataset's metadata from the cache, if SWMR is enabled */ if(UC_opts.use_swmr) @@ -389,12 +390,11 @@ int write_uc_file(hbool_t tosend, hid_t fid) return -1; } - /* flush file to make the just written plane available. */ - if(H5Dflush(dsid) < 0) - { - HDfprintf(stderr, "Failed to H5Fflush file\n"); - return -1; - } + /* flush file to make the just written plane available. */ + if(H5Dflush(dsid) < 0) { + HDfprintf(stderr, "Failed to H5Fflush file\n"); + return -1; + } } /* Done writing. Free/Close all resources including data file */ @@ -38,13 +38,14 @@ const char *FILENAME[] = { #define N_ELEMENTS 10 #define FAKE_VOL_NAME "fake" +#define FAKE_VOL_VALUE ((H5VL_class_value_t)501) /* A VOL class struct that describes a VOL class with no * functionality. */ static const H5VL_class_t fake_vol_g = { 0, /* version */ - (H5VL_class_value_t)501, /* value */ + FAKE_VOL_VALUE, /* value */ FAKE_VOL_NAME, /* name */ 0, /* capability flags */ NULL, /* initialize */ @@ -174,7 +175,11 @@ test_vol_registration(void) TESTING("VOL registration"); /* The test/fake VOL connector should not be registered at the start of the test */ - if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0) + TEST_ERROR; + if (is_registered > 0) + FAIL_PUTS_ERROR("VOL connector is inappropriately registered"); + if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0) TEST_ERROR; if (is_registered > 0) FAIL_PUTS_ERROR("VOL connector is inappropriately registered"); @@ -203,7 +208,11 @@ test_vol_registration(void) TEST_ERROR; /* The test/fake VOL connector should be registered now */ - if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0) + TEST_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("VOL connector is un-registered"); + if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0) TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("VOL connector is un-registered"); @@ -213,7 +222,11 @@ test_vol_registration(void) TEST_ERROR; /* The test/fake VOL connector should still be registered now */ - if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0) + TEST_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("VOL connector is un-registered"); + if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0) TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("VOL connector is un-registered"); @@ -223,7 +236,11 @@ test_vol_registration(void) TEST_ERROR; /* The test/fake VOL connector should still be registered now */ - if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0) + TEST_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("VOL connector is un-registered"); + if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0) TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("VOL connector is un-registered"); @@ -272,7 +289,12 @@ test_native_vol_init(void) TESTING("Native VOL connector initialization"); /* The native VOL connector should always be registered */ - if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(H5VL_NATIVE_NAME)) < 0) + TEST_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL connector is un-registered"); + + if ((is_registered = H5VLis_connector_registered_by_value(H5VL_NATIVE_VALUE)) < 0) TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("native VOL connector is un-registered"); diff --git a/test/vol_plugin.c b/test/vol_plugin.c index e4f171b..565c847 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -43,7 +43,7 @@ test_registration_by_value(void) TESTING("VOL registration by value"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; if(TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); @@ -53,7 +53,7 @@ test_registration_by_value(void) TEST_ERROR; /* The connector should be registered now */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; if(FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); @@ -63,7 +63,7 @@ test_registration_by_value(void) TEST_ERROR; /* The connector should not be registered now */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; if(TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); @@ -99,7 +99,7 @@ test_registration_by_name(void) TESTING("VOL registration by name"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); @@ -109,7 +109,7 @@ test_registration_by_name(void) TEST_ERROR; /* The connector should be registered now */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); @@ -119,7 +119,7 @@ test_registration_by_name(void) TEST_ERROR; /* The connector should not be registered now */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); @@ -156,7 +156,7 @@ test_multiple_registration(void) TESTING("registering a VOL connector multiple times"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); @@ -168,7 +168,7 @@ test_multiple_registration(void) } /* The connector should be registered now */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); @@ -186,7 +186,43 @@ test_multiple_registration(void) } /* The connector should not be registered now */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + /* Repeat testing with the _by_value routines */ + if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + /* Register the connector multiple times */ + for(i = 0; i < N_REGISTRATIONS; i++) { + if((vol_ids[i] = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) + TEST_ERROR; + } + + /* The connector should be registered now */ + if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + TEST_ERROR; + if(FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector was not registered"); + + /* Unregister the connector */ + for(i = 0; i < N_REGISTRATIONS; i++) { + if(H5VLunregister_connector(vol_ids[i]) < 0) + TEST_ERROR; + /* Also test close on some of the IDs. This call currently works + * identically to unregister. + */ + i++; + if(H5VLclose(vol_ids[i]) < 0) + TEST_ERROR; + } + + /* The connector should not be registered now */ + if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; if(TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); @@ -223,7 +259,7 @@ test_getters(void) TESTING("VOL getters"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); @@ -232,11 +268,35 @@ test_getters(void) if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - /* Get the connector's ID */ + /* Get the connector's ID by name */ if((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); + if(H5VLclose(vol_id_out) < 0) + TEST_ERROR; + + /* Unregister the connector */ + if(H5VLunregister_connector(vol_id) < 0) + TEST_ERROR; + + /* Repeat testing with the _by_value routines */ + if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + /* Register the connector by value */ + if((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Get the connector's ID by value */ + if((vol_id_out = H5VLget_connector_id_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + TEST_ERROR; + if(vol_id != vol_id_out) + FAIL_PUTS_ERROR("VOL connector IDs don't match"); + if(H5VLclose(vol_id_out) < 0) + TEST_ERROR; /* Unregister the connector */ if(H5VLunregister_connector(vol_id) < 0) @@ -247,6 +307,7 @@ test_getters(void) error: H5E_BEGIN_TRY { + H5VLclose(vol_id_out); H5VLunregister_connector(vol_id); } H5E_END_TRY; return FAIL; |