diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2017-01-05 05:36:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2017-01-05 05:36:14 (GMT) |
commit | afd7e5b476d65960d0e309f35fa2df3235731564 (patch) | |
tree | f92049d856d85402a334c00df4c98b12accf7a41 /test | |
parent | 6232dd6d62e5a58a6185b9502b6d8719cf0ce676 (diff) | |
download | hdf5-afd7e5b476d65960d0e309f35fa2df3235731564.zip hdf5-afd7e5b476d65960d0e309f35fa2df3235731564.tar.gz hdf5-afd7e5b476d65960d0e309f35fa2df3235731564.tar.bz2 |
Bring file shutdown code from cache image branch
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 19 | ||||
-rw-r--r-- | test/cache_common.c | 6 | ||||
-rw-r--r-- | test/freespace.c | 29 |
3 files changed, 42 insertions, 12 deletions
diff --git a/test/cache.c b/test/cache.c index ed4fceb..8f4935b 100644 --- a/test/cache.c +++ b/test/cache.c @@ -15912,6 +15912,11 @@ check_destroy_pinned_err(void) protect_entry(file_ptr, 0, 0); unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + pass = FALSE; + failure_mssg = "unexpected failure of prep for file close.\n"; + } /* end if */ + if(H5C_dest(file_ptr, H5AC_ind_read_dxpl_id) >= 0) { pass = FALSE; failure_mssg = "destroy succeeded on cache with pinned entry.\n"; @@ -15987,6 +15992,20 @@ check_destroy_protected_err(void) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + /* Note: normally this call would go just before the series of + * flushes prior to file close -- in particular, all entries + * should be unprotected when this call is made. + * + * Thus H5C_prep_for_file_close() contains an assert to verify + * this. Since this assert would be triggered by the condition + * we are trying to test, put the call to H5C_prep_for_file_close() + * prior to the final protect call. + */ + if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + pass = FALSE; + failure_mssg = "unexpected failure of prep for file close.\n"; + } /* end if */ + protect_entry(file_ptr, 0, 0); if(H5C_dest(file_ptr, H5AC_ind_read_dxpl_id) >= 0) { diff --git a/test/cache_common.c b/test/cache_common.c index 0061f31..daf9777 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3408,6 +3408,12 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } + if ( H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + + pass = FALSE; + failure_mssg = "unexpected failure of prep for file close.\n"; + } + flush_cache(file_ptr, TRUE, FALSE, FALSE); H5C_dest(file_ptr, H5AC_ind_read_dxpl_id); diff --git a/test/freespace.c b/test/freespace.c index af53eba..d963a6e 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -2869,7 +2869,7 @@ test_fs_sect_iterate(hid_t fapl) if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR - } + } /* end for */ if(H5FS_sect_iterate(f, dxpl_id, frsp, TEST_sects_cb, &udata) < 0) TEST_ERROR @@ -2905,7 +2905,7 @@ error: H5E_BEGIN_TRY { if(frsp) H5FS_close(f, dxpl_id, frsp); - H5Fclose(file); + H5Fclose(file); H5Pclose(dxpl_id); } H5E_END_TRY; return 1; @@ -2915,9 +2915,9 @@ error: int main(void) { - hid_t fapl = -1; /* File access property list for data files */ - unsigned nerrors = 0; /* Cumulative error count */ - const char *env_h5_drvr = NULL; /* File Driver value from environment */ + hid_t fapl = -1; /* File access property list for data files */ + unsigned nerrors = 0; /* Cumulative error count */ + const char *env_h5_drvr = NULL; /* File Driver value from environment */ /* Get the VFD to use */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -2926,11 +2926,16 @@ main(void) h5_reset(); - fapl = h5_fileaccess(); + if((fapl = h5_fileaccess()) < 0) { + nerrors++; + PUTS_ERROR("Can't get VFD-dependent fapl") + } /* end if */ /* make sure alignment is not set for tests to succeed */ - if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) - TEST_ERROR + if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) { + nerrors++; + PUTS_ERROR("Can't set alignment") + } /* end if */ nerrors += test_fs_create(fapl); nerrors += test_fs_sect_add(fapl); @@ -2946,16 +2951,16 @@ main(void) if(nerrors) goto error; - puts("All free-space tests passed."); + HDputs("All free-space tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl); } H5E_END_TRY; - return 1; + HDexit(EXIT_FAILURE); } /* main() */ |