summaryrefslogtreecommitdiffstats
path: root/test/API/tattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/API/tattr.c')
-rw-r--r--test/API/tattr.c656
1 files changed, 336 insertions, 320 deletions
diff --git a/test/API/tattr.c b/test/API/tattr.c
index 5ae1167..4e905b0 100644
--- a/test/API/tattr.c
+++ b/test/API/tattr.c
@@ -201,10 +201,8 @@ test_attr_basic_write(hid_t fapl)
hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
int i;
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- hid_t ret_id; /* Generic hid_t return value */
-#endif
- herr_t ret; /* Generic return value */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n"));
@@ -252,15 +250,17 @@ test_attr_basic_write(hid_t fapl)
/* Create an attribute for the dataset */
attr = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Try to create the same attribute again (should fail) */
- H5E_BEGIN_TRY
- {
- ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to create the same attribute again (should fail) */
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(ret_id, FAIL, "H5Acreate2");
-#endif
+
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
CHECK(ret, FAIL, "H5Awrite");
@@ -398,15 +398,17 @@ test_attr_basic_write(hid_t fapl)
attr_size = H5Aget_storage_size(attr);
VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5Aget_storage_size");
#endif
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Try to create the same attribute again (should fail) */
- H5E_BEGIN_TRY
- {
- ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to create the same attribute again (should fail) */
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(ret_id, FAIL, "H5Acreate2");
-#endif
+
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
CHECK(ret, FAIL, "H5Awrite");
@@ -555,24 +557,28 @@ test_attr_flush(hid_t fapl)
att = H5Acreate2(set, ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate2");
-#ifndef NO_ATTR_FILL_VALUE_SUPPORT
- ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
- CHECK(ret, FAIL, "H5Aread");
- if (!H5_DBL_ABS_EQUAL(rdata, 0.0))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0);
+ if ((vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) && (vol_cap_flags_g & H5VL_CAP_FLAG_FILL_VALUES) &&
+ (vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) {
+ ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
+ CHECK(ret, FAIL, "H5Aread");
- ret = H5Fflush(fil, H5F_SCOPE_GLOBAL);
- CHECK(ret, FAIL, "H5Fflush");
+ if (!H5_DBL_ABS_EQUAL(rdata, 0.0))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0);
- ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
- CHECK(ret, FAIL, "H5Awrite");
+ ret = H5Fflush(fil, H5F_SCOPE_GLOBAL);
+ CHECK(ret, FAIL, "H5Fflush");
+
+ ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ if (!H5_DBL_ABS_EQUAL(rdata, 0.0))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0);
+ }
+ else {
+ HDprintf("** SKIPPED attribute pre-read due to fill values not being supported **\n");
+ }
- if (!H5_DBL_ABS_EQUAL(rdata, 0.0))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0);
-#else
- HDprintf("** SKIPPED attribute pre-read temporarily until attribute fill values supported **\n");
-#endif
ret = H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
CHECK(ret, FAIL, "H5Awrite");
@@ -731,10 +737,8 @@ test_attr_compound_write(hid_t fapl)
hid_t attr; /* Attribute ID */
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {ATTR4_DIM1, ATTR4_DIM2};
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- hid_t ret_id; /* Generic hid_t return value */
-#endif
- herr_t ret; /* Generic return value */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
@@ -775,15 +779,17 @@ test_attr_compound_write(hid_t fapl)
/* Create complex attribute for the dataset */
attr = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Try to create the same attribute again (should fail) */
- H5E_BEGIN_TRY
- {
- ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to create the same attribute again (should fail) */
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(ret_id, FAIL, "H5Acreate2");
-#endif
+
/* Write complex attribute data */
ret = H5Awrite(attr, tid1, attr_data4);
CHECK(ret, FAIL, "H5Awrite");
@@ -975,10 +981,8 @@ test_attr_scalar_write(hid_t fapl)
hid_t sid1, sid2; /* Dataspace ID */
hid_t attr; /* Attribute ID */
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- hid_t ret_id; /* Generic hid_t return value */
-#endif
- herr_t ret; /* Generic return value */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1002,15 +1006,17 @@ test_attr_scalar_write(hid_t fapl)
/* Create an attribute for the dataset */
attr = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Try to create the same attribute again (should fail) */
- H5E_BEGIN_TRY
- {
- ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to create the same attribute again (should fail) */
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(ret_id, FAIL, "H5Acreate2");
-#endif
+
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_FLOAT, &attr_data5);
CHECK(ret, FAIL, "H5Awrite");
@@ -1120,10 +1126,8 @@ test_attr_mult_write(hid_t fapl)
hsize_t dims2[] = {ATTR1_DIM1};
hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
hsize_t dims4[] = {ATTR3_DIM1, ATTR3_DIM2, ATTR3_DIM3};
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- hid_t ret_id; /* Generic hid_t return value */
-#endif
- herr_t ret; /* Generic return value */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
@@ -1151,15 +1155,17 @@ test_attr_mult_write(hid_t fapl)
/* Create 1st attribute for the dataset */
attr = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Try to create the same attribute again (should fail) */
- H5E_BEGIN_TRY
- {
- ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to create the same attribute again (should fail) */
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(ret_id, FAIL, "H5Acreate2");
-#endif
+
/* Write 1st attribute data */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
CHECK(ret, FAIL, "H5Awrite");
@@ -1179,15 +1185,17 @@ test_attr_mult_write(hid_t fapl)
/* Create 2nd attribute for the dataset */
attr = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Try to create the same attribute again (should fail) */
- H5E_BEGIN_TRY
- {
- ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to create the same attribute again (should fail) */
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(ret_id, FAIL, "H5Acreate2");
-#endif
+
/* Write 2nd attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
CHECK(ret, FAIL, "H5Awrite");
@@ -1207,15 +1215,17 @@ test_attr_mult_write(hid_t fapl)
/* Create 3rd attribute for the dataset */
attr = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Try to create the same attribute again (should fail) */
- H5E_BEGIN_TRY
- {
- ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to create the same attribute again (should fail) */
+ H5E_BEGIN_TRY
+ {
+ ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(ret_id, FAIL, "H5Acreate2");
-#endif
+
/* Write 3rd attribute information */
ret = H5Awrite(attr, H5T_NATIVE_DOUBLE, attr_data3);
CHECK(ret, FAIL, "H5Awrite");
@@ -1605,15 +1615,17 @@ test_attr_delete(hid_t fapl)
ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
CHECK(ret, FAIL, "H5Oget_info3");
VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
-#ifndef NO_DELETE_NONEXISTENT_ATTRIBUTE
- /* Try to delete bogus attribute */
- H5E_BEGIN_TRY
- {
- ret = H5Adelete(dataset, "Bogus");
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Try to delete bogus attribute */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Adelete(dataset, "Bogus");
+ }
+ H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Adelete");
}
- H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Adelete");
-#endif
+
/* Verify the correct number of attributes */
ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
CHECK(ret, FAIL, "H5Oget_info3");
@@ -1709,7 +1721,6 @@ test_attr_delete(hid_t fapl)
static void
test_attr_dtype_shared(hid_t fapl)
{
-#ifndef NO_SHARED_DATATYPES
hid_t file_id; /* File ID */
hid_t dset_id; /* Dataset ID */
hid_t space_id; /* Dataspace ID for dataset & attribute */
@@ -1723,164 +1734,162 @@ test_attr_dtype_shared(hid_t fapl)
h5_stat_size_t filesize; /* Size of file after modifications */
#endif
herr_t ret; /* Generic return value */
-#else
- (void)fapl;
-#endif
+
/* Output message about test being performed */
- MESSAGE(5, ("Testing Shared Datatypes with Attributes - SKIPPED for now due to no support for shared "
- "datatypes\n"));
-#ifndef NO_SHARED_DATATYPES
- /* Create a file */
- file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- CHECK(file_id, FAIL, "H5Fopen");
+ MESSAGE(5, ("Testing Shared Datatypes with Attributes\n"));
- /* Close file */
- ret = H5Fclose(file_id);
- CHECK(ret, FAIL, "H5Fclose");
+ if ((vol_cap_flags_g & H5VL_CAP_FLAG_STORED_DATATYPES) && (vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) {
+ /* Create a file */
+ file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(file_id, FAIL, "H5Fopen");
+
+ /* Close file */
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
#if 0
- /* Get size of file */
- empty_filesize = h5_get_file_size(FILENAME, fapl);
- if (empty_filesize < 0)
- TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
+ /* Get size of file */
+ empty_filesize = h5_get_file_size(FILENAME, fapl);
+ if (empty_filesize < 0)
+ TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
#endif
- /* Re-open file */
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
- CHECK(file_id, FAIL, "H5Fopen");
+ /* Re-open file */
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
+ CHECK(file_id, FAIL, "H5Fopen");
- /* Create a datatype to commit and use */
- type_id = H5Tcopy(H5T_NATIVE_INT);
- CHECK(type_id, FAIL, "H5Tcopy");
+ /* Create a datatype to commit and use */
+ type_id = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(type_id, FAIL, "H5Tcopy");
- /* Commit datatype to file */
- ret = H5Tcommit2(file_id, TYPE1_NAME, type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Tcommit2");
+ /* Commit datatype to file */
+ ret = H5Tcommit2(file_id, TYPE1_NAME, type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
- /* Check reference count on named datatype */
- ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
+ /* Check reference count on named datatype */
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
- /* Create dataspace for dataset */
- space_id = H5Screate(H5S_SCALAR);
- CHECK(space_id, FAIL, "H5Screate");
+ /* Create dataspace for dataset */
+ space_id = H5Screate(H5S_SCALAR);
+ CHECK(space_id, FAIL, "H5Screate");
- /* Create dataset */
- dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dcreate2");
+ /* Create dataset */
+ dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate2");
- /* Check reference count on named datatype */
- ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
+ /* Check reference count on named datatype */
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
- /* Create attribute on dataset */
- attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(attr_id, FAIL, "H5Acreate2");
+ /* Create attribute on dataset */
+ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Acreate2");
- /* Check reference count on named datatype */
- ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
+ /* Check reference count on named datatype */
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
- /* Close attribute */
- ret = H5Aclose(attr_id);
- CHECK(ret, FAIL, "H5Aclose");
+ /* Close attribute */
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
- /* Delete attribute */
- ret = H5Adelete(dset_id, ATTR1_NAME);
- CHECK(ret, FAIL, "H5Adelete");
+ /* Delete attribute */
+ ret = H5Adelete(dset_id, ATTR1_NAME);
+ CHECK(ret, FAIL, "H5Adelete");
- /* Check reference count on named datatype */
- ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
+ /* Check reference count on named datatype */
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
- /* Create attribute on dataset */
- attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(attr_id, FAIL, "H5Acreate2");
+ /* Create attribute on dataset */
+ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Acreate2");
- /* Check reference count on named datatype */
- ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
+ /* Check reference count on named datatype */
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
- /* Write data into the attribute */
- ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data);
- CHECK(ret, FAIL, "H5Awrite");
+ /* Write data into the attribute */
+ ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data);
+ CHECK(ret, FAIL, "H5Awrite");
- /* Close attribute */
- ret = H5Aclose(attr_id);
- CHECK(ret, FAIL, "H5Aclose");
+ /* Close attribute */
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
- /* Close dataset */
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Close dataset */
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
- /* Close dataspace */
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Close dataspace */
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Close datatype */
- ret = H5Tclose(type_id);
- CHECK(ret, FAIL, "H5Tclose");
+ /* Close datatype */
+ ret = H5Tclose(type_id);
+ CHECK(ret, FAIL, "H5Tclose");
- /* Close file */
- ret = H5Fclose(file_id);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Close file */
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
- /* Re-open file */
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
- CHECK(file_id, FAIL, "H5Fopen");
+ /* Re-open file */
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
+ CHECK(file_id, FAIL, "H5Fopen");
- /* Open dataset */
- dset_id = H5Dopen2(file_id, DSET1_NAME, H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dopen2");
+ /* Open dataset */
+ dset_id = H5Dopen2(file_id, DSET1_NAME, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dopen2");
- /* Open attribute */
- attr_id = H5Aopen(dset_id, ATTR1_NAME, H5P_DEFAULT);
- CHECK(attr_id, FAIL, "H5Aopen");
+ /* Open attribute */
+ attr_id = H5Aopen(dset_id, ATTR1_NAME, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Aopen");
- /* Read data from the attribute */
- ret = H5Aread(attr_id, H5T_NATIVE_INT, &rdata);
- CHECK(ret, FAIL, "H5Aread");
- VERIFY(data, rdata, "H5Aread");
+ /* Read data from the attribute */
+ ret = H5Aread(attr_id, H5T_NATIVE_INT, &rdata);
+ CHECK(ret, FAIL, "H5Aread");
+ VERIFY(data, rdata, "H5Aread");
- /* Close attribute */
- ret = H5Aclose(attr_id);
- CHECK(ret, FAIL, "H5Aclose");
+ /* Close attribute */
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
- /* Close dataset */
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Close dataset */
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
- /* Check reference count on named datatype */
- ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
+ /* Check reference count on named datatype */
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
- /* Unlink the dataset */
- ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Ldelete");
+ /* Unlink the dataset */
+ ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
- /* Check reference count on named datatype */
- ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
+ /* Check reference count on named datatype */
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
- /* Unlink the named datatype */
- ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Ldelete");
+ /* Unlink the named datatype */
+ ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
- /* Close file */
- ret = H5Fclose(file_id);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Close file */
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
#if 0
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-#endif
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
#endif
+ }
} /* test_attr_dtype_shared() */
/****************************************************************
@@ -2313,15 +2322,17 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
/* Close attribute */
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
-#ifndef NO_PREVENT_CREATE_SAME_ATTRIBUTE_TWICE
- /* Attempt to add attribute again, which should fail */
- H5E_BEGIN_TRY
- {
- attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC) {
+ /* Attempt to add attribute again, which should fail */
+ H5E_BEGIN_TRY
+ {
+ attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(attr, FAIL, "H5Acreate2");
}
- H5E_END_TRY;
- VERIFY(attr, FAIL, "H5Acreate2");
-#endif
+
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -5911,11 +5922,10 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us
if (HDstrcmp(attrname, tmpname) != 0)
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
- /* Don't test "native" order queries on link name order, since there's not
- * a good way to easily predict the order of the links in the name index.
- */
+ /* Don't test "native" order queries on link name order, since there's not
+ * a good way to easily predict the order of the links in the name index.
+ */
-#ifndef NO_DECREASING_ALPHA_ITER_ORDER
/* Verify the information for first attribute, in decreasing name order */
HDmemset(&ainfo, 0, sizeof(ainfo));
ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &ainfo, H5P_DEFAULT);
@@ -5935,7 +5945,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if (HDstrcmp(attrname, tmpname) != 0)
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
-#endif
+
/* Retrieve current # of errors */
if (old_nerrs == nerrors)
return (0);
@@ -6463,6 +6473,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
MESSAGE(5, ("Testing Deleting Attribute By Index\n"))
+ if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) {
+ MESSAGE(5, (" SKIPPED\n"))
+ return;
+ }
+
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
CHECK(sid, FAIL, "H5Screate");
@@ -6516,18 +6531,14 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
"Creation Order Index\n"))
} /* end if */
else {
-#ifndef NO_DECREASING_ALPHA_ITER_ORDER
if (use_index)
MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order "
"w/Creation Order Index\n"))
else
MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order w/o "
"Creation Order Index\n"))
-#else
- continue;
-#endif
- } /* end else */
- } /* end else */
+ }
+ } /* end else */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
@@ -7096,7 +7107,6 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#endif
-#ifndef NO_ITERATION_RESTART
/*-------------------------------------------------------------------------
* Function: attr_iterate2_fail_cb
*
@@ -7148,6 +7158,13 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, H5_index_t idx
/* Retrieve the current # of reported errors */
old_nerrs = nerrors;
+ if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ITERATE)) {
+ SKIPPED();
+ HDprintf(" API functions for iterate aren't "
+ "supported with this connector\n");
+ return 1;
+ }
+
/* Iterate over attributes on object */
iter_info->nskipped = (unsigned)(skip = 0);
iter_info->order = order;
@@ -7425,7 +7442,6 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, H5_index_t idx
else
return (-1);
} /* end attr_iterate_check() */
-#endif
/****************************************************************
**
@@ -7451,19 +7467,21 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
#endif
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- attr_iter_info_t iter_info; /* Iterator info */
- hbool_t *visited = NULL; /* Array of flags for visiting links */
-#ifndef NO_ITERATION_RESTART
- hsize_t idx; /* Start index for iteration */
-#endif
- unsigned use_index; /* Use index on creation order values */
- const char *dsetname; /* Name of dataset for attributes */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ attr_iter_info_t iter_info; /* Iterator info */
+ hbool_t *visited = NULL; /* Array of flags for visiting links */
+ hsize_t idx; /* Start index for iteration */
+ unsigned use_index; /* Use index on creation order values */
+ const char *dsetname; /* Name of dataset for attributes */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
+
+ if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) {
+ return;
+ }
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -7524,16 +7542,12 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
"w/o Creation Order Index\n"))
} /* end if */
else {
-#ifndef NO_DECREASING_ALPHA_ITER_ORDER
if (use_index)
MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order "
"w/Creation Order Index\n"))
else
MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order "
"w/o Creation Order Index\n"))
-#else
- continue;
-#endif
} /* end else */
} /* end else */
@@ -7626,38 +7640,39 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
#endif
-#ifndef NO_ITERATION_RESTART
- /* Check for out of bound iteration */
- idx = u;
- H5E_BEGIN_TRY
- {
- ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL);
- }
- H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Aiterate2");
- idx = u;
- H5E_BEGIN_TRY
- {
- ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL,
- H5P_DEFAULT);
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ITERATE) {
+ /* Check for out of bound iteration */
+ idx = u;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL);
+ }
+ H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Aiterate2");
+
+ idx = u;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb,
+ NULL, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
+ idx = u;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb,
+ NULL, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
+ /* Test iteration over attributes stored compactly */
+ ret = attr_iterate_check(fid, dsetname, my_dataset, idx_type, order, u, &iter_info);
+ CHECK(ret, FAIL, "attr_iterate_check");
}
- H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Aiterate_by_name");
-
- idx = u;
- H5E_BEGIN_TRY
- {
- ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb,
- NULL, H5P_DEFAULT);
- }
- H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Aiterate_by_name");
-
- /* Test iteration over attributes stored compactly */
- ret = attr_iterate_check(fid, dsetname, my_dataset, idx_type, order, u, &iter_info);
- CHECK(ret, FAIL, "attr_iterate_check");
-#endif
} /* end for */
/* Work on all the datasets */
@@ -7725,41 +7740,42 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
if (use_index)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test");
- } /* end if */
-#endif
-#ifndef NO_ITERATION_RESTART
- /* Check for out of bound iteration */
- idx = u;
- H5E_BEGIN_TRY
- {
- ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL);
- }
- H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Aiterate2");
-
- idx = u;
- H5E_BEGIN_TRY
- {
- ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL,
- H5P_DEFAULT);
}
- H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Aiterate_by_name");
+#endif
- idx = u;
- H5E_BEGIN_TRY
- {
- ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb,
- NULL, H5P_DEFAULT);
+ if (vol_cap_flags_g & H5VL_CAP_FLAG_ITERATE) {
+ /* Check for out of bound iteration */
+ idx = u;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL);
+ }
+ H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Aiterate2");
+
+ idx = u;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb,
+ NULL, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
+ idx = u;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb,
+ NULL, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
+ /* Test iteration over attributes stored densely */
+ ret = attr_iterate_check(fid, dsetname, my_dataset, idx_type, order, u, &iter_info);
+ CHECK(ret, FAIL, "attr_iterate_check");
}
- H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Aiterate_by_name");
-
- /* Test iteration over attributes stored densely */
- ret = attr_iterate_check(fid, dsetname, my_dataset, idx_type, order, u, &iter_info);
- CHECK(ret, FAIL, "attr_iterate_check");
-#endif
- } /* end for */
+ }
/* Close Datasets */
ret = H5Dclose(dset1);
@@ -7879,6 +7895,10 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
hid_t ret_id; /* Generic hid_t return value */
herr_t ret; /* Generic return value */
+ if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) {
+ return;
+ }
+
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
CHECK(sid, FAIL, "H5Screate");
@@ -7932,16 +7952,12 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
"Creation Order Index\n"))
} /* end if */
else {
-#ifndef NO_DECREASING_ALPHA_ITER_ORDER
if (use_index)
MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order "
"w/Creation Order Index\n"))
else
MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order w/o "
"Creation Order Index\n"))
-#else
- continue;
-#endif
} /* end else */
} /* end else */