summaryrefslogtreecommitdiffstats
path: root/test/cache_api.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
commit0313cbb91d974b153dbe8747d193ac3c619eea3b (patch)
treeaf6c4a631d5753685ee0033a6a8415a25fc97672 /test/cache_api.c
parent847d675f2743ec420ef6c9efdd6e52ae93b4fe44 (diff)
downloadhdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.zip
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.gz
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.bz2
Final merge of page buffering branch to develop
Diffstat (limited to 'test/cache_api.c')
-rw-r--r--test/cache_api.c105
1 files changed, 71 insertions, 34 deletions
diff --git a/test/cache_api.c b/test/cache_api.c
index 710e38f..867f055 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -30,12 +30,12 @@
/* private function declarations: */
-static hbool_t check_fapl_mdc_api_calls(void);
-static hbool_t check_file_mdc_api_calls(void);
-static hbool_t mdc_api_call_smoke_check(int express_test);
+static hbool_t check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id);
+static hbool_t check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id);
+static hbool_t mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id);
static H5AC_cache_config_t * init_invalid_configs(void);
static hbool_t check_fapl_mdc_api_errs(void);
-static hbool_t check_file_mdc_api_errs(void);
+static hbool_t check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id);
@@ -64,7 +64,7 @@ static hbool_t check_file_mdc_api_errs(void);
*-------------------------------------------------------------------------
*/
static hbool_t
-check_fapl_mdc_api_calls(void)
+check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
char filename[512];
herr_t result;
@@ -113,7 +113,10 @@ check_fapl_mdc_api_calls(void)
H5C_auto_size_ctl_t default_auto_size_ctl;
H5C_auto_size_ctl_t mod_auto_size_ctl;
- TESTING("MDC/FAPL related API calls");
+ if(paged)
+ TESTING("MDC/FAPL related API calls for paged aggregation strategy")
+ else
+ TESTING("MDC/FAPL related API calls")
pass = TRUE;
@@ -217,7 +220,7 @@ check_fapl_mdc_api_calls(void)
/* create the file using the default FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -365,7 +368,7 @@ check_fapl_mdc_api_calls(void)
/* create the file using the modified FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
if ( file_id < 0 ) {
@@ -517,7 +520,7 @@ check_fapl_mdc_api_calls(void)
*-------------------------------------------------------------------------
*/
static hbool_t
-check_file_mdc_api_calls(void)
+check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
char filename[512];
hid_t file_id = -1;
@@ -669,7 +672,10 @@ check_file_mdc_api_calls(void)
H5AC__DEFAULT_METADATA_WRITE_STRATEGY
};
- TESTING("MDC/FILE related API calls");
+ if(paged)
+ TESTING("MDC/FILE related API calls for paged aggregation strategy")
+ else
+ TESTING("MDC/FILE related API calls")
pass = TRUE;
@@ -695,7 +701,7 @@ check_file_mdc_api_calls(void)
/* create the file using the default FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -874,7 +880,7 @@ check_file_mdc_api_calls(void)
#define NUM_RANDOM_ACCESSES 200000
static hbool_t
-mdc_api_call_smoke_check(int express_test)
+mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
{
char filename[512];
hbool_t valid_chunk;
@@ -1003,7 +1009,10 @@ mdc_api_call_smoke_check(int express_test)
H5AC__DEFAULT_METADATA_WRITE_STRATEGY
};
- TESTING("MDC API smoke check");
+ if(paged)
+ TESTING("MDC API smoke check for paged aggregation strategy")
+ else
+ TESTING("MDC API smoke check")
pass = TRUE;
@@ -1038,7 +1047,7 @@ mdc_api_call_smoke_check(int express_test)
/* create the file using the default FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -1921,7 +1930,7 @@ check_fapl_mdc_api_errs(void)
*-------------------------------------------------------------------------
*/
static hbool_t
-check_file_mdc_api_errs(void)
+check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
{
char filename[512];
static char msg[128];
@@ -1937,7 +1946,10 @@ check_file_mdc_api_errs(void)
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
H5AC_cache_config_t scratch;
- TESTING("MDC/FILE related API input errors");
+ if(paged)
+ TESTING("MDC/FILE related API input errors for paged aggregation strategy")
+ else
+ TESTING("MDC/FILE related API input errors")
pass = TRUE;
@@ -1968,7 +1980,7 @@ check_file_mdc_api_errs(void)
HDfprintf(stdout, "%s: calling H5Fcreate().\n", FUNC);
}
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -2267,6 +2279,9 @@ main(void)
{
unsigned nerrs = 0;
int express_test;
+ hid_t fcpl_id = -1;
+ hid_t fcpl2_id = -1;
+ unsigned paged;
H5open();
@@ -2281,42 +2296,64 @@ main(void)
/* Initialize invalid configurations.
*/
invalid_configs = init_invalid_configs();
-
if ( NULL == invalid_configs ) {
-
failure_mssg = "Unable to allocate memory for invalid configs.";
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return EXIT_FAILURE;
- }
+ } /* end if */
- if ( !check_fapl_mdc_api_calls() ) {
+ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
- nerrs += 1;
- }
+ /* Set file space strategy to default or paged aggregation strategy */
+ if((fcpl2_id = H5Pcopy(fcpl_id)) < 0) {
+ failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
- if ( !check_file_mdc_api_calls() ) {
+ if(H5Pset_file_space_strategy(fcpl2_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0) {
+ failure_mssg = "H5Pset_file_space_strategy() failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
- nerrs += 1;
- }
+ /* Test with paged aggregation enabled or not */
+ /* The "my_fcpl" passed to each test has the paged or non-paged strategy set up accordinly */
+ for(paged = FALSE; paged <= TRUE; paged++) {
+ hid_t my_fcpl = fcpl_id;
- if ( !mdc_api_call_smoke_check(express_test) ) {
+ if(paged)
+ my_fcpl = fcpl2_id;
- nerrs += 1;
- }
+ if(!check_fapl_mdc_api_calls(paged, my_fcpl))
+ nerrs += 1;
- if ( !check_fapl_mdc_api_errs() ) {
+ if(!check_file_mdc_api_calls(paged, my_fcpl))
+ nerrs += 1;
- nerrs += 1;
- }
+ if(!mdc_api_call_smoke_check(express_test, paged, my_fcpl))
+ nerrs += 1;
- if ( !check_file_mdc_api_errs() ) {
+ if(!check_file_mdc_api_errs(paged, my_fcpl))
+ nerrs += 1;
+ } /* end for paged */
+ if(!check_fapl_mdc_api_errs())
nerrs += 1;
- }
if(invalid_configs)
HDfree(invalid_configs);
+ if(H5Pclose(fcpl_id) < 0 ) {
+ failure_mssg = "H5Pclose() failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
+
if(nerrs > 0)
return EXIT_FAILURE;
else