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.c117
1 files changed, 51 insertions, 66 deletions
diff --git a/test/cache_common.c b/test/cache_common.c
index 12001b2..60ab827 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -475,18 +475,14 @@ addr_to_type_and_index(haddr_t addr,
*
*-------------------------------------------------------------------------
*/
-
-herr_t
-check_write_permitted(const H5F_t H5_ATTR_UNUSED *f,
- hid_t H5_ATTR_UNUSED dxpl_id,
- hbool_t *write_permitted_ptr)
+static herr_t
+check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_ptr)
{
+ HDassert(write_permitted_ptr);
- HDassert( write_permitted_ptr );
*write_permitted_ptr = write_permitted;
return(SUCCEED);
-
} /* check_write_permitted() */
@@ -2395,7 +2391,6 @@ H5F_t *
setup_cache(size_t max_cache_size,
size_t min_clean_size)
{
- const char * fcn_name = "setup_cache()";
char filename[512];
hbool_t show_progress = FALSE;
hbool_t verbose = TRUE;
@@ -2409,7 +2404,7 @@ setup_cache(size_t max_cache_size,
if ( show_progress ) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
saved_fid = -1;
@@ -2426,7 +2421,7 @@ setup_cache(size_t max_cache_size,
if ( show_progress ) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
if ( ( pass ) && ( try_core_file_driver ) ) {
@@ -2448,7 +2443,7 @@ setup_cache(size_t max_cache_size,
core_file_driver_failed = TRUE;
if ( verbose ) {
- HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", fcn_name);
+ HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", FUNC);
}
} else {
@@ -2459,7 +2454,7 @@ setup_cache(size_t max_cache_size,
if ( show_progress ) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
/* if we either aren't using the core file driver, or a create
* with the core file driver failed, try again with a regular file.
@@ -2477,14 +2472,14 @@ setup_cache(size_t max_cache_size,
failure_mssg = "H5Fcreate() failed.";
if ( verbose ) {
- HDfprintf(stdout, "%s: H5Fcreate() failed.\n", fcn_name);
+ HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC);
}
}
}
if ( show_progress ) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
if ( pass ) {
@@ -2498,7 +2493,7 @@ setup_cache(size_t max_cache_size,
failure_mssg = "H5Fflush() failed.";
if ( verbose ) {
- HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name);
+ HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
}
} else {
@@ -2511,7 +2506,7 @@ setup_cache(size_t max_cache_size,
failure_mssg = "Can't get file_ptr.";
if ( verbose ) {
- HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name);
+ HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
}
}
}
@@ -2519,7 +2514,7 @@ setup_cache(size_t max_cache_size,
if ( show_progress ) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
if ( pass ) {
@@ -2571,7 +2566,7 @@ setup_cache(size_t max_cache_size,
if ( show_progress ) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
if ( pass ) {
@@ -2581,7 +2576,7 @@ setup_cache(size_t max_cache_size,
failure_mssg = "H5C_create() failed.";
if ( verbose ) {
- HDfprintf(stdout, "%s: H5C_create() failed.\n", fcn_name);
+ HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC);
}
} else if ( cache_ptr->magic != H5C__H5C_T_MAGIC ) {
@@ -2590,14 +2585,14 @@ setup_cache(size_t max_cache_size,
failure_mssg = "Bad cache_ptr magic.";
if ( verbose ) {
- HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", fcn_name);
+ HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC);
}
}
}
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
if ( pass ) { /* allocate space for test entries */
@@ -2610,7 +2605,7 @@ setup_cache(size_t max_cache_size,
failure_mssg = "H5MF_alloc() failed.";
if ( verbose ) {
- HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", fcn_name);
+ HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", FUNC);
}
} else if ( actual_base_addr > BASE_ADDR ) {
@@ -2624,7 +2619,7 @@ setup_cache(size_t max_cache_size,
if ( verbose ) {
HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n",
- fcn_name);
+ FUNC);
}
}
@@ -2633,7 +2628,7 @@ setup_cache(size_t max_cache_size,
if ( show_progress ) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
if ( pass ) {
@@ -2646,7 +2641,7 @@ setup_cache(size_t max_cache_size,
if ( show_progress ) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- fcn_name, mile_stone++, (int)pass);
+ FUNC, mile_stone++, (int)pass);
return(ret_val);
} /* setup_cache() */
@@ -2766,7 +2761,6 @@ expunge_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx)
{
- /* const char * fcn_name = "expunge_entry()"; */
herr_t result;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
@@ -2829,7 +2823,6 @@ flush_cache(H5F_t * file_ptr,
hbool_t dump_stats,
hbool_t dump_detailed_stats)
{
- const char * fcn_name = "flush_cache()";
hbool_t verbose = FALSE;
verify_unprotected();
@@ -2865,7 +2858,7 @@ flush_cache(H5F_t * file_ptr,
if(verbose) {
HDfprintf(stdout,
"%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
- fcn_name,
+ FUNC,
(long long)(cache_ptr->index_len),
(long long)(cache_ptr->index_size),
(long long)(cache_ptr->clean_index_size),
@@ -3583,13 +3576,12 @@ row_major_scan_forward(H5F_t * file_ptr,
int dirty_destroys,
int dirty_unprotects)
{
- const char * fcn_name = "row_major_scan_forward";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int32_t type = 0;
int32_t idx;
if ( verbose )
- HDfprintf(stdout, "%s(): entering.\n", fcn_name);
+ HDfprintf(stdout, "%s(): entering.\n", FUNC);
if ( pass ) {
@@ -3875,8 +3867,7 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
hbool_t display_detailed_stats,
hbool_t do_inserts)
{
- const char * fcn_name = "hl_row_major_scan_forward";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int32_t type = 0;
int32_t idx;
int32_t i;
@@ -3884,7 +3875,7 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
int32_t local_max_index;
if ( verbose )
- HDfprintf(stdout, "%s(): entering.\n", fcn_name);
+ HDfprintf(stdout, "%s(): entering.\n", FUNC);
if ( pass ) {
@@ -3987,13 +3978,12 @@ row_major_scan_backward(H5F_t * file_ptr,
int dirty_destroys,
int dirty_unprotects)
{
- const char * fcn_name = "row_major_scan_backward";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
int32_t idx;
if ( verbose )
- HDfprintf(stdout, "%s(): Entering.\n", fcn_name);
+ HDfprintf(stdout, "%s(): Entering.\n", FUNC);
if ( pass ) {
@@ -4273,8 +4263,7 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
hbool_t display_detailed_stats,
hbool_t do_inserts)
{
- const char * fcn_name = "hl_row_major_scan_backward";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
int32_t idx;
int32_t i;
@@ -4282,7 +4271,7 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
int32_t local_max_index;
if ( verbose )
- HDfprintf(stdout, "%s(): entering.\n", fcn_name);
+ HDfprintf(stdout, "%s(): entering.\n", FUNC);
if ( pass ) {
@@ -4380,13 +4369,12 @@ col_major_scan_forward(H5F_t * file_ptr,
hbool_t do_inserts,
int dirty_unprotects)
{
- const char * fcn_name = "col_major_scan_forward()";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int32_t type = 0;
int32_t idx;
if ( verbose )
- HDfprintf(stdout, "%s: entering.\n", fcn_name);
+ HDfprintf(stdout, "%s: entering.\n", FUNC);
if ( pass ) {
@@ -4481,8 +4469,7 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
hbool_t do_inserts,
int dirty_unprotects)
{
- const char * fcn_name = "hl_col_major_scan_forward()";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int32_t type = 0;
int32_t idx;
int32_t lag = 200;
@@ -4490,7 +4477,7 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
int32_t local_max_index;
if ( verbose )
- HDfprintf(stdout, "%s: entering.\n", fcn_name);
+ HDfprintf(stdout, "%s: entering.\n", FUNC);
if ( pass ) {
@@ -4598,14 +4585,13 @@ col_major_scan_backward(H5F_t * file_ptr,
hbool_t do_inserts,
int dirty_unprotects)
{
- const char * fcn_name = "col_major_scan_backward()";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int mile_stone = 1;
int32_t type;
int32_t idx;
if ( verbose )
- HDfprintf(stdout, "%s: entering.\n", fcn_name);
+ HDfprintf(stdout, "%s: entering.\n", FUNC);
if ( pass ) {
@@ -4624,7 +4610,7 @@ col_major_scan_backward(H5F_t * file_ptr,
idx = MAX_ENTRIES + lag;
if ( verbose ) /* 1 */
- HDfprintf(stdout, "%s: point %d.\n", fcn_name, mile_stone++);
+ HDfprintf(stdout, "%s: point %d.\n", FUNC, mile_stone++);
while ( ( pass ) && ( (idx + lag) >= 0 ) )
@@ -4672,7 +4658,7 @@ col_major_scan_backward(H5F_t * file_ptr,
}
if ( verbose ) /* 2 */
- HDfprintf(stdout, "%s: point %d.\n", fcn_name, mile_stone++);
+ HDfprintf(stdout, "%s: point %d.\n", FUNC, mile_stone++);
if ( ( pass ) && ( display_stats ) ) {
@@ -4680,7 +4666,7 @@ col_major_scan_backward(H5F_t * file_ptr,
}
if ( verbose )
- HDfprintf(stdout, "%s: exiting.\n", fcn_name);
+ HDfprintf(stdout, "%s: exiting.\n", FUNC);
return;
@@ -4712,16 +4698,15 @@ hl_col_major_scan_backward(H5F_t * file_ptr,
hbool_t do_inserts,
int dirty_unprotects)
{
- const char * fcn_name = "hl_col_major_scan_backward()";
- H5C_t * cache_ptr;
+ H5C_t * cache_ptr = NULL;
int32_t type = 0;
- int32_t idx;
+ int32_t idx = -1;
int32_t lag = 50;
int32_t i;
- int32_t local_max_index;
+ int32_t local_max_index = -1;
if ( verbose )
- HDfprintf(stdout, "%s: entering.\n", fcn_name);
+ HDfprintf(stdout, "%s: entering.\n", FUNC);
if ( pass ) {
@@ -5105,7 +5090,7 @@ check_and_validate_cache_hit_rate(hid_t file_id,
pass = FALSE;
failure_mssg = "H5Fget_mdc_hit_rate() failed.";
- } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001F) ) {
+ } else if ( ! H5_DBL_ABS_EQUAL(hit_rate, expected_hit_rate) ) {
pass = FALSE;
failure_mssg = "unexpected hit rate.";
@@ -5298,7 +5283,7 @@ resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
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)
+ else if(!H5_DBL_ABS_EQUAL(a->min_clean_fraction, b->min_clean_fraction))
return(FALSE);
else if(a->max_size != b->max_size)
return(FALSE);
@@ -5308,9 +5293,9 @@ resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
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)
+ else if(!H5_DBL_ABS_EQUAL(a->lower_hr_threshold, b->lower_hr_threshold))
return(FALSE);
- else if(HDfabs(a->increment - b->increment) > FP_EPSILON)
+ else if(!H5_DBL_ABS_EQUAL(a->increment, b->increment))
return(FALSE);
else if(a->apply_max_increment != b->apply_max_increment)
return(FALSE);
@@ -5318,15 +5303,15 @@ resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
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)
+ else if(!H5_DBL_ABS_EQUAL(a->flash_multiple, b->flash_multiple))
return(FALSE);
- else if(HDfabs(a->flash_threshold - b->flash_threshold) > FP_EPSILON)
+ else if(!H5_DBL_ABS_EQUAL(a->flash_threshold, b->flash_threshold))
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)
+ else if(!H5_DBL_ABS_EQUAL(a->upper_hr_threshold, b->upper_hr_threshold))
return(FALSE);
- else if(HDfabs(a->decrement - b->decrement) > FP_EPSILON)
+ else if(!H5_DBL_ABS_EQUAL(a->decrement, b->decrement))
return(FALSE);
else if(a->apply_max_decrement != b->apply_max_decrement)
return(FALSE);
@@ -5336,7 +5321,7 @@ resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
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)
+ else if(!H5_DBL_ABS_EQUAL(a->empty_reserve, b->empty_reserve))
return(FALSE);
return(TRUE);
}