summaryrefslogtreecommitdiffstats
path: root/test/cache_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/cache_common.c')
-rw-r--r--test/cache_common.c189
1 files changed, 119 insertions, 70 deletions
diff --git a/test/cache_common.c b/test/cache_common.c
index e1757af..e786b61 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -23,7 +23,7 @@
#include <aio.h>
#include "h5test.h"
-#include "H5ACprivate.h"
+#include "H5Cprivate.h"
#include "H5Iprivate.h"
#include "H5MFprivate.h"
#include "H5MMprivate.h"
@@ -66,19 +66,17 @@ hbool_t run_full_test = TRUE;
hbool_t try_core_file_driver = TRUE;
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);
@@ -271,7 +269,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,
@@ -282,7 +280,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,
@@ -293,7 +291,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,
@@ -304,7 +302,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,
@@ -315,7 +313,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,
@@ -326,7 +324,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,
@@ -337,7 +335,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,
@@ -348,7 +346,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,
@@ -359,7 +357,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,
@@ -370,7 +368,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,
@@ -379,7 +377,8 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
}
};
-/* address translation funtions: */
+
+/* address translation functions: */
/*-------------------------------------------------------------------------
@@ -1715,7 +1714,7 @@ recommend_core_file_driver(void)
/*-------------------------------------------------------------------------
* 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
*
@@ -2039,7 +2038,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,
@@ -2598,12 +2597,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 ) {
@@ -2614,6 +2607,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;
@@ -2730,38 +2735,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;
@@ -2812,7 +2810,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;
@@ -2844,24 +2842,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;
+ if(insert_pinned)
+ HDassert(entry_ptr->header.is_pinned);
+ else
+ HDassert(!(entry_ptr->header.is_pinned));
+ entry_ptr->is_pinned = insert_pinned;
- } else {
-
- HDassert( ! ( entry_ptr->header.is_pinned ) );
- entry_ptr->is_pinned = FALSE;
-
- }
- 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;
@@ -3364,8 +3357,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) ) );
@@ -3409,12 +3402,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;
}
@@ -5027,6 +5020,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()
@@ -5095,7 +5144,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;