diff options
author | raylu-hdf <60487644+raylu-hdf@users.noreply.github.com> | 2022-10-28 20:36:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-28 20:36:49 (GMT) |
commit | 71595e9ea3df2f1ecae4fc52cf31aa04813d3287 (patch) | |
tree | 89fdee8b75842c5287fad518676a27bf3d6cc1a7 /test | |
parent | 2b8139f34ce77ee7852f936307868604b57dd12c (diff) | |
download | hdf5-71595e9ea3df2f1ecae4fc52cf31aa04813d3287.zip hdf5-71595e9ea3df2f1ecae4fc52cf31aa04813d3287.tar.gz hdf5-71595e9ea3df2f1ecae4fc52cf31aa04813d3287.tar.bz2 |
Added a test case for H5VLget_connector_name (#2195)
* Added a test case for H5VLget_connector_name.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/vol.c | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -40,6 +40,7 @@ const char *FILENAME[] = {"native_vol_test", NULL}; #define NATIVE_VOL_TEST_DATATYPE_NAME "test_datatype" #define N_ELEMENTS 10 +#define NAME_LEN 512 /* A VOL class struct to verify registering optional operations */ static int reg_opt_curr_op_val; @@ -2217,6 +2218,62 @@ error: } /* end test_vol_cap_flags() */ /*------------------------------------------------------------------------- + * Function: test_get_vol_name() + * + * Purpose: Tests getting VOL name using H5VLget_connector_name + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_get_vol_name(void) +{ + hid_t fapl_id = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; + char filename[NAME_LEN]; + char vol_name[NAME_LEN]; + + TESTING("getting connector name"); + + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + + if (H5VLget_connector_name(file_id, vol_name, NAME_LEN) < 0) + TEST_ERROR; + + if (HDstrcmp(vol_name, "native")) + TEST_ERROR; + + if (H5Fclose(file_id) < 0) + TEST_ERROR; + + h5_delete_test_file(FILENAME[0], fapl_id); + + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Fclose(file_id); + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} /* end test_vol_cap_flags() */ + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the virtual object layer interface (H5VL) @@ -2252,6 +2309,7 @@ main(void) nerrors += test_basic_datatype_operation() < 0 ? 1 : 0; nerrors += test_async_vol_props() < 0 ? 1 : 0; nerrors += test_vol_cap_flags() < 0 ? 1 : 0; + nerrors += test_get_vol_name() < 0 ? 1 : 0; if (nerrors) { HDprintf("***** %d Virtual Object Layer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); |