summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-08 20:10:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-08 20:10:12 (GMT)
commit74a30fff3e0fcd8919ced487abd03eefd27d57c1 (patch)
tree2df0a0d2cfc51cce067f25e503e6dfd26c8e827d /test
parent25bb6f5dd8af42d2facaab26f0cdeb7fc76456ae (diff)
downloadhdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.zip
hdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.tar.gz
hdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.tar.bz2
[svn-r13477] Description:
The main purpose of this checkin was to eliminate the space used for tracking creation time indices when there is no way they can be used (i.e. attributes can't be shared in the file and the user hasn't turned on attribute creation tracking), however there were some other minor changes which crept in: - Fix a cache locking deadlock when a shared attribute and one of its components end up in the same fractal heap direct block. (This is fixed the "slow" way for right now, until John has time to add support for readers/writer locking to the cache. - Optimize attribute copying when a copy will be kept during a v2 B-tree search. - When freeing a block on disk, attempt to merge it with the metadata and "small data" aggregators. Tested on: Mac OS X/32 10.4.8 (amazon) FreeBSD/32 6.2 (duty)
Diffstat (limited to 'test')
-rw-r--r--test/stab.c10
-rw-r--r--test/tattr.c35
-rw-r--r--test/tfile.c6
-rw-r--r--test/titerate.c18
-rw-r--r--test/tsohm.c22
5 files changed, 57 insertions, 34 deletions
diff --git a/test/stab.c b/test/stab.c
index 79871ee..6540916 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -427,9 +427,9 @@ lifecycle(hid_t fapl)
/* Check that the object header is only one chunk and the space has been allocated correctly */
if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_stat.ohdr.size != 254) TEST_ERROR
+ if(obj_stat.ohdr.size != 240) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.size != 234) TEST_ERROR
+ if(obj_stat.ohdr.size != 220) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.free != 0) TEST_ERROR
if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR
@@ -453,11 +453,11 @@ lifecycle(hid_t fapl)
/* Check that the object header is still one chunk and the space has been allocated correctly */
if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_stat.ohdr.size != 254) TEST_ERROR
+ if(obj_stat.ohdr.size != 240) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.size != 234) TEST_ERROR
+ if(obj_stat.ohdr.size != 220) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.free != 120) TEST_ERROR
+ if(obj_stat.ohdr.free != 112) TEST_ERROR
if(obj_stat.ohdr.nmesgs != 3) TEST_ERROR
if(obj_stat.ohdr.nchunks != 1) TEST_ERROR
diff --git a/test/tattr.c b/test/tattr.c
index e0d08e8..cf8f5d4 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -1753,15 +1753,19 @@ test_attr_dtype_shared(hid_t fapl)
** Verify attributes on object
**
****************************************************************/
-static void
+static int
test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
{
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
hid_t attr; /* Attribute ID */
unsigned value; /* Attribute value */
unsigned u; /* Local index variable */
+ int old_nerrs; /* Number of errors when entering this check */
herr_t ret; /* Generic return value */
+ /* Retrieve the current # of reported errors */
+ old_nerrs = GetTestNumErrs();
+
/* Re-open all the attributes by name and verify the data */
for(u = 0; u < max_attr; u++) {
/* Open attribute */
@@ -1804,6 +1808,12 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
} /* end for */
+
+ /* Retrieve current # of errors */
+ if(old_nerrs == GetTestNumErrs())
+ return(0);
+ else
+ return(-1);
} /* test_attr_dense_verify() */
@@ -1989,6 +1999,10 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
+ /* Enable creation order tracking on attributes, so creation order tests work */
+ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED);
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+
/* Create a dataset */
dataset = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl);
CHECK(dataset, FAIL, "H5Dcreate");
@@ -2021,7 +2035,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Verify attributes written so far */
- test_attr_dense_verify(dataset, u);
+ ret = test_attr_dense_verify(dataset, u);
+ CHECK(ret, FAIL, "test_attr_dense_verify");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -2051,7 +2066,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
/* Verify all the attributes written */
- test_attr_dense_verify(dataset, (u + 1));
+ ret = test_attr_dense_verify(dataset, (u + 1));
+ CHECK(ret, FAIL, "test_attr_dense_verify");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -2123,6 +2139,10 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
+ /* Enable creation order tracking on attributes, so creation order tests work */
+ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED);
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+
/* Create a dataset */
dataset = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl);
CHECK(dataset, FAIL, "H5Dcreate");
@@ -2193,7 +2213,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Adelete");
/* Verify attributes still left */
- test_attr_dense_verify(dataset, u);
+ ret = test_attr_dense_verify(dataset, u);
+ CHECK(ret, FAIL, "test_attr_dense_verify");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -2210,7 +2231,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Verify attributes still left */
- test_attr_dense_verify(dataset, (u - 1));
+ ret = test_attr_dense_verify(dataset, (u - 1));
+ CHECK(ret, FAIL, "test_attr_dense_verify");
/* Delete another attribute, to verify deletion in compact storage */
sprintf(attrname, "attr %02u", (u - 1));
@@ -2222,7 +2244,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Verify attributes still left */
- test_attr_dense_verify(dataset, (u - 2));
+ ret = test_attr_dense_verify(dataset, (u - 2));
+ CHECK(ret, FAIL, "test_attr_dense_verify");
/* Close Dataset */
ret = H5Dclose(dataset);
diff --git a/test/tfile.c b/test/tfile.c
index f143fad..34a304b 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1261,11 +1261,7 @@ test_file_freespace(void)
/* Check that there is the right amount of free space in the file */
free_space = H5Fget_freespace(file);
CHECK(free_space, FAIL, "H5Fget_freespace");
-#ifdef H5_HAVE_LARGE_HSIZET
- VERIFY(free_space, 5512, "H5Fget_freespace");
-#else /* H5_HAVE_LARGE_HSIZET */
- VERIFY(free_space, 4592, "H5Fget_freespace"); /* XXX: fix me */
-#endif /* H5_HAVE_LARGE_HSIZET */
+ VERIFY(free_space, 0, "H5Fget_freespace");
/* Close file */
ret = H5Fclose(file);
diff --git a/test/titerate.c b/test/titerate.c
index 10ddf17..e60d98a 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -473,9 +473,12 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Verify that the index is the correct value */
VERIFY(idx, (unsigned)i, "H5Aiterate");
- /* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, anames[idx - 1]) != 0)
- TestErrPrintf("%u: Attribute iteration function didn't return 'two' correctly!\n", __LINE__);
+ /* Don't check name when new format is used */
+ if(!new_format) {
+ /* Verify that the correct name is retrieved */
+ if(HDstrcmp(info.name, anames[idx - 1]) != 0)
+ TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = '%s', anames[idx - 1] = '%s'!\n", __LINE__, info.name, anames[idx - 1]);
+ } /* end if */
} /* end while */
VERIFY(ret, -1, "H5Aiterate");
if(i != 50 || idx != 50)
@@ -496,9 +499,12 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Verify that the index is the correct value */
VERIFY(idx, (unsigned)i + 10, "H5Aiterate");
- /* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, anames[idx - 1]) != 0)
- TestErrPrintf("Attribute iteration function didn't return changing correctly!\n");
+ /* Don't check name when new format is used */
+ if(!new_format) {
+ /* Verify that the correct name is retrieved */
+ if(HDstrcmp(info.name, anames[idx - 1]) != 0)
+ TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = '%s', anames[idx - 1] = '%s'!\n", __LINE__, info.name, anames[idx - 1]);
+ } /* end if */
} /* end while */
VERIFY(ret, -1, "H5Aiterate");
if(i != 40 || idx != 50)
diff --git a/test/tsohm.c b/test/tsohm.c
index f5a6514..0612794 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -2200,8 +2200,8 @@ static void test_sohm_size2(int close_reopen)
*/
if(list_index_med.dsets2 >= btree_index.dsets2)
VERIFY(list_index_med.dsets2, 1, "h5_get_file_size");
- if(btree_index.dsets2 > list_index_small.dsets2)
- VERIFY(btree_index.dsets2, 1, "h5_get_file_size");
+ if(btree_index.dsets2 > list_index_small.dsets2 * OVERHEAD_ALLOWED)
+ VERIFY(btree_index.dsets2, list_index_small.dsets2, "h5_get_file_size");
if(list_index_small.dsets2 >= norm_sizes.dsets2)
VERIFY(btree_index.dsets2, 1, "h5_get_file_size");
/* If the small list (now a B-tree) is bigger than the existing B-tree,
@@ -2233,8 +2233,8 @@ static void test_sohm_size2(int close_reopen)
*/
if(list_index_med.interleaved >= btree_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(btree_index.interleaved > list_index_small.interleaved)
- VERIFY(0, 1, "h5_get_file_size");
+ if(btree_index.interleaved > list_index_small.interleaved * OVERHEAD_ALLOWED)
+ VERIFY(btree_index.interleaved, list_index_small.interleaved, "h5_get_file_size");
if(list_index_small.interleaved >= norm_sizes.interleaved)
VERIFY(0, 1, "h5_get_file_size");
/* The lists should still have grown the same amount. The converted
@@ -2262,8 +2262,8 @@ static void test_sohm_size2(int close_reopen)
* of file space can be hard to predict.
*/
- if(btree_index.attrs1 > list_index_small.attrs1)
- VERIFY(0, 1, "h5_get_file_size");
+ if(btree_index.attrs1 > list_index_small.attrs1 * OVERHEAD_ALLOWED)
+ VERIFY(btree_index.attrs1, list_index_small.attrs1, "h5_get_file_size");
if(btree_index.attrs1 > list_index_med.attrs1 * OVERHEAD_ALLOWED)
VERIFY(0, 1, "h5_get_file_size");
if(list_index_med.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
@@ -2297,8 +2297,8 @@ static void test_sohm_size2(int close_reopen)
* of sizes. The big list index is still too big to be smaller than a
* normal file. The B-tree indexes should all be about the same size.
*/
- if(btree_index.attrs2 > list_index_small.attrs2)
- VERIFY(0, 1, "h5_get_file_size");
+ if(btree_index.attrs2 > list_index_small.attrs2 * OVERHEAD_ALLOWED)
+ VERIFY(btree_index.attrs2, list_index_small.attrs2, "h5_get_file_size");
if(list_index_small.attrs2 > btree_index.attrs2 * OVERHEAD_ALLOWED)
VERIFY(0, 1, "h5_get_file_size");
if(btree_index.attrs2 > list_index_med.attrs2 * OVERHEAD_ALLOWED)
@@ -2680,14 +2680,12 @@ static void delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
/* The two filesizes should be almost the same */
if(norm_filesize > deleted_filesize * OVERHEAD_ALLOWED)
- VERIFY(0, 1, "h5_get_file_size");
+ VERIFY(norm_filesize, deleted_filesize, "h5_get_file_size");
if(deleted_filesize > norm_filesize * OVERHEAD_ALLOWED)
- VERIFY(0, 1, "h5_get_file_size");
-
+ VERIFY(deleted_filesize, norm_filesize, "h5_get_file_size");
}
-
/*-------------------------------------------------------------------------
* Function: test_sohm_delete
*