diff options
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | src/H5ACprivate.h | 2 | ||||
-rw-r--r-- | src/H5C.c | 399 | ||||
-rw-r--r-- | src/H5Cprivate.h | 11 | ||||
-rw-r--r-- | test/cache.c | 710 | ||||
-rw-r--r-- | test/cache_api.c | 153 | ||||
-rw-r--r-- | test/cache_common.c | 249 | ||||
-rw-r--r-- | test/cache_common.h | 139 | ||||
-rw-r--r-- | testpar/t_cache.c | 685 |
9 files changed, 923 insertions, 1426 deletions
@@ -25087,7 +25087,6 @@ if test "X-$DEBUG_PKG" = X- ; then fi -#all_packages="ac,b,b2,d,e,f,g,hg,hl,i,mf,mm,o,p,s,t,v,z" all_packages="ac,b,d,e,f,g,hg,hl,i,mf,mm,o,p,s,t,v,z" case "X-$DEBUG_PKG" in X-yes) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 4fa52bc..5afb272 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -156,7 +156,7 @@ extern hid_t H5AC_dxpl_id; /* Dataset transfer property list for independent metadata I/O calls */ /* (just "library internal" set - i.e. independent transfer mode) */ /* (Global variable declaration, definition is in H5AC.c) */ -extern hid_t H5AC_ind_dxpl_id; +H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* Default cache configuration. */ @@ -465,37 +465,18 @@ H5C_create(size_t max_cache_size, cache_ptr->epoch_marker_ringbuf_last = 0; cache_ptr->epoch_marker_ringbuf_size = 0; + /* Initialize all epoch marker entries' fields to zero/FALSE/NULL */ + HDmemset(cache_ptr->epoch_markers, 0, sizeof(cache_ptr->epoch_markers)); + + /* Set non-zero/FALSE/NULL fields for epoch markers */ for ( i = 0; i < H5C__MAX_EPOCH_MARKERS; i++ ) { - (cache_ptr->epoch_marker_active)[i] = FALSE; #ifndef NDEBUG ((cache_ptr->epoch_markers)[i]).magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i; - ((cache_ptr->epoch_markers)[i]).size = (size_t)0; - ((cache_ptr->epoch_markers)[i]).image_ptr = NULL; - ((cache_ptr->epoch_markers)[i]).image_up_to_date = FALSE; ((cache_ptr->epoch_markers)[i]).type = &epoch_marker_class; - ((cache_ptr->epoch_markers)[i]).is_dirty = FALSE; - ((cache_ptr->epoch_markers)[i]).dirtied = FALSE; - ((cache_ptr->epoch_markers)[i]).is_protected = FALSE; - ((cache_ptr->epoch_markers)[i]).is_read_only = FALSE; - ((cache_ptr->epoch_markers)[i]).ro_ref_count = 0; - ((cache_ptr->epoch_markers)[i]).is_pinned = FALSE; - ((cache_ptr->epoch_markers)[i]).in_slist = FALSE; - ((cache_ptr->epoch_markers)[i]).ht_next = NULL; - ((cache_ptr->epoch_markers)[i]).ht_prev = NULL; - ((cache_ptr->epoch_markers)[i]).next = NULL; - ((cache_ptr->epoch_markers)[i]).prev = NULL; - ((cache_ptr->epoch_markers)[i]).aux_next = NULL; - ((cache_ptr->epoch_markers)[i]).aux_prev = NULL; -#if H5C_COLLECT_CACHE_ENTRY_STATS - ((cache_ptr->epoch_markers)[i]).accesses = 0; - ((cache_ptr->epoch_markers)[i]).clears = 0; - ((cache_ptr->epoch_markers)[i]).flushes = 0; - ((cache_ptr->epoch_markers)[i]).pins = 0; -#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ } if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { @@ -615,6 +596,12 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, switch ( (cache_ptr->resize_ctl).decr_mode ) { + case H5C_decr__off: + HDfprintf(stdout, + "%sAuto cache resize -- decrease off. HR = %lf\n", + cache_ptr->prefix, hit_rate); + break; + case H5C_decr__threshold: HDassert( hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold ); @@ -765,57 +752,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5C_dest_empty - * - * Purpose: Destroy an empty cache. - * - * This function fails if the cache is not empty on entry. - * - * Note that *cache_ptr has been freed upon successful return. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/2/04 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_dest_empty(H5C_t * cache_ptr) -{ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5C_dest_empty, FAIL) - - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if ( ( ! cache_ptr ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( cache_ptr->index_len != 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad cache_ptr or non-empty cache on entry.") - } - - - if ( cache_ptr->slist_ptr != NULL ) { - - H5SL_close(cache_ptr->slist_ptr); - cache_ptr->slist_ptr = NULL; - } - - cache_ptr->magic = 0; - - cache_ptr = H5FL_FREE(H5C_t, cache_ptr); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_dest_empty() */ - - -/*------------------------------------------------------------------------- * * Function: H5C_expunge_entry * @@ -989,30 +925,17 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) { flushed_entries_last_pass = FALSE; node_ptr = H5SL_first(cache_ptr->slist_ptr); + HDassert( node_ptr != NULL ); - if ( node_ptr != NULL ) { - - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if ( next_entry_ptr == NULL ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 1 ?!?!"); - } + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") #ifndef NDEBUG - HDassert( next_entry_ptr->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC ); + HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); #endif /* NDEBUG */ - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - - } else { - - next_entry_ptr = NULL; - - } + HDassert( next_entry_ptr->is_dirty ); + HDassert( next_entry_ptr->in_slist ); - HDassert( node_ptr != NULL ); #if H5C_DO_SANITY_CHECKS /* For sanity checking, try to verify that the skip list has @@ -1091,8 +1014,7 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) #ifndef NDEBUG if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "entry_ptr->magic invalid ?!?!"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry_ptr->magic is invalid ?!?!") } else #endif /* NDEBUG */ @@ -1115,11 +1037,8 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( next_entry_ptr == NULL ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 2 ?!?!"); - } + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") #ifndef NDEBUG HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); @@ -1436,9 +1355,7 @@ H5C_flush_to_min_clean(H5F_t * f, #endif /* end modified code -- commented out for now */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_flush_to_min_clean() */ @@ -1631,7 +1548,7 @@ H5C_get_entry_status(const H5F_t *f, hbool_t * is_protected_ptr, hbool_t * is_pinned_ptr) { - H5C_t * cache_ptr; + H5C_t * cache_ptr; H5C_cache_entry_t * entry_ptr = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -1876,6 +1793,20 @@ H5C_insert_entry(H5F_t * f, insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); entry_ptr = (H5C_cache_entry_t *)thing; + + /* verify that the new entry isn't already in the hash table -- scream + * and die if it is. + */ + + H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) + + if(test_entry_ptr != NULL) { + if(test_entry_ptr == entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache.") + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache.") + } /* end if */ + #ifndef NDEBUG entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ @@ -1886,6 +1817,12 @@ H5C_insert_entry(H5F_t * f, entry_ptr->image_ptr = NULL; entry_ptr->image_up_to_date = FALSE; + entry_ptr->is_protected = FALSE; + entry_ptr->is_read_only = FALSE; + entry_ptr->ro_ref_count = 0; + + entry_ptr->is_pinned = insert_pinned; + /* newly inserted entries are assumed to be dirty */ entry_ptr->is_dirty = TRUE; @@ -1999,38 +1936,6 @@ H5C_insert_entry(H5F_t * f, } } - /* verify that the new entry isn't already in the hash table -- scream - * and die if it is. - */ - - H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) - - if ( test_entry_ptr != NULL ) { - - if ( test_entry_ptr == entry_ptr ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "entry already in cache.") - - } else { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "duplicate entry in cache, addr = %llu", (unsigned long long)addr) - } - } - - /* we don't initialize the protected field until here as it is - * possible that the entry is already in the cache, and already - * protected. If it is, we don't want to make things worse by - * marking it unprotected. - */ - - entry_ptr->is_protected = FALSE; - entry_ptr->is_read_only = FALSE; - entry_ptr->ro_ref_count = 0; - - entry_ptr->is_pinned = insert_pinned; - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) /* New entries are presumed to be dirty, so this if statement is @@ -2616,9 +2521,8 @@ done: herr_t H5C_resize_entry(void *thing, size_t new_size) { - H5C_t * cache_ptr; + H5C_t * cache_ptr; H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; - size_t size_increase; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_resize_entry, FAIL) @@ -2651,6 +2555,7 @@ H5C_resize_entry(void *thing, size_t new_size) if ( cache_ptr->flash_size_increase_possible ) { if ( new_size > entry_ptr->size ) { + size_t size_increase; size_increase = new_size - entry_ptr->size; @@ -2720,8 +2625,8 @@ done: herr_t H5C_pin_protected_entry(void *thing) { - H5C_t * cache_ptr; - H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_pin_protected_entry, FAIL) @@ -4057,8 +3962,8 @@ H5C_stats__reset(H5C_t UNUSED * cache_ptr) herr_t H5C_unpin_entry(void *_entry_ptr) { - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_entry_ptr; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)_entry_ptr; /* Pointer to entry to unpin */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_unpin_entry, FAIL) @@ -6034,27 +5939,19 @@ H5C_flush_invalidate_cache(const H5F_t * f, if ( cache_ptr->slist_len == 0 ) { node_ptr = NULL; - next_entry_ptr = NULL; HDassert( cache_ptr->slist_size == 0 ); } else { + /* Start at beginning of skip list each time */ node_ptr = H5SL_first(cache_ptr->slist_ptr); + HDassert( node_ptr != NULL ); - if ( node_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "slist_len != 0 && node_ptr == NULL"); - } - + /* Get cache entry for this node */ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if ( next_entry_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 1 ?!?!"); - } -#ifndef NDEBUG + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); -#endif /* NDEBUG */ HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); @@ -6124,8 +6021,7 @@ H5C_flush_invalidate_cache(const H5F_t * f, #ifndef NDEBUG if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "entry_ptr->magic is invalid ?!?!"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry_ptr->magic is invalid ?!?!") } else #endif /* NDEBUG */ @@ -6147,19 +6043,13 @@ H5C_flush_invalidate_cache(const H5F_t * f, next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( next_entry_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 2 ?!?!"); - } -#ifndef NDEBUG - HDassert( next_entry_ptr->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC ); -#endif /* NDEBUG */ + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); } else { - next_entry_ptr = NULL; } @@ -6412,7 +6302,7 @@ H5C_flush_invalidate_cache(const H5F_t * f, } else if ( cur_pel_len > 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Can't unpin all pinned entries 2.") + "Can't unpin all pinned entries.") } @@ -6470,7 +6360,7 @@ H5C_flush_single_entry(const H5F_t * f, hbool_t was_dirty; herr_t status; int type_id; - unsigned serialize_flags = 0; + unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; haddr_t new_addr; size_t new_len; void * new_image_ptr; @@ -6515,17 +6405,6 @@ H5C_flush_single_entry(const H5F_t * f, } } } -#if 0 - /* this should be useful for debugging from time to time. - * lets leave it in for now. -- JRM 12/15/04 - */ - else { - HDfprintf(stdout, - "H5C_flush_single_entry(): non-existant entry. addr = %a\n", - addr); - HDfflush(stdout); - } -#endif #endif /* H5C_DO_SANITY_CHECKS */ if ( ( entry_ptr != NULL ) && ( entry_ptr->is_protected ) ) @@ -6565,7 +6444,7 @@ H5C_flush_single_entry(const H5F_t * f, if ( NULL == (dxpl = H5I_object(dxpl_id)) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ - "not a dataset creation property list") + "not a dataset transfer property list") } /* Get the transfer mode property */ @@ -6576,12 +6455,6 @@ H5C_flush_single_entry(const H5F_t * f, } /* Sanity check transfer mode */ - /* I'm surprised that this sanity check is working at - * present -- will need to look into it at some point. - * - * JRM -- 7/7/07 - */ - HDassert( xfer_mode == H5FD_MPIO_COLLECTIVE ); } @@ -6631,133 +6504,6 @@ H5C_flush_single_entry(const H5F_t * f, /* Update the replacement policy for the flush or eviction. */ if ( destroy ) { /* AKA eviction */ -#if 0 /* JRM */ - /* This test code may come in handy -- lets keep it for a while. - * - * Note that it will cause spurious errors in the serial case - * unless we are maintaining the clean and dirty LRU lists. - */ - { - if ( entry_ptr->is_dirty ) - { - if ( cache_ptr->dLRU_head_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_head_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->dLRU_tail_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_tail_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->dLRU_list_len <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_list_len <= 0.\n", - FUNC); - - if ( cache_ptr->dLRU_list_size <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_list_size <= 0.\n", - FUNC); - - if ( cache_ptr->dLRU_list_size < entry_ptr->size ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_list_size < entry_ptr->size.\n", - FUNC); - - if ( ( (cache_ptr->dLRU_list_size) == entry_ptr->size ) && - ( ! ( (cache_ptr->dLRU_list_len) == 1 ) ) ) - HDfprintf(stdout, - "%s: dLRU_list_size == size && dLRU_list_len != 1\n", - FUNC); - - if ( ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->dLRU_head_ptr != entry_ptr ) ) - HDfprintf(stdout, - "%s: entry_ptr->aux_prev == NULL && dLRU_head_ptr != entry_ptr\n", - FUNC); - - if ( ( entry_ptr->aux_next == NULL ) && - ( cache_ptr->dLRU_tail_ptr != entry_ptr ) ) - HDfprintf(stdout, - "%s: entry_ptr->aux_next == NULL && dLRU_tail_ptr != entry_ptr\n", - FUNC); - - if ( ( cache_ptr->dLRU_list_len == 1 ) && - ( ! ( ( cache_ptr->dLRU_head_ptr == entry_ptr ) && - ( cache_ptr->dLRU_tail_ptr == entry_ptr ) && - ( entry_ptr->aux_next == NULL ) && - ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->dLRU_list_size == entry_ptr->size ) - ) - ) - ) - { - HDfprintf(stdout, - "%s: single entry dlru sanity check fails\n", - FUNC); - } - - } - else - { - if ( cache_ptr->cLRU_head_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_head_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->cLRU_tail_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_tail_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->cLRU_list_len <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_list_len <= 0.\n", - FUNC); - - if ( cache_ptr->cLRU_list_size <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_list_size <= 0.\n", - FUNC); - - if ( cache_ptr->cLRU_list_size < entry_ptr->size ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_list_size < entry_ptr->size.\n", - FUNC); - - if ( ( (cache_ptr->cLRU_list_size) == entry_ptr->size ) && - ( ! ( (cache_ptr->cLRU_list_len) == 1 ) ) ) - HDfprintf(stdout, - "%s: cLRU_list_size == size && cLRU_list_len != 1\n", - FUNC); - - if ( ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->cLRU_head_ptr != entry_ptr ) ) - HDfprintf(stdout, "%s: entry_ptr->aux_prev == NULL && cLRU_head_ptr != entry_ptr\n", FUNC); - - if ( ( entry_ptr->aux_next == NULL ) && - ( cache_ptr->cLRU_tail_ptr != entry_ptr ) ) - HDfprintf(stdout, "%s: entry_ptr->aux_next == NULL && cLRU_tail_ptr != entry_ptr\n", FUNC); - - if ( ( cache_ptr->cLRU_list_len == 1 ) && - ( ! ( ( cache_ptr->cLRU_head_ptr == entry_ptr ) && - ( cache_ptr->cLRU_tail_ptr == entry_ptr ) && - ( entry_ptr->aux_next == NULL ) && - ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->cLRU_list_size == entry_ptr->size ) - ) - ) - ) - { - HDfprintf(stdout, - "%s: single entry clru sanity check fails\n", - FUNC); - } - } - } -#endif /* JRM */ - H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL) } else { @@ -6913,7 +6659,7 @@ H5C_flush_single_entry(const H5F_t * f, * the image was up to date on entry, serialize_flags should * still be 0 at this point. */ - if ( serialize_flags != 0 ) { + if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { /* In the parallel case, resizes and moves in * the serialize operation can cause problems. @@ -7001,9 +6747,7 @@ H5C_flush_single_entry(const H5F_t * f, } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_flush_single_entry() */ @@ -7170,13 +6914,13 @@ H5C_load_entry(H5F_t * f, */ HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6) ); - HDassert( entry->size < H5C_MAX_ENTRY_SIZE ); #ifndef NDEBUG entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ entry->cache_ptr = f->shared->cache; entry->addr = addr; entry->size = len; + HDassert(entry->size < H5C_MAX_ENTRY_SIZE); entry->image_ptr = image; entry->image_up_to_date = TRUE; entry->type = type; @@ -7467,27 +7211,6 @@ H5C_make_space_in_cache(H5F_t * f, * from the tail. */ -#if 0 /* This debuging code may be useful in the future -- keep it for now. */ - if ( ! ( prev_ptr->is_dirty ) ) { - HDfprintf(stdout, "%s: ! prev_ptr->is_dirty\n", - FUNC); - } - if ( prev_ptr->aux_next != next_ptr ) { - HDfprintf(stdout, "%s: prev_ptr->next != next_ptr\n", - FUNC); - } - if ( prev_ptr->is_protected ) { - HDfprintf(stdout, "%s: prev_ptr->is_protected\n", - FUNC); - } - if ( prev_ptr->is_pinned ) { - HDfprintf(stdout, "%s:prev_ptr->is_pinned\n", - FUNC); - } - - HDfprintf(stdout, "%s: re-starting scan of dirty list\n", - FUNC); -#endif /* JRM */ entry_ptr = cache_ptr->dLRU_tail_ptr; } else { diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index eecade6..db0a856 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -32,12 +32,12 @@ #include "H5Cpublic.h" /* public prototypes */ -/* Pivate headers needed by this header */ +/* Private headers needed by this header */ #include "H5private.h" /* Generic Functions */ #include "H5Fprivate.h" /* File access */ -#define H5C_DO_SANITY_CHECKS 1 +#define H5C_DO_SANITY_CHECKS 0 #define H5C_DO_EXTREME_SANITY_CHECKS 0 /* Note: The memory sanity checks aren't going to work until I/O filters are * changed to call a particular alloc/free routine for their buffers, @@ -55,12 +55,12 @@ * * JRM - 5/17/04 */ -#define H5C_MAX_ENTRY_SIZE ((size_t)(10 * 1024 * 1024)) +#define H5C_MAX_ENTRY_SIZE ((size_t)(32 * 1024 * 1024)) /* H5C_COLLECT_CACHE_STATS controls overall collection of statistics * on cache activity. In general, this #define should be set to 0. */ -#define H5C_COLLECT_CACHE_STATS 1 +#define H5C_COLLECT_CACHE_STATS 0 /* H5C_COLLECT_CACHE_ENTRY_STATS controls collection of statistics * in individual cache entries. @@ -427,6 +427,7 @@ typedef void *(*H5C_deserialize_func_t)(const void *image_ptr, typedef herr_t (*H5C_image_len_func_t)(const void *thing, size_t *image_len_ptr); +#define H5C__SERIALIZE_NO_FLAGS_SET ((unsigned)0) #define H5C__SERIALIZE_RESIZED_FLAG ((unsigned)0x1) #define H5C__SERIALIZE_MOVED_FLAG ((unsigned)0x2) @@ -1304,8 +1305,6 @@ H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, H5_DLL herr_t H5C_dest(H5F_t * f, hid_t dxpl_id); -H5_DLL herr_t H5C_dest_empty(H5C_t * cache_ptr); - H5_DLL herr_t H5C_expunge_entry(H5F_t * f, hid_t dxpl_id, const H5C_class_t * type, diff --git a/test/cache.c b/test/cache.c index 0e5f980..805c5e1 100644 --- a/test/cache.c +++ b/test/cache.c @@ -100,17 +100,17 @@ struct move_entry_test_spec /* private function declarations: */ -static unsigned smoke_check_1(void); -static unsigned smoke_check_2(void); -static unsigned smoke_check_3(void); -static unsigned smoke_check_4(void); -static unsigned smoke_check_5(void); -static unsigned smoke_check_6(void); -static unsigned smoke_check_7(void); -static unsigned smoke_check_8(void); -static unsigned smoke_check_9(void); -static unsigned smoke_check_10(void); -static unsigned write_permitted_check(void); +static unsigned smoke_check_1(int express_test); +static unsigned smoke_check_2(int express_test); +static unsigned smoke_check_3(int express_test); +static unsigned smoke_check_4(int express_test); +static unsigned smoke_check_5(int express_test); +static unsigned smoke_check_6(int express_test); +static unsigned smoke_check_7(int express_test); +static unsigned smoke_check_8(int express_test); +static unsigned smoke_check_9(int express_test); +static unsigned smoke_check_10(int express_test); +static unsigned write_permitted_check(int express_test); static unsigned check_insert_entry(void); static unsigned check_flush_cache(void); static void check_flush_cache__empty_cache(H5F_t * file_ptr); @@ -222,7 +222,7 @@ static unsigned check_auto_cache_resize_aux_fcns(void); */ static unsigned -smoke_check_1(void) +smoke_check_1(int express_test) { const char * fcn_name = "smoke_check_1"; hbool_t show_progress = FALSE; @@ -400,8 +400,7 @@ smoke_check_1(void) fcn_name, failure_mssg); } - - return !pass; + return (unsigned)!pass; } /* smoke_check_1() */ @@ -429,7 +428,7 @@ smoke_check_1(void) */ static unsigned -smoke_check_2(void) +smoke_check_2(int express_test) { const char * fcn_name = "smoke_check_2"; hbool_t show_progress = FALSE; @@ -607,7 +606,7 @@ smoke_check_2(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_2() */ @@ -634,7 +633,7 @@ smoke_check_2(void) */ static unsigned -smoke_check_3(void) +smoke_check_3(int express_test) { const char * fcn_name = "smoke_check_3"; hbool_t show_progress = FALSE; @@ -812,7 +811,7 @@ smoke_check_3(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_3() */ @@ -840,7 +839,7 @@ smoke_check_3(void) */ static unsigned -smoke_check_4(void) +smoke_check_4(int express_test) { const char * fcn_name = "smoke_check_4"; hbool_t show_progress = FALSE; @@ -1018,7 +1017,7 @@ smoke_check_4(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_4() */ @@ -1046,7 +1045,7 @@ smoke_check_4(void) */ static unsigned -smoke_check_5(void) +smoke_check_5(int express_test) { const char * fcn_name = "smoke_check_5"; herr_t result; @@ -1261,7 +1260,7 @@ smoke_check_5(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_5() */ @@ -1289,7 +1288,7 @@ smoke_check_5(void) */ static unsigned -smoke_check_6(void) +smoke_check_6(int express_test) { const char * fcn_name = "smoke_check_6"; herr_t result; @@ -1504,7 +1503,7 @@ smoke_check_6(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_6() */ @@ -1532,7 +1531,7 @@ smoke_check_6(void) */ static unsigned -smoke_check_7(void) +smoke_check_7(int express_test) { const char * fcn_name = "smoke_check_7"; herr_t result; @@ -1748,7 +1747,7 @@ smoke_check_7(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_7() */ @@ -1776,7 +1775,7 @@ smoke_check_7(void) */ static unsigned -smoke_check_8(void) +smoke_check_8(int express_test) { const char * fcn_name = "smoke_check_8"; herr_t result; @@ -1872,8 +1871,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - file_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); cache_ptr = file_ptr->shared->cache; if ( pass ) { @@ -1992,7 +1990,7 @@ smoke_check_8(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_8() */ @@ -2021,7 +2019,7 @@ smoke_check_8(void) */ static unsigned -smoke_check_9(void) +smoke_check_9(int express_test) { const char * fcn_name = "smoke_check_9"; herr_t result; @@ -2313,7 +2311,7 @@ smoke_check_9(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_9() */ @@ -2342,7 +2340,7 @@ smoke_check_9(void) */ static unsigned -smoke_check_10(void) +smoke_check_10(int express_test) { const char * fcn_name = "smoke_check_10"; herr_t result; @@ -2629,7 +2627,7 @@ smoke_check_10(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* smoke_check_10() */ @@ -2654,7 +2652,7 @@ smoke_check_10(void) */ static unsigned -write_permitted_check(void) +write_permitted_check(int express_test) { #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS @@ -2842,7 +2840,7 @@ write_permitted_check(void) #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - return !pass; + return (unsigned)!pass; } /* write_permitted_check() */ @@ -3140,7 +3138,7 @@ check_insert_entry(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_insert_entry() */ @@ -3225,7 +3223,7 @@ check_flush_cache(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_flush_cache() */ @@ -12734,8 +12732,8 @@ check_get_entry_status(void) hbool_t is_pinned; size_t entry_size; H5F_t * file_ptr = NULL; - test_entry_t * base_addr; - test_entry_t * entry_ptr; + test_entry_t * base_addr = NULL; + test_entry_t * entry_ptr = NULL; TESTING("H5C_get_entry_status() functionality"); @@ -12748,8 +12746,18 @@ check_get_entry_status(void) file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); - base_addr = entries[0]; - entry_ptr = &(base_addr[0]); + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else { + + base_addr = entries[0]; + entry_ptr = &(base_addr[0]); + + } } if ( pass ) { @@ -12776,9 +12784,13 @@ check_get_entry_status(void) } } - protect_entry(file_ptr, 0, 0); + if ( pass ) { + + protect_entry(file_ptr, 0, 0); + + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + } if ( pass ) { @@ -12800,7 +12812,11 @@ check_get_entry_status(void) } } - protect_entry(file_ptr, 0, 0); + if ( pass ) { + + protect_entry(file_ptr, 0, 0); + + } if ( pass ) { @@ -12822,7 +12838,11 @@ check_get_entry_status(void) } } - unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + if ( pass ) { + + unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + + } if ( pass ) { @@ -12844,7 +12864,11 @@ check_get_entry_status(void) } } - mark_entry_dirty(0, 0); + if ( pass ) { + + mark_entry_dirty(0, 0); + + } if ( pass ) { @@ -12866,7 +12890,11 @@ check_get_entry_status(void) } } - unpin_entry(0, 0); + if ( pass ) { + + unpin_entry(0, 0); + + } if ( pass ) { @@ -12901,7 +12929,7 @@ check_get_entry_status(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_get_entry_status() */ @@ -12990,9 +13018,13 @@ check_expunge_entry(void) * it without marking it dirty. */ - protect_entry(file_ptr, 0, 0); + if ( pass ) { + + protect_entry(file_ptr, 0, 0); - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + + } if ( pass ) { @@ -13027,7 +13059,11 @@ check_expunge_entry(void) * Also verify that the entry was loaded and destroyed, but * not flushed. */ - expunge_entry(file_ptr, 0, 0); + if ( pass ) { + + expunge_entry(file_ptr, 0, 0); + + } if ( pass ) { @@ -13107,9 +13143,13 @@ check_expunge_entry(void) * it with the dirty flag set. */ - protect_entry(file_ptr, 0, 1); + if ( pass ) { + + protect_entry(file_ptr, 0, 1); - unprotect_entry(file_ptr, 0, 1, H5C__DIRTIED_FLAG); + unprotect_entry(file_ptr, 0, 1, H5C__DIRTIED_FLAG); + + } if ( pass ) { @@ -13145,7 +13185,11 @@ check_expunge_entry(void) * Also verify that the entry was loaded and destroyed, but not * flushed. */ - expunge_entry(file_ptr, 0, 1); + if ( pass ) { + + expunge_entry(file_ptr, 0, 1); + + } if ( pass ) { @@ -13194,7 +13238,7 @@ check_expunge_entry(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_expunge_entry() */ @@ -13615,7 +13659,7 @@ check_multiple_read_protect(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_multiple_read_protect() */ @@ -13728,7 +13772,7 @@ check_move_entry(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_move_entry() */ @@ -13806,14 +13850,18 @@ check_move_entry__run_test(H5F_t * file_ptr, } } - protect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index); + if ( pass ) { - if(spec_ptr->is_dirty) - flags |= H5C__DIRTIED_FLAG; + protect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index); - unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags); + if(spec_ptr->is_dirty) + flags |= H5C__DIRTIED_FLAG; - move_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE); + unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags); + + move_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE); + + } if ( pass ) { @@ -13926,9 +13974,20 @@ check_pin_protected_entry(void) file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); + + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } } - protect_entry(file_ptr, 0, 0); + if ( pass ) { + + protect_entry(file_ptr, 0, 0); + + } if ( pass ) { @@ -13971,7 +14030,7 @@ check_pin_protected_entry(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_pin_protected_entry() */ @@ -14048,11 +14107,20 @@ check_resize_entry(void) file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); - cache_ptr = file_ptr->shared->cache; + if ( file_ptr == NULL ) { - base_addr = entries[LARGE_ENTRY_TYPE]; - entry_ptr = &(base_addr[0]); - entry_size = LARGE_ENTRY_SIZE; + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else + { + cache_ptr = file_ptr->shared->cache; + + base_addr = entries[LARGE_ENTRY_TYPE]; + entry_ptr = &(base_addr[0]); + entry_size = LARGE_ENTRY_SIZE; + } } if ( pass ) { @@ -14069,7 +14137,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + + } if ( pass ) { @@ -14195,7 +14267,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + + } if ( pass ) { @@ -14276,9 +14352,13 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__PIN_ENTRY_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__PIN_ENTRY_FLAG); + + } if ( pass ) { @@ -14398,10 +14478,14 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, - H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, + H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + + } if ( pass ) { @@ -14448,7 +14532,7 @@ check_resize_entry(void) } - /* now repreat the above tests with several entries in the cache: */ + /* now repeat the above tests with several entries in the cache: */ if ( pass ) { @@ -14467,14 +14551,18 @@ check_resize_entry(void) entry_size = LARGE_ENTRY_SIZE; } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); + + } if ( pass ) { @@ -14491,7 +14579,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + + } if ( pass ) { @@ -14619,7 +14711,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + + } if ( pass ) { @@ -14700,9 +14796,13 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__PIN_ENTRY_FLAG); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__PIN_ENTRY_FLAG); + } if ( pass ) { @@ -14824,10 +14924,14 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, - H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, + H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + + } if ( pass ) { @@ -14873,15 +14977,18 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DELETED_FLAG); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DELETED_FLAG); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DELETED_FLAG); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__DELETED_FLAG); + } if ( pass ) { @@ -14910,7 +15017,7 @@ check_resize_entry(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_resize_entry() */ @@ -14946,7 +15053,7 @@ check_evictions_enabled(void) size_t entry_size; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; - test_entry_t * base_addr; + test_entry_t * base_addr = NULL; test_entry_t * entry_ptr; TESTING("evictions enabled/disabled functionality"); @@ -14999,10 +15106,19 @@ check_evictions_enabled(void) file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)( 512 * 1024)); - cache_ptr = file_ptr->shared->cache; + if ( file_ptr == NULL ) { - base_addr = entries[MONSTER_ENTRY_TYPE]; - entry_size = MONSTER_ENTRY_SIZE; + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else + { + cache_ptr = file_ptr->shared->cache; + + base_addr = entries[MONSTER_ENTRY_TYPE]; + entry_size = MONSTER_ENTRY_SIZE; + } } if ( show_progress ) /* 2 */ @@ -15046,11 +15162,15 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* fill the cache */ - for ( i = 0; i < 16 ; i++ ) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* fill the cache */ + for ( i = 0; i < 16 ; i++ ) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); + } + } if ( show_progress ) /* 5 */ @@ -15078,9 +15198,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect another entry */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect another entry */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 7 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15141,8 +15265,12 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* insert an entry */ - insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* insert an entry */ + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 10 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15240,9 +15368,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect another entry */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect another entry */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 15 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15268,8 +15400,12 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* insert another entry */ - insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* insert another entry */ + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 17 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15312,9 +15448,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect an entry that is in the cache */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect an entry that is in the cache */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 20 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15340,9 +15480,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect an entry that isn't in the cache */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect an entry that isn't in the cache */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 22 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15458,12 +15602,15 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect an entry that isn't in the cache, forcing - * the cache to grow. - */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21, H5C__NO_FLAGS_SET); + if ( pass ) { + /* protect and unprotect an entry that isn't in the cache, forcing + * the cache to grow. + */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 27 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15506,8 +15653,12 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* insert an entry */ - insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* insert an entry */ + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 30 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15602,7 +15753,7 @@ check_evictions_enabled(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_evictions_enabled() */ @@ -15676,7 +15827,7 @@ check_flush_protected_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_flush_protected_err() */ @@ -15768,7 +15919,7 @@ check_destroy_pinned_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_destroy_pinned_err() */ @@ -15854,7 +16005,7 @@ check_destroy_protected_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_destroy_protected_err() */ @@ -15879,7 +16030,7 @@ static unsigned check_duplicate_insert_err(void) { const char * fcn_name = "check_duplicate_insert_err"; - herr_t result; + herr_t result = -1; H5F_t * file_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -15933,7 +16084,7 @@ check_duplicate_insert_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_duplicate_insert_err() */ @@ -16028,7 +16179,7 @@ check_move_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_move_err() */ @@ -16116,7 +16267,7 @@ check_double_pin_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_double_pin_err() */ @@ -16215,7 +16366,7 @@ check_double_unpin_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_double_unpin_err() */ @@ -16326,7 +16477,7 @@ check_pin_entry_errs(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_pin_entry_errs() */ @@ -16376,7 +16527,7 @@ check_double_protect_err(void) if ( pass ) { - cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -16405,7 +16556,7 @@ check_double_protect_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_double_protect_err() */ @@ -16482,7 +16633,7 @@ check_double_unprotect_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_double_unprotect_err() */ @@ -16562,7 +16713,7 @@ check_mark_entry_dirty_errs(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_mark_entry_dirty_errs() */ @@ -16686,7 +16837,7 @@ check_expunge_entry_errs(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_expunge_entry_errs() */ @@ -16788,7 +16939,7 @@ check_resize_entry_errs(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_resize_entry_errs() */ @@ -16914,7 +17065,7 @@ check_unprotect_ro_dirty_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_unprotect_ro_dirty_err() */ @@ -16969,7 +17120,7 @@ check_protect_ro_rw_err(void) if ( pass ) { - thing_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -16998,7 +17149,7 @@ check_protect_ro_rw_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_protect_ro_rw_err() */ @@ -17124,7 +17275,7 @@ check_check_evictions_enabled_err(void) } - if ( pass ) { + if ( cache_ptr ) { takedown_cache(file_ptr, FALSE, FALSE); } @@ -17137,7 +17288,7 @@ check_check_evictions_enabled_err(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_evictions_enabled_err() */ @@ -20300,6 +20451,10 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* now repeat the above tests using the add space flash cache size + * increment algorithm. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -20509,6 +20664,7 @@ check_auto_cache_resize(void) if ( pass ) { insert_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); + /* protect and unprotect a couple times to increment cache_accesses */ protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1); unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); @@ -21349,7 +21505,7 @@ check_auto_cache_resize(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize() */ @@ -21447,7 +21603,17 @@ check_auto_cache_resize_disable(void) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - cache_ptr = file_ptr->shared->cache; + + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else { + + cache_ptr = file_ptr->shared->cache; + } } if ( pass ) { @@ -22489,8 +22655,12 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(file_ptr, TRUE, FALSE, FALSE); + if ( pass ) { + + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(file_ptr, TRUE, FALSE, FALSE); + + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -22712,8 +22882,12 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(file_ptr, TRUE, FALSE, FALSE); + if ( pass ) { + + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(file_ptr, TRUE, FALSE, FALSE); + + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -22942,8 +23116,12 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(file_ptr, TRUE, FALSE, FALSE); + if ( pass ) { + + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(file_ptr, TRUE, FALSE, FALSE); + + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -24057,7 +24235,7 @@ check_auto_cache_resize_disable(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_disable() */ @@ -24762,7 +24940,7 @@ check_auto_cache_resize_epoch_markers(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_epoch_markers() */ @@ -24788,34 +24966,6 @@ check_auto_cache_resize_epoch_markers(void) *------------------------------------------------------------------------- */ -#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \ -( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn == (b).rpt_fcn ) && \ - ( ( ! compare_init ) || \ - ( (a).set_initial_size == (b).set_initial_size ) ) && \ - ( ( ! compare_init ) || \ - ( (a).initial_size == (b).initial_size ) ) && \ - ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ - ( (a).max_size == (b).max_size ) && \ - ( (a).min_size == (b).min_size ) && \ - ( (a).epoch_length == (b).epoch_length ) && \ - ( (a).incr_mode == (b).incr_mode ) && \ - ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ - ( (a).apply_max_increment == (b).apply_max_increment ) && \ - ( (a).max_increment == (b).max_increment ) && \ - ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ - ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ - ( (a).decr_mode == (b).decr_mode ) && \ - ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ - ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ - ( (a).max_decrement == (b).max_decrement ) && \ - ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ - ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ - ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) - static unsigned check_auto_cache_resize_input_errs(void) { @@ -24922,8 +25072,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 1."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 1."; @@ -24994,8 +25144,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 2."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 2."; @@ -25069,8 +25219,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 3."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 3."; @@ -25145,8 +25295,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 4."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 4."; @@ -25218,8 +25368,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 5."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 5."; @@ -25293,8 +25443,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 6."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 6."; @@ -25365,8 +25515,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 7."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 7."; @@ -25441,8 +25591,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 8."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 8."; @@ -25513,8 +25663,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 9."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 9."; @@ -25585,8 +25735,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 10."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 10."; @@ -25660,8 +25810,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 11."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 11."; @@ -25732,8 +25882,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 12."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 12."; @@ -25808,8 +25958,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 13."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 13."; @@ -25881,8 +26031,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 14."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 14."; @@ -25956,8 +26106,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 15."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 15."; @@ -26028,8 +26178,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 16."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 16."; @@ -26100,8 +26250,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 17."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 17."; @@ -26176,8 +26326,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 18."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 18."; @@ -26251,8 +26401,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 19."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 19."; @@ -26326,8 +26476,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 20."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 20."; @@ -26399,8 +26549,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 21."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 21."; @@ -26474,8 +26624,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 22."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 22."; @@ -26547,8 +26697,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 23."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 23."; @@ -26623,8 +26773,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 24."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 24."; @@ -26696,8 +26846,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 25."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 25."; @@ -26771,8 +26921,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 26."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 26."; @@ -26843,8 +26993,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 27."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 27."; @@ -26917,8 +27067,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 28."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 28."; @@ -26989,8 +27139,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 29."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 29."; @@ -27063,8 +27213,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 30."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 30."; @@ -27135,8 +27285,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 31."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 31."; @@ -27185,7 +27335,7 @@ check_auto_cache_resize_input_errs(void) } } - if ( pass ) { + if ( cache_ptr ) { takedown_cache(file_ptr, FALSE, FALSE); } @@ -27198,7 +27348,7 @@ check_auto_cache_resize_input_errs(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_input_errs() */ @@ -27347,7 +27497,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( hit_rate != 0.0 ) { + } else if ( hit_rate > FP_EPSILON ) { /* i.e. hit_rate != 0.0 */ pass = FALSE; failure_mssg = @@ -27380,7 +27530,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( hit_rate != 0.0 ) { + } else if ( hit_rate > FP_EPSILON ) { /* i.e. hit_rate != 0.0 */ pass = FALSE; failure_mssg = @@ -27425,7 +27575,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, 0.00001) ) { + } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = @@ -27508,7 +27658,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, 0.00001) ) { + } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = @@ -27764,7 +27914,7 @@ check_auto_cache_resize_aux_fcns(void) } } - if ( pass ) { + if ( cache_ptr ) { takedown_cache(file_ptr, FALSE, FALSE); } @@ -27777,7 +27927,7 @@ check_auto_cache_resize_aux_fcns(void) fcn_name, failure_mssg); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_aux_fcns() */ @@ -27802,48 +27952,30 @@ check_auto_cache_resize_aux_fcns(void) int main(void) { - const char *envval = NULL; unsigned nerrs = 0; + int express_test; H5open(); express_test = GetTestExpress(); - if ( express_test >= 3 ) { - - skip_long_tests = TRUE; - - } else { - - skip_long_tests = FALSE; - } - -#ifdef NDEBUG - run_full_test = TRUE; -#else /* NDEBUG */ - run_full_test = FALSE; -#endif /* NDEBUG */ - -#if 0 - run_full_test = TRUE; -#endif printf("=========================================\n"); printf("Internal cache tests\n"); printf(" express_test = %d\n", express_test); - printf(" skip_long_tests = %d\n", (int)skip_long_tests); printf("=========================================\n"); - nerrs += smoke_check_1(); - nerrs += smoke_check_2(); - nerrs += smoke_check_3(); - nerrs += smoke_check_4(); - nerrs += smoke_check_5(); - nerrs += smoke_check_6(); - nerrs += smoke_check_7(); - nerrs += smoke_check_8(); - nerrs += smoke_check_9(); - nerrs += smoke_check_10(); - nerrs += write_permitted_check(); + nerrs += smoke_check_1(express_test); + nerrs += smoke_check_2(express_test); + nerrs += smoke_check_3(express_test); + nerrs += smoke_check_4(express_test); + nerrs += smoke_check_5(express_test); + nerrs += smoke_check_6(express_test); + nerrs += smoke_check_7(express_test); + nerrs += smoke_check_8(express_test); + nerrs += smoke_check_9(express_test); + nerrs += smoke_check_10(express_test); + + nerrs += write_permitted_check(express_test); nerrs += check_insert_entry(); nerrs += check_flush_cache(); diff --git a/test/cache_api.c b/test/cache_api.c index dfbe12d..8ec55d7 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -38,7 +38,7 @@ static unsigned check_fapl_mdc_api_calls(void); static unsigned check_file_mdc_api_calls(void); -static unsigned mdc_api_call_smoke_check(void); +static unsigned mdc_api_call_smoke_check(int express_test); static unsigned check_fapl_mdc_api_errs(void); @@ -67,11 +67,8 @@ static unsigned check_file_mdc_api_errs(void); * Programmer: John Mainzer * 4/12/04 * - * Modifications: - * *------------------------------------------------------------------------- */ - static unsigned check_fapl_mdc_api_calls(void) { @@ -265,8 +262,8 @@ check_fapl_mdc_api_calls(void) /* conpare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! RESIZE_CONFIGS_ARE_EQUAL(default_auto_size_ctl, \ - cache_ptr->resize_ctl, TRUE) ) { + if ( ! resize_configs_are_equal(&default_auto_size_ctl, \ + &cache_ptr->resize_ctl, TRUE) ) { pass = FALSE; @@ -414,8 +411,8 @@ check_fapl_mdc_api_calls(void) /* conpare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! RESIZE_CONFIGS_ARE_EQUAL(mod_auto_size_ctl, \ - cache_ptr->resize_ctl, TRUE) ) { + if ( ! resize_configs_are_equal(&mod_auto_size_ctl, \ + &cache_ptr->resize_ctl, TRUE) ) { pass = FALSE; @@ -865,12 +862,11 @@ check_file_mdc_api_calls(void) #define NUM_RANDOM_ACCESSES 200000 static unsigned -mdc_api_call_smoke_check(void) +mdc_api_call_smoke_check(int express_test) { 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; @@ -883,7 +879,6 @@ 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]; @@ -993,7 +988,7 @@ mdc_api_call_smoke_check(void) TESTING("MDC API smoke check"); - if ( skip_long_tests > 0 ) { + if ( express_test > 0 ) { SKIPPED(); @@ -1014,12 +1009,6 @@ 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[1], H5P_DEFAULT, filename, sizeof(filename)) @@ -1058,21 +1047,9 @@ 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; @@ -1121,8 +1098,7 @@ mdc_api_call_smoke_check(void) sprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, - dataspace_id, H5P_DEFAULT, - properties, H5P_DEFAULT); + dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -1178,21 +1154,8 @@ 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 ) ) { @@ -1260,23 +1223,6 @@ 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 */ @@ -1294,14 +1240,7 @@ mdc_api_call_smoke_check(void) /* 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; @@ -1384,24 +1323,6 @@ 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); } @@ -1445,15 +1366,8 @@ mdc_api_call_smoke_check(void) /* 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; @@ -1531,31 +1445,6 @@ 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); } @@ -1615,13 +1504,6 @@ 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 ) @@ -2151,7 +2033,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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 = */ -1, + /* enum H5C_cache_incr_mode incr_mode = */ (enum H5C_cache_incr_mode)-1, /* double lower_hr_threshold = */ 0.9, /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, @@ -2322,7 +2204,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ -1, + /* flash_incr_mode = */ (enum H5C_cache_flash_incr_mode)-1, /* double flash_multiple = */ 2.0, /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, @@ -2490,7 +2372,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* flash_incr_mode = */ H5C_flash_incr__off, /* double flash_multiple = */ 2.0, /* double flash_threshold = */ 0.5, - /* enum H5C_cache_decr_mode decr_mode = */ -1, + /* enum H5C_cache_decr_mode decr_mode = */ (enum H5C_cache_decr_mode)-1, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, /* hbool_t apply_max_decrement = */ TRUE, @@ -3531,24 +3413,15 @@ int main(void) { unsigned nerrs = 0; + int express_test; H5open(); express_test = GetTestExpress(); - if ( express_test >= 3 ) { - - skip_long_tests = TRUE; - - } else { - - skip_long_tests = FALSE; - } - printf("===================================\n"); printf("Cache API tests\n"); printf(" express_test = %d\n", express_test); - printf(" skip_long_tests = %d\n", (int)skip_long_tests); printf("===================================\n"); @@ -3559,7 +3432,7 @@ main(void) nerrs += check_file_mdc_api_calls(); #endif #if 1 - nerrs += mdc_api_call_smoke_check(); + nerrs += mdc_api_call_smoke_check(express_test); #endif #if 1 nerrs += check_fapl_mdc_api_errs(); diff --git a/test/cache_common.c b/test/cache_common.c index 206d3c0..702a555 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,7 +20,7 @@ * implemented in H5C.c */ #include "h5test.h" -#include "H5ACprivate.h" +#include "H5Cprivate.h" #include "H5Iprivate.h" #include "H5MFprivate.h" #include "H5MMprivate.h" @@ -58,24 +58,20 @@ haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the hbool_t write_permitted = TRUE; hbool_t pass = TRUE; /* set to false on error */ -hbool_t skip_long_tests = TRUE; -hbool_t run_full_test = TRUE; hbool_t try_core_file_driver = FALSE; hbool_t core_file_driver_failed = FALSE; const char *failure_mssg = NULL; -int failures = 0; -int express_test = 0; - -test_entry_t pico_entries[NUM_PICO_ENTRIES]; -test_entry_t nano_entries[NUM_NANO_ENTRIES]; -test_entry_t micro_entries[NUM_MICRO_ENTRIES]; -test_entry_t tiny_entries[NUM_TINY_ENTRIES]; -test_entry_t small_entries[NUM_SMALL_ENTRIES]; -test_entry_t medium_entries[NUM_MEDIUM_ENTRIES]; -test_entry_t large_entries[NUM_LARGE_ENTRIES]; -test_entry_t huge_entries[NUM_HUGE_ENTRIES]; -test_entry_t monster_entries[NUM_MONSTER_ENTRIES]; -test_entry_t variable_entries[NUM_VARIABLE_ENTRIES]; + +static test_entry_t pico_entries[NUM_PICO_ENTRIES]; +static test_entry_t nano_entries[NUM_NANO_ENTRIES]; +static test_entry_t micro_entries[NUM_MICRO_ENTRIES]; +static test_entry_t tiny_entries[NUM_TINY_ENTRIES]; +static test_entry_t small_entries[NUM_SMALL_ENTRIES]; +static test_entry_t medium_entries[NUM_MEDIUM_ENTRIES]; +static test_entry_t large_entries[NUM_LARGE_ENTRIES]; +static test_entry_t huge_entries[NUM_HUGE_ENTRIES]; +static test_entry_t monster_entries[NUM_MONSTER_ENTRIES]; +static test_entry_t variable_entries[NUM_VARIABLE_ENTRIES]; static herr_t pico_get_load_size(const void *udata_ptr, size_t *image_len_ptr); static herr_t nano_get_load_size(const void *udata_ptr, size_t *image_len_ptr); @@ -268,7 +264,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = PICO_ENTRY_TYPE, "pico_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)pico_get_load_size, (H5C_deserialize_func_t)pico_deserialize, (H5C_image_len_func_t)pico_image_len, @@ -279,7 +275,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NANO_ENTRY_TYPE, "nano_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)nano_get_load_size, (H5C_deserialize_func_t)nano_deserialize, (H5C_image_len_func_t)nano_image_len, @@ -290,7 +286,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = MICRO_ENTRY_TYPE, "micro_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)micro_get_load_size, (H5C_deserialize_func_t)micro_deserialize, (H5C_image_len_func_t)micro_image_len, @@ -301,7 +297,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = TINY_ENTRY_TYPE, "tiny_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)tiny_get_load_size, (H5C_deserialize_func_t)tiny_deserialize, (H5C_image_len_func_t)tiny_image_len, @@ -312,7 +308,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = SMALL_ENTRY_TYPE, "small_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)small_get_load_size, (H5C_deserialize_func_t)small_deserialize, (H5C_image_len_func_t)small_image_len, @@ -323,7 +319,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = MEDIUM_ENTRY_TYPE, "medium_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)medium_get_load_size, (H5C_deserialize_func_t)medium_deserialize, (H5C_image_len_func_t)medium_image_len, @@ -334,7 +330,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = LARGE_ENTRY_TYPE, "large_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)large_get_load_size, (H5C_deserialize_func_t)large_deserialize, (H5C_image_len_func_t)large_image_len, @@ -345,7 +341,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = HUGE_ENTRY_TYPE, "huge_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)huge_get_load_size, (H5C_deserialize_func_t)huge_deserialize, (H5C_image_len_func_t)huge_image_len, @@ -356,7 +352,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = MONSTER_ENTRY_TYPE, "monster_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)monster_get_load_size, (H5C_deserialize_func_t)monster_deserialize, (H5C_image_len_func_t)monster_image_len, @@ -367,7 +363,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = VARIABLE_ENTRY_TYPE, "variable_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)variable_get_load_size, (H5C_deserialize_func_t)variable_deserialize, (H5C_image_len_func_t)variable_image_len, @@ -376,7 +372,8 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = } }; -/* address translation funtions: */ + +/* address translation functions: */ /*------------------------------------------------------------------------- @@ -1638,7 +1635,7 @@ entry_in_cache(H5C_t * cache_ptr, /*------------------------------------------------------------------------- * Function: reset_entries * - * Purpose: reset the contents of the entries arrays to know values. + * Purpose: reset the contents of the entries arrays to known values. * * Return: void * @@ -1962,7 +1959,7 @@ verify_entry_status(H5C_t * cache_ptr, pass = FALSE; sprintf(msg, - "%d entry (%d, %d) size actualexpected = %ld/%ld.\n", + "%d entry (%d, %d) size actual/expected = %ld/%ld.\n", tag, (int)expected[i].entry_type, (int)expected[i].entry_index, @@ -2521,12 +2518,6 @@ takedown_cache(H5F_t * file_ptr, saved_cache = NULL; } - if ( H5F_addr_defined(saved_actual_base_addr) ) { - - H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr, - (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); - saved_actual_base_addr = HADDR_UNDEF; - } } if ( saved_fapl_id != H5P_DEFAULT ) { @@ -2537,6 +2528,18 @@ takedown_cache(H5F_t * file_ptr, if ( saved_fid != -1 ) { + if ( H5F_addr_defined(saved_actual_base_addr) ) { + + if ( NULL == file_ptr ) { + file_ptr = (H5F_t *)H5I_object_verify(saved_fid, H5I_FILE); + HDassert ( file_ptr ); + } + + H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr, + (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); + saved_actual_base_addr = HADDR_UNDEF; + } + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; @@ -2653,38 +2656,31 @@ flush_cache(H5F_t * file_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats) { - H5C_t * cache_ptr; - herr_t result = 0; - verify_unprotected(); - if ( pass ) { + if(pass) { + H5C_t * cache_ptr; + herr_t result = 0; HDassert(file_ptr); cache_ptr = file_ptr->shared->cache; - if ( destroy_entries ) { - + if(destroy_entries) result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); - } else { - + else result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); - } - } - - if ( dump_stats ) { - H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - } - - if ( result < 0 ) { + if(dump_stats) + H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - pass = FALSE; - failure_mssg = "error in H5C_flush_cache()."; + if(result < 0) { + pass = FALSE; + failure_mssg = "error in H5C_flush_cache()."; + } } return; @@ -2735,7 +2731,7 @@ insert_entry(H5F_t * file_ptr, HDassert( entry_ptr == entry_ptr->self ); HDassert( !(entry_ptr->is_protected) ); - insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0 ); + insert_pinned = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0 ); entry_ptr->is_dirty = TRUE; @@ -2767,24 +2763,19 @@ insert_entry(H5F_t * file_ptr, (int)(entry_ptr->addr != entry_ptr->header.addr)); #endif } - HDassert( entry_ptr->cache_ptr == NULL ); + HDassert(entry_ptr->cache_ptr == NULL); entry_ptr->file_ptr = file_ptr; entry_ptr->cache_ptr = cache_ptr; - if ( insert_pinned ) { - - HDassert( entry_ptr->header.is_pinned ); - entry_ptr->is_pinned = TRUE; - - } else { - - HDassert( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; + if(insert_pinned) + HDassert(entry_ptr->header.is_pinned); + else + HDassert(!(entry_ptr->header.is_pinned)); + entry_ptr->is_pinned = insert_pinned; - } - HDassert( entry_ptr->header.is_dirty ); - HDassert( ((entry_ptr->header).type)->id == type ); + HDassert(entry_ptr->header.is_dirty); + HDassert(((entry_ptr->header).type)->id == type); } return; @@ -2957,64 +2948,6 @@ move_entry(H5C_t * cache_ptr, /*------------------------------------------------------------------------- - * Function: pin_protected_entry() - * - * Purpose: Pin the specified protected entry. - * - * Do nothing if pass is FALSE on entry. - * - * Return: void - * - * Programmer: John Mainzer - * 5/17/06 - * - *------------------------------------------------------------------------- - */ -void -pin_protected_entry(H5F_t *file_ptr, int32_t type, int32_t idx) -{ - herr_t result; - test_entry_t * base_addr; - test_entry_t * entry_ptr; - - if(pass) { -#ifndef NDEBUG - H5C_t * cache_ptr = file_ptr->shared->cache; -#endif /* NDEBUG */ - - 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->header.is_pinned); - - result = H5C_pin_protected_entry((void *)entry_ptr); - - if((result < 0) || !entry_ptr->header.is_protected - || !entry_ptr->header.is_pinned - || (entry_ptr->header.type != &(types[type])) - || (entry_ptr->size != entry_ptr->header.size) - || (entry_ptr->addr != entry_ptr->header.addr)) { - pass = FALSE; - failure_mssg = "error in H5C_pin_protected_entry()."; - } /* end if */ - - entry_ptr->is_pinned = TRUE; - HDassert(((entry_ptr->header).type)->id == type); - } /* end if */ - -} /* pin_protected_entry() */ - - -/*------------------------------------------------------------------------- * Function: protect_entry() * * Purpose: Protect the entry indicated by the type and index. @@ -3287,8 +3220,8 @@ unprotect_entry(H5F_t * file_ptr, HDassert( entry_ptr->header.is_protected ); HDassert( entry_ptr->is_protected ); - pin_flag_set = ((flags & H5C__PIN_ENTRY_FLAG) != 0 ); - unpin_flag_set = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0 ); + pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0); + unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0); HDassert ( ! ( pin_flag_set && unpin_flag_set ) ); HDassert ( ( ! pin_flag_set ) || ( ! (entry_ptr->is_pinned) ) ); @@ -3332,12 +3265,12 @@ unprotect_entry(H5F_t * file_ptr, if ( pin_flag_set ) { - HDassert ( entry_ptr->header.is_pinned ); + HDassert(entry_ptr->header.is_pinned); entry_ptr->is_pinned = TRUE; } else if ( unpin_flag_set ) { - HDassert ( ! ( entry_ptr->header.is_pinned ) ); + HDassert(!(entry_ptr->header.is_pinned)); entry_ptr->is_pinned = FALSE; } @@ -4950,6 +4883,62 @@ check_and_validate_cache_size(hid_t file_id, } /* check_and_validate_cache_size() */ +hbool_t +resize_configs_are_equal(const H5C_auto_size_ctl_t *a, + const H5C_auto_size_ctl_t *b, + hbool_t compare_init) +{ + if(a->version != b->version) + return(FALSE); + else if(a->rpt_fcn != b->rpt_fcn) + return(FALSE); + else if(compare_init && (a->set_initial_size != b->set_initial_size)) + return(FALSE); + else if(compare_init && (a->initial_size != b->initial_size)) + return(FALSE); + else if(HDfabs(a->min_clean_fraction - b->min_clean_fraction) > FP_EPSILON) + return(FALSE); + else if(a->max_size != b->max_size) + return(FALSE); + else if(a->min_size != b->min_size) + return(FALSE); + else if(a->epoch_length != b->epoch_length) + return(FALSE); + else if(a->incr_mode != b->incr_mode) + return(FALSE); + else if(HDfabs(a->lower_hr_threshold - b->lower_hr_threshold) > FP_EPSILON) + return(FALSE); + else if(HDfabs(a->increment - b->increment) > FP_EPSILON) + return(FALSE); + else if(a->apply_max_increment != b->apply_max_increment) + return(FALSE); + else if(a->max_increment != b->max_increment) + return(FALSE); + else if(a->flash_incr_mode != b->flash_incr_mode) + return(FALSE); + else if(HDfabs(a->flash_multiple - b->flash_multiple) > FP_EPSILON) + return(FALSE); + else if(HDfabs(a->flash_threshold - b->flash_threshold) > FP_EPSILON) + return(FALSE); + else if(a->decr_mode != b->decr_mode) + return(FALSE); + else if(HDfabs(a->upper_hr_threshold - b->upper_hr_threshold) > FP_EPSILON) + return(FALSE); + else if(HDfabs(a->decrement - b->decrement) > FP_EPSILON) + return(FALSE); + else if(a->apply_max_decrement != b->apply_max_decrement) + return(FALSE); + else if(a->max_decrement != b->max_decrement) + return(FALSE); + else if(a->epochs_before_eviction != b->epochs_before_eviction) + return(FALSE); + else if(a->apply_empty_reserve != b->apply_empty_reserve) + return(FALSE); + else if(HDfabs(a->empty_reserve - b->empty_reserve) > FP_EPSILON) + return(FALSE); + return(TRUE); +} + /*------------------------------------------------------------------------- * Function: validate_mdc_config() @@ -5018,7 +5007,7 @@ validate_mdc_config(hid_t file_id, /* compare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! RESIZE_CONFIGS_ARE_EQUAL(int_config, cache_ptr->resize_ctl, + if ( ! resize_configs_are_equal(&int_config, &cache_ptr->resize_ctl, compare_init) ) { pass = FALSE; diff --git a/test/cache_common.h b/test/cache_common.h index 1a59f22..3c8b9ff 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -19,17 +19,20 @@ * This file contains common #defines, type definitions, and * externs for tests of the cache implemented in H5C.c */ -#include "h5test.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" +#ifndef _CACHE_COMMON_H +#define _CACHE_COMMON_H #define H5C_PACKAGE /*suppress error about including H5Cpkg */ - -#include "H5Cpkg.h" - #define H5F_PACKAGE /*suppress error about including H5Fpkg */ +/* Include library header files */ +#include "H5ACprivate.h" +#include "H5Cpkg.h" #include "H5Fpkg.h" +#include "H5Iprivate.h" + +/* Include test header files */ +#include "h5test.h" #define NO_CHANGE -1 @@ -355,12 +358,12 @@ if ( ( (cache_ptr) == NULL ) || \ } -#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ +#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ { \ int k; \ int depth = 0; \ - H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ - k = H5C__HASH_FCN(Addr); \ + H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ + k = H5C__HASH_FCN(Addr); \ entry_ptr = ((cache_ptr)->index)[k]; \ while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \ { \ @@ -369,7 +372,7 @@ if ( ( (cache_ptr) == NULL ) || \ } \ if ( entry_ptr ) \ { \ - H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ + H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ if ( entry_ptr != ((cache_ptr)->index)[k] ) \ { \ if ( (entry_ptr)->ht_next ) \ @@ -389,67 +392,38 @@ if ( ( (cache_ptr) == NULL ) || \ /* Macros used in H5AC level tests */ -#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ -( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \ - ( (a).open_trace_file == (b).open_trace_file ) && \ - ( (a).close_trace_file == (b).close_trace_file ) && \ - ( ( (a).open_trace_file == FALSE ) || \ - ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \ - ( (a).evictions_enabled == (b).evictions_enabled ) && \ - ( ( ! cmp_set_init ) || \ - ( (a).set_initial_size == (b).set_initial_size ) ) && \ - ( ( ! cmp_init_size ) || \ - ( (a).initial_size == (b).initial_size ) ) && \ - ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ - ( (a).max_size == (b).max_size ) && \ - ( (a).min_size == (b).min_size ) && \ - ( (a).epoch_length == (b).epoch_length ) && \ - ( (a).incr_mode == (b).incr_mode ) && \ - ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ - ( (a).apply_max_increment == (b).apply_max_increment ) && \ - ( (a).max_increment == (b).max_increment ) && \ - ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ - ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ - ( (a).decr_mode == (b).decr_mode ) && \ - ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ - ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ - ( (a).max_decrement == (b).max_decrement ) && \ - ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ - ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ - ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) - - -#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \ -( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn == (b).rpt_fcn ) && \ - ( ( ! compare_init ) || \ - ( (a).set_initial_size == (b).set_initial_size ) ) && \ - ( ( ! compare_init ) || \ - ( (a).initial_size == (b).initial_size ) ) && \ - ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ - ( (a).max_size == (b).max_size ) && \ - ( (a).min_size == (b).min_size ) && \ - ( (a).epoch_length == (b).epoch_length ) && \ - ( (a).incr_mode == (b).incr_mode ) && \ - ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ - ( (a).apply_max_increment == (b).apply_max_increment ) && \ - ( (a).max_increment == (b).max_increment ) && \ - ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ - ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ - ( (a).decr_mode == (b).decr_mode ) && \ - ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ - ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ - ( (a).max_decrement == (b).max_decrement ) && \ - ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ - ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ - ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) +#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ + ( ( (a).version == (b).version ) && \ + ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \ + ( (a).open_trace_file == (b).open_trace_file ) && \ + ( (a).close_trace_file == (b).close_trace_file ) && \ + ( ( (a).open_trace_file == FALSE ) || \ + ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \ + ( (a).evictions_enabled == (b).evictions_enabled ) && \ + ( ( ! cmp_set_init ) || \ + ( (a).set_initial_size == (b).set_initial_size ) ) && \ + ( ( ! cmp_init_size ) || \ + ( (a).initial_size == (b).initial_size ) ) && \ + ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ + ( (a).max_size == (b).max_size ) && \ + ( (a).min_size == (b).min_size ) && \ + ( (a).epoch_length == (b).epoch_length ) && \ + ( (a).incr_mode == (b).incr_mode ) && \ + ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ + ( (a).apply_max_increment == (b).apply_max_increment ) && \ + ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ + ( (a).decr_mode == (b).decr_mode ) && \ + ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ + ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ + ( (a).max_decrement == (b).max_decrement ) && \ + ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ + ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ + ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) #define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \ @@ -510,21 +484,7 @@ struct expected_entry_status extern haddr_t saved_actual_base_addr; extern hbool_t write_permitted; extern hbool_t pass; /* set to false on error */ -extern hbool_t skip_long_tests; -extern hbool_t run_full_test; extern const char *failure_mssg; -extern int express_test; -extern int failures; - -extern test_entry_t pico_entries[NUM_PICO_ENTRIES]; -extern test_entry_t nano_entries[NUM_NANO_ENTRIES]; -extern test_entry_t micro_entries[NUM_MICRO_ENTRIES]; -extern test_entry_t tiny_entries[NUM_TINY_ENTRIES]; -extern test_entry_t small_entries[NUM_SMALL_ENTRIES]; -extern test_entry_t medium_entries[NUM_MEDIUM_ENTRIES]; -extern test_entry_t large_entries[NUM_LARGE_ENTRIES]; -extern test_entry_t huge_entries[NUM_HUGE_ENTRIES]; -extern test_entry_t monster_entries[NUM_MONSTER_ENTRIES]; extern test_entry_t * entries[NUMBER_OF_ENTRY_TYPES]; extern const int32_t max_indices[NUMBER_OF_ENTRY_TYPES]; @@ -587,10 +547,6 @@ void move_entry(H5C_t * cache_ptr, int32_t idx, hbool_t main_addr); -void pin_protected_entry(H5F_t * file_ptr, - int32_t type, - int32_t idx); - void protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx); @@ -737,6 +693,9 @@ void verify_unprotected(void); /*** H5AC level utility functions ***/ +hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a, + const H5C_auto_size_ctl_t *b, hbool_t compare_init); + void check_and_validate_cache_hit_rate(hid_t file_id, double * hit_rate_ptr, hbool_t dump_data, @@ -755,3 +714,5 @@ void validate_mdc_config(hid_t file_id, hbool_t compare_init, int test_num); +#endif /* _CACHE_COMMON_H */ + diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 97d11a2..68a56d5 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -206,6 +206,9 @@ int virt_num_data_entries = NUM_DATA_ENTRIES; int data_index[NUM_DATA_ENTRIES]; +#define DO_WRITE_REQ_ACK FALSE +#define DO_SYNC_AFTER_WRITE TRUE + /***************************************************************************** * struct mssg @@ -232,9 +235,6 @@ int data_index[NUM_DATA_ENTRIES]; * *****************************************************************************/ -#define DO_WRITE_REQ_ACK FALSE -#define DO_SYNC_AFTER_WRITE TRUE - #define WRITE_REQ_CODE 0 #define WRITE_REQ_ACK_CODE 1 #define READ_REQ_CODE 2 @@ -253,7 +253,7 @@ struct mssg_t int dest; long int mssg_num; haddr_t base_addr; - int len; + unsigned len; int ver; unsigned magic; }; @@ -267,41 +267,40 @@ MPI_Datatype mpi_mssg_t; /* for MPI derived type created from mssg */ /* stats functions */ -void print_stats(void); -void reset_stats(void); +static void reset_stats(void); /* MPI setup functions */ -hbool_t set_up_file_communicator(void); +static hbool_t set_up_file_communicator(void); /* data array manipulation functions */ -int addr_to_datum_index(haddr_t base_addr); -void init_data(void); +static int addr_to_datum_index(haddr_t base_addr); +static void init_data(void); /* test coodination related functions */ -int do_express_test(void); -void do_sync(void); -int get_max_nerrors(void); +static int do_express_test(void); +static void do_sync(void); +static int get_max_nerrors(void); /* mssg xfer related functions */ -hbool_t recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset); -hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag); -hbool_t setup_derived_types(void); -hbool_t takedown_derived_types(void); +static hbool_t recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset); +static hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag); +static hbool_t setup_derived_types(void); +static hbool_t takedown_derived_types(void); /* server functions */ -hbool_t server_main(void); -hbool_t serve_read_request(struct mssg_t * mssg_ptr); -hbool_t serve_sync_request(struct mssg_t * mssg_ptr); -hbool_t serve_write_request(struct mssg_t * mssg_ptr); +static hbool_t server_main(void); +static hbool_t serve_read_request(struct mssg_t * mssg_ptr); +static hbool_t serve_sync_request(struct mssg_t * mssg_ptr); +static hbool_t serve_write_request(struct mssg_t * mssg_ptr); /* call back functions & related data structures */ @@ -352,44 +351,44 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = /* test utility functions */ -void expunge_entry(H5F_t * file_ptr, int32_t idx); -void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr, +static void expunge_entry(H5F_t * file_ptr, int32_t idx); +static void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx, unsigned int flags); -void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx, +static void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, int min_count, int max_count); -void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx); -void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect); -int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx, +static void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx); +static void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect); +static int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx, hbool_t via_unprotect); -void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, +static void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, int min_count, int max_count); -void lock_and_unlock_random_entry(H5F_t * file_ptr, +static void lock_and_unlock_random_entry(H5F_t * file_ptr, int min_idx, int max_idx); -void lock_entry(H5F_t * file_ptr, int32_t idx); -void mark_entry_dirty(int32_t idx); -void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); -void pin_protected_entry(int32_t idx, hbool_t global); -void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx); -void resize_entry(int32_t idx, size_t new_size); -hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr, +static void lock_entry(H5F_t * file_ptr, int32_t idx); +static void mark_entry_dirty(int32_t idx); +static void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); +static void pin_protected_entry(int32_t idx, hbool_t global); +static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx); +static void resize_entry(int32_t idx, size_t new_size); +static hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr); -void setup_rand(void); -hbool_t take_down_cache(hid_t fid); -void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags); -void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, +static void setup_rand(void); +static hbool_t take_down_cache(hid_t fid); +static void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags); +static void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty, hbool_t via_unprotect); /* test functions */ -hbool_t server_smoke_check(void); -hbool_t smoke_check_1(void); -hbool_t smoke_check_2(void); -hbool_t smoke_check_3(void); -hbool_t smoke_check_4(void); -hbool_t smoke_check_5(void); -hbool_t trace_file_check(void); +static hbool_t server_smoke_check(void); +static hbool_t smoke_check_1(void); +static hbool_t smoke_check_2(void); +static hbool_t smoke_check_3(void); +static hbool_t smoke_check_4(void); +static hbool_t smoke_check_5(void); +static hbool_t trace_file_check(void); /*****************************************************************************/ @@ -398,44 +397,6 @@ hbool_t trace_file_check(void); /***************************************************************************** * - * Function: print_stats() - * - * Purpose: Print the rudementary stats maintained by t_cache. - * - * This is a debugging function, which will not normally - * be run as part of t_cache. - * - * Return: void - * - * Programmer: JRM -- 4/17/06 - * - * Modifications: - * - * None. - * - *****************************************************************************/ - -void -print_stats(void) -{ - HDfprintf(stdout, - "%d: destroys = %ld\n", - world_mpi_rank, datum_destroys ); - HDfprintf(stdout, - "%d: datum flushes / pinned flushes / loads = %ld / %ld / %ld\n", - world_mpi_rank, datum_flushes, datum_pinned_flushes, - datum_loads ); - HDfprintf(stdout, - "%d: pins: global / global dirty / local = %ld / %ld / %ld\n", - world_mpi_rank, global_pins, global_dirty_pins, local_pins); - HDfflush(stdout); - - return; - -} /* print_stats() */ - -/***************************************************************************** - * * Function: reset_stats() * * Purpose: Reset the rudementary stats maintained by t_cache. @@ -450,7 +411,7 @@ print_stats(void) * *****************************************************************************/ -void +static void reset_stats(void) { datum_destroys = 0; @@ -489,7 +450,7 @@ reset_stats(void) * *****************************************************************************/ -hbool_t +static hbool_t set_up_file_communicator(void) { const char * fcn_name = "set_up_file_communicator()"; @@ -636,13 +597,8 @@ set_up_file_communicator(void) * * Programmer: JRM -- 12/20/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -int +static int addr_to_datum_index(haddr_t base_addr) { /* const char * fcn_name = "addr_to_datum_index()"; */ @@ -689,14 +645,8 @@ addr_to_datum_index(haddr_t base_addr) * * Programmer: JRM -- 12/20/05 * - * Modifications: - * - * JRM -- 7/11/06 - * Added support for the local_len field. - * *****************************************************************************/ - -void +static void init_data(void) { /* const char * fcn_name = "init_data()"; */ @@ -772,13 +722,8 @@ init_data(void) * * Programmer: JRM -- 4/25/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -int +static int do_express_test(void) { const char * fcn_name = "do_express_test()"; @@ -826,13 +771,8 @@ do_express_test(void) * * Programmer: JRM -- 5/10/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -void +static void do_sync(void) { const char * fcn_name = "do_sync()"; @@ -902,13 +842,8 @@ do_sync(void) * * Programmer: JRM -- 1/3/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -int +static int get_max_nerrors(void) { const char * fcn_name = "get_max_nerrors()"; @@ -963,7 +898,7 @@ get_max_nerrors(void) #define CACHE_TEST_TAG 99 /* different from any used by the library */ -hbool_t +static hbool_t recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset) { @@ -1047,8 +982,7 @@ recv_mssg(struct mssg_t *mssg_ptr, * Added the add_req_to_tag parameter and supporting code. * *****************************************************************************/ - -hbool_t +static hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag) { @@ -1102,7 +1036,7 @@ send_mssg(struct mssg_t *mssg_ptr, } /* send_mssg() */ - + /***************************************************************************** * * Function: setup_derived_types() @@ -1116,13 +1050,8 @@ send_mssg(struct mssg_t *mssg_ptr, * * Programmer: JRM -- 12/22/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t setup_derived_types(void) { const char * fcn_name = "setup_derived_types()"; @@ -1196,7 +1125,7 @@ setup_derived_types(void) } /* setup_derived_types */ - + /***************************************************************************** * * Function: takedown_derived_types() @@ -1210,13 +1139,8 @@ setup_derived_types(void) * * Programmer: JRM -- 12/22/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t takedown_derived_types(void) { const char * fcn_name = "takedown_derived_types()"; @@ -1244,6 +1168,7 @@ takedown_derived_types(void) /***************************** server functions ******************************/ /*****************************************************************************/ + /***************************************************************************** * * Function: server_main() @@ -1267,8 +1192,7 @@ takedown_derived_types(void) * Updated for sync message. * *****************************************************************************/ - -hbool_t +static hbool_t server_main(void) { const char * fcn_name = "server_main()"; @@ -1302,7 +1226,8 @@ server_main(void) case WRITE_REQ_ACK_CODE: success = FALSE; - HDfprintf(stdout, "%s: Received write ack?!?.\n", fcn_name); + if(verbose) + HDfprintf(stdout, "%s: Received write ack?!?.\n", fcn_name); break; case READ_REQ_CODE: @@ -1311,8 +1236,8 @@ server_main(void) case READ_REQ_REPLY_CODE: success = FALSE; - HDfprintf(stdout, "%s: Received read req reply?!?.\n", - fcn_name); + if(verbose) + HDfprintf(stdout, "%s: Received read req reply?!?.\n", fcn_name); break; case SYNC_REQ_CODE: @@ -1321,27 +1246,21 @@ server_main(void) case SYNC_ACK_CODE: success = FALSE; - HDfprintf(stdout, "%s: Received sync ack?!?.\n", - fcn_name); + if(verbose) + HDfprintf(stdout, "%s: Received sync ack?!?.\n", fcn_name); break; case DONE_REQ_CODE: done_count++; - /* HDfprintf(stdout, "%d:%s: done_count = %d.\n", - world_mpi_rank, fcn_name, done_count); */ - if ( done_count >= file_mpi_size ) { - + if(done_count >= file_mpi_size) done = TRUE; - } break; default: nerrors++; success = FALSE; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: Unknown request code.\n", - world_mpi_rank, fcn_name); - } + if(verbose) + HDfprintf(stdout, "%d:%s: Unknown request code.\n", world_mpi_rank, fcn_name); break; } } @@ -1351,7 +1270,7 @@ server_main(void) } /* server_main() */ - + /***************************************************************************** * * Function: serve_read_request() @@ -1369,13 +1288,8 @@ server_main(void) * * Programmer: JRM -- 12/22/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t serve_read_request(struct mssg_t * mssg_ptr) { const char * fcn_name = "serve_read_request()"; @@ -1454,7 +1368,7 @@ serve_read_request(struct mssg_t * mssg_ptr) } /* serve_read_request() */ - + /***************************************************************************** * * Function: serve_sync_request() @@ -1475,13 +1389,8 @@ serve_read_request(struct mssg_t * mssg_ptr) * * Programmer: JRM -- 5/10/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t serve_sync_request(struct mssg_t * mssg_ptr) { const char * fcn_name = "serve_sync_request()"; @@ -1522,7 +1431,7 @@ serve_sync_request(struct mssg_t * mssg_ptr) } /* serve_sync_request() */ - + /***************************************************************************** * * Function: serve_write_request() @@ -1548,8 +1457,7 @@ serve_sync_request(struct mssg_t * mssg_ptr) * doesn't work, it will help narrow down the possibilities. * *****************************************************************************/ - -hbool_t +static hbool_t serve_write_request(struct mssg_t * mssg_ptr) { const char * fcn_name = "serve_write_request()"; @@ -1711,14 +1619,9 @@ datum_get_load_size(const void * udata_ptr, * Programmer: John Mainzer * 9/20/07 * - * Modifications: - * - * None - * *------------------------------------------------------------------------- */ - -void * +static void * datum_deserialize(const void * image_ptr, UNUSED size_t len, void * udata_ptr, @@ -1789,13 +1692,13 @@ datum_deserialize(const void * image_ptr, if ( success ) { - if ( ( mssg.req != READ_REQ_REPLY_CODE ) || - ( mssg.src != world_server_mpi_rank ) || - ( mssg.dest != world_mpi_rank ) || - ( mssg.base_addr != entry_ptr->base_addr ) || - ( mssg.len != entry_ptr->len ) || - ( mssg.ver < entry_ptr->ver ) || - ( mssg.magic != MSSG_MAGIC ) ) { + if ( ( mssg.req != READ_REQ_REPLY_CODE ) || + ( mssg.src != world_server_mpi_rank ) || + ( mssg.dest != world_mpi_rank ) || + ( mssg.base_addr != entry_ptr->base_addr ) || + ( mssg.len != entry_ptr->len ) || + ( mssg.ver < entry_ptr->ver ) || + ( mssg.magic != MSSG_MAGIC ) ) { nerrors++; success = FALSE; @@ -1804,56 +1707,56 @@ datum_deserialize(const void * image_ptr, world_mpi_rank, fcn_name); } #if 0 /* This has been useful debugging code -- keep it for now. */ - if ( mssg.req != READ_REQ_REPLY_CODE ) { + if ( mssg.req != READ_REQ_REPLY_CODE ) { - HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.req = %d.\n", - world_mpi_rank, fcn_name, (int)(mssg.req)); - } + HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.req = %d.\n", + world_mpi_rank, fcn_name, (int)(mssg.req)); + } - if ( mssg.src != world_server_mpi_rank ) { + if ( mssg.src != world_server_mpi_rank ) { - HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n", + world_mpi_rank, fcn_name); + } - if ( mssg.dest != world_mpi_rank ) { + if ( mssg.dest != world_mpi_rank ) { - HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n", + world_mpi_rank, fcn_name); + } - if ( mssg.base_addr != entry_ptr->base_addr ) { + if ( mssg.base_addr != entry_ptr->base_addr ) { - HDfprintf(stdout, - "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n", - world_mpi_rank, fcn_name, mssg.base_addr); - HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %a.\n", - world_mpi_rank, fcn_name, entry_ptr->base_addr); - } + HDfprintf(stdout, + "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n", + world_mpi_rank, fcn_name, mssg.base_addr); + HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %a.\n", + world_mpi_rank, fcn_name, entry_ptr->base_addr); + } - if ( mssg.len != entry_ptr->len ) { + if ( mssg.len != entry_ptr->len ) { - HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.len = %a.\n", - world_mpi_rank, fcn_name, mssg.len); - } + HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.len = %a.\n", + world_mpi_rank, fcn_name, mssg.len); + } - if ( mssg.ver < entry_ptr->ver ) { + if ( mssg.ver < entry_ptr->ver ) { - HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n", + world_mpi_rank, fcn_name); + } - if ( mssg.magic != MSSG_MAGIC ) { + if ( mssg.magic != MSSG_MAGIC ) { - HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n", + world_mpi_rank, fcn_name); + } #endif /* JRM */ } else { @@ -1891,8 +1794,7 @@ datum_deserialize(const void * image_ptr, * *------------------------------------------------------------------------- */ - -herr_t +static herr_t datum_image_len(void *thing, size_t *image_len) { int idx; @@ -1938,14 +1840,9 @@ datum_image_len(void *thing, size_t *image_len) * Programmer: John Mainzer * 10/30/07 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - -herr_t +static herr_t datum_serialize(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, @@ -1957,8 +1854,8 @@ datum_serialize(const H5F_t UNUSED *f, size_t * new_len_ptr, void ** new_image_ptr_ptr) { - const char * fcn_name = "datum_serialize()"; + hbool_t was_dirty = FALSE; herr_t ret_value = SUCCEED; int idx; struct datum * entry_ptr; @@ -2005,65 +1902,67 @@ datum_serialize(const H5F_t UNUSED *f, world_mpi_rank, fcn_name); } - if ( ret_value == SUCCEED ) { + if ( ret_value == SUCCEED ) { - if ( entry_ptr->header.is_dirty ) { + if ( entry_ptr->header.is_dirty ) { - /* compose the message */ - mssg.req = WRITE_REQ_CODE; - mssg.src = world_mpi_rank; - mssg.dest = world_server_mpi_rank; - mssg.mssg_num = -1; /* set by send function */ - mssg.base_addr = entry_ptr->base_addr; - mssg.len = entry_ptr->len; - mssg.ver = entry_ptr->ver; - mssg.magic = MSSG_MAGIC; + was_dirty = TRUE; /* so we will receive the ack if requested */ - if ( ! send_mssg(&mssg, FALSE) ) { + /* compose the message */ + mssg.req = WRITE_REQ_CODE; + mssg.src = world_mpi_rank; + mssg.dest = world_server_mpi_rank; + mssg.mssg_num = -1; /* set by send function */ + mssg.base_addr = entry_ptr->base_addr; + mssg.len = entry_ptr->len; + mssg.ver = entry_ptr->ver; + mssg.magic = MSSG_MAGIC; - nerrors++; - ret_value = FAIL; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", - world_mpi_rank, fcn_name); - } - } - else - { - entry_ptr->header.is_dirty = FALSE; - entry_ptr->dirty = FALSE; + if ( ! send_mssg(&mssg, FALSE) ) { + + nerrors++; + ret_value = FAIL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", + world_mpi_rank, fcn_name); } } + else + { + entry_ptr->header.is_dirty = FALSE; + entry_ptr->dirty = FALSE; + } } + } #if DO_WRITE_REQ_ACK - if ( ( ret_value == SUCCEED ) && ( entry_ptr->header.is_dirty ) ) { + if ( ( ret_value == SUCCEED ) && ( was_dirty ) ) { - if ( ! recv_mssg(&mssg, WRITE_REQ_ACK_CODE) ) { + if ( ! recv_mssg(&mssg, WRITE_REQ_ACK_CODE) ) { - nerrors++; - ret_value = FAIL; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", - world_mpi_rank, fcn_name); - } - } else if ( ( mssg.req != WRITE_REQ_ACK_CODE ) || - ( mssg.src != world_server_mpi_rank ) || - ( mssg.dest != world_mpi_rank ) || - ( mssg.base_addr != entry_ptr->base_addr ) || - ( mssg.len != entry_ptr->len ) || - ( mssg.ver != entry_ptr->ver ) || - ( mssg.magic != MSSG_MAGIC ) ) { + nerrors++; + ret_value = FAIL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", + world_mpi_rank, fcn_name); + } + } else if ( ( mssg.req != WRITE_REQ_ACK_CODE ) || + ( mssg.src != world_server_mpi_rank ) || + ( mssg.dest != world_mpi_rank ) || + ( mssg.base_addr != entry_ptr->base_addr ) || + ( mssg.len != entry_ptr->len ) || + ( mssg.ver != entry_ptr->ver ) || + ( mssg.magic != MSSG_MAGIC ) ) { - nerrors++; - ret_value = FAIL; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", - world_mpi_rank, fcn_name); - } + nerrors++; + ret_value = FAIL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", + world_mpi_rank, fcn_name); } } + } #endif /* DO_WRITE_REQ_ACK */ @@ -2094,14 +1993,9 @@ datum_serialize(const H5F_t UNUSED *f, * Programmer: John Mainzer * 9/19/07 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - -herr_t +static herr_t datum_free_icr(void * thing) { int idx; @@ -2138,7 +2032,6 @@ datum_free_icr(void * thing) datum_destroys++; return(SUCCEED); - } /* datum_free_icr() */ @@ -2146,6 +2039,7 @@ datum_free_icr(void * thing) /************************** test utility functions ***************************/ /*****************************************************************************/ + /***************************************************************************** * Function: expunge_entry() * @@ -2159,13 +2053,8 @@ datum_free_icr(void * thing) * Programmer: John Mainzer * 07/11/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -void +static void expunge_entry(H5F_t * file_ptr, int32_t idx) { @@ -2227,7 +2116,7 @@ expunge_entry(H5F_t * file_ptr, } /* expunge_entry() */ - + /***************************************************************************** * Function: insert_entry() * @@ -2249,8 +2138,7 @@ expunge_entry(H5F_t * file_ptr, * any pins must be global pins. * *****************************************************************************/ - -void +static void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx, @@ -2338,7 +2226,7 @@ insert_entry(H5C_t * cache_ptr, } /* insert_entry() */ - + /***************************************************************************** * Function: local_pin_and_unpin_random_entries() * @@ -2352,11 +2240,8 @@ insert_entry(H5C_t * cache_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, @@ -2410,7 +2295,7 @@ local_pin_and_unpin_random_entries(H5F_t * file_ptr, } /* local_pin_and_unpin_random_entries() */ - + /***************************************************************************** * Function: local_pin_random_entry() * @@ -2426,11 +2311,8 @@ local_pin_and_unpin_random_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx) @@ -2461,7 +2343,7 @@ local_pin_random_entry(H5F_t * file_ptr, } /* local_pin_random_entry() */ - + /***************************************************************************** * Function: local_unpin_all_entries() * @@ -2474,11 +2356,8 @@ local_pin_random_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect) { @@ -2503,7 +2382,7 @@ local_unpin_all_entries(H5F_t * file_ptr, } /* local_unpin_all_entries() */ - + /***************************************************************************** * Function: local_unpin_next_pinned_entry() * @@ -2519,11 +2398,8 @@ local_unpin_all_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -int +static int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx, hbool_t via_unprotect) @@ -2565,7 +2441,7 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr, } /* local_unpin_next_pinned_entry() */ - + /***************************************************************************** * Function: lock_and_unlock_random_entries() * @@ -2580,11 +2456,8 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 1/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, @@ -2616,7 +2489,7 @@ lock_and_unlock_random_entries(H5F_t * file_ptr, } /* lock_and_unlock_random_entries() */ - + /***************************************************************************** * Function: lock_and_unlock_random_entry() * @@ -2630,11 +2503,8 @@ lock_and_unlock_random_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 1/4/06 * - * Modifications: - * *****************************************************************************/ - -void +static void lock_and_unlock_random_entry(H5F_t * file_ptr, int min_idx, int max_idx) @@ -2663,7 +2533,7 @@ lock_and_unlock_random_entry(H5F_t * file_ptr, } /* lock_and_unlock_random_entry() */ - + /***************************************************************************** * Function: lock_entry() * @@ -2683,8 +2553,7 @@ lock_and_unlock_random_entry(H5F_t * file_ptr, * datum. * *****************************************************************************/ - -void +static void lock_entry(H5F_t * file_ptr, int32_t idx) { @@ -2743,8 +2612,7 @@ lock_entry(H5F_t * file_ptr, * 4/14/06 * *****************************************************************************/ - -void +static void mark_entry_dirty(int32_t idx) { const char * fcn_name = "mark_entry_dirty()"; @@ -2785,7 +2653,7 @@ mark_entry_dirty(int32_t idx) } /* mark_entry_dirty() */ - + /***************************************************************************** * Function: pin_entry() * @@ -2798,10 +2666,7 @@ mark_entry_dirty(int32_t idx) * Programmer: John Mainzer * 4/11/06 * - * Modifications: - * *****************************************************************************/ - void pin_entry(H5F_t * file_ptr, int32_t idx, @@ -2855,7 +2720,7 @@ pin_entry(H5F_t * file_ptr, } /* pin_entry() */ - + /***************************************************************************** * Function: pin_protected_entry() * @@ -2869,13 +2734,8 @@ pin_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 01/04/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -void +static void pin_protected_entry(int32_t idx, hbool_t global) { @@ -2930,7 +2790,7 @@ pin_protected_entry(int32_t idx, } /* pin_protected_entry() */ - + /***************************************************************************** * Function: move_entry() * @@ -2946,14 +2806,8 @@ pin_protected_entry(int32_t idx, * Programmer: John Mainzer * 1/10/06 * - * Modifications: - * - * 7/11/06 -- JRM - * Added support for the phony_len field in datum. - * *****************************************************************************/ - -void +static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx) @@ -2986,7 +2840,35 @@ move_entry(H5F_t * file_ptr, old_addr = old_entry_ptr->base_addr; new_addr = new_entry_ptr->base_addr; - result = H5AC_move_entry(file_ptr, &(types[0]), old_addr, new_addr); + /* Moving will mark the entry dirty if it is not already */ + old_entry_ptr->dirty = TRUE; + + /* touch up versions, base_addrs, and data_index. Do this + * now as it is possible that the rename will trigger a + * sync point. + */ + if(old_entry_ptr->ver < new_entry_ptr->ver) + old_entry_ptr->ver = new_entry_ptr->ver; + else + (old_entry_ptr->ver)++; + + old_entry_ptr->base_addr = new_addr; + new_entry_ptr->base_addr = old_addr; + + data_index[old_entry_ptr->index] = new_idx; + data_index[new_entry_ptr->index] = old_idx; + + tmp = old_entry_ptr->index; + old_entry_ptr->index = new_entry_ptr->index; + new_entry_ptr->index = tmp; + + if(old_entry_ptr->local_len != new_entry_ptr->local_len) { + tmp_len = old_entry_ptr->local_len; + old_entry_ptr->local_len = new_entry_ptr->local_len; + new_entry_ptr->local_len = tmp_len; + } /* end if */ + + result = H5AC_move_entry(file_ptr, &(types[0]), old_addr, new_addr); if ( ( result < 0 ) || ( old_entry_ptr->header.addr != new_addr ) ) { @@ -3000,44 +2882,13 @@ move_entry(H5F_t * file_ptr, HDassert( ((old_entry_ptr->header).type)->id == DATUM_ENTRY_TYPE ); HDassert( old_entry_ptr->header.is_dirty ); - old_entry_ptr->dirty = TRUE; - - /* touch up versions, base_addrs, and data_index */ - - if ( old_entry_ptr->ver < new_entry_ptr->ver ) { - old_entry_ptr->ver = new_entry_ptr->ver; - - } else { - - (old_entry_ptr->ver)++; - - } - - old_entry_ptr->base_addr = new_addr; - new_entry_ptr->base_addr = old_addr; - - data_index[old_entry_ptr->index] = new_idx; - data_index[new_entry_ptr->index] = old_idx; - - tmp = old_entry_ptr->index; - old_entry_ptr->index = new_entry_ptr->index; - new_entry_ptr->index = tmp; - - if ( old_entry_ptr->local_len != new_entry_ptr->local_len ) { - - tmp_len = old_entry_ptr->local_len; - old_entry_ptr->local_len = new_entry_ptr->local_len; - new_entry_ptr->local_len = tmp_len; - } } } - return; - } /* move_entry() */ - + /***************************************************************************** * Function: resize_entry() * @@ -3052,13 +2903,8 @@ move_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 7/11/06 * - * Modifications: - * - * None - * *****************************************************************************/ - -void +static void resize_entry(int32_t idx, size_t new_size) { @@ -3111,7 +2957,7 @@ resize_entry(int32_t idx, } /* resize_entry() */ - + /***************************************************************************** * * Function: setup_cache_for_test() @@ -3130,13 +2976,8 @@ resize_entry(int32_t idx, * * Programmer: JRM -- 1/4/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr) @@ -3283,7 +3124,7 @@ setup_cache_for_test(hid_t * fid_ptr, } /* setup_cache_for_test() */ - + /***************************************************************************** * * Function: setup_rand() @@ -3303,8 +3144,7 @@ setup_cache_for_test(hid_t * fid_ptr, * Modified function to facilitate setting predefined seeds. * *****************************************************************************/ - -void +static void setup_rand(void) { const char * fcn_name = "setup_rand()"; @@ -3351,7 +3191,7 @@ setup_rand(void) } /* setup_rand() */ - + /***************************************************************************** * * Function: take_down_cache() @@ -3367,13 +3207,8 @@ setup_rand(void) * * Programmer: JRM -- 1/4/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t take_down_cache(hid_t fid) { const char * fcn_name = "take_down_cache()"; @@ -3410,7 +3245,7 @@ take_down_cache(hid_t fid) } /* take_down_cache() */ - + /***************************************************************************** * Function: unlock_entry() * @@ -3429,8 +3264,7 @@ take_down_cache(hid_t fid) * Updated for the new local_len field in datum. * *****************************************************************************/ - -void +static void unlock_entry(H5F_t * file_ptr, int32_t idx, unsigned int flags) @@ -3492,7 +3326,7 @@ unlock_entry(H5F_t * file_ptr, } /* unlock_entry() */ - + /***************************************************************************** * Function: unpin_entry() * @@ -3511,8 +3345,7 @@ unlock_entry(H5F_t * file_ptr, * Added assertion that entry is pinned on entry. * *****************************************************************************/ - -void +static void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, @@ -3591,6 +3424,7 @@ unpin_entry(H5F_t * file_ptr, /****************************** test functions *******************************/ /*****************************************************************************/ + /***************************************************************************** * * Function: server_smoke_check() @@ -3617,8 +3451,7 @@ unpin_entry(H5F_t * file_ptr, * write request ack message. * *****************************************************************************/ - -hbool_t +static hbool_t server_smoke_check(void) { const char * fcn_name = "server_smoke_check()"; @@ -3814,6 +3647,7 @@ server_smoke_check(void) } /* server_smoke_check() */ + /***************************************************************************** * * Function: smoke_check_1() @@ -3826,13 +3660,8 @@ server_smoke_check(void) * * Programmer: JRM -- 1/4/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_1(void) { const char * fcn_name = "smoke_check_1()"; @@ -3968,7 +3797,7 @@ smoke_check_1(void) } /* smoke_check_1() */ - + /***************************************************************************** * * Function: smoke_check_2() @@ -3993,8 +3822,7 @@ smoke_check_1(void) * Modified test to move pinned entries. * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_2(void) { const char * fcn_name = "smoke_check_2()"; @@ -4177,7 +4005,7 @@ smoke_check_2(void) } /* smoke_check_2() */ - + /***************************************************************************** * * Function: smoke_check_3() @@ -4205,8 +4033,7 @@ smoke_check_2(void) * Added pinned entry tests. JRM - 4/14/06 * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_3(void) { const char * fcn_name = "smoke_check_3()"; @@ -4488,7 +4315,7 @@ smoke_check_3(void) } /* smoke_check_3() */ - + /***************************************************************************** * * Function: smoke_check_4() @@ -4518,8 +4345,7 @@ smoke_check_3(void) * JRM - 8/15/06 * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_4(void) { const char * fcn_name = "smoke_check_4()"; @@ -4794,7 +4620,7 @@ smoke_check_4(void) } /* smoke_check_4() */ - + /***************************************************************************** * * Function: smoke_check_5() @@ -4815,8 +4641,7 @@ smoke_check_4(void) * H5AC_resize_entry(). * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_5(void) { const char * fcn_name = "smoke_check_5()"; @@ -4986,7 +4811,7 @@ smoke_check_5(void) } /* smoke_check_5() */ - + /***************************************************************************** * * Function: trace_file_check() @@ -5008,7 +4833,7 @@ smoke_check_5(void) * - H5AC_flush() * - H5AC_insert_entry() * - H5AC_mark_entry_dirty() - * H5AC_move_entry() + * - H5AC_move_entry() * - H5AC_pin_protected_entry() * - H5AC_protect() * - H5AC_unpin_entry() @@ -5036,8 +4861,7 @@ smoke_check_5(void) * to support the new flash cache size increment code. * *****************************************************************************/ - -hbool_t +static hbool_t trace_file_check(void) { hbool_t success = TRUE; @@ -5361,7 +5185,7 @@ trace_file_check(void) } /* trace_file_check() */ - + /***************************************************************************** * * Function: main() @@ -5374,12 +5198,7 @@ trace_file_check(void) * * Programmer: JRM -- 12/23/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - int main(int argc, char **argv) { @@ -5567,6 +5386,8 @@ finish: printf("===================================\n"); } + takedown_derived_types(); + /* close HDF5 library */ H5close(); |