summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-30 16:07:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-30 16:07:20 (GMT)
commitdbff4af21c57cfd14f7f35a6799faad5087c0867 (patch)
treece015ab8b594886613d43fd5bc5b4b6a5017fdc3 /test
parentaaddd739b4a3ebaf7d61a2c60dd4c3d9a08e0654 (diff)
downloadhdf5-dbff4af21c57cfd14f7f35a6799faad5087c0867.zip
hdf5-dbff4af21c57cfd14f7f35a6799faad5087c0867.tar.gz
hdf5-dbff4af21c57cfd14f7f35a6799faad5087c0867.tar.bz2
[svn-r14217] Description:
Change H5Aopen -> H5Aopen_by_name, in order to be more consistent with other new API routines. Re-add H5Aopen as a simpler routine, to open attributes on a particular object. (Much like the old H5Aopen_name routine). Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'test')
-rw-r--r--test/dangle.c2
-rwxr-xr-xtest/objcopy.c2
-rw-r--r--test/tattr.c109
-rw-r--r--test/th5s.c2
-rw-r--r--test/tmisc.c2
-rw-r--r--test/tsohm.c6
-rw-r--r--test/ttsafe_acreate.c2
-rw-r--r--test/tvlstr.c4
8 files changed, 93 insertions, 36 deletions
diff --git a/test/dangle.c b/test/dangle.c
index 039c405..a08941c 100644
--- a/test/dangle.c
+++ b/test/dangle.c
@@ -476,7 +476,7 @@ test_dangle_attribute(H5F_close_degree_t degree)
/* Leave open a _lot_ of objects */
for(u = 0; u < MAX_DANGLE; u++)
- if((aid = H5Aopen(dsid, ".", ATTRNAME, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if((aid = H5Aopen(dsid, ATTRNAME, H5P_DEFAULT)) < 0)
TEST_ERROR
if(H5Dclose(dsid) < 0)
diff --git a/test/objcopy.c b/test/objcopy.c
index 88fee57..bea0c11 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -792,7 +792,7 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Aget_name(aid, ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
- if((aid2 = H5Aopen(oid2, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check the attributes are equal */
if(!compare_attribute(aid, aid2, pid, NULL, oid)) TEST_ERROR
diff --git a/test/tattr.c b/test/tattr.c
index b391836..cb93300 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -204,7 +204,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(group, FAIL, "H5Gopen2");
/* Open attribute again */
- attr = H5Aopen(group, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(group, ATTR1_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Close attribute */
@@ -262,7 +262,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Arename2");
/* Open attribute again */
- attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Verify new attribute name */
@@ -294,7 +294,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Open the second attribute again */
- attr2=H5Aopen(dataset, ".", ATTR1A_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr2=H5Aopen(dataset, ATTR1A_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Verify new attribute name */
@@ -415,7 +415,7 @@ test_attr_basic_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 2, "H5Oget_info");
/* Open first attribute for the dataset */
- attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
@@ -444,7 +444,7 @@ test_attr_basic_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
/* Open the attribute for the group */
- attr = H5Aopen(group, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(group, ATTR2_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
@@ -627,7 +627,7 @@ test_attr_plist(hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Re-open the second attribute and ensure that its character encoding is correct */
- attr = H5Aopen(dataset, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, ATTR2_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
plist = H5Aget_create_plist(attr);
CHECK(plist, FAIL, "H5Aget_create_plist");
@@ -988,7 +988,7 @@ test_attr_scalar_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
/* Open an attribute for the dataset */
- attr = H5Aopen(dataset, ".", ATTR5_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, ATTR5_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
@@ -1732,7 +1732,7 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(dset_id, FAIL, "H5Dopen2");
/* Open attribute */
- attr_id = H5Aopen(dset_id, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ attr_id = H5Aopen(dset_id, ATTR1_NAME, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen");
/* Read data from the attribute */
@@ -1799,7 +1799,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
for(u = 0; u < max_attr; u++) {
/* Open attribute */
sprintf(attrname, "attr %02u", u);
- attr = H5Aopen(loc_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(loc_id, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read data from the attribute */
@@ -2422,7 +2422,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Open attribute */
sprintf(attrname, "new attr %02u", u);
- attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read data from the attribute */
@@ -3156,7 +3156,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Open first attribute */
HDstrcpy(attrname, "null attr #2");
- attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Try to read data from the attribute */
@@ -3195,7 +3195,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Open second attribute */
HDstrcpy(attrname, "null attr");
- attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Try to write data to the attribute */
@@ -3408,7 +3408,7 @@ test_attr_many(hid_t fcpl, hid_t fapl)
sprintf(attrname, "a-%06u", u);
- aid = H5Aopen(fid, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ aid = H5Aopen(fid, attrname, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Aopen");
ret = H5Aread(aid, H5T_NATIVE_UINT, &value);
@@ -6463,7 +6463,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-attr_open_check(hid_t obj_id, unsigned max_attrs)
+attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, unsigned max_attrs)
{
hid_t attr_id; /* ID of attribute to test */
H5A_info_t ainfo; /* Attribute info */
@@ -6479,7 +6479,7 @@ attr_open_check(hid_t obj_id, unsigned max_attrs)
for(u = 0; u < max_attrs; u++) {
/* Open the attribute */
sprintf(attrname, "attr %02u", u);
- attr_id = H5Aopen(obj_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen");
/* Get the attribute's information */
@@ -6492,6 +6492,38 @@ attr_open_check(hid_t obj_id, unsigned max_attrs)
/* Close attribute */
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
+
+
+ /* Open the attribute */
+ attr_id = H5Aopen_by_name(obj_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Aopen_by_name");
+
+ /* Get the attribute's information */
+ ret = H5Aget_info(attr_id, &ainfo);
+ CHECK(ret, FAIL, "H5Aget_info");
+
+ /* Check that the object is the correct one */
+ VERIFY(ainfo.corder, u, "H5Aget_info");
+
+ /* Close attribute */
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
+
+
+ /* Open the attribute */
+ attr_id = H5Aopen_by_name(fid, dsetname, attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Aopen_by_name");
+
+ /* Get the attribute's information */
+ ret = H5Aget_info(attr_id, &ainfo);
+ CHECK(ret, FAIL, "H5Aget_info");
+
+ /* Check that the object is the correct one */
+ VERIFY(ainfo.corder, u, "H5Aget_info");
+
+ /* Close attribute */
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
} /* end for */
/* Retrieve current # of errors */
@@ -6525,6 +6557,7 @@ test_attr_open(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 */
hbool_t 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 */
@@ -6573,14 +6606,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
switch(curr_dset) {
case 0:
my_dataset = dset1;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
+ dsetname = DSET3_NAME;
break;
default:
@@ -6594,9 +6630,15 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with no attributes */
- ret = H5Aopen(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen");
+ ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aopen_by_name");
+
+ ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aopen_by_name");
+
/* Create attributes, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
/* Create attribute */
@@ -6627,11 +6669,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with compact attribute storage */
- ret = H5Aopen(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen");
+ ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aopen_by_name");
+
+ ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aopen_by_name");
+
/* Test opening attributes stored compactly */
- ret = attr_open_check(my_dataset, u);
+ ret = attr_open_check(fid, dsetname, my_dataset, u);
CHECK(ret, FAIL, "attr_open_check");
} /* end for */
@@ -6641,14 +6689,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
switch(curr_dset) {
case 0:
my_dataset = dset1;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
+ dsetname = DSET3_NAME;
break;
default:
@@ -6700,11 +6751,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end if */
/* Check for opening a non-existant attribute on an object with dense attribute storage */
- ret = H5Aopen(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen");
+ ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aopen_by_name");
+
+ ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aopen_by_name");
+
/* Test opening attributes stored compactly */
- ret = attr_open_check(my_dataset, u);
+ ret = attr_open_check(fid, dsetname, my_dataset, u);
CHECK(ret, FAIL, "attr_open_check");
} /* end for */
@@ -7322,7 +7379,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
- attr = H5Aopen(dataset2, ".", attrname2, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset2, attrname2, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@@ -7346,7 +7403,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check refcount on original attribute */
- attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@@ -7378,7 +7435,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
- attr = H5Aopen(dataset2, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset2, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@@ -7402,7 +7459,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check refcount on original attribute */
- attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@@ -7766,7 +7823,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on first dataset's attribute */
- attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@@ -8140,7 +8197,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
sprintf(attrname, "attr %02u", u);
/* Open attribute on first dataset */
- attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
diff --git a/test/th5s.c b/test/th5s.c
index 196e777..f649fa6 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -494,7 +494,7 @@ test_h5s_null(void)
CHECK(ret, FAIL, "H5Sclose");
/* Open the attribute for the dataset */
- attr = H5Aopen(did, ".", NULLATTR, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen(did, NULLATTR, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Get the space of the dataset */
diff --git a/test/tmisc.c b/test/tmisc.c
index efc38c3..ef53c1c 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -497,7 +497,7 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name
root = H5Gopen2(file, "/", H5P_DEFAULT);
CHECK(root, FAIL, "H5Gopen2");
- att = H5Aopen(root, ".", att_name, H5P_DEFAULT, H5P_DEFAULT);
+ att = H5Aopen(root, att_name, H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &data_check);
diff --git a/test/tsohm.c b/test/tsohm.c
index bcf0432..64eb86f 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -1886,9 +1886,9 @@ static void size2_verify(void)
attr_correct_string[0] = attr_name[0] = (x / 10) + '0';
attr_correct_string[1] = attr_name[1] = (x % 10) + '0';
- attr1_id = H5Aopen(group1_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
+ attr1_id = H5Aopen(group1_id, attr_name, H5P_DEFAULT);
CHECK_I(attr1_id, "H5Aopen");
- attr2_id = H5Aopen(group2_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
+ attr2_id = H5Aopen(group2_id, attr_name, H5P_DEFAULT);
CHECK_I(attr2_id, "H5Aopen");
ret = H5Aread(attr1_id, attr_type_id, attr_string);
@@ -2613,7 +2613,7 @@ static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
VERIFY(rdata, (x + 'a'), "H5Dread");
/* Open attribute */
- attr_id = H5Aopen(dset_id, ".", "attr_name", H5P_DEFAULT, H5P_DEFAULT);
+ attr_id = H5Aopen(dset_id, "attr_name", H5P_DEFAULT);
CHECK_I(attr_id, "H5Aopen");
/* Read */
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index c9dd64d..b4c27ae 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -130,7 +130,7 @@ void tts_acreate(void)
/* verify the correctness of the test */
for(i = 0; i < NUM_THREADS; i++) {
- attribute = H5Aopen(dataset, ".", gen_name(i), H5P_DEFAULT, H5P_DEFAULT);
+ attribute = H5Aopen(dataset, gen_name(i), H5P_DEFAULT);
if(attribute < 0)
TestErrPrintf("unable to open appropriate attribute. Test failed!\n");
diff --git a/test/tvlstr.c b/test/tvlstr.c
index a6d3851..dfc3015 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -680,7 +680,7 @@ static void test_read_vl_string_attribute(void)
CHECK(root, FAIL, "H5Gopen2");
/* Test reading "normal" sized string attribute */
- att = H5Aopen(root, ".", "test_scalar", H5P_DEFAULT, H5P_DEFAULT);
+ att = H5Aopen(root, "test_scalar", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &string_att_check);
@@ -695,7 +695,7 @@ static void test_read_vl_string_attribute(void)
CHECK(ret, FAIL, "HAclose");
/* Test reading "large" sized string attribute */
- att = H5Aopen(root, ".", "test_scalar_large", H5P_DEFAULT, H5P_DEFAULT);
+ att = H5Aopen(root, "test_scalar_large", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &string_att_check);