summaryrefslogtreecommitdiffstats
path: root/test/trefer.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/trefer.c')
-rw-r--r--test/trefer.c240
1 files changed, 137 insertions, 103 deletions
diff --git a/test/trefer.c b/test/trefer.c
index f17e114..b8f91a0 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -104,7 +104,8 @@ test_reference_params(void)
const char *write_comment = "Foo!"; /* Comments for group */
hid_t ret_id; /* Generic hid_t return value */
ssize_t name_size; /* Size of reference name */
- herr_t ret; /* Generic return value */
+ bool vol_is_native;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
@@ -122,6 +123,9 @@ test_reference_params(void)
fid1 = H5Fcreate(FILE_REF_PARAM, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
+ /* Check if native VOL is being used */
+ CHECK(h5_using_native_vol(H5P_DEFAULT, fid1, &vol_is_native), FAIL, "h5_using_native_vol");
+
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
@@ -138,9 +142,11 @@ test_reference_params(void)
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, H5I_INVALID_HID, "H5Gcreate2");
- /* Set group's comment */
- ret = H5Oset_comment(group, write_comment);
- CHECK(ret, FAIL, "H5Oset_comment");
+ if (vol_is_native) {
+ /* Set group's comment */
+ ret = H5Oset_comment(group, write_comment);
+ CHECK(ret, FAIL, "H5Oset_comment");
+ }
/* Create a dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -2026,6 +2032,12 @@ test_reference_obj_deleted(void)
MESSAGE(5, ("Testing References to Deleted Objects\n"));
+ if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_REF_BASIC) ||
+ !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC)) {
+ MESSAGE(5, (" -- SKIPPED --\n"));
+ return;
+ }
+
/* Create file */
fid1 = H5Fcreate(FILE_REF_OBJ_DEL, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
@@ -2848,22 +2860,31 @@ test_reference_compat_conv(void)
hdset_reg_ref_t *wbuf_reg = NULL; /* Buffer to write to disk */
H5R_ref_t *rbuf_reg = NULL; /* Buffer read from disk */
H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
- unsigned int i; /* Counter */
+ bool vol_is_native;
+ herr_t ret; /* Generic return value */
+ unsigned int i; /* Counter */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
+ /* Create file */
+ fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Check if native VOL is being used */
+ CHECK(h5_using_native_vol(H5P_DEFAULT, fid1, &vol_is_native), FAIL, "h5_using_native_vol");
+ if (!vol_is_native) {
+ CHECK(H5Fclose(fid1), FAIL, "H5Fclose");
+ MESSAGE(5, (" -- SKIPPED --\n"));
+ return;
+ }
+
/* Allocate write & read buffers */
wbuf_obj = (hobj_ref_t *)calloc(sizeof(hobj_ref_t), SPACE1_DIM1);
rbuf_obj = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
wbuf_reg = calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
rbuf_reg = calloc(sizeof(H5R_ref_t), SPACE1_DIM1);
- /* Create file */
- fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
-
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
@@ -3158,8 +3179,9 @@ test_reference_perf(void)
hdset_reg_ref_t *wbuf_reg_deprec, /* deprecated references*/
*rbuf_reg_deprec; /* deprecated references*/
unsigned *ibuf, *obuf;
- unsigned i, j; /* Counters */
- H5O_type_t obj_type; /* Object type */
+ unsigned i, j; /* Counters */
+ H5O_type_t obj_type; /* Object type */
+ bool vol_is_native;
herr_t ret; /* Generic return value */
double t1, t2, t; /* Timers */
@@ -3186,6 +3208,9 @@ test_reference_perf(void)
fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
+ /* Check if native VOL is being used */
+ CHECK(h5_using_native_vol(H5P_DEFAULT, fid1, &vol_is_native), FAIL, "h5_using_native_vol");
+
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
@@ -3284,40 +3309,42 @@ test_reference_perf(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
- /* Create a dataset */
- dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+ if (vol_is_native) {
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ t = 0;
+ for (i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
+ ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID);
+ CHECK(ret, FAIL, "H5Rcreate");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if (VERBOSE_MED)
+ printf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE);
- t = 0;
- for (i = 0; i < MAX_ITER_CREATE; i++) {
- t1 = H5_get_time();
+ /* Create reference to dataset */
ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID);
CHECK(ret, FAIL, "H5Rcreate");
- t2 = H5_get_time();
- t += t2 - t1;
- }
- if (VERBOSE_MED)
- printf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE);
- /* Create reference to dataset */
- ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID);
- CHECK(ret, FAIL, "H5Rcreate");
+ t = 0;
+ for (i = 0; i < MAX_ITER_WRITE; i++) {
+ t1 = H5_get_time();
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_deprec);
+ CHECK(ret, FAIL, "H5Dwrite");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if (VERBOSE_MED)
+ printf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE);
- t = 0;
- for (i = 0; i < MAX_ITER_WRITE; i++) {
- t1 = H5_get_time();
- /* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_deprec);
- CHECK(ret, FAIL, "H5Dwrite");
- t2 = H5_get_time();
- t += t2 - t1;
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
}
- if (VERBOSE_MED)
- printf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE);
-
- /* Close Dataset */
- ret = H5Dclose(dataset);
- CHECK(ret, FAIL, "H5Dclose");
/* Create a dataset */
dataset = H5Dcreate2(fid1, "Dataset5", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -3357,37 +3384,40 @@ test_reference_perf(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
- /* Create a dataset */
- dataset = H5Dcreate2(fid1, "Dataset6", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
-
- t = 0;
- for (i = 0; i < MAX_ITER_CREATE; i++) {
- t1 = H5_get_time();
- /* Store first dataset region */
- ret = H5Rcreate(&wbuf_reg_deprec[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION1, sid1);
- CHECK(ret, FAIL, "H5Rcreate");
- t2 = H5_get_time();
- t += t2 - t1;
- }
- if (VERBOSE_MED)
- printf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE);
+ if (vol_is_native) {
+ /* Create a dataset */
+ dataset =
+ H5Dcreate2(fid1, "Dataset6", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ t = 0;
+ for (i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
+ /* Store first dataset region */
+ ret = H5Rcreate(&wbuf_reg_deprec[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION1, sid1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if (VERBOSE_MED)
+ printf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE);
+
+ t = 0;
+ for (i = 0; i < MAX_ITER_WRITE; i++) {
+ t1 = H5_get_time();
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg_deprec);
+ CHECK(ret, FAIL, "H5Dwrite");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if (VERBOSE_MED)
+ printf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE);
- t = 0;
- for (i = 0; i < MAX_ITER_WRITE; i++) {
- t1 = H5_get_time();
- /* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg_deprec);
- CHECK(ret, FAIL, "H5Dwrite");
- t2 = H5_get_time();
- t += t2 - t1;
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
}
- if (VERBOSE_MED)
- printf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE);
-
- /* Close Dataset */
- ret = H5Dclose(dataset);
- CHECK(ret, FAIL, "H5Dclose");
/* Close disk dataspace */
ret = H5Sclose(sid1);
@@ -3449,25 +3479,27 @@ test_reference_perf(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
- /* Open the dataset */
- dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
- CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+ if (vol_is_native) {
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+
+ t = 0;
+ for (i = 0; i < MAX_ITER_READ; i++) {
+ t1 = H5_get_time();
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_deprec);
+ CHECK(ret, FAIL, "H5Dread");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if (VERBOSE_MED)
+ printf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ);
- t = 0;
- for (i = 0; i < MAX_ITER_READ; i++) {
- t1 = H5_get_time();
- /* Read selection from disk */
- ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_deprec);
- CHECK(ret, FAIL, "H5Dread");
- t2 = H5_get_time();
- t += t2 - t1;
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
}
- if (VERBOSE_MED)
- printf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ);
-
- /* Close Dataset */
- ret = H5Dclose(dataset);
- CHECK(ret, FAIL, "H5Dclose");
/* Open the dataset */
dataset = H5Dopen2(fid1, "/Dataset5", H5P_DEFAULT);
@@ -3495,25 +3527,27 @@ test_reference_perf(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
- /* Open the dataset */
- dataset = H5Dopen2(fid1, "/Dataset6", H5P_DEFAULT);
- CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+ if (vol_is_native) {
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset6", H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+
+ t = 0;
+ for (i = 0; i < MAX_ITER_READ; i++) {
+ t1 = H5_get_time();
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg_deprec);
+ CHECK(ret, FAIL, "H5Dread");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if (VERBOSE_MED)
+ printf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ);
- t = 0;
- for (i = 0; i < MAX_ITER_READ; i++) {
- t1 = H5_get_time();
- /* Read selection from disk */
- ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg_deprec);
- CHECK(ret, FAIL, "H5Dread");
- t2 = H5_get_time();
- t += t2 - t1;
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
}
- if (VERBOSE_MED)
- printf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ);
-
- /* Close Dataset */
- ret = H5Dclose(dataset);
- CHECK(ret, FAIL, "H5Dclose");
/* Close dataset access property list */
ret = H5Pclose(dapl_id);