summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-04 19:29:58 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-04 19:29:58 (GMT)
commitbb3afd50c2e94cf2db558218c6704dcc285c72e9 (patch)
treeadd60605c7c88c64582acde6b3e84051f72ea27b /test
parent3db40827da29243b88ade3c3f174f3f5e6cd0622 (diff)
downloadhdf5-bb3afd50c2e94cf2db558218c6704dcc285c72e9.zip
hdf5-bb3afd50c2e94cf2db558218c6704dcc285c72e9.tar.gz
hdf5-bb3afd50c2e94cf2db558218c6704dcc285c72e9.tar.bz2
[svn-r14185] Description:
Move H5Aopen_name() routine to deprecated symbol section and replace internal usage with H5Aopen(). Add simple regression test for H5Aopen_name() to deprecated routine test. 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.c25
-rwxr-xr-xtest/objcopy.c2
-rw-r--r--test/tattr.c84
-rw-r--r--test/th5s.c4
-rw-r--r--test/tmisc.c4
-rw-r--r--test/tsohm.c10
-rw-r--r--test/ttsafe_acreate.c44
-rw-r--r--test/tvlstr.c8
8 files changed, 94 insertions, 87 deletions
diff --git a/test/dangle.c b/test/dangle.c
index cbd29a1..84cc965 100644
--- a/test/dangle.c
+++ b/test/dangle.c
@@ -463,38 +463,37 @@ test_dangle_attribute(H5F_close_degree_t degree)
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the dataset */
- if(H5Aclose (aid)<0)
+ if(H5Aclose(aid) < 0)
TEST_ERROR;
/* Try creating duplicate attribute */
H5E_BEGIN_TRY {
- if((aid = H5Acreate (dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT))>=0)
+ if((aid = H5Acreate(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT)) >= 0)
TEST_ERROR;
} H5E_END_TRY;
- if(H5Sclose(sid)<0)
+ if(H5Sclose(sid) < 0)
TEST_ERROR;
/* Leave open a _lot_ of objects */
- for(u=0; u<MAX_DANGLE; u++) {
- if((aid = H5Aopen_name (dsid, ATTRNAME))<0)
- TEST_ERROR;
- } /* end for */
+ for(u = 0; u < MAX_DANGLE; u++)
+ if((aid = H5Aopen(dsid, ".", ATTRNAME, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(H5Dclose(dsid)<0)
- TEST_ERROR;
+ if(H5Dclose(dsid) < 0)
+ TEST_ERROR
- if(degree==H5F_CLOSE_SEMI) {
+ if(degree == H5F_CLOSE_SEMI) {
H5E_BEGIN_TRY {
- if(H5Fclose(fid)>=0)
+ if(H5Fclose(fid) >= 0)
TEST_ERROR;
} H5E_END_TRY;
} /* end if */
else
- if(H5Fclose(fid)<0)
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- if(H5Pclose(fapl)<0)
+ if(H5Pclose(fapl) < 0)
TEST_ERROR;
if(H5close()<0)
diff --git a/test/objcopy.c b/test/objcopy.c
index 88828d4..119ad82 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_name(oid2, attr_name)) < 0) TEST_ERROR
+ if((aid2 = H5Aopen(oid2, ".", attr_name, H5P_DEFAULT, 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 4e3058e..b88ba5f 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -204,8 +204,8 @@ test_attr_basic_write(hid_t fapl)
CHECK(group, FAIL, "H5Gopen2");
/* Open attribute again */
- attr = H5Aopen_name(group, ATTR1_NAME);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(group, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Close attribute */
ret = H5Aclose(attr);
@@ -262,8 +262,8 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Arename2");
/* Open attribute again */
- attr = H5Aopen_name(dataset, ATTR_TMP_NAME);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Verify new attribute name */
attr_name_size = H5Aget_name(attr, (size_t)0, NULL);
@@ -294,8 +294,8 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Open the second attribute again */
- attr2=H5Aopen_name(dataset, ATTR1A_NAME);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr2=H5Aopen(dataset, ".", ATTR1A_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Verify new attribute name */
attr_name_size = H5Aget_name(attr2, (size_t)0, NULL);
@@ -415,8 +415,8 @@ test_attr_basic_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 2, "H5Oget_info");
/* Open first attribute for the dataset */
- attr = H5Aopen_name(dataset, ATTR_TMP_NAME);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
ret = H5Aread(attr, H5T_NATIVE_INT, read_data1);
@@ -444,8 +444,8 @@ test_attr_basic_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
/* Open the attribute for the group */
- attr = H5Aopen_name(group, ATTR2_NAME);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(group, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
ret = H5Aread(attr, H5T_NATIVE_INT, read_data2);
@@ -627,8 +627,8 @@ 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_name(dataset, ATTR2_NAME);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
plist = H5Aget_create_plist(attr);
CHECK(plist, FAIL, "H5Aget_create_plist");
ret = H5Pget_char_encoding(plist, &cset);
@@ -989,8 +989,8 @@ test_attr_scalar_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
/* Open an attribute for the dataset */
- attr = H5Aopen_name(dataset, ATTR5_NAME);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", ATTR5_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
ret = H5Aread(attr, H5T_NATIVE_FLOAT, &rdata);
@@ -1733,8 +1733,8 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(dset_id, FAIL, "H5Dopen");
/* Open attribute */
- attr_id = H5Aopen_name(dset_id, ATTR1_NAME);
- CHECK(attr_id, FAIL, "H5Aopen_name");
+ attr_id = H5Aopen(dset_id, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Aopen");
/* Read data from the attribute */
ret = H5Aread(attr_id, H5T_NATIVE_INT, &rdata);
@@ -1800,8 +1800,8 @@ 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_name(loc_id, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(loc_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Read data from the attribute */
ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
@@ -2423,8 +2423,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Open attribute */
sprintf(attrname, "new attr %02u", u);
- attr = H5Aopen_name(dataset, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Read data from the attribute */
ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
@@ -3157,8 +3157,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Open first attribute */
HDstrcpy(attrname, "null attr #2");
- attr = H5Aopen_name(dataset, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Try to read data from the attribute */
/* (shouldn't fail, but should leave buffer alone) */
@@ -3196,8 +3196,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Open second attribute */
HDstrcpy(attrname, "null attr");
- attr = H5Aopen_name(dataset, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Try to write data to the attribute */
/* (shouldn't fail, but should leave buffer alone) */
@@ -3307,7 +3307,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
ret = H5Aget_num_attrs(dataset);
VERIFY(ret, 1, "H5Aget_num_attrs");
- /* Open the attribute */
+ /* Open the attribute by index */
attr = H5Aopen_idx(dataset, 0);
CHECK(attr, FAIL, "H5Aopen_idx");
@@ -3315,6 +3315,14 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
+ /* Open the attribute by name */
+ attr = H5Aopen_name(dataset, "attr");
+ CHECK(attr, FAIL, "H5Aopen_name");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
/* Rename attribute */
ret = H5Arename1(dataset, "attr", "attr2");
@@ -3401,8 +3409,8 @@ test_attr_many(hid_t fcpl, hid_t fapl)
sprintf(attrname, "a-%06u", u);
- aid = H5Aopen_name(fid, attrname);
- CHECK(aid, FAIL, "H5Aopen_name");
+ aid = H5Aopen(fid, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(aid, FAIL, "H5Aopen");
ret = H5Aread(aid, H5T_NATIVE_UINT, &value);
CHECK(ret, FAIL, "H5Aread");
@@ -7315,8 +7323,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
- attr = H5Aopen_name(dataset2, attrname2);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset2, ".", attrname2, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
/* Check that attribute is not shared */
@@ -7339,8 +7347,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check refcount on original attribute */
- attr = H5Aopen_name(dataset, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
/* Check that attribute is not shared */
@@ -7371,8 +7379,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
- attr = H5Aopen_name(dataset2, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset2, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
/* Check that attribute is not shared */
@@ -7395,8 +7403,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check refcount on original attribute */
- attr = H5Aopen_name(dataset, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
/* Check that attribute is not shared */
@@ -7759,8 +7767,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on first dataset's attribute */
- attr = H5Aopen_name(dataset, attrname);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
/* Check that attribute is not shared */
@@ -8133,7 +8141,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
sprintf(attrname, "attr %02u", u);
/* Open attribute on first dataset */
- attr = H5Aopen_name(dataset, attrname);
+ attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
if(u % 2) {
diff --git a/test/th5s.c b/test/th5s.c
index a67d5a2..e9f7951 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -495,8 +495,8 @@ test_h5s_null(void)
CHECK(ret, FAIL, "H5Sclose");
/* Open the attribute for the dataset */
- attr=H5Aopen_name(did,NULLATTR);
- CHECK(attr, FAIL, "H5Aopen_name");
+ attr = H5Aopen(did, ".", NULLATTR, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Aopen");
/* Get the space of the dataset */
attr_sid = H5Aget_space(attr);
diff --git a/test/tmisc.c b/test/tmisc.c
index aa95bb0..5fee9dc 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -497,8 +497,8 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name
root = H5Gopen2(file, "/", H5P_DEFAULT);
CHECK(root, FAIL, "H5Gopen2");
- att = H5Aopen_name(root, att_name);
- CHECK(att, FAIL, "H5Aopen_name");
+ att = H5Aopen(root, ".", att_name, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &data_check);
CHECK(ret, FAIL, "H5Aread");
diff --git a/test/tsohm.c b/test/tsohm.c
index e0ddc8c..5b003c3 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -1891,10 +1891,10 @@ 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_name(group1_id, attr_name);
- CHECK_I(attr1_id, "H5Aopen_name");
- attr2_id = H5Aopen_name(group2_id, attr_name);
- CHECK_I(attr2_id, "H5Aopen_name");
+ attr1_id = H5Aopen(group1_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK_I(attr1_id, "H5Aopen");
+ attr2_id = H5Aopen(group2_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK_I(attr2_id, "H5Aopen");
ret = H5Aread(attr1_id, attr_type_id, attr_string);
CHECK_I(ret, "H5Aread");
@@ -2618,7 +2618,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_name(dset_id, "attr_name");
+ attr_id = H5Aopen(dset_id, ".", "attr_name", H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Aopen");
/* Read */
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index d48077c..cfc250b 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -112,47 +112,47 @@ void tts_acreate(void)
* Simultaneously create a large number of attributes to be associated
* with the dataset
*/
- for (i = 0; i < NUM_THREADS; i++) {
+ for(i = 0; i < NUM_THREADS; i++) {
attrib_data = malloc(sizeof(ttsafe_name_data_t));
attrib_data->dataset = dataset;
attrib_data->datatype = datatype;
attrib_data->dataspace = dataspace;
attrib_data->current_index = i;
- ret=pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data);
- assert(ret==0);
- }
+ ret = pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data);
+ assert(ret == 0);
+ } /* end for */
- for (i = 0; i < NUM_THREADS; i++) {
- ret=pthread_join(threads[i], NULL);
- assert(ret==0);
- }
+ for(i = 0; i < NUM_THREADS; i++) {
+ ret = pthread_join(threads[i], NULL);
+ assert(ret == 0);
+ } /* end for */
/* verify the correctness of the test */
- for (i = 0; i < NUM_THREADS; i++) {
- attribute = H5Aopen_name(dataset,gen_name(i));
+ for(i = 0; i < NUM_THREADS; i++) {
+ attribute = H5Aopen(dataset, ".", gen_name(i), H5P_DEFAULT, H5P_DEFAULT);
- if (attribute < 0)
+ if(attribute < 0)
TestErrPrintf("unable to open appropriate attribute. Test failed!\n");
else {
ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer);
- if (ret < 0 || buffer != i)
+ if(ret < 0 || buffer != i)
TestErrPrintf("wrong data values. Test failed!\n");
H5Aclose(attribute);
- }
- }
+ } /* end else */
+ } /* end for */
/* close remaining resources */
- ret=H5Sclose(dataspace);
- assert(ret>=0);
- ret=H5Tclose(datatype);
- assert(ret>=0);
- ret=H5Dclose(dataset);
- assert(ret>=0);
- ret=H5Fclose(file);
- assert(ret>=0);
+ ret = H5Sclose(dataspace);
+ assert(ret >= 0);
+ ret = H5Tclose(datatype);
+ assert(ret >= 0);
+ ret = H5Dclose(dataset);
+ assert(ret >= 0);
+ ret = H5Fclose(file);
+ assert(ret >= 0);
}
void *tts_acreate_thread(void *client_data)
diff --git a/test/tvlstr.c b/test/tvlstr.c
index a0eedc6..a758a9e 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -680,8 +680,8 @@ static void test_read_vl_string_attribute(void)
CHECK(root, FAIL, "H5Gopen2");
/* Test reading "normal" sized string attribute */
- att = H5Aopen_name(root, "test_scalar");
- CHECK(att, FAIL, "H5Aopen_name");
+ att = H5Aopen(root, ".", "test_scalar", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
@@ -695,8 +695,8 @@ static void test_read_vl_string_attribute(void)
CHECK(ret, FAIL, "HAclose");
/* Test reading "large" sized string attribute */
- att = H5Aopen_name(root, "test_scalar_large");
- CHECK(att, FAIL, "H5Aopen_name");
+ att = H5Aopen(root, ".", "test_scalar_large", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");