diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/tattr.c | 470 |
1 files changed, 329 insertions, 141 deletions
diff --git a/test/tattr.c b/test/tattr.c index 1426c16..c0f89d2 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -115,6 +115,7 @@ struct attr4_struct { #define ATTR5_RANK 0 float attr_data5=(float)-5.123; /* Test data for 5th attribute */ +#ifndef QAK herr_t attr_op1(hid_t loc_id, const char *name, void *op_data); @@ -1551,6 +1552,7 @@ test_attr_dtype_shared(hid_t fapl) if(empty_filesize<0) TestErrPrintf("Line %d: file size wrong!\n",__LINE__); + /* Re-open file */ file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl); CHECK(file_id, FAIL, "H5Fopen"); @@ -2609,7 +2611,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /**************************************************************** ** ** test_attr_shared_write(): Test basic H5A (attribute) code. -** Tests writing to shared attributes in "compact" & "dense" storage +** Tests writing mix of shared & un-shared attributes in "compact" & "dense" storage ** ****************************************************************/ static void @@ -2619,7 +2621,8 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) hid_t my_fcpl; /* File creation property list ID */ hid_t dataset, dataset2; /* Dataset IDs */ hid_t attr_tid; /* Attribute's datatype ID */ - hid_t sid; /* Dataspace ID */ + hid_t sid, big_sid; /* Dataspace IDs */ + hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ hid_t attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ @@ -2629,6 +2632,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ + unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ size_t mesg_count; /* # of shared messages */ unsigned test_shared; /* Index over shared component type */ unsigned u; /* Local index variable */ @@ -2637,7 +2641,18 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) herr_t ret; /* Generic return value */ /* Output message about test being performed */ - MESSAGE(5, ("Testing Writing to Shared Attributes in Compact & Dense Storage\n")); + MESSAGE(5, ("Testing Writing Shared & Unshared Attributes in Compact & Dense Storage\n")); + + /* Initialize "big" attribute data */ + HDmemset(big_value, 1, sizeof(big_value)); + + /* Create dataspace for dataset */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create "big" dataspace for "large" attributes */ + big_sid = H5Screate_simple(SPACE1_RANK, big_dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); /* Loop over type of shared components */ for(test_shared = 0; test_shared < 3; test_shared++) { @@ -2650,19 +2665,28 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Tcopy"); /* Special setup for each type of shared components */ - if(test_shared != 0) { + if(test_shared == 0) { + /* Make attributes > 500 bytes shared */ + ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)0, H5O_MESG_ATTR_FLAG, (unsigned)500); + } /* end if */ + else { /* Set up copy of file creation property list */ - /* Make attributes, datatypes & dataspaces > 1 byte shared (i.e. all of them :-) */ ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)3); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)0, H5O_MESG_ATTR_FLAG, (unsigned)1); + + /* Make attributes > 500 bytes shared */ + ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)0, H5O_MESG_ATTR_FLAG, (unsigned)500); + + /* Make datatypes & dataspaces > 1 byte shared (i.e. all of them :-) */ CHECK_I(ret, "H5Pset_shared_mesg_index"); ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)1, H5O_MESG_DTYPE_FLAG, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_index"); ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)2, H5O_MESG_SDSPACE_FLAG, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_index"); - } /* end if */ + } /* end else */ /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, my_fcpl, fapl); @@ -2702,10 +2726,6 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Topen"); } /* end if */ - /* Create dataspace for dataset */ - sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); - /* Set up to query the object creation properties */ dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); @@ -2744,23 +2764,45 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Create attribute name */ sprintf(attrname, "attr %02u", u); - /* Create attribute on first dataset */ - attr = H5Acreate(dataset, attrname, attr_tid, sid, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Acreate"); - - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); - - /* Write data into the attribute */ - attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); - CHECK(ret, FAIL, "H5Awrite"); + /* Alternate between creating "small" & "big" attributes */ + if(u % 2) { + /* Create "small" attribute on first dataset */ + attr = H5Acreate(dataset, attrname, attr_tid, sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + + /* Write data into the attribute */ + attr_value = u + 1; + ret = H5Awrite(attr, attr_tid, &attr_value); + CHECK(ret, FAIL, "H5Awrite"); + } /* end if */ + else { + /* Create "big" attribute on first dataset */ + attr = H5Acreate(dataset, attrname, attr_tid, big_sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + + /* Write data into the attribute */ + big_value[0] = u + 1; + ret = H5Awrite(attr, attr_tid, big_value); + CHECK(ret, FAIL, "H5Awrite"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -2774,28 +2816,45 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); - /* Create attribute on second dataset */ - attr = H5Acreate(dataset2, attrname, attr_tid, sid, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Acreate"); - - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); - - /* Write data into the attribute */ - attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); - CHECK(ret, FAIL, "H5Awrite"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + /* Alternate between creating "small" & "big" attributes */ + if(u % 2) { + /* Create "small" attribute on second dataset */ + attr = H5Acreate(dataset2, attrname, attr_tid, sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + + /* Write data into the attribute */ + attr_value = u + 1; + ret = H5Awrite(attr, attr_tid, &attr_value); + CHECK(ret, FAIL, "H5Awrite"); + } /* end if */ + else { + /* Create "big" attribute on second dataset */ + attr = H5Acreate(dataset2, attrname, attr_tid, big_sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + + /* Write data into the attribute */ + big_value[0] = u + 1; + ret = H5Awrite(attr, attr_tid, big_value); + CHECK(ret, FAIL, "H5Awrite"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -2813,16 +2872,27 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) ret = H5Tclose(attr_tid); CHECK(ret, FAIL, "H5Tclose"); - /* Close dataspace */ - ret = H5Sclose(sid); - CHECK(ret, FAIL, "H5Sclose"); - /* Close Datasets */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); ret = H5Dclose(dataset2); CHECK(ret, FAIL, "H5Dclose"); + /* Check on shared message status now */ + if(test_shared != 0) { + if(test_shared == 1) { + /* Check on datatype storage status */ + ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + } /* end if */ + + /* Check on dataspace storage status */ + ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + } /* end if */ + /* Unlink datasets with attributes */ ret = H5Gunlink(fid, DSET1_NAME); CHECK(ret, FAIL, "H5Gunlink"); @@ -2854,7 +2924,14 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME); VERIFY(filesize, empty_filesize, "h5_get_file_size"); + + /* Close dataspaces */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(big_sid); + CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_shared_write() */ +#endif /* QAK */ /**************************************************************** ** @@ -2869,7 +2946,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) hid_t my_fcpl; /* File creation property list ID */ hid_t dataset, dataset2; /* Dataset ID2 */ hid_t attr_tid; /* Attribute's datatype ID */ - hid_t sid; /* Dataspace ID */ + hid_t sid, big_sid; /* Dataspace IDs */ + hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ hid_t attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */ @@ -2880,6 +2958,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ + unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ size_t mesg_count; /* # of shared messages */ unsigned test_shared; /* Index over shared component type */ unsigned u; /* Local index variable */ @@ -2888,10 +2967,23 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) herr_t ret; /* Generic return value */ /* Output message about test being performed */ - MESSAGE(5, ("Testing Renaming Shared Attributes in Compact & Dense Storage\n")); + MESSAGE(5, ("Testing Renaming Shared & Unshared Attributes in Compact & Dense Storage\n")); + + /* Initialize "big" attribute data */ + HDmemset(big_value, 1, sizeof(big_value)); + + /* Create dataspace for dataset */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create "big" dataspace for "large" attributes */ + big_sid = H5Screate_simple(SPACE1_RANK, big_dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); /* Loop over type of shared components */ - for(test_shared = 0; test_shared < 3; test_shared++) { + for(test_shared = 0; test_shared < 1; test_shared++) { +HDfprintf(stderr, "Fix Loop!\n"); +HDfprintf(stderr, "test_shared = %u\n", test_shared); /* Make copy of file creation property list */ my_fcpl = H5Pcopy(fcpl); CHECK(my_fcpl, FAIL, "H5Pcopy"); @@ -2901,19 +2993,28 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Tcopy"); /* Special setup for each type of shared components */ - if(test_shared != 0) { + if(test_shared == 0) { + /* Make attributes > 500 bytes shared */ + ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)0, H5O_MESG_ATTR_FLAG, (unsigned)500); + } /* end if */ + else { /* Set up copy of file creation property list */ - /* Make attributes, datatypes & dataspaces > 1 byte shared (i.e. all of them :-) */ ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)3); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)0, H5O_MESG_ATTR_FLAG, (unsigned)1); + + /* Make attributes > 500 bytes shared */ + ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)0, H5O_MESG_ATTR_FLAG, (unsigned)500); + + /* Make datatypes & dataspaces > 1 byte shared (i.e. all of them :-) */ CHECK_I(ret, "H5Pset_shared_mesg_index"); ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)1, H5O_MESG_DTYPE_FLAG, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_index"); ret = H5Pset_shared_mesg_index(my_fcpl, (unsigned)2, H5O_MESG_SDSPACE_FLAG, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_index"); - } /* end if */ + } /* end else */ /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, my_fcpl, fapl); @@ -2953,10 +3054,6 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Topen"); } /* end if */ - /* Create dataspace for dataset */ - sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); - /* Set up to query the object creation properties */ dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); @@ -2968,7 +3065,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(dataset2, FAIL, "H5Dcreate"); /* Check on dataset's message storage status */ - if(test_shared) { + if(test_shared != 0) { /* Dataset's datatypes are immutable and shouldn't be shared */ ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); @@ -2995,23 +3092,45 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Create attribute name */ sprintf(attrname, "attr %02u", u); - /* Create attribute on first dataset */ - attr = H5Acreate(dataset, attrname, attr_tid, sid, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Acreate"); - - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); - - /* Write data into the attribute */ - attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); - CHECK(ret, FAIL, "H5Awrite"); + /* Alternate between creating "small" & "big" attributes */ + if(u % 2) { + /* Create "small" attribute on first dataset */ + attr = H5Acreate(dataset, attrname, attr_tid, sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + + /* Write data into the attribute */ + attr_value = u + 1; + ret = H5Awrite(attr, attr_tid, &attr_value); + CHECK(ret, FAIL, "H5Awrite"); + } /* end if */ + else { + /* Create "big" attribute on first dataset */ + attr = H5Acreate(dataset, attrname, attr_tid, big_sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + + /* Write data into the attribute */ + big_value[0] = u + 1; + ret = H5Awrite(attr, attr_tid, big_value); + CHECK(ret, FAIL, "H5Awrite"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -3025,28 +3144,45 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); - /* Create attribute on second dataset */ - attr = H5Acreate(dataset2, attrname, attr_tid, sid, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Acreate"); - - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); - - /* Write data into the attribute */ - attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); - CHECK(ret, FAIL, "H5Awrite"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + /* Alternate between creating "small" & "big" attributes */ + if(u % 2) { + /* Create "small" attribute on second dataset */ + attr = H5Acreate(dataset2, attrname, attr_tid, sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + + /* Write data into the attribute */ + attr_value = u + 1; + ret = H5Awrite(attr, attr_tid, &attr_value); + CHECK(ret, FAIL, "H5Awrite"); + } /* end if */ + else { + /* Create "big" attribute on second dataset */ + attr = H5Acreate(dataset2, attrname, attr_tid, big_sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + + /* Write data into the attribute */ + big_value[0] = u + 1; + ret = H5Awrite(attr, attr_tid, big_value); + CHECK(ret, FAIL, "H5Awrite"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -3074,14 +3210,21 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) attr = H5Aopen_name(dataset2, attrname2); CHECK(attr, FAIL, "H5Aopen_name"); - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + if(u % 2) { + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + } /* end if */ + else { + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -3091,14 +3234,21 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) attr = H5Aopen_name(dataset, attrname); CHECK(attr, FAIL, "H5Aopen_name"); - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + if(u % 2) { + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + } /* end if */ + else { + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 1, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -3116,14 +3266,21 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) attr = H5Aopen_name(dataset2, attrname); CHECK(attr, FAIL, "H5Aopen_name"); - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + if(u % 2) { + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + } /* end if */ + else { + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -3133,14 +3290,21 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) attr = H5Aopen_name(dataset, attrname); CHECK(attr, FAIL, "H5Aopen_name"); - /* Check that attribute is shared */ - is_shared = H5A_is_shared_test(attr); - VERIFY(is_shared, TRUE, "H5A_is_shared_test"); - - /* Check refcount for attribute */ - ret = H5A_get_shared_rc_test(attr, &shared_refcount); - CHECK(ret, FAIL, "H5A_get_shared_rc_test"); - VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + if(u % 2) { + /* Check that attribute is not shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, FALSE, "H5A_is_shared_test"); + } /* end if */ + else { + /* Check that attribute is shared */ + is_shared = H5A_is_shared_test(attr); + VERIFY(is_shared, TRUE, "H5A_is_shared_test"); + + /* Check refcount for attribute */ + ret = H5A_get_shared_rc_test(attr, &shared_refcount); + CHECK(ret, FAIL, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + } /* end else */ /* Close attribute */ ret = H5Aclose(attr); @@ -3151,16 +3315,27 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) ret = H5Tclose(attr_tid); CHECK(ret, FAIL, "H5Tclose"); - /* Close dataspace */ - ret = H5Sclose(sid); - CHECK(ret, FAIL, "H5Sclose"); - /* Close Datasets */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); ret = H5Dclose(dataset2); CHECK(ret, FAIL, "H5Dclose"); + /* Check on shared message status now */ + if(test_shared != 0) { + if(test_shared == 1) { + /* Check on datatype storage status */ + ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + } /* end if */ + + /* Check on dataspace storage status */ + ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + } /* end if */ + /* Unlink datasets with attributes */ ret = H5Gunlink(fid, DSET1_NAME); CHECK(ret, FAIL, "H5Gunlink"); @@ -3192,8 +3367,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME); VERIFY(filesize, empty_filesize, "h5_get_file_size"); + + /* Close dataspaces */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(big_sid); + CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_shared_rename() */ +#ifndef QAK /**************************************************************** ** ** test_attr_shared_delete(): Test basic H5A (attribute) code. @@ -3758,6 +3940,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) filesize = h5_get_file_size(FILENAME); VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_shared_unlink() */ +#endif /* QAK */ /**************************************************************** ** @@ -3802,6 +3985,7 @@ test_attr(void) ret = H5Pset_shared_mesg_index(fcpl2, (unsigned)0, H5O_MESG_ATTR_FLAG, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_index"); +#ifndef QAK /* Loop over using new group format */ for(new_format = FALSE; new_format <= TRUE; new_format++) { hid_t my_fapl; @@ -3870,6 +4054,10 @@ test_attr(void) test_attr_shared_rename(fcpl2, fapl2); /* Test renaming shared attributes in compact & dense storage */ test_attr_shared_delete(fcpl2, fapl2); /* Test deleting shared attributes in compact & dense storage */ test_attr_shared_unlink(fcpl2, fapl2); /* Test unlinking object with shared attributes in compact & dense storage */ +#else /* QAK */ +HDfprintf(stderr, "Uncomment tests!\n"); + test_attr_shared_rename(fcpl2, fapl2); /* Test renaming shared attributes in compact & dense storage */ +#endif /* QAK */ /* Close FCPLs */ ret = H5Pclose(fcpl); |