summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-31 18:27:33 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-31 18:27:33 (GMT)
commit7eb4441658717332e475e317570b58eb2cbd6f9f (patch)
treecada972fb27ac1d40c78cd4ebd686ab9ef7a2b94 /test
parent9fc29cdd1c563aeab48952327e0910d83763236b (diff)
downloadhdf5-7eb4441658717332e475e317570b58eb2cbd6f9f.zip
hdf5-7eb4441658717332e475e317570b58eb2cbd6f9f.tar.gz
hdf5-7eb4441658717332e475e317570b58eb2cbd6f9f.tar.bz2
[svn-r18926] Description:
Get down to just one "resize_configs_are_equal" comparison routine. Tested on: Mac OS X/32 10.6.3 (amazon) (too minor to require h5committest)
Diffstat (limited to 'test')
-rw-r--r--test/cache.c59
-rw-r--r--test/cache_api.c8
-rw-r--r--test/cache_common.c58
-rw-r--r--test/cache_common.h35
4 files changed, 67 insertions, 93 deletions
diff --git a/test/cache.c b/test/cache.c
index 94e44a1..0e6cb42 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -25657,65 +25657,6 @@ check_auto_cache_resize_epoch_markers(void)
*-------------------------------------------------------------------------
*/
-/* Epsilon for floating-point comparisons */
-#define FP_EPSILON 0.000001
-
-static 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);
-}
-
static unsigned
check_auto_cache_resize_input_errs(void)
{
diff --git a/test/cache_api.c b/test/cache_api.c
index 8ad3635..8fd2912 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -263,8 +263,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;
@@ -412,8 +412,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;
diff --git a/test/cache_common.c b/test/cache_common.c
index 4024816..3de01c5 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -5351,6 +5351,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()
@@ -5420,7 +5476,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 91fdd6c..f493239 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -445,35 +445,6 @@ if ( ( (cache_ptr) == NULL ) || \
( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
( (a).empty_reserve == (b).empty_reserve ) )
-#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 XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \
{ \
(i).version = H5C__CURR_AUTO_SIZE_CTL_VER; \
@@ -508,6 +479,9 @@ if ( ( (cache_ptr) == NULL ) || \
(i).empty_reserve = (e).empty_reserve; \
}
+/* Epsilon for floating-point comparisons */
+#define FP_EPSILON 0.000001
+
/* misc type definitions */
@@ -760,6 +734,9 @@ void destroy_flush_dependency(int32_t parent_type,
/*** 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,