diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2018-09-20 17:40:51 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2018-09-20 17:40:51 (GMT) |
commit | 67a126c7ba8825ffb193c930c7b8cae939b3446d (patch) | |
tree | eca9e38529355d2ec2a9c5fd934e7a9d9e4821b7 /test/cache_common.c | |
parent | 99299e195b5294549b75b28321ae7f8d2c6f8644 (diff) | |
download | hdf5-67a126c7ba8825ffb193c930c7b8cae939b3446d.zip hdf5-67a126c7ba8825ffb193c930c7b8cae939b3446d.tar.gz hdf5-67a126c7ba8825ffb193c930c7b8cae939b3446d.tar.bz2 |
Normalization with vol_integration (test code and H5Xtest.c)
Diffstat (limited to 'test/cache_common.c')
-rw-r--r-- | test/cache_common.c | 107 |
1 files changed, 55 insertions, 52 deletions
diff --git a/test/cache_common.c b/test/cache_common.c index 2cc188e..b078964 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" #include "H5MMprivate.h" + #include "cache_common.h" @@ -3276,23 +3277,24 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - HDassert(fid >= 0); - saved_fid = fid; + HDassert(fid >= 0); + saved_fid = fid; if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { pass = FALSE; failure_mssg = "H5Fflush() failed."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } else { + } + else { file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); - if(file_ptr == NULL) { + if(file_ptr == NULL) { pass = FALSE; failure_mssg = "Can't get file_ptr."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } + } } } @@ -3303,36 +3305,36 @@ setup_cache(size_t max_cache_size, if(pass) { /* A bit of fancy footwork here: - * - * The call to H5Fcreate() allocates an instance of H5C_t, - * initializes it, and stores its address in f->shared->cache. - * - * We don't want to use this cache, as it has a bunch of extra - * initialization that may change over time, and in any case - * it will not in general be configured the way we want it. - * - * We used to deal with this problem by storing the file pointer - * in another instance of H5C_t, and then ignoring the original - * version. However, this strategy doesn't work any more, as - * we can't store the file pointer in the instance of H5C_t, - * and we have modified many cache routines to use a file - * pointer to look up the target cache. - * - * Thus we now make note of the address of the instance of - * H5C_t created by the call to H5Fcreate(), set - * file_ptr->shared->cache to NULL, call H5C_create() - * to allocate a new instance of H5C_t for test purposes, - * and store than new instance's address in - * file_ptr->shared->cache. - * - * On shut down, we call H5C_dest on our instance of H5C_t, - * set file_ptr->shared->cache to point to the original - * instance, and then close the file normally. - */ + * + * The call to H5Fcreate() allocates an instance of H5C_t, + * initializes it, and stores its address in f->shared->cache. + * + * We don't want to use this cache, as it has a bunch of extra + * initialization that may change over time, and in any case + * it will not in general be configured the way we want it. + * + * We used to deal with this problem by storing the file pointer + * in another instance of H5C_t, and then ignoring the original + * version. However, this strategy doesn't work any more, as + * we can't store the file pointer in the instance of H5C_t, + * and we have modified many cache routines to use a file + * pointer to look up the target cache. + * + * Thus we now make note of the address of the instance of + * H5C_t created by the call to H5Fcreate(), set + * file_ptr->shared->cache to NULL, call H5C_create() + * to allocate a new instance of H5C_t for test purposes, + * and store than new instance's address in + * file_ptr->shared->cache. + * + * On shut down, we call H5C_dest on our instance of H5C_t, + * set file_ptr->shared->cache to point to the original + * instance, and then close the file normally. + */ HDassert(saved_cache == NULL); - saved_cache = file_ptr->shared->cache; - file_ptr->shared->cache = NULL; + saved_cache = file_ptr->shared->cache; + file_ptr->shared->cache = NULL; cache_ptr = H5C_create(max_cache_size, min_clean_size, @@ -3351,19 +3353,20 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - if(cache_ptr == NULL) { + if(cache_ptr == NULL) { pass = FALSE; failure_mssg = "H5C_create() failed."; if(verbose) HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC); - } else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { + } + else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { pass = FALSE; - failure_mssg = "Bad cache_ptr magic."; + failure_mssg = "Bad cache_ptr magic."; if(verbose) HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC); - } + } } if(show_progress) /* 7 */ @@ -3446,7 +3449,7 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - if ( H5C_prep_for_file_close(file_ptr) < 0 ) { + if ( H5C_prep_for_file_close(file_ptr) < 0 ) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; @@ -3456,23 +3459,23 @@ takedown_cache(H5F_t * file_ptr, H5C_dest(file_ptr); - if ( saved_cache != NULL ) { + if ( saved_cache != NULL ) { - file_ptr->shared->cache = saved_cache; - saved_cache = NULL; - } + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + } } if ( saved_fapl_id != H5P_DEFAULT ) { H5Pclose(saved_fapl_id); - saved_fapl_id = H5P_DEFAULT; + saved_fapl_id = H5P_DEFAULT; } if ( saved_fcpl_id != H5P_DEFAULT ) { H5Pclose(saved_fcpl_id); - saved_fcpl_id = H5P_DEFAULT; + saved_fcpl_id = H5P_DEFAULT; } if ( saved_fid != -1 ) { @@ -3489,21 +3492,21 @@ takedown_cache(H5F_t * file_ptr, saved_actual_base_addr = HADDR_UNDEF; } - if ( H5Fclose(saved_fid) < 0 ) { + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; - failure_mssg = "couldn't close test file."; + failure_mssg = "couldn't close test file."; - } else { + } else { - saved_fid = -1; + saved_fid = -1; } /* Pop API context */ H5CX_pop(); - if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -3515,10 +3518,10 @@ takedown_cache(H5F_t * file_ptr, if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "couldn't delete test file."; + failure_mssg = "couldn't delete test file."; - } - } + } + } } return; |