summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-07 02:06:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-07 02:06:34 (GMT)
commit8a00995b3a6df681fddc71e0d54e999e346e7b66 (patch)
tree18d1febbbb2e0a2441bf4b95ea4b88b3f04d5b1e /test
parent5b320d81abb8c228f2ded592b1d725a8c668ba37 (diff)
downloadhdf5-8a00995b3a6df681fddc71e0d54e999e346e7b66.zip
hdf5-8a00995b3a6df681fddc71e0d54e999e346e7b66.tar.gz
hdf5-8a00995b3a6df681fddc71e0d54e999e346e7b66.tar.bz2
[svn-r18738] Description:
Switch H5AC_resize_pinned_entry() to work on protected entries as well, and rename to H5AC_resize_entry() Tested on: Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode (h5committest not required on this branch)
Diffstat (limited to 'test')
-rw-r--r--test/cache.c48
-rw-r--r--test/cache_common.c110
-rw-r--r--test/cache_common.h7
3 files changed, 46 insertions, 119 deletions
diff --git a/test/cache.c b/test/cache.c
index e03525b..437dfc9 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -14415,13 +14415,13 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_resize_pinned_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
+ result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5C_resize_pinned_entry() reports failure 1.");
+ "H5C_resize_entry() reports failure 1.");
failure_mssg = msg;
}
@@ -14475,13 +14475,13 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_resize_pinned_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
+ result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5C_resize_pinned_entry() reports failure 2.");
+ "H5C_resize_entry() reports failure 2.");
failure_mssg = msg;
}
@@ -14823,13 +14823,13 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_resize_pinned_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
+ result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5C_resize_pinned_entry() reports failure 3.");
+ "H5C_resize_entry() reports failure 3.");
failure_mssg = msg;
}
@@ -14885,13 +14885,13 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_resize_pinned_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
+ result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5C_resize_pinned_entry() reports failure 4.");
+ "H5C_resize_entry() reports failure 4.");
failure_mssg = msg;
}
@@ -16842,7 +16842,7 @@ check_expunge_entry_errs(void)
/*-------------------------------------------------------------------------
* Function: check_resize_entry_errs()
*
- * Purpose: Verify that invalid calls to H5C_resize_pinned_entry()
+ * Purpose: Verify that invalid calls to H5C_resize_entry()
* generates errors as expected.
*
* Return: void
@@ -16850,10 +16850,6 @@ check_expunge_entry_errs(void)
* Programmer: John Mainzer
* 7/7/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -16870,11 +16866,11 @@ check_resize_entry_errs(void)
pass = TRUE;
/* Allocate a cache, protect an entry, and then call
- * H5C_resize_pinned_entry() to resize it -- this should fail.
+ * H5C_resize_entry() to resize it -- this should succeed.
*
* Unprotect the the entry with the pinned flag, and then call
- * H5C_resize_pinned_entry() again with new size of zero.
- * This should fail too.
+ * H5C_resize_entry() again with new size of zero.
+ * This should fail.
*
* Finally, unpin the entry and destroy the cache.
* This should succeed.
@@ -16895,13 +16891,13 @@ check_resize_entry_errs(void)
if ( pass ) {
- result = H5C_resize_pinned_entry((void *)entry_ptr, (size_t)1);
+ result = H5C_resize_entry((void *)entry_ptr, (size_t)1);
- if ( result > 0 ) {
+ if ( result < 0 ) {
pass = FALSE;
failure_mssg =
- "Call to H5C_resize_pinned_entry on a protected entry succeeded.\n";
+ "Call to H5C_resize_entry on a protected entry failed.\n";
} else {
@@ -16912,13 +16908,13 @@ check_resize_entry_errs(void)
if ( pass ) {
- result = H5C_resize_pinned_entry((void *)entry_ptr, (size_t)0);
+ result = H5C_resize_entry((void *)entry_ptr, (size_t)0);
- if ( result > 0 ) {
+ if ( result >= 0 ) {
pass = FALSE;
failure_mssg =
- "Call to H5C_resize_pinned_entry with 0 new size succeeded.\n";
+ "Call to H5C_resize_entry with 0 new size succeeded.\n";
} else {
@@ -21242,7 +21238,7 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
- resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (6 * 1024) ) ||
@@ -21260,7 +21256,7 @@ check_auto_cache_resize(void)
if ( pass ) {
- resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (13 * 1024) ) ||
@@ -21281,7 +21277,7 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
- resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (22 * 1024) ) ||
@@ -21302,7 +21298,7 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
- resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (22 * 1024) ) ||
diff --git a/test/cache_common.c b/test/cache_common.c
index e78081d..c1f018b 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -1633,14 +1633,15 @@ reset_entries(void)
* Function: resize_entry
*
* Purpose: Given a pointer to a cache, an entry type, an index, and
- * a size, set the size of the target entry to the size. Note
- * that at present, the type of the entry must be
+ * a new size, set the size of the target entry to the new size.
+ *
+ * Note that at present, the type of the entry must be
* VARIABLE_ENTRY_TYPE.
*
* If the resize_pin parameter is true, verify that the
- * target entry is in the cache and is pinned. If it
+ * target entry is in the cache. If it
* isn't, scream and die. If it is, use the
- * H5C_resize_pinned_entry() call to resize it.
+ * H5C_resize_entry() call to resize it.
*
* Do nothing if pass is false on entry.
*
@@ -1661,6 +1662,7 @@ resize_entry(H5F_t * file_ptr,
{
test_entry_t * base_addr;
test_entry_t * entry_ptr;
+ herr_t result;
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( type == VARIABLE_ENTRY_TYPE );
@@ -1688,14 +1690,28 @@ resize_entry(H5F_t * file_ptr,
} else {
- if ( ! ( (entry_ptr->header).is_pinned ) ) {
+ if ( ! ( entry_ptr->header.is_pinned || entry_ptr->header.is_protected ) ) {
pass = FALSE;
- failure_mssg = "entry to be resized pinned is not pinned.";
+ failure_mssg = "entry to be resized is not pinned or protected.";
} else {
- resize_pinned_entry(cache_ptr, type, idx, new_size);
+ entry_ptr->size = new_size;
+
+ result = H5C_resize_entry((void *)entry_ptr, new_size);
+ entry_ptr->is_dirty = TRUE;
+
+ if ( result != SUCCEED ) {
+
+ pass = FALSE;
+ failure_mssg = "error(s) in H5C_resize_entry().";
+
+ } else {
+
+ HDassert( entry_ptr->size = (entry_ptr->header).size );
+
+ }
}
}
} else {
@@ -1712,86 +1728,6 @@ resize_entry(H5F_t * file_ptr,
/*-------------------------------------------------------------------------
- * Function: resize_pinned_entry
- *
- * Purpose: Given a pointer to a cache, an entry type, an index, and
- * a new size, change the size of the target pinned entry
- * to match the supplied new size.
- *
- * Do nothing if pass is false on entry.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 1/11/08
- *
- *-------------------------------------------------------------------------
- */
-
-void
-resize_pinned_entry(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx,
- size_t new_size)
-{
- herr_t result;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
-
- HDassert( cache_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
- HDassert( type == VARIABLE_ENTRY_TYPE ) ;
- HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes[type] ) );
-
- if ( pass ) {
-
- if ( ! entry_in_cache(cache_ptr, type, idx) ) {
-
- pass = FALSE;
- failure_mssg = "entry not in cache.";
-
- } else {
-
- base_addr = entries[type];
- entry_ptr = &(base_addr[idx]);
-
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
-
- if ( ! ( (entry_ptr->header).is_pinned ) ) {
-
- pass = FALSE;
- failure_mssg = "entry to be resized is not pinned.";
-
- } else {
-
- entry_ptr->size = new_size;
-
- result = H5C_resize_pinned_entry((void *)entry_ptr,
- new_size);
-
- if ( result != SUCCEED ) {
-
- pass = FALSE;
- failure_mssg = "error(s) in H5C_resize_pinned_entry().";
-
- } else {
-
- HDassert( entry_ptr->size = (entry_ptr->header).size );
-
- }
- }
- }
- }
-
- return;
-
-} /* resize_pinned_entry() */
-
-
-/*-------------------------------------------------------------------------
* Function: verify_clean
*
* Purpose: Verify that all cache entries are marked as clean. If any
diff --git a/test/cache_common.h b/test/cache_common.h
index dba0c64..1db19c7 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -174,7 +174,7 @@ typedef struct flush_op
* FLUSH_OP__RESIZE: TRUE iff the
* target is pinned, and is to
* be resized via the
- * H5C_mark_entry_dirty()
+ * H5C_resize_entry()
* call.
*
* FLUSH_OP__MOVE: TRUE iff the
@@ -641,11 +641,6 @@ void resize_entry(H5F_t * file_ptr,
size_t new_size,
hbool_t resize_pin);
-void resize_pinned_entry(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx,
- size_t new_size);
-
H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size);
void row_major_scan_forward(H5F_t * file_ptr,