diff options
author | John Mainzer <mainzer@hdfgroup.org> | 2006-07-13 17:59:39 (GMT) |
---|---|---|
committer | John Mainzer <mainzer@hdfgroup.org> | 2006-07-13 17:59:39 (GMT) |
commit | 801b5b09f26dac69e77bb4a794f2785977f9eb7e (patch) | |
tree | f96577fe353fe34c5ad7be4fcb72b62cebdcda4d /test | |
parent | 8db4fe6d16d3e51e3d6122db02aaf888b911ebe0 (diff) | |
download | hdf5-801b5b09f26dac69e77bb4a794f2785977f9eb7e.zip hdf5-801b5b09f26dac69e77bb4a794f2785977f9eb7e.tar.gz hdf5-801b5b09f26dac69e77bb4a794f2785977f9eb7e.tar.bz2 |
[svn-r12462] Committed a variety of metadata cache related changes:
1) Added trace file support to the metadata cache. This allows capture
of all metadata cache calls in trace files for purposes of optimization
and debuging.
2) Added an expunge entry function. This allows an entry to be deleteded
from the cache without writing it to disk even if it is dirty.
3) Added a function call to resize pinned entries.
4) Added code to deal with entries that are dirty on load. This is
needed in support of a bug fix which can alter object headers on
load to repair files.
5) Added progress reporting code to the "MDC API smoke check" test in
cache_api.c. To enable the progress reporting, set report_progress
to TRUE in mdc_api_call_smoke_check().
Tested with h5committest, and a parallel test on phoenix (dual athelon
linux box).
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 1459 | ||||
-rw-r--r-- | test/cache_api.c | 470 | ||||
-rw-r--r-- | test/cache_common.c | 65 | ||||
-rw-r--r-- | test/cache_common.h | 4 |
4 files changed, 1966 insertions, 32 deletions
diff --git a/test/cache.c b/test/cache.c index 01859f1..98f68d5 100644 --- a/test/cache.c +++ b/test/cache.c @@ -76,10 +76,12 @@ static void check_flush_cache__pinned_single_entry_test(H5C_t * cache_ptr, hbool_t expected_destroyed); static void check_flush_protected_err(void); static void check_get_entry_status(void); +static void check_expunge_entry(void); static void check_rename_entry(void); static void check_rename_entry__run_test(H5C_t * cache_ptr, int test_num, struct rename_entry_test_spec * spec_ptr); static void check_pin_protected_entry(void); +static void check_resize_entry(void); static void check_destroy_pinned_err(void); static void check_destroy_protected_err(void); static void check_duplicate_insert_err(void); @@ -90,6 +92,8 @@ static void check_pin_entry_errs(void); static void check_double_protect_err(void); static void check_double_unprotect_err(void); static void check_mark_entry_dirty_errs(void); +static void check_expunge_entry_errs(void); +static void check_resize_entry_errs(void); static void check_auto_cache_resize(void); static void check_auto_cache_resize_disable(void); static void check_auto_cache_resize_epoch_markers(void); @@ -6651,6 +6655,306 @@ check_get_entry_status(void) /*------------------------------------------------------------------------- + * Function: check_expunge_entry() + * + * Purpose: Verify that H5C_expunge_entry() behaves as expected. + * + * Return: void + * + * Programmer: John Mainzer + * 7/5/06 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +check_expunge_entry(void) +{ + const char * fcn_name = "check_expunge_entry"; + static char msg[128]; + herr_t result; + hbool_t in_cache; + hbool_t is_dirty; + hbool_t is_protected; + hbool_t is_pinned; + size_t entry_size; + H5C_t * cache_ptr = NULL; + test_entry_t * base_addr; + test_entry_t * entry_ptr; + + TESTING("H5C_expunge_entry() functionality"); + + pass = TRUE; + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + (size_t)(1 * 1024 * 1024)); + + base_addr = entries[0]; + entry_ptr = &(base_addr[0]); + } + + if ( pass ) { + + /* entry not in cache -- only in_cache should be touched by + * the status call. Thus, only check that boolean. + */ + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, + &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 1."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 1."); + failure_mssg = msg; + + } else if ( ( entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 1."); + failure_mssg = msg; + + } + } + + /* protect an entry to force the cache to load it, and then unprotect + * it without marking it dirty. + */ + + protect_entry(cache_ptr, 0, 0); + + unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 2."); + failure_mssg = msg; + + } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 2."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); + failure_mssg = msg; + + } + } + + /* Expunge the entry and then verify that it is no longer in the cache. + * Also verify that the entry was loaded, cleared, and destroyed, but + * not flushed. + */ + expunge_entry(cache_ptr, 0, 0); + + if ( pass ) { + + /* entry shouldn't be in cache -- only in_cache should be touched + * by the status call. Thus, only check that boolean. + */ + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 3."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 3."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( ! entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); + failure_mssg = msg; + + } + } + + /* now repeat the process with a different entry. On unprotect + * mark the entry as dirty. Verify that it is not flushed. + */ + + base_addr = entries[0]; + entry_ptr = &(base_addr[1]); + + if ( pass ) { + + /* entry not in cache -- only in_cache should be touched by + * the status call. Thus, only check that boolean. + */ + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, + &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 4."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 4."); + failure_mssg = msg; + + } else if ( ( entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); + failure_mssg = msg; + + } + } + + /* protect the entry to force the cache to load it, and then unprotect + * it with the dirty flag set. + */ + + protect_entry(cache_ptr, 0, 1); + + unprotect_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET); + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, + &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 5."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 5."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); + failure_mssg = msg; + + } + } + + /* Expunge the entry and then verify that it is no longer in the cache. + * Also verify that the entry was loaded, cleared and destroyed, but not + * flushed. + */ + expunge_entry(cache_ptr, 0, 1); + + if ( pass ) { + + /* entry shouldn't be in cache -- only in_cache should be touched + * by the status call. Thus, only check that boolean. + */ + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, + &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 6."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 6."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( ! entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 6."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* check_expunge_entry() */ + + +/*------------------------------------------------------------------------- * Function: check_rename_entry() * * Purpose: Verify that H5C_rename_entry behaves as expected. In @@ -7004,6 +7308,927 @@ check_pin_protected_entry(void) /*------------------------------------------------------------------------- + * Function: check_resize_entry() + * + * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize + * entries as expected. + * + * Return: void + * + * Programmer: John Mainzer + * 7/7/06 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +check_resize_entry(void) +{ + const char * fcn_name = "check_resize_entry"; + static char msg[128]; + herr_t result; + hbool_t in_cache; + hbool_t is_dirty; + hbool_t is_protected; + hbool_t is_pinned; + size_t entry_size; + size_t reported_entry_size; + H5C_t * cache_ptr = NULL; + test_entry_t * base_addr; + test_entry_t * entry_ptr; + + TESTING("entry resize functionality"); + + /* Setup a cache and verify that it is empty. + * + * Then force the load of an entry by protecting it, and verify that + * the entry and cache have the expected sizes. + * + * Then unprotect the entry with the size changed flag and a reduced + * size. Verify that the entry and cache have the expected expected + * sizes. + * + * Use a second protect/unprotect cycle to restore the entry to + * its original size. Verify that the entry and cache have the + * expected sizes. + * + * Protect and unprotect the entry again to pin it. Use + * H5C_resize_entry to reduce its size. Verify that the entry + * and cache have the expected sizes. + * + * Use H5C_resize_entry again to restore the entry to its original + * size. Verify that the entry and cache have the expected sizes. + * + * Use a protect / unprotect cycle to unpin and destroy the entry. + * Verify that the entry and cache have the expected sizes. + * + * + * Obesrve that all the above tests have been done with only one + * entry in the cache. Repeat the tests with several entries in + * the cache. + */ + + pass = TRUE; + + /* tests with only one entry in the cache: */ + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + (size_t)(1 * 1024 * 1024)); + + base_addr = entries[LARGE_ENTRY_TYPE]; + entry_ptr = &(base_addr[0]); + entry_size = LARGE_ENTRY_SIZE; + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 1."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + + if ( pass ) { + + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) { + + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 2."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 1."); + failure_mssg = msg; + + } else if ( !in_cache || is_dirty || !is_protected || is_pinned ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 1."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 1."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_unprotect(NULL, -1, -1, cache_ptr, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, + (void *)entry_ptr, + H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, + (LARGE_ENTRY_SIZE / 2)); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 1."); + failure_mssg = msg; + + } else { + + /* tidy up so we play nice with the standard protect / unprotect + * calls. + */ + entry_ptr->is_protected = FALSE; + entry_ptr->is_dirty = TRUE; + entry_ptr->size = LARGE_ENTRY_SIZE / 2; + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2) ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 3."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 2."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || is_pinned || + ( reported_entry_size != (LARGE_ENTRY_SIZE / 2) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 2."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + + if ( pass ) { + + result = H5C_unprotect(NULL, -1, -1, cache_ptr, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, + (void *)entry_ptr, + (H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), + LARGE_ENTRY_SIZE); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 2."); + failure_mssg = msg; + + } else { + + /* tidy up so we play nice with the standard protect / unprotect + * calls. + */ + entry_ptr->is_protected = FALSE; + entry_ptr->is_dirty = TRUE; + entry_ptr->size = LARGE_ENTRY_SIZE; + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 4."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 3."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || is_pinned || + ( reported_entry_size != LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 3."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__PIN_ENTRY_FLAG); + + if ( pass ) { + + result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, + (LARGE_ENTRY_SIZE / 4)); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_resize_pinned_entry() reports failure 1."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4) ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 5."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 4."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || + ( reported_entry_size != (LARGE_ENTRY_SIZE / 4) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 4."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, + LARGE_ENTRY_SIZE); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_resize_pinned_entry() reports failure 2."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 6."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 5."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || + ( reported_entry_size != LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 5."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, + H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, + &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 6."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 6."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( ! entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 6."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 7."); + failure_mssg = msg; + + } + } + + + /* now repreat the above tests with several entries in the cache: */ + + if ( pass ) { + + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); + failure_mssg = msg; + + } + base_addr = entries[LARGE_ENTRY_TYPE]; + entry_ptr = &(base_addr[3]); + entry_size = LARGE_ENTRY_SIZE; + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__NO_FLAGS_SET); + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1, TRUE, H5C__NO_FLAGS_SET); + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__NO_FLAGS_SET); + + if ( pass ) { + + if ( ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) { + + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 9."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + + if ( pass ) { + + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) { + + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 10."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 7."); + failure_mssg = msg; + + } else if ( !in_cache || is_dirty || !is_protected || is_pinned ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 7."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 7."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_unprotect(NULL, -1, -1, cache_ptr, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, + (void *)entry_ptr, + H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, + (LARGE_ENTRY_SIZE / 2)); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 3."); + failure_mssg = msg; + + } else { + + /* tidy up so we play nice with the standard protect / unprotect + * calls. + */ + entry_ptr->is_protected = FALSE; + entry_ptr->is_dirty = TRUE; + entry_ptr->size = LARGE_ENTRY_SIZE / 2; + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != + ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2)) ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != + (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 11."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 8."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || is_pinned || + ( reported_entry_size != (LARGE_ENTRY_SIZE / 2) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 8."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 8."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + + if ( pass ) { + + result = H5C_unprotect(NULL, -1, -1, cache_ptr, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, + (void *)entry_ptr, + (H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), + LARGE_ENTRY_SIZE); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 4."); + failure_mssg = msg; + + } else { + + /* tidy up so we play nice with the standard protect / unprotect + * calls. + */ + entry_ptr->is_protected = FALSE; + entry_ptr->is_dirty = TRUE; + entry_ptr->size = LARGE_ENTRY_SIZE; + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 12."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 9."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || is_pinned || + ( reported_entry_size != LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 9."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 9."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3, FALSE, H5C__PIN_ENTRY_FLAG); + + if ( pass ) { + + result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, + (LARGE_ENTRY_SIZE / 4)); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_resize_pinned_entry() reports failure 3."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != + ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4)) ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != + (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 13."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 10."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || + ( reported_entry_size != (LARGE_ENTRY_SIZE / 4) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 10."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 10."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, + LARGE_ENTRY_SIZE); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_resize_pinned_entry() reports failure 4."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE) ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE) ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 14."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 11."); + failure_mssg = msg; + + } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || + ( reported_entry_size != LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 11."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 11."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3, FALSE, + H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + + if ( pass ) { + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, + &is_pinned); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 12."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 12."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( ! entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 12."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + if ( ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE) ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 15."); + failure_mssg = msg; + + } + } + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__DELETED_FLAG); + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1, FALSE, H5C__DELETED_FLAG); + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__DELETED_FLAG); + + + if ( pass ) { + + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 16."); + failure_mssg = msg; + + } + } + + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* check_resize_entry() */ + + +/*------------------------------------------------------------------------- * Function: check_flush_protected_err() * * Purpose: Verify that an attempt to flush the cache when it contains @@ -7991,6 +9216,236 @@ check_mark_entry_dirty_errs(void) /*------------------------------------------------------------------------- + * Function: check_expunge_entry_errs() + * + * Purpose: Verify that invalid calls to H5C_expunge_entry() + * generate errors as expected. + * + * Return: void + * + * Programmer: John Mainzer + * 7/6/06 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +check_expunge_entry_errs(void) +{ + const char * fcn_name = "check_expunge_entry_errs()"; + herr_t result; + H5C_t * cache_ptr = NULL; + test_entry_t * entry_ptr; + + TESTING("expunge entry related errors"); + + pass = TRUE; + + /* Allocate a cache, protect an entry, and then call H5C_expunge_entry() + * to expunge it -- this should fail + * + * Unprotect the the entry with the pinned flag, and then call + * H5C_expunge_entry() again. This should fail too. + * + * Finally, unpin the entry and call H5C_expunge_entry() yet again. + * This should succeed. + * + * Destroy the cache -- should succeed. + */ + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + + entry_ptr = &((entries[0])[0]); + + protect_entry(cache_ptr, 0, 0); + + } + + if ( pass ) { + + result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, + &(types[0]), entry_ptr->addr); + + if ( result > 0 ) { + + pass = FALSE; + failure_mssg = + "attempt to expunge a protected entry succeeded.\n"; + + } else { + + unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + + } + } + + if ( pass ) { + + result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, + &(types[0]), entry_ptr->addr); + + if ( result > 0 ) { + + pass = FALSE; + failure_mssg = + "attempt to expunge a pinned entry succeeded.\n"; + + } else { + + unpin_entry(cache_ptr, 0, 0); + + } + } + + if ( pass ) { + + result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, + &(types[0]), entry_ptr->addr); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = + "attempt to expunge an unpinned and unprotected entry failed.\n"; + + } + } + + + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* check_expunge_entry_errs() */ + + +/*------------------------------------------------------------------------- + * Function: check_resize_entry_errs() + * + * Purpose: Verify that invalid calls to H5C_resize_pinned_entry() + * generates errors as expected. + * + * Return: void + * + * Programmer: John Mainzer + * 7/7/06 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +check_resize_entry_errs(void) +{ + const char * fcn_name = "check_resize_entry_errs()"; + herr_t result; + H5C_t * cache_ptr = NULL; + test_entry_t * entry_ptr; + + TESTING("resize entry related errors"); + + pass = TRUE; + + /* Allocate a cache, protect an entry, and then call + * H5C_resize_pinned_entry() to resize it -- this should fail. + * + * 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. + * + * Finally, unpin the entry and destroy the cache. + * This should succeed. + */ + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + + entry_ptr = &((entries[0])[0]); + + protect_entry(cache_ptr, 0, 0); + + } + + if ( pass ) { + + result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, 1); + + if ( result > 0 ) { + + pass = FALSE; + failure_mssg = + "Call to H5C_resize_pinned_entry on a protected entry succeeded.\n"; + + } else { + + unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + + } + } + + if ( pass ) { + + result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, 0); + + if ( result > 0 ) { + + pass = FALSE; + failure_mssg = + "Call to H5C_resize_pinned_entry with 0 new size succeeded.\n"; + + } else { + + unpin_entry(cache_ptr, 0, 0); + + } + } + + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* check_resize_entry_errs() */ + + +/*------------------------------------------------------------------------- * Function: check_auto_cache_resize() * * Purpose: Exercise the automatic cache resizing functionality. @@ -16995,8 +18450,10 @@ main(void) write_permitted_check(); check_flush_cache(); check_get_entry_status(); + check_expunge_entry(); check_rename_entry(); check_pin_protected_entry(); + check_resize_entry(); check_flush_protected_err(); check_destroy_pinned_err(); check_destroy_protected_err(); @@ -17008,6 +18465,8 @@ main(void) check_double_protect_err(); check_double_unprotect_err(); check_mark_entry_dirty_errs(); + check_expunge_entry_errs(); + check_resize_entry_errs(); check_auto_cache_resize(); check_auto_cache_resize_disable(); check_auto_cache_resize_epoch_markers(); diff --git a/test/cache_api.c b/test/cache_api.c index f303601..e72a903 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -187,6 +187,9 @@ check_fapl_mdc_api_calls(void) /* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024 + 1), /* double min_clean_fraction = */ 0.2, @@ -748,6 +751,9 @@ check_file_mdc_api_calls(void) { /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024 + 1), /* double min_clean_fraction = */ 0.2, @@ -773,6 +779,9 @@ check_file_mdc_api_calls(void) { /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ TRUE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (512 * 1024), /* double min_clean_fraction = */ 0.1, @@ -798,6 +807,9 @@ check_file_mdc_api_calls(void) { /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.2, @@ -823,6 +835,9 @@ check_file_mdc_api_calls(void) { /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.15, @@ -1306,6 +1321,9 @@ check_and_validate_cache_size(hid_t file_id, * * Modifications: * + * JRM -- 7/12/06 + * Added progress reporting code. + * *------------------------------------------------------------------------- */ @@ -1320,6 +1338,7 @@ mdc_api_call_smoke_check(void) const char * fcn_name = "mdc_api_call_smoke_check()"; char filename[512]; hbool_t valid_chunk; + hbool_t report_progress = FALSE; hbool_t dump_hit_rate = FALSE; int64_t min_accesses = 1000; double min_hit_rate = 0.90; @@ -1332,6 +1351,7 @@ mdc_api_call_smoke_check(void) hid_t properties; char dset_name[64]; int i, j, k, l, m, n; + int progress_counter; herr_t status; hsize_t dims[2]; hsize_t a_size[2]; @@ -1343,6 +1363,9 @@ mdc_api_call_smoke_check(void) { /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ 500000, /* double min_clean_fraction = */ 0.1, @@ -1368,6 +1391,9 @@ mdc_api_call_smoke_check(void) { /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ 12000000, /* double min_clean_fraction = */ 0.1, @@ -1393,6 +1419,9 @@ mdc_api_call_smoke_check(void) { /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ 2000000, /* double min_clean_fraction = */ 0.1, @@ -1428,6 +1457,13 @@ mdc_api_call_smoke_check(void) */ /* setup the file name */ + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout,"\nSetting up file ... "); + HDfflush(stdout); + } + if ( pass ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) @@ -1466,8 +1502,21 @@ mdc_api_call_smoke_check(void) /* verify that the cache is now set to the alternate config */ validate_mdc_config(file_id, &mod_config_1, TRUE, 2); + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout,"Done.\n"); /* setting up file */ + HDfflush(stdout); + } + /* create the datasets */ + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout,"Creating datasets ... "); + HDfflush(stdout); + } + if ( pass ) { i = 0; @@ -1572,8 +1621,22 @@ mdc_api_call_smoke_check(void) } } + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout,"Done.\n"); + HDfflush(stdout); + } + /* initialize all datasets on a round robin basis */ i = 0; + progress_counter = 0; + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout, "Initializing datasets "); + HDfflush(stdout); + } + while ( ( pass ) && ( i < DSET_SIZE ) ) { j = 0; @@ -1639,6 +1702,24 @@ mdc_api_call_smoke_check(void) } i += CHUNK_SIZE; + + if ( ( pass ) && ( report_progress ) ) { + + progress_counter += CHUNK_SIZE; + + if ( progress_counter >= DSET_SIZE / 20 ) { + + progress_counter = 0; + HDfprintf(stdout, "."); + HDfflush(stdout); + } + } + } + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout," Done.\n"); /* initializing data sets */ + HDfflush(stdout); } /* set alternate config 2 */ @@ -1655,7 +1736,15 @@ mdc_api_call_smoke_check(void) validate_mdc_config(file_id, &mod_config_2, TRUE, 3); /* do random reads on all datasets */ + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout, "Doing random reads on all datasets "); + HDfflush(stdout); + } + n = 0; + progress_counter = 0; while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) { m = rand() % NUM_DSETS; @@ -1738,8 +1827,27 @@ mdc_api_call_smoke_check(void) } n++; + + if ( ( pass ) && ( report_progress ) ) { + + progress_counter++; + + if ( progress_counter >= NUM_RANDOM_ACCESSES / 20 ) { + + progress_counter = 0; + HDfprintf(stdout, "."); + HDfflush(stdout); + } + } + } + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout, " Done.\n"); /* random reads on all data sets */ + HDfflush(stdout); } + /* close the file spaces we are done with */ i = 1; while ( ( pass ) && ( i < NUM_DSETS ) ) @@ -1779,8 +1887,16 @@ mdc_api_call_smoke_check(void) validate_mdc_config(file_id, &mod_config_3, TRUE, 4); /* do random reads on data set 0 only */ + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout, "Doing random reads on dataset 0 "); + HDfflush(stdout); + } + m = 0; n = 0; + progress_counter = 0; while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) { i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; @@ -1858,8 +1974,34 @@ mdc_api_call_smoke_check(void) } n++; + + if ( ( pass ) && ( report_progress ) ) { + + progress_counter++; + + if ( progress_counter >= NUM_RANDOM_ACCESSES / 20 ) { + + progress_counter = 0; + HDfprintf(stdout, "."); + HDfflush(stdout); + } + } + } + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout, " Done.\n"); /* random reads data set 0 */ + HDfflush(stdout); } + + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout,"Shutting down ... "); + HDfflush(stdout); + } + + /* close file space 0 */ if ( pass ) { @@ -1916,6 +2058,13 @@ mdc_api_call_smoke_check(void) } } + if ( ( pass ) && ( report_progress ) ) { + + HDfprintf(stdout,"Done.\n"); /* shutting down */ + HDfflush(stdout); + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } if ( ! pass ) @@ -1929,7 +2078,7 @@ mdc_api_call_smoke_check(void) * used to test error rejection in the MDC related API calls. */ -#define NUM_INVALID_CONFIGS 31 +#define NUM_INVALID_CONFIGS 34 H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = { @@ -1937,6 +2086,9 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 0 -- bad version */ /* int version = */ -1, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -1962,6 +2114,9 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 1 -- bad rpt_fcn_enabled */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ -1, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -1984,9 +2139,96 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 2 -- bad set_initial_size */ + /* 2 -- bad open_trace_file */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ -1, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 3 -- bad close_trace_file */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ -1, + /* char trace_file_name[] = */ "", + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 4 -- open_trace_file == TRUE and empty trace_file_name */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ TRUE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 5 -- bad set_initial_size */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ 2, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2009,9 +2251,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 3 -- max_size too big */ + /* 6 -- max_size too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2034,9 +2279,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 4 -- min_size too small */ + /* 7 -- min_size too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2059,9 +2307,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 5 -- min_size > max_size */ + /* 8 -- min_size > max_size */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ FALSE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2084,9 +2335,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 6 -- initial size out of range (too big) */ + /* 9 -- initial size out of range (too big) */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (16 * 1024 * 1024 + 1), /* double min_clean_fraction = */ 0.25, @@ -2109,9 +2363,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 7 -- initial_size out of range (too small) */ + /* 10 -- initial_size out of range (too small) */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024 - 1), /* double min_clean_fraction = */ 0.25, @@ -2134,9 +2391,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 8 -- min_clean_fraction too big */ + /* 11 -- min_clean_fraction too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 1.000001, @@ -2159,9 +2419,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 9 -- min_clean_fraction too small */ + /* 12 -- min_clean_fraction too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ -0.00000001, @@ -2184,9 +2447,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 10 -- epoch_length too small */ + /* 13 -- epoch_length too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2209,9 +2475,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 11 -- epoch_length too big */ + /* 14 -- epoch_length too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2234,9 +2503,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 12 -- invalid incr_mode */ + /* 15 -- invalid incr_mode */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2259,9 +2531,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 13 -- lower_hr_threshold too small */ + /* 16 -- lower_hr_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2284,9 +2559,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 14 -- lower_hr_threshold too big */ + /* 17 -- lower_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2309,9 +2587,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 15 -- increment too small */ + /* 18 -- increment too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2334,9 +2615,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 16 -- bad apply_max_increment */ + /* 19 -- bad apply_max_increment */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2359,9 +2643,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 17 -- bad decr_mode */ + /* 20 -- bad decr_mode */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2384,9 +2671,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 18 -- upper_hr_threshold too big */ + /* 21 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2409,9 +2699,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 19 -- decrement too small */ + /* 22 -- decrement too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2434,9 +2727,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 20 -- decrement too big */ + /* 23 -- decrement too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2459,9 +2755,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 21 -- epochs_before_eviction too small */ + /* 24 -- epochs_before_eviction too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2484,9 +2783,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 22 -- epochs_before_eviction too big */ + /* 24 -- epochs_before_eviction too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2509,9 +2811,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 23 -- invalid apply_empty_reserve */ + /* 26 -- invalid apply_empty_reserve */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2534,9 +2839,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 24 -- empty_reserve too small */ + /* 27 -- empty_reserve too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2559,9 +2867,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 25 -- empty_reserve too big */ + /* 28 -- empty_reserve too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2584,9 +2895,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 26 -- upper_hr_threshold too small */ + /* 29 -- upper_hr_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2609,9 +2923,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 27 -- upper_hr_threshold too big */ + /* 30 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2634,9 +2951,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 28 -- upper_hr_threshold <= lower_hr_threshold */ + /* 31 -- upper_hr_threshold <= lower_hr_threshold */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2659,9 +2979,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 29 -- dirty_bytes_threshold too small */ + /* 32 -- dirty_bytes_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2684,9 +3007,12 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (H5C__MIN_MAX_CACHE_SIZE / 2) - 1 }, { - /* 30 -- dirty_bytes_threshold too big */ + /* 33 -- dirty_bytes_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2758,7 +3084,7 @@ check_fapl_mdc_api_errs(void) } } - /* Create a FAPL for test purposes, and veify that it contains the + /* Create a FAPL for test purposes, and verify that it contains the * default MDC configuration. */ @@ -2902,6 +3228,7 @@ check_file_mdc_api_errs(void) const char * fcn_name = "check_file_mdc_api_errs()"; char filename[512]; static char msg[128]; + hbool_t show_progress = FALSE; int i; herr_t result; hid_t file_id = -1; @@ -2924,6 +3251,11 @@ check_file_mdc_api_errs(void) /* setup the file name */ if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: calling h5_fixname().\n", fcn_name); + } + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -2934,6 +3266,11 @@ check_file_mdc_api_errs(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: calling H5Fcreate().\n", fcn_name); + } + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if ( file_id < 0 ) { @@ -2951,6 +3288,11 @@ check_file_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", fcn_name); + } + H5E_BEGIN_TRY { result = H5Fget_mdc_config(-1, &scratch); } H5E_END_TRY; @@ -2964,6 +3306,11 @@ check_file_mdc_api_errs(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", fcn_name); + } + H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, NULL); } H5E_END_TRY; @@ -2978,6 +3325,11 @@ check_file_mdc_api_errs(void) scratch.version = -1; /* a convenient, invalid value */ if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", fcn_name); + } + H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, &scratch); } H5E_END_TRY; @@ -2995,6 +3347,11 @@ check_file_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", fcn_name); + } + H5E_BEGIN_TRY { result = H5Fset_mdc_config(-1, &default_config); } H5E_END_TRY; @@ -3008,6 +3365,11 @@ check_file_mdc_api_errs(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", fcn_name); + } + H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, NULL); } H5E_END_TRY; @@ -3022,6 +3384,13 @@ check_file_mdc_api_errs(void) i = 0; while ( ( pass ) && ( i < NUM_INVALID_CONFIGS ) ) { + if ( show_progress ) { + + HDfprintf(stdout, + "%s: testing H5Fset_mdc_config() with invalid config %d.\n", + fcn_name, i); + } + H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, &(invalid_configs[i])); } H5E_END_TRY; @@ -3045,6 +3414,12 @@ check_file_mdc_api_errs(void) /* test H5Fget_mdc_hit_rate() */ if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", + fcn_name); + } + H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate(-1, &hit_rate); } H5E_END_TRY; @@ -3058,6 +3433,12 @@ check_file_mdc_api_errs(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", + fcn_name); + } + H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate(file_id, NULL); } H5E_END_TRY; @@ -3073,6 +3454,12 @@ check_file_mdc_api_errs(void) /* test H5Freset_mdc_hit_rate_stats() */ if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", + fcn_name); + } + H5E_BEGIN_TRY { result = H5Freset_mdc_hit_rate_stats(-1); } H5E_END_TRY; @@ -3089,6 +3476,11 @@ check_file_mdc_api_errs(void) /* test H5Fget_mdc_size() */ if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", fcn_name); + } + H5E_BEGIN_TRY { result = H5Fget_mdc_size(-1, &max_size, &min_clean_size, &cur_size, &cur_num_entries); @@ -3103,6 +3495,11 @@ check_file_mdc_api_errs(void) if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", fcn_name); + } + if ( ( H5Fget_mdc_size(file_id, &max_size, NULL, NULL, NULL) < 0 ) || ( H5Fget_mdc_size(file_id, NULL, &min_clean_size, NULL, NULL) < 0 ) || @@ -3120,6 +3517,11 @@ check_file_mdc_api_errs(void) /* close the file and delete it */ if ( pass ) { + if ( show_progress ) { + + HDfprintf(stdout, "%s: cleaning up from tests.\n", fcn_name); + } + if ( H5Fclose(file_id) < 0 ) { pass = FALSE; @@ -3173,11 +3575,17 @@ main(void) #if 1 check_fapl_mdc_api_calls(); +#endif +#if 1 check_file_mdc_api_calls(); #endif +#if 1 mdc_api_call_smoke_check(); +#endif #if 1 check_fapl_mdc_api_errs(); +#endif +#if 1 check_file_mdc_api_errs(); #endif diff --git a/test/cache_common.c b/test/cache_common.c index ad5fe12..7e04d37 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1449,6 +1449,69 @@ takedown_cache(H5C_t * cache_ptr, /*------------------------------------------------------------------------- + * Function: expunge_entry() + * + * Purpose: Expunge the entry indicated by the type and index. + * + * Do nothing if pass is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 7/6/06 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +void +expunge_entry(H5C_t * cache_ptr, + int32_t type, + int32_t idx) +{ + /* const char * fcn_name = "expunge_entry()"; */ + herr_t result; + test_entry_t * base_addr; + test_entry_t * entry_ptr; + + if ( pass ) { + + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); + + 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 ); + HDassert( entry_ptr->cache_ptr == cache_ptr ); + HDassert( ! ( entry_ptr->header.is_protected ) ); + HDassert( ! ( entry_ptr->is_protected ) ); + HDassert( ! ( entry_ptr->header.is_pinned ) ); + HDassert( ! ( entry_ptr->is_pinned ) ); + + result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, &(types[type]), + entry_ptr->addr); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "error in H5C_expunge_entry()."; + + } + } + + return; + +} /* expunge_entry() */ + + +/*------------------------------------------------------------------------- * Function: flush_cache() * * Purpose: Flush the specified cache, destroying all entries if @@ -1709,7 +1772,7 @@ mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, int32_t type, int32_t idx) { - const char * fcn_name = "mark_pinned_or_protected_entry_dirty()"; + /* const char * fcn_name = "mark_pinned_or_protected_entry_dirty()"; */ herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr; diff --git a/test/cache_common.h b/test/cache_common.h index 452824e..c6c2a32 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -423,6 +423,10 @@ haddr_t type_and_index_to_addr(int32_t type, int32_t idx); #endif +void expunge_entry(H5C_t * cache_ptr, + int32_t type, + int32_t idx); + void insert_entry(H5C_t * cache_ptr, int32_t type, int32_t idx, |