From 77a223347552ceb2029c1d2677f7aec4d3cd6684 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 15 Jun 2016 13:35:25 -0500 Subject: [svn-r30083] Added BRANCH.txt --- BRANCH.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 BRANCH.txt diff --git a/BRANCH.txt b/BRANCH.txt new file mode 100644 index 0000000..9efaed8 --- /dev/null +++ b/BRANCH.txt @@ -0,0 +1,8 @@ +evict_on_close + +This branch is for the development of the "evict on close" feature +which will cause the library to evict all cached information +on object close. + +Dana Robinson is in charge of the branch, which follows the trunk. +It will be deleted when the feature is merged to the trunk. -- cgit v0.12 From 75aa26981b4becc6926f4100707d9614e84a041c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 15 Jun 2016 13:55:59 -0500 Subject: [svn-r30084] First pass at the evict-on-close feature. The features is controlled via H5Pset/get_evict_on_close() and is currently enabled by default (it will be disabled by default in the final implementation). There is a bug in the code where the eviction of tagged metadata fails due to some of the metadata being dirty, resulting in error return values and test failures. --- MANIFEST | 1 + src/H5D.c | 30 +++++++++++++++--- src/H5Fint.c | 16 ++++++++++ src/H5Fpkg.h | 1 + src/H5Fprivate.h | 6 +++- src/H5Fquery.c | 27 ++++++++++++++++ src/H5Pfapl.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Ppublic.h | 2 ++ test/CMakeTests.cmake | 2 ++ test/Makefile.am | 2 +- 10 files changed, 168 insertions(+), 6 deletions(-) diff --git a/MANIFEST b/MANIFEST index e3b0195..13596d0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -900,6 +900,7 @@ ./test/enc_dec_plist.c ./test/enc_dec_plist_cross_platform.c ./test/enum.c +./test/evict_on_close.c ./test/extend.c ./test/external.c ./test/error_test.c diff --git a/src/H5D.c b/src/H5D.c index 23397ad..1ba3829 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -324,21 +324,43 @@ done: herr_t H5Dclose(hid_t dset_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset = NULL; /* Dataset */ + H5F_t *file = NULL; /* File */ + hbool_t evict = FALSE; /* Evict metadata on close? */ + haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == H5I_object_verify(dset_id, H5I_DATASET)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + /* Check if this is the last object reference and we'll be evicting + * on close. We need to cache this info since it will be gone after the + * decrement call frees the struct. + */ + file = dset->oloc.file; + if(1 == dset->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { + evict = TRUE; + tag = dset->oloc.addr; + } /* end if */ /* * Decrement the counter on the dataset. It will be freed if the count * reaches zero. */ if(H5I_dec_app_ref_always_close(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") + + /* Clean up metadata in the metadata cache if evicting on close */ + if(evict && H5F_SHARED(file)) { + if(H5F_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + if(H5F_evict_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") + } /* end if */ done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fint.c b/src/H5Fint.c index 80c593b..5b7fdda 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -954,6 +954,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_class_t *drvr; /*file driver class info */ H5P_genplist_t *a_plist; /*file access property list */ H5F_close_degree_t fc_degree; /*file close degree */ + hbool_t evict_on_close; /* evict on close value from plist */ H5F_t *ret_value = NULL; /*actual return value */ FUNC_ENTER_NOAPI(NULL) @@ -1118,6 +1119,21 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match") } /* end if */ + /* Record the evict-on-close MDC behavior. If it's the first time opening + * the file, set it to access property list value; if it's the second time + * or later, verify that the access property list value matches the value + * in shared file structure. + */ + if(H5P_get(a_plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get evict on close value") + + if(shared->nrefs == 1) { + shared->evict_on_close = evict_on_close; + } else if(shared->nrefs > 1) { + if(shared->evict_on_close != evict_on_close) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file evict-on-close value doesn't match") + } /* end if */ + /* Formulate the absolute path for later search of target file for external links */ if(H5_build_extpath(name, &file->extpath) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index c5aed3b..8ec2a93 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -261,6 +261,7 @@ struct H5F_file_t { /* not change thereafter. */ hid_t fcpl_id; /* File creation property list ID */ H5F_close_degree_t fc_degree; /* File close behavior degree */ + hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */ size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 34a5277..e3b5547 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -279,7 +279,7 @@ #define H5F_ACTUAL_NAME(F) ((F)->actual_name) #define H5F_EXTPATH(F) ((F)->extpath) #define H5F_SHARED(F) ((F)->shared) -#define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared)) +#define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared) #define H5F_NOPEN_OBJS(F) ((F)->nopen_objs) #define H5F_INCR_NOPEN_OBJS(F) ((F)->nopen_objs++) #define H5F_DECR_NOPEN_OBJS(F) ((F)->nopen_objs--) @@ -303,6 +303,7 @@ #define H5F_SET_SOHM_NINDEXES(F, N) ((F)->shared->sohm_nindexes = (N)) #define H5F_FCPL(F) ((F)->shared->fcpl_id) #define H5F_GET_FC_DEGREE(F) ((F)->shared->fc_degree) +#define H5F_EVICT_ON_CLOSE(F) ((F)->shared->evict_on_close) #define H5F_RDCC_NSLOTS(F) ((F)->shared->rdcc_nslots) #define H5F_RDCC_NBYTES(F) ((F)->shared->rdcc_nbytes) #define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0) @@ -348,6 +349,7 @@ #define H5F_SET_SOHM_NINDEXES(F, N) (H5F_set_sohm_nindexes((F), (N))) #define H5F_FCPL(F) (H5F_get_fcpl(F)) #define H5F_GET_FC_DEGREE(F) (H5F_get_fc_degree(F)) +#define H5F_EVICT_ON_CLOSE(F) (H5F_get_evict_on_close(F)) #define H5F_RDCC_NSLOTS(F) (H5F_rdcc_nslots(F)) #define H5F_RDCC_NBYTES(F) (H5F_rdcc_nbytes(F)) #define H5F_RDCC_W0(F) (H5F_rdcc_w0(F)) @@ -463,6 +465,7 @@ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */ +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME "evict_on_close_flag" /* Whether or not the metadata cache will evict objects on close */ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */ #define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */ @@ -660,6 +663,7 @@ H5_DLL unsigned H5F_get_sohm_nindexes(const H5F_t *f); H5_DLL herr_t H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes); H5_DLL hid_t H5F_get_fcpl(const H5F_t *f); H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f); +H5_DLL hbool_t H5F_get_evict_on_close(const H5F_t *f); H5_DLL size_t H5F_rdcc_nbytes(const H5F_t *f); H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f); H5_DLL double H5F_rdcc_w0(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index dd6e8e3..f59a9b7 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -835,6 +835,33 @@ H5F_get_fc_degree(const H5F_t *f) /*------------------------------------------------------------------------- + * Function: H5F_get_evict_on_close + * + * Purpose: Retrieve the 'file close degree' for the file. + * + * Return: Success: Flag indicating whether the evict-on-close + * property was set for the file. + * Failure: (can't happen) + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_get_evict_on_close(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->evict_on_close) +} /* end H5F_get_evict_on_close() */ + + +/*------------------------------------------------------------------------- * Function: H5F_store_msg_crt_idx * * Purpose: Retrieve the 'store message creation index' flag for the file. diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a315f92..c3108c5 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -181,6 +181,11 @@ /* Definition for object flush callback */ #define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) #define H5F_ACS_OBJECT_FLUSH_CB_DEF {NULL, NULL} +/* Definition for evict on close property */ +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE sizeof(hbool_t) +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_DEF TRUE +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC H5P__encode_hbool_t +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC H5P__decode_hbool_t #ifdef H5_HAVE_PARALLEL /* Definition of collective metadata read mode flag */ #define H5F_ACS_COLL_MD_READ_FLAG_SIZE sizeof(H5P_coll_md_read_flag_t) @@ -296,6 +301,7 @@ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMA static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ static const H5F_object_flush_t H5F_def_object_flush_cb_g = H5F_ACS_OBJECT_FLUSH_CB_DEF; /* Default setting for object flush callback */ +static const hbool_t H5F_def_evict_on_close_flag_g = H5F_ACS_EVICT_ON_CLOSE_FLAG_DEF; /* Default setting for evict on close property */ #ifdef H5_HAVE_PARALLEL static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ @@ -462,6 +468,12 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the evict on close flag */ + if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, + NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, @@ -3605,6 +3617,81 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_obj_flush_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_evict_on_close + * + * Purpose: + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close) +{ + H5P_genplist_t *plist; /* property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", fapl_id, evict_on_close); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_evict_on_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_evict_on_close + * + * Purpose: + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close) +{ + H5P_genplist_t *plist; /* property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", fapl_id, evict_on_close); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, evict_on_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close property") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_evict_on_close() */ + #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 0318c8f..b807a37 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -353,6 +353,8 @@ H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata); H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata); +H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close); +H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index e42d8b1..dacf4ba 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -603,6 +603,7 @@ set (H5TEST_TESTS ohdr stab gheap + evict_on_close farray earray btree2 @@ -955,6 +956,7 @@ if (HDF5_TEST_VFD) ohdr stab gheap + evict_on_close pool # accum farray diff --git a/test/Makefile.am b/test/Makefile.am index 37bf539..a7c39f3 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -42,7 +42,7 @@ check_SCRIPTS = $(TEST_SCRIPT) # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. TEST_PROG= testhdf5 cache cache_api cache_tagging lheap ohdr stab gheap \ - farray earray btree2 fheap \ + evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ -- cgit v0.12 From f9312d49d52ba6e6af4549907dd73a4901db6f70 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 08:30:11 -0500 Subject: [svn-r30105] Datatypes and Groups now support evict-on-close. --- src/H5G.c | 32 ++++++++++++++++++++++++++++++-- src/H5T.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/H5G.c b/src/H5G.c index 9bbd43f..e4313fe 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -715,15 +715,29 @@ done: herr_t H5Gclose(hid_t group_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5G_t *grp = NULL; /* Group */ + H5F_t *file = NULL; /* File */ + hbool_t evict = FALSE; /* Evict metadata on close? */ + haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == H5I_object_verify(group_id,H5I_GROUP)) + if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id,H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + /* Check if this is the last object reference and we'll be evicting + * on close. We need to cache this info since it will be gone after the + * decrement call frees the struct. + */ + file = grp->oloc.file; + if(1 == grp->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { + evict = TRUE; + tag = grp->oloc.addr; + } /* end if */ + /* * Decrement the counter on the group atom. It will be freed if the count * reaches zero. @@ -731,6 +745,20 @@ H5Gclose(hid_t group_id) if(H5I_dec_app_ref(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") + /* Clean up metadata in the metadata cache if evicting on close */ + if(evict && H5F_SHARED(file)) { +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(file); + if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(file); + if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(file); + } /* end if */ + done: FUNC_LEAVE_API(ret_value) } /* end H5Gclose() */ diff --git a/src/H5T.c b/src/H5T.c index 775cfdb..2fbc193 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1712,8 +1712,11 @@ done: herr_t H5Tclose(hid_t type_id) { - H5T_t *dt; /* Pointer to datatype to close */ - herr_t ret_value = SUCCEED; /* Return value */ + H5T_t *dt; /* Pointer to datatype to close */ + H5F_t *file = NULL; /* File */ + hbool_t evict = FALSE; /* Evict metadata on close? */ + haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", type_id); @@ -1724,10 +1727,34 @@ H5Tclose(hid_t type_id) if(H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") + /* Check if this is the last object reference and we'll be evicting + * on close. We need to cache this info since it will be gone after the + * decrement call frees the struct. + */ + file = dt->oloc.file; + if(file && 1 == dt->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { + evict = TRUE; + tag = dt->oloc.addr; + } /* end if */ + /* When the reference count reaches zero the resources are freed */ if(H5I_dec_app_ref(type_id) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") + /* Clean up metadata in the metadata cache if evicting on close */ + if(evict && H5F_SHARED(file)) { +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(file); + if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(file); + if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(file); + } /* end if */ + done: FUNC_LEAVE_API(ret_value) } /* end H5Tclose() */ -- cgit v0.12 From b236c2160102a5ed6dd6bce7b0fea0613424981e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 09:54:33 -0500 Subject: [svn-r30106] Moved datatype close code to new internal function. H5Oclose() now supports evict-on-close for datatypes. --- src/H5O.c | 8 ++++++-- src/H5T.c | 49 ++++++++++++++++++++++++++++++++++++++----------- src/H5Tprivate.h | 1 + 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/src/H5O.c b/src/H5O.c index d1806a1..aa30e79 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1069,14 +1069,18 @@ H5Oclose(hid_t object_id) /* Get the type of the object and close it in the correct way */ switch(H5I_get_type(object_id)) { case H5I_GROUP: - case H5I_DATATYPE: case H5I_DATASET: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") if(H5I_dec_app_ref(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") break; - + case H5I_DATATYPE: + if(H5I_object(object_id) == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") + if(H5T_close_id(object_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + break; case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5T.c b/src/H5T.c index 2fbc193..dca1a30 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1696,30 +1696,57 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tclose + * Function: H5Tclose * - * Purpose: Frees a datatype and all associated memory. + * Purpose: Frees a datatype and all associated memory. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Return: Non-negative on success/Negative on failure * - * Modifications: + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ herr_t H5Tclose(hid_t type_id) { + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", type_id); + + /* Call internal function */ + if(H5T_close_id(type_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Tclose() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_close_id + * + * Purpose: Internal function to free a datatype and all associated + * memory. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Summer 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_close_id(hid_t type_id) +{ H5T_t *dt; /* Pointer to datatype to close */ H5F_t *file = NULL; /* File */ hbool_t evict = FALSE; /* Evict metadata on close? */ haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", type_id); + FUNC_ENTER_NOAPI(FAIL) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -1756,8 +1783,8 @@ H5Tclose(hid_t type_id) } /* end if */ done: - FUNC_LEAVE_API(ret_value) -} /* end H5Tclose() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_close_id() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 17826ae..45d8d76 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -108,6 +108,7 @@ H5_DLL herr_t H5T_init(void); H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); +H5_DLL herr_t H5T_close_id(hid_t type_id); H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); -- cgit v0.12 From 35f8a064c505e46c438caae8aca01ab85974bca8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 11:15:52 -0500 Subject: [svn-r30107] Moved dataset flush and evict code to H5D_close from H5Dclose. --- src/H5D.c | 44 ++++++++------------------------------------ src/H5Dint.c | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 50 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index e389930..44e4baa 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -308,45 +308,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dclose + * Function: H5Dclose * - * Purpose: Closes access to a dataset (DATASET_ID) and releases - * resources used by it. It is illegal to subsequently use that - * same dataset ID in calls to other dataset functions. + * Purpose: Closes access to a dataset (DATASET_ID) and releases + * resources used by it. It is illegal to subsequently use that + * same dataset ID in calls to other dataset functions. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ herr_t H5Dclose(hid_t dset_id) { - H5D_t *dset = NULL; /* Dataset */ - H5F_t *file = NULL; /* File */ - hbool_t evict = FALSE; /* Evict metadata on close? */ - haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == H5I_object_verify(dset_id, H5I_DATASET)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - /* Check if this is the last object reference and we'll be evicting - * on close. We need to cache this info since it will be gone after the - * decrement call frees the struct. - */ - file = dset->oloc.file; - if(1 == dset->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { - evict = TRUE; - tag = dset->oloc.addr; - } /* end if */ - /* * Decrement the counter on the dataset. It will be freed if the count * reaches zero. @@ -354,20 +340,6 @@ H5Dclose(hid_t dset_id) if(H5I_dec_app_ref_always_close(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") - /* Clean up metadata in the metadata cache if evicting on close */ - if(evict && H5F_SHARED(file)) { -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(file); - if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(file); - if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(file); - } /* end if */ - done: FUNC_LEAVE_API(ret_value) } /* end H5Dclose() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 6f088af..b089c10 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1775,9 +1775,9 @@ done: herr_t H5D_close(H5D_t *dataset) { - hbool_t free_failed = FALSE; - hbool_t corked; /* Whether the dataset is corked or not */ - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t free_failed = FALSE; /* Set if freeing sub-components failed */ + hbool_t corked; /* Whether the dataset is corked or not */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1792,6 +1792,7 @@ H5D_close(H5D_t *dataset) dataset->shared->fo_count--; if(dataset->shared->fo_count == 0) { + /* Flush the dataset's information. Continue to close even if it fails. */ if(H5D__flush_real(dataset, H5AC_ind_read_dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") @@ -1886,12 +1887,12 @@ H5D_close(H5D_t *dataset) (H5O_msg_reset(H5O_FILL_ID, &dataset->shared->dcpl_cache.fill) < 0) || (H5O_msg_reset(H5O_EFL_ID, &dataset->shared->dcpl_cache.efl) < 0); - /* Uncork cache entries with object address tag */ - if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") - if(corked) - if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + /* Uncork cache entries with object address tag */ + if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + if(corked) + if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") /* * Release datatype, dataspace and creation property list -- there isn't @@ -1912,6 +1913,21 @@ H5D_close(H5D_t *dataset) if(H5O_close(&(dataset->oloc)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") + /* Evict dataset metadata if evicting on close */ + if(H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { +// printf("tag: 0x%3llx\n", dataset->oloc.addr); +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(dataset->oloc.file); + if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(dataset->oloc.file); + if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(dataset->oloc.file); + } /* end if */ + /* * Free memory. Before freeing the memory set the file pointer to NULL. * We always check for a null file pointer in other H5D functions to be @@ -1919,8 +1935,8 @@ H5D_close(H5D_t *dataset) * above). */ dataset->oloc.file = NULL; - dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); + } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -1938,16 +1954,16 @@ H5D_close(H5D_t *dataset) HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "problem attempting to free location") } /* end else */ - /* Release the dataset's path info */ - if(H5G_name_free(&(dataset->path)) < 0) - free_failed = TRUE; + /* Release the dataset's path info */ + if(H5G_name_free(&(dataset->path)) < 0) + free_failed = TRUE; /* Free the dataset's memory structure */ dataset = H5FL_FREE(H5D_t, dataset); /* Check if anything failed in the middle... */ if(free_failed) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't free a component of the dataset, but the dataset was freed anyway.") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't free a component of the dataset, but the dataset was freed anyway.") done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From 88c8c78763dcfc0e42906a1b07b117896f6f3dac Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 22:41:48 -0500 Subject: [svn-r30108] Moved group flush and evict code to H5G_close from H5Gclose. --- src/H5Dint.c | 2 +- src/H5G.c | 30 +----------------------------- src/H5Gint.c | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index b089c10..bbe16cf 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1915,7 +1915,7 @@ H5D_close(H5D_t *dataset) /* Evict dataset metadata if evicting on close */ if(H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { -// printf("tag: 0x%3llx\n", dataset->oloc.addr); +// printf("EVICTING DATASET (TAG: 0x%3llx)\n", dataset->oloc.addr); // printf("DUMPING CACHE - BEFORE FLUSH\n"); // H5AC_dump_cache(dataset->oloc.file); if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) diff --git a/src/H5G.c b/src/H5G.c index e4313fe..1955c33 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -715,29 +715,15 @@ done: herr_t H5Gclose(hid_t group_id) { - H5G_t *grp = NULL; /* Group */ - H5F_t *file = NULL; /* File */ - hbool_t evict = FALSE; /* Evict metadata on close? */ - haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id,H5I_GROUP))) + if(NULL == H5I_object_verify(group_id,H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* Check if this is the last object reference and we'll be evicting - * on close. We need to cache this info since it will be gone after the - * decrement call frees the struct. - */ - file = grp->oloc.file; - if(1 == grp->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { - evict = TRUE; - tag = grp->oloc.addr; - } /* end if */ - /* * Decrement the counter on the group atom. It will be freed if the count * reaches zero. @@ -745,20 +731,6 @@ H5Gclose(hid_t group_id) if(H5I_dec_app_ref(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - /* Clean up metadata in the metadata cache if evicting on close */ - if(evict && H5F_SHARED(file)) { -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(file); - if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(file); - if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(file); - } /* end if */ - done: FUNC_LEAVE_API(ret_value) } /* end H5Gclose() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index f5bccc3..ff92ecc 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -486,7 +486,7 @@ H5G_close(H5G_t *grp) if(0 == grp->shared->fo_count) { HDassert(grp != H5G_rootof(H5G_fileof(grp))); - /* Uncork cache entries with object address tag */ + /* Uncork cache entries with object address tag */ if(H5AC_cork(grp->oloc.file, grp->oloc.addr, H5AC__GET_CORKED, &corked) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") if(corked) @@ -500,6 +500,23 @@ H5G_close(H5G_t *grp) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects") if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + + /* Evict group metadata if evicting on close */ + if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { +// printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(grp->oloc.file); + if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(grp->oloc.file); + if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(grp->oloc.file); + } /* end if */ + + /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } else { /* Decrement the ref. count for this object in the top file */ -- cgit v0.12 From 3d13b7c6eeedda3037d2db2ea5bd30a36ebde5c0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 27 Jun 2016 16:04:52 -0500 Subject: [svn-r30110] Added missing evict_on_close.c file to test/. --- test/evict_on_close.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 test/evict_on_close.c diff --git a/test/evict_on_close.c b/test/evict_on_close.c new file mode 100644 index 0000000..bcbd030 --- /dev/null +++ b/test/evict_on_close.c @@ -0,0 +1,144 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Dana Robinson + * Spring 2016 + * + * Purpose: Tests the basic operation of the evict-on-close cache + * behavior. Tests that ensure the tagging is handled correctly + * are located in cache.c. + */ + +#include "h5test.h" + +static herr_t check_evict_on_close_api(void); + + +/*------------------------------------------------------------------------- + * Function: check_evict_on_close_api() + * + * Purpose: Verify that the H5Pset/get_evict_on_close() calls behave + * correctly. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +check_evict_on_close_api(void) +{ + hid_t fapl_id = -1; + hid_t dapl_id = -1; + hbool_t evict_on_close; + herr_t status; + + TESTING("evict on close API"); + + /* Create a fapl */ + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + FAIL_STACK_ERROR; + + /* Check the default */ + evict_on_close = TRUE; + if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) + FAIL_STACK_ERROR; + if(evict_on_close != FALSE) + FAIL_PUTS_ERROR("Incorrect default evict on close value."); + + /* Set the evict on close property */ + evict_on_close = TRUE; + if(H5Pset_evict_on_close(fapl_id, evict_on_close) < 0) + FAIL_STACK_ERROR; + + /* Make sure we can get it back out */ + evict_on_close = FALSE; + if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) + FAIL_STACK_ERROR; + if(evict_on_close != TRUE) + FAIL_PUTS_ERROR("Incorrect evict on close value."); + + /* close fapl */ + if(H5Pclose(fapl_id) < 0) + FAIL_STACK_ERROR; + + /**********************************************/ + /* Trying passing in a non-fapl property list */ + /**********************************************/ + + if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR; + + /* ensure using an incorrect access plist fails */ + H5E_BEGIN_TRY { + status = H5Pset_evict_on_close(dapl_id, evict_on_close); + } H5E_END_TRY; + if(status >= 0) + FAIL_PUTS_ERROR("H5Pset_evict_on_close() accepted invalid access plist."); + + /* ensure an invalid plist fails */ + H5E_BEGIN_TRY { + status = H5Pget_evict_on_close((hid_t)-1, &evict_on_close); + } H5E_END_TRY; + if(status >= 0) + FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); + + /* close dapl */ + if(H5Pclose(dapl_id) < 0) + FAIL_STACK_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5_FAILED(); + return FAIL; + +} /* check_evict_on_close_api() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Return: EXIT_FAILURE/EXIT_SUCCESS + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + unsigned nerrors = 0; + + printf("Testing evict-on-close cache behavior.\n"); + + nerrors += check_evict_on_close_api() < 0 ? 1 : 0; + + if(nerrors) { + printf("***** %u evict-on-close test%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + return EXIT_FAILURE; + } + + printf("All evict-on-close tests passed.\n"); + + return EXIT_SUCCESS; +} + -- cgit v0.12 From b1eb1b3ee8693e2a56b074315b521c66255acca1 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 1 Sep 2016 17:24:24 -0500 Subject: Replace assertion in H5O_dtype_decode_helper for number of array dimensions with a check and error. The assertion was inappropriate because it is operating on data read from the file, which the library does not always have direct control of. --- src/H5Odtype.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index e51d319..eae542b 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -519,7 +519,8 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p dt->shared->u.array.ndims = *(*pp)++; /* Double-check the number of dimensions */ - HDassert(dt->shared->u.array.ndims <= H5S_MAX_RANK); + if(dt->shared->u.array.ndims > H5S_MAX_RANK) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "too many dimensions for array datatype") /* Skip reserved bytes, if version has them */ if(version < H5O_DTYPE_VERSION_3) -- cgit v0.12 From 2409f991667283f8fa1dacc66f245950693495aa Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 8 Sep 2016 10:48:54 -0500 Subject: Fix issues in H5Znbit.c where the decompression algorithm would not check the compressed data for validity, potentially causing a buffer overflow. --- src/H5Znbit.c | 97 ++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 73 insertions(+), 24 deletions(-) diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 04e8869..7efab42 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -65,13 +65,13 @@ static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_of unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size); static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p); -static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, +static herr_t H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index); -static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, +static herr_t H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index); -static void H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, +static herr_t H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, const unsigned parms[]); static void H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size); @@ -1011,7 +1011,8 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit decompression") /* decompress the buffer */ - H5Z_nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values); + if(H5Z__nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, 0, "can't decompress buffer") } /* end if */ /* output; compress */ else { @@ -1166,13 +1167,16 @@ H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, } } -static void -H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, +static herr_t +H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index) { unsigned i, total_size, base_class, base_size, n, begin_index; parms_atomic p; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC total_size = parms[(*parms_index)++]; base_class = parms[(*parms_index)++]; @@ -1183,6 +1187,11 @@ H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, p.order = parms[(*parms_index)++]; p.precision = parms[(*parms_index)++]; p.offset = parms[(*parms_index)++]; + + /* Check values of precision and offset */ + if(p.precision > p.size * 8 || (p.precision + p.offset) > p.size * 8) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") + n = total_size / p.size; for(i = 0; i < n; i++) H5Z_nbit_decompress_one_atomic(data, data_offset + i * p.size, @@ -1194,8 +1203,9 @@ H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_decompress_one_array(data, data_offset + i * base_size, - buffer, j, buf_len, parms, parms_index); + if(H5Z__nbit_decompress_one_array(data, data_offset + i * base_size, + buffer, j, buf_len, parms, parms_index) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") *parms_index = begin_index; } break; @@ -1205,8 +1215,9 @@ H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_decompress_one_compound(data, data_offset + i * base_size, - buffer, j, buf_len, parms, parms_index); + if(H5Z__nbit_decompress_one_compound(data, data_offset + i * base_size, + buffer, j, buf_len, parms, parms_index) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") *parms_index = begin_index; } break; @@ -1219,44 +1230,66 @@ H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, default: HDassert(0 && "This Should never be executed!"); } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) } -static void -H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, +static herr_t +H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index) { - unsigned i, nmembers, member_offset, member_class, size; + unsigned i, nmembers, member_offset, member_class, member_size, used_size = 0, size; parms_atomic p; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC - (*parms_index)++; /* skip total size of compound datatype */ + size = parms[(*parms_index)++]; nmembers = parms[(*parms_index)++]; for(i = 0; i < nmembers; i++) { member_offset = parms[(*parms_index)++]; member_class = parms[(*parms_index)++]; + + /* Check for overflow */ + member_size = parms[*parms_index]; + used_size += member_size; + if(used_size > size) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "compound member offset overflowed compound size") switch(member_class) { case H5Z_NBIT_ATOMIC: - p.size = parms[(*parms_index)++]; + p.size = member_size; + /* Advance past member size */ + (*parms_index)++; p.order = parms[(*parms_index)++]; p.precision = parms[(*parms_index)++]; p.offset = parms[(*parms_index)++]; + + /* Check values of precision and offset */ + if(p.precision > p.size * 8 || (p.precision + p.offset) > p.size * 8) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") + H5Z_nbit_decompress_one_atomic(data, data_offset + member_offset, buffer, j, buf_len, &p); break; case H5Z_NBIT_ARRAY: - H5Z_nbit_decompress_one_array(data, data_offset + member_offset, - buffer, j, buf_len, parms, parms_index); + if(H5Z__nbit_decompress_one_array(data, data_offset + member_offset, + buffer, j, buf_len, parms, parms_index) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") break; case H5Z_NBIT_COMPOUND: - H5Z_nbit_decompress_one_compound(data, data_offset+member_offset, - buffer, j, buf_len, parms, parms_index); + if(H5Z__nbit_decompress_one_compound(data, data_offset+member_offset, + buffer, j, buf_len, parms, parms_index) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") break; case H5Z_NBIT_NOOPTYPE: - size = parms[(*parms_index)++]; + /* Advance past member size */ + (*parms_index)++; H5Z_nbit_decompress_one_nooptype(data, data_offset+member_offset, buffer, j, buf_len, size); break; @@ -1265,10 +1298,13 @@ H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, HDassert(0 && "This Should never be executed!"); } /* end switch */ } + +done: + FUNC_LEAVE_NOAPI(ret_value) } -static void -H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, +static herr_t +H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, const unsigned parms[]) { /* i: index of data, j: index of buffer, @@ -1278,6 +1314,9 @@ H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffe size_t buf_len; parms_atomic p; unsigned parms_index; /* index in array parms used by compression/decompression functions */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC /* may not have to initialize to zeros */ HDmemset(data, 0, d_nelmts * parms[4]); @@ -1292,6 +1331,11 @@ H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffe p.order = parms[5]; p.precision = parms[6]; p.offset = parms[7]; + + /* Check values of precision and offset */ + if(p.precision > p.size * 8 || (p.precision + p.offset) > p.size * 8) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") + for(i = 0; i < d_nelmts; i++) H5Z_nbit_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, &p); break; @@ -1300,7 +1344,8 @@ H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffe size = parms[4]; parms_index = 4; /* set the index before goto function call */ for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_decompress_one_array(data, i * size, buffer, &j, &buf_len, parms, &parms_index); + if(H5Z__nbit_decompress_one_array(data, i * size, buffer, &j, &buf_len, parms, &parms_index) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") parms_index = 4; } break; @@ -1309,7 +1354,8 @@ H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffe size = parms[4]; parms_index = 4; /* set the index before goto function call */ for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_decompress_one_compound(data, i * size, buffer, &j, &buf_len, parms, &parms_index); + if(H5Z__nbit_decompress_one_compound(data, i * size, buffer, &j, &buf_len, parms, &parms_index) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") parms_index = 4; } break; @@ -1317,6 +1363,9 @@ H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffe default: HDassert(0 && "This Should never be executed!"); } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) } static void -- cgit v0.12 From bc10fd219e60fc4b9df7d80567ecb1e39ae5b6e3 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 8 Sep 2016 13:47:22 -0500 Subject: Change check for number of dimensions for old-style arrays in datatype decoding routine from an assertion to an if/HGOTO_ERROR check, since it is inappropriate to assert the contents of a file will be what we expect. --- src/H5Odtype.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index e51d319..3c3f284 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -311,7 +311,11 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p if(version == H5O_DTYPE_VERSION_1) { /* Decode the number of dimensions */ ndims = *(*pp)++; - HDassert(ndims <= 4); + + /* Check that ndims is valid */ + if(ndims > 4) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid number of dimensions for array") + *pp += 3; /*reserved bytes */ /* Skip dimension permutation */ -- cgit v0.12 From 391a231b76c1200ecda5d74636213e9e479fa51a Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Fri, 9 Sep 2016 12:08:30 -0500 Subject: Fix bug in "nooptype" decode in fix for TALOS-0177. --- src/H5Znbit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 7efab42..7a41d16 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -1291,7 +1291,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, /* Advance past member size */ (*parms_index)++; H5Z_nbit_decompress_one_nooptype(data, data_offset+member_offset, - buffer, j, buf_len, size); + buffer, j, buf_len, member_size); break; default: -- cgit v0.12 From c1c384878ba58193120c3da804d761542c47bd7d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 14 Sep 2016 16:50:29 -0400 Subject: Added missing evict on close test file line to test/CMakeLists.txt. --- test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 97471d1..19603ca 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -203,6 +203,7 @@ set (H5_TESTS ohdr stab gheap + evict_on_close farray earray btree2 -- cgit v0.12 From 12fbb4426aee6be3de235a3818ca43ecfec4b84b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 13:04:07 -0400 Subject: Updated manifest. Was missing BRANCH.txt. --- MANIFEST | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST b/MANIFEST index fb454c5..3ed99e7 100644 --- a/MANIFEST +++ b/MANIFEST @@ -25,6 +25,7 @@ ./.autom4te.cfg _DO_NOT_DISTRIBUTE_ ./.h5chkright.ini _DO_NOT_DISTRIBUTE_ ./ACKNOWLEDGMENTS +./BRANCH.txt ./COPYING ./MANIFEST ./Makefile.dist -- cgit v0.12 From 73bd8b7c2fe0d5c8763cb2d33fe1915e465947cb Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 13:51:38 -0400 Subject: Fixed format_convert and fortran files (bad merge?). --- fortran/src/H5Eff.F90 | 2 +- fortran/src/H5Pff.F90 | 8 +-- tools/h5format_convert/testfiles/h5fc_ext1_f.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_ext1_i.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_ext1_s.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_ext2_if.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_ext2_is.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_all.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_bt1.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_err.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_n_all.ddl | 2 +- .../testfiles/h5fc_v_ndata_bt1.ddl | 2 +- .../testfiles/h5fc_v_non_chunked.ddl | 2 +- .../h5format_convert/testfiles/old_h5fc_ext1_f.ddl | 2 +- .../h5format_convert/testfiles/old_h5fc_ext1_i.ddl | 2 +- .../h5format_convert/testfiles/old_h5fc_ext1_s.ddl | 2 +- .../testfiles/old_h5fc_ext2_if.ddl | 2 +- .../testfiles/old_h5fc_ext2_is.ddl | 2 +- .../testfiles/old_h5fc_ext2_sf.ddl | 2 +- .../testfiles/old_h5fc_ext3_isf.ddl | 2 +- tools/h5format_convert/testh5fc.sh.in | 82 ++++++++++++---------- 24 files changed, 69 insertions(+), 65 deletions(-) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index 7a0b15b..d96d448 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -141,8 +141,8 @@ CONTAINS INTEGER FUNCTION h5eprint_c2() BIND(C,NAME='h5eprint_c2') END FUNCTION h5eprint_c2 END INTERFACE - namelen = LEN(NAME) IF (PRESENT(name)) THEN + namelen = LEN(NAME) hdferr = h5eprint_c1(name, namelen) ELSE hdferr = h5eprint_c2() diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index e052ea0..532ecc6 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -6260,11 +6260,11 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of ! of fillvalue datatype ! (in memory) - CHARACTER, INTENT(IN), TARGET :: fillvalue ! Fillvalue + CHARACTER(LEN=1), INTENT(IN), TARGET :: fillvalue ! Fillvalue INTEGER, INTENT(OUT) :: hdferr ! Error code TYPE(C_PTR) :: f_ptr ! C address - f_ptr = C_LOC(fillvalue) + f_ptr = C_LOC(fillvalue(1:1)) hdferr = h5pset_fill_value_c(prp_id, type_id, f_ptr) END SUBROUTINE h5pset_fill_value_char @@ -6275,7 +6275,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of ! of fillvalue datatype ! (in memory) - CHARACTER, INTENT(OUT) :: fillvalue ! Fillvalue + CHARACTER(LEN=*), INTENT(OUT) :: fillvalue ! Fillvalue INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER :: i @@ -6286,7 +6286,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! To resolve Issue #1 outlined in the preamble of this file we ! need to pack the character string into an array. - chr_len = LEN(fillvalue) + chr_len = LEN(fillvalue(1:1)) ALLOCATE(chr(1:chr_len), STAT=hdferr) IF (hdferr .NE. 0) THEN hdferr = -1 diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl index fb5192d..dae9284 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl index 2fff4ac..8ec4656 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl index fb5192d..dae9284 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl index 2fff4ac..8ec4656 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl index 2fff4ac..8ec4656 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl index fb5192d..dae9284 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl b/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl index 2fff4ac..8ec4656 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_all.ddl index 5e7365d..a1af831 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_all.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_CONTIGUOUS... Open the dataset diff --git a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl index c501eb0..31de12a 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /GROUP/DSET_BT2... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/h5fc_v_err.ddl b/tools/h5format_convert/testfiles/h5fc_v_err.ddl index 4a728e8..b671db0 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_err.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_err.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_ERR... Open the dataset diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl index ff5da4a..fcdadd8 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /DSET_EA... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl index d2ffbbf..074ce6f 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file tmp.h5 +Open the file outtmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_CONTIGUOUS... Open the dataset diff --git a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl index ba794a7..c75699a 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /DSET_NDATA_BT2... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl index aba0740..5945389 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /DSET_CONTIGUOUS... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl index fb5192d..dae9284 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl index c906082..d1768c8 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 1 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl index fb5192d..dae9284 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl index 2fff4ac..8ec4656 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl index 2fff4ac..8ec4656 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl index fb5192d..dae9284 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl index 2fff4ac..8ec4656 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testh5fc.sh.in b/tools/h5format_convert/testh5fc.sh.in index 000425b..0d74697 100644 --- a/tools/h5format_convert/testh5fc.sh.in +++ b/tools/h5format_convert/testh5fc.sh.in @@ -69,7 +69,10 @@ TESTDIR=./testfiles test -d $TESTDIR || mkdir $TESTDIR # Copy the testfile to a temporary file for testing as h5format_convert is changing the file in place +TMPOUTFILE=outtmp.h5 TMPFILE=tmp.h5 +TMPCHKFILE=chktmp.h5 +TMPDMPFILE=dmptmp.h5 ###################################################################### # test files @@ -170,7 +173,7 @@ CLEAN_TESTFILES_AND_TESTDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=$SRC_H5FORMCONV_TESTFILES INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -213,11 +216,11 @@ TOOLTEST_OUT() { actual_err_sav=${actual_err}-sav # Prepare the test file - $RM $TESTDIR/$TMPFILE + $RM $TESTDIR/$TMPOUTFILE TFILE=$2 if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then - $CP $TESTDIR/$2 $TESTDIR/$TMPFILE - TFILE=$TMPFILE + $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE + TFILE=$TMPOUTFILE fi # Run test. @@ -245,14 +248,15 @@ TOOLTEST_OUT() { # $1 is the test file name # --fname exists # --fname is copied to a temporary file for testing -# $2 to at most $4--options to the tool such as: +# $2 is the temporary file name +# $3 to at most $5--options to the tool such as: # -d dname # -n TOOLTEST() { - TESTING $FORMCONV $2 $3 $4 $1 - $RM $TESTDIR/$TMPFILE - $CP $TESTDIR/$1 $TESTDIR/$TMPFILE - $RUNSERIAL $FORMCONV_BIN $2 $3 $4 $TESTDIR/$TMPFILE + TESTING $FORMCONV $3 $4 $5 $1 + $RM $TESTDIR/$2 + $CP $TESTDIR/$1 $TESTDIR/$2 + $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $TESTDIR/$2 exitcode=$? if [ $exitcode -ne 0 ]; then echo "*FAILED*" @@ -272,7 +276,7 @@ CHECKING() { # $1 dataset name IDX_CHECK() { CHECKING $1 - $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPFILE $1 + $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPCHKFILE $1 ret=$? if [ $ret -eq 0 ]; then echo " PASSED" @@ -304,7 +308,7 @@ H5DUMP_CHECK() { expect="$TESTDIR/$2" actual="$TESTDIR/`basename $2 .ddl`.out" actual_err="$TESTDIR/`basename $2 .ddl`.err" - $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$TMPFILE > $actual 2>$actual_err + $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$TMPDMPFILE > $actual 2>$actual_err cat $actual_err >> $actual # Compare output @@ -387,28 +391,28 @@ TOOLTEST_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v # h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5 # h5format_convert -d /DSET_NONE h5fc_ext_none.h5 # h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5 -TOOLTEST h5fc_ext_none.h5 -d /DSET_EA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_EA IDX_CHECK /DSET_EA # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_EA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_EA IDX_CHECK /GROUP/DSET_NDATA_EA # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_BT2 +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_BT2 IDX_CHECK /GROUP/DSET_BT2 # -TOOLTEST h5fc_ext_none.h5 -d /DSET_NDATA_BT2 +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NDATA_BT2 IDX_CHECK /DSET_NDATA_BT2 # -TOOLTEST h5fc_ext_none.h5 -d /DSET_FA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_FA IDX_CHECK /DSET_FA # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_FA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_FA IDX_CHECK /GROUP/DSET_NDATA_FA # -TOOLTEST h5fc_ext_none.h5 -d /DSET_NONE +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NONE IDX_CHECK /DSET_NONE # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_NONE +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_NONE IDX_CHECK /GROUP/DSET_NDATA_NONE # # @@ -416,16 +420,16 @@ IDX_CHECK /GROUP/DSET_NDATA_NONE # No output from tests: just check exit code # h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset) # h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset) -TOOLTEST old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -TOOLTEST h5fc_non_v3.h5 -d /DSET_CONTIGUOUS +TOOLTEST old_h5fc_ext_none.h5 $TMPFILE -d /DSET_NDATA_BT2 +TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /DSET_CONTIGUOUS # # # # No output from tests: just check exit code # h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset) # h5format_convert -n h5fc_non_v3.h5 (noop, all datasets) -TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_BT2 -n -TOOLTEST h5fc_non_v3.h5 -n +TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /GROUP/DSET_BT2 -n +TOOLTEST h5fc_non_v3.h5 $TMPFILE -n # # # @@ -433,7 +437,7 @@ TOOLTEST h5fc_non_v3.h5 -n # h5format_convert h5fc_non_v3.h5 # 1) convert all datasets # 2) verify indexing types -TOOLTEST h5fc_non_v3.h5 +TOOLTEST h5fc_non_v3.h5 $TMPCHKFILE IDX_CHECK /DSET_NDATA_EA IDX_CHECK /DSET_NDATA_BT2 IDX_CHECK /GROUP/DSET_BT2 @@ -445,47 +449,47 @@ IDX_CHECK /GROUP/DSET_EA # h5format_convert h5fc_edge_v3.h5 # 1) convert the chunked dataset (filter, no-filter-edge-chunk) # 2) verify the indexing type -TOOLTEST h5fc_edge_v3.h5 +TOOLTEST h5fc_edge_v3.h5 $TMPCHKFILE IDX_CHECK /DSET_EDGE # # # The following test files have messages in the superblock extension. # Verify h5dump output for correctness after conversion -TOOLTEST h5fc_ext1_i.h5 +TOOLTEST h5fc_ext1_i.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext1_i.h5 h5fc_ext1_i.ddl -TOOLTEST h5fc_ext1_s.h5 +TOOLTEST h5fc_ext1_s.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext1_s.h5 h5fc_ext1_s.ddl -TOOLTEST h5fc_ext1_f.h5 +TOOLTEST h5fc_ext1_f.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext1_f.h5 h5fc_ext1_f.ddl # -TOOLTEST h5fc_ext2_if.h5 +TOOLTEST h5fc_ext2_if.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext2_if.h5 h5fc_ext2_if.ddl -TOOLTEST h5fc_ext2_is.h5 +TOOLTEST h5fc_ext2_is.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext2_is.h5 h5fc_ext2_is.ddl -TOOLTEST h5fc_ext2_sf.h5 +TOOLTEST h5fc_ext2_sf.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext2_sf.h5 h5fc_ext2_sf.ddl # -TOOLTEST h5fc_ext3_isf.h5 +TOOLTEST h5fc_ext3_isf.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext3_isf.h5 h5fc_ext3_isf.ddl # # # -TOOLTEST old_h5fc_ext1_i.h5 +TOOLTEST old_h5fc_ext1_i.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext1_i.h5 old_h5fc_ext1_i.ddl -TOOLTEST old_h5fc_ext1_s.h5 +TOOLTEST old_h5fc_ext1_s.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext1_s.h5 old_h5fc_ext1_s.ddl -TOOLTEST old_h5fc_ext1_f.h5 +TOOLTEST old_h5fc_ext1_f.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext1_f.h5 old_h5fc_ext1_f.ddl # -TOOLTEST old_h5fc_ext2_if.h5 +TOOLTEST old_h5fc_ext2_if.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext2_if.h5 old_h5fc_ext2_if.ddl -TOOLTEST old_h5fc_ext2_is.h5 +TOOLTEST old_h5fc_ext2_is.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext2_is.h5 old_h5fc_ext2_is.ddl -TOOLTEST old_h5fc_ext2_sf.h5 +TOOLTEST old_h5fc_ext2_sf.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf.ddl # -TOOLTEST old_h5fc_ext3_isf.h5 +TOOLTEST old_h5fc_ext3_isf.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf.ddl # # Clean up temporary files/directories -- cgit v0.12 From 7f99d42583e4ba3d4e6c3e1bb09538db6b42e388 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 14:52:45 -0400 Subject: Reverted H5T code since datatypes will not be supported at this time. --- src/H5T.c | 82 ++++++++++---------------------------------------------- src/H5Tprivate.h | 1 - 2 files changed, 14 insertions(+), 69 deletions(-) diff --git a/src/H5T.c b/src/H5T.c index cc0e782..b2575d5 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1696,95 +1696,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tclose + * Function: H5Tclose * - * Purpose: Frees a datatype and all associated memory. + * Purpose: Frees a datatype and all associated memory. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Tclose(hid_t type_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5T_t *dt; /* Pointer to datatype to close */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", type_id); - /* Call internal function */ - if(H5T_close_id(type_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Tclose() */ - - -/*------------------------------------------------------------------------- - * Function: H5T_close_id - * - * Purpose: Internal function to free a datatype and all associated - * memory. - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * Summer 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -H5T_close_id(hid_t type_id) -{ - H5T_t *dt; /* Pointer to datatype to close */ - H5F_t *file = NULL; /* File */ - hbool_t evict = FALSE; /* Evict metadata on close? */ - haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(H5T_STATE_IMMUTABLE == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") - - /* Check if this is the last object reference and we'll be evicting - * on close. We need to cache this info since it will be gone after the - * decrement call frees the struct. - */ - file = dt->oloc.file; - if(file && 1 == dt->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { - evict = TRUE; - tag = dt->oloc.addr; - } /* end if */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") /* When the reference count reaches zero the resources are freed */ if(H5I_dec_app_ref(type_id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") - - /* Clean up metadata in the metadata cache if evicting on close */ - if(evict && H5F_SHARED(file)) { -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(file); - if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(file); - if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(file); - } /* end if */ + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_close_id() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Tclose() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 5fd0cf3..7efcb41 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -108,7 +108,6 @@ H5_DLL herr_t H5T_init(void); H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); -H5_DLL herr_t H5T_close_id(hid_t type_id); H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); -- cgit v0.12 From 29b169abb3ab8fcb0c1e75693def8829433dd6a0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 15:31:07 -0400 Subject: Removed blank line in Fortran file (leftover from last commit) --- fortran/src/H5Eff.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index d96d448..2fc77f4 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -136,7 +136,6 @@ CONTAINS CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name END FUNCTION h5eprint_c1 END INTERFACE - INTERFACE INTEGER FUNCTION h5eprint_c2() BIND(C,NAME='h5eprint_c2') END FUNCTION h5eprint_c2 -- cgit v0.12 From 2646f917adb5b2e17404260e433dc3ed7c39a602 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 16:18:30 -0400 Subject: Cleaned up feature for dissemination to LLNL: - Removed support for datatypes. - Commented out support for groups - General change clean-up - Added a list of improvements to BRANCH.txt --- BRANCH.txt | 14 ++++++++++++++ src/H5Ctag.c | 12 ++++++------ src/H5Gint.c | 18 +++++++++++------- src/H5O.c | 8 ++------ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/BRANCH.txt b/BRANCH.txt index 9efaed8..6c4ee6c 100644 --- a/BRANCH.txt +++ b/BRANCH.txt @@ -6,3 +6,17 @@ on object close. Dana Robinson is in charge of the branch, which follows the trunk. It will be deleted when the feature is merged to the trunk. + +Key changes: + +* New H5Pset/get_evict_on_close() functions that enable and disable + the feature (default: disabled). + +* New property: H5F_ACS_EVICT_ON_CLOSE_FLAG + +* Added match_global flag to H5AC_evict_tagged_metadata() and + H5C_evict_tagged_entries() parameter lists. + +* H5D_close() updated to evict on close, when the property is set. + +* New evict_on_close test to exercise the function. diff --git a/src/H5Ctag.c b/src/H5Ctag.c index fc01ecb..e1b4df6 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -374,15 +374,15 @@ H5C_evict_tagged_entries(H5F_t * f, hid_t dxpl_id, haddr_t tag, hbool_t match_gl /* Start evicting entries */ do { - /* Reset pinned/evicted tracking flags */ - ctx.pinned_entries_need_evicted = FALSE; - ctx.evicted_entries_last_pass = FALSE; + /* Reset pinned/evicted tracking flags */ + ctx.pinned_entries_need_evicted = FALSE; + ctx.evicted_entries_last_pass = FALSE; - /* Iterate through entries in the cache */ + /* Iterate through entries in the cache */ if(H5C__iter_tagged_entries(cache, tag, match_global, H5C__evict_tagged_entries_cb, &ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, match_global, "Iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") - /* Keep doing this until we have stopped evicted entries */ + /* Keep doing this until we have stopped evicted entries */ } while(TRUE == ctx.evicted_entries_last_pass); /* Fail if we have finished evicting entries and pinned entries still need evicted */ diff --git a/src/H5Gint.c b/src/H5Gint.c index ff92ecc..4b34015 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -501,20 +501,24 @@ H5G_close(H5G_t *grp) if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") +#ifdef DER + /* XXX - NOT IMPLEMENTED */ /* Evict group metadata if evicting on close */ if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { -// printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(grp->oloc.file); + /* I've left in the cache dump code for now - DER */ + printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); + printf("DUMPING CACHE - BEFORE FLUSH\n"); + H5AC_dump_cache(grp->oloc.file); if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(grp->oloc.file); + printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); + H5AC_dump_cache(grp->oloc.file); if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(grp->oloc.file); + printf("DUMPING CACHE - AFTER EVICT\n"); + H5AC_dump_cache(grp->oloc.file); } /* end if */ +#endif /* DER */ /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); diff --git a/src/H5O.c b/src/H5O.c index aa30e79..d1806a1 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1069,18 +1069,14 @@ H5Oclose(hid_t object_id) /* Get the type of the object and close it in the correct way */ switch(H5I_get_type(object_id)) { case H5I_GROUP: + case H5I_DATATYPE: case H5I_DATASET: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") if(H5I_dec_app_ref(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") break; - case H5I_DATATYPE: - if(H5I_object(object_id) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") - if(H5T_close_id(object_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") - break; + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: -- cgit v0.12 From 392b8ce3c98ac4e52d53f33e591ed6bf14155925 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 22 Sep 2016 12:02:02 -0500 Subject: HDFFV-9973 Fortran library fails to compile and fails tests with NAG compiler Fixes issues with KIND = BYTE assumptions. --- fortran/src/H5Pff.F90 | 14 +-- fortran/src/H5_f.c | 236 +++++++++++++---------------------- fortran/src/H5_ff.F90 | 38 +++--- fortran/src/H5f90global.F90 | 43 ++++--- fortran/src/H5match_types.c | 40 ++++-- fortran/test/fortranlib_test_F03.F90 | 2 +- fortran/test/tH5T_F03.F90 | 42 +++---- 7 files changed, 181 insertions(+), 234 deletions(-) diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 532ecc6..6ba5aeb 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -6397,18 +6397,18 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) !! SUBROUTINE h5pget_fill_value_f(prp_id, type_id, fillvalue, hdferr) !! INTEGER(HID_T), INTENT(IN) :: prp_id !! INTEGER(HID_T), INTENT(IN) :: type_id -!! TYPE(C_PTR) , INTENT(OUT) :: fillvalue +!! TYPE(C_PTR) :: fillvalue !! INTEGER , INTENT(OUT) :: hdferr !***** SUBROUTINE h5pget_fill_value_ptr(prp_id, type_id, fillvalue, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier - INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of - ! of fillvalue datatype - ! (in memory) - TYPE(C_PTR), INTENT(OUT) :: fillvalue ! Fillvalue - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + TYPE(C_PTR) :: fillvalue ! Fillvalue + INTEGER , INTENT(OUT) :: hdferr ! Error code hdferr = h5pget_fill_value_c(prp_id, type_id, fillvalue) diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index d7b952d..9d4c297 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -23,6 +23,10 @@ #include "H5f90.h" #include "H5fort_type_defines.h" + +int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; + + /****if* H5_f/h5init_types_c * NAME * h5init_types_c @@ -55,173 +59,136 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes int ret_value = -1; hid_t c_type_id; size_t tmp_val; + int i; + + /* Fortran INTEGER may not be the same as C; do all checking to find + an appropriate size + */ + + /* + * FIND H5T_NATIVE_INTEGER_# + */ + for(i=0;i<4;i++) { + + if ( IntKinds_SizeOf[i] == sizeof(char)) { + if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; + } /*end if */ + else if ( IntKinds_SizeOf[i] == sizeof(short)) { + if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; + } /*end if */ + else if ( IntKinds_SizeOf[i] == sizeof(int)) { + if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; + } /*end if */ + else if ( IntKinds_SizeOf[i] == sizeof(long long)) { + if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; + } /*end if */ + else { + if ((types[i] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + if ( H5Tset_precision (types[i], 128) < 0) return ret_value; + } /*end else */ + + } + +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 + /* + * FIND H5T_NATIVE_INTEGER_KIND(5), INTEGER*16 + */ + if (sizeof(int_16_f) == sizeof(char)) { + if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; + } /*end if */ + else if (sizeof(int_16_f) == sizeof(short)) { + if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; + } /*end if */ + else if (sizeof(int_16_f) == sizeof(int)) { + if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; + } /*end if */ + else if (sizeof(int_16_f) == sizeof(long long)) { + if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; + } /*end else */ + else { + if ((types[4] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + if ( H5Tset_precision (types[4], 128) < 0) return ret_value; + } /*end else */ +#else + if ((types[4] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + if ( H5Tset_precision (types[4], 128) < 0) return ret_value; +#endif -/* Fortran INTEGER may not be the same as C; do all checking to find - an appropriate size -*/ if (sizeof(int_f) == sizeof(int)) { - if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; + if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; } /*end if */ else if (sizeof(int_f) == sizeof(long)) { - if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0) return ret_value; + if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0) return ret_value; } /*end if */ else if (sizeof(int_f) == sizeof(long long)) { - if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; + if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; } /*end else */ /* Find appropriate size to store Fortran REAL */ if(sizeof(real_f)==sizeof(float)) { - if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; } /* end if */ else if(sizeof(real_f)==sizeof(double)){ - if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; + if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; } /* end if */ #if H5_SIZEOF_LONG_DOUBLE!=0 else if (sizeof(real_f) == sizeof(long double)) { - if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; + if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; } /* end else */ #endif /* Find appropriate size to store Fortran DOUBLE */ if(sizeof(double_f)==sizeof(double)) { - if ((types[2] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; + if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; }/*end if */ #if H5_SIZEOF_LONG_DOUBLE!=0 else if(sizeof(double_f)==sizeof(long double)) { - if ((types[2] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; + if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; }/*end else */ #endif #ifdef H5_HAVE_FLOAT128 else if(sizeof(double_f)==sizeof(__float128)) { - if ((types[2] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; - if ( H5Tset_precision (types[2], 128) < 0) return ret_value; + if ((types[7] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ( H5Tset_precision (types[7], 128) < 0) return ret_value; }/*end else */ #endif -/* - if ((types[3] = H5Tcopy(H5T_NATIVE_UINT8)) < 0) return ret_value; -*/ if ((c_type_id = H5Tcopy(H5T_FORTRAN_S1)) < 0) return ret_value; tmp_val = 1; if(H5Tset_size(c_type_id, tmp_val) < 0) return ret_value; if(H5Tset_strpad(c_type_id, H5T_STR_SPACEPAD) < 0) return ret_value; - types[3] = (hid_t_f)c_type_id; - -/* - if ((types[3] = H5Tcopy(H5T_C_S1)) < 0) return ret_value; - if(H5Tset_strpad(types[3],H5T_STR_NULLTERM) < 0) return ret_value; - if(H5Tset_size(types[3],1) < 0) return ret_value; -*/ + types[8] = (hid_t_f)c_type_id; - -/* if ((types[3] = H5Tcopy(H5T_STD_I8BE)) < 0) return ret_value; -*/ - if ((types[4] = (hid_t_f)H5Tcopy(H5T_STD_REF_OBJ)) < 0) return ret_value; - if ((types[5] = (hid_t_f)H5Tcopy(H5T_STD_REF_DSETREG)) < 0) return ret_value; - /* - * FIND H5T_NATIVE_INTEGER_1 - */ - if (sizeof(int_1_f) == sizeof(char)) { - if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_1_f) == sizeof(short)) { - if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_1_f) == sizeof(int)) { - if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_1_f) == sizeof(long long)) { - if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; - } /*end if */ - else { - if ((types[6] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[6], 128) < 0) return ret_value; - } /*end else */ - /* - * FIND H5T_NATIVE_INTEGER_2 - */ - if (sizeof(int_2_f) == sizeof(char)) { - if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_2_f) == sizeof(short)) { - if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_2_f) == sizeof(int)) { - if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_2_f) == sizeof(long long)) { - if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; - } /*end else */ - else { - if ((types[7] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[7], 128) < 0) return ret_value; - } /*end else */ - /* - * FIND H5T_NATIVE_INTEGER_4 - */ - if (sizeof(int_4_f) == sizeof(char)) { - if ((types[8] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_4_f) == sizeof(short)) { - if ((types[8] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_4_f) == sizeof(int)) { - if ((types[8] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_4_f) == sizeof(long long)) { - if ((types[8] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; - } /*end else */ - else { - if ((types[8] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[8], 128) < 0) return ret_value; - } /*end else */ - /* - * FIND H5T_NATIVE_INTEGER_8 - */ - if (sizeof(int_8_f) == sizeof(char)) { - if ((types[9] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_8_f) == sizeof(short)) { - if ((types[9] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_8_f) == sizeof(int)) { - if ((types[9] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_8_f) == sizeof(long long)) { - if ((types[9] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; - } /*end else */ - else { - if ((types[9] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[9], 128) < 0) return ret_value; - } /*end else */ + if ((types[9] = (hid_t_f)H5Tcopy(H5T_STD_REF_OBJ)) < 0) return ret_value; + if ((types[10] = (hid_t_f)H5Tcopy(H5T_STD_REF_DSETREG)) < 0) return ret_value; /* * FIND H5T_NATIVE_REAL_C_FLOAT */ if (sizeof(real_C_FLOAT_f) == sizeof(float)) { - if ((types[10] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; } /*end if */ else if (sizeof(real_C_FLOAT_f) == sizeof(double)) { - if ((types[10] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; + if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; } /*end if */ #if H5_SIZEOF_LONG_DOUBLE!=0 else if (sizeof(real_C_FLOAT_f) == sizeof(long double)) { - if ((types[10] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; + if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; } /*end else */ #endif /* * FIND H5T_NATIVE_REAL_C_DOUBLE */ if (sizeof(real_C_DOUBLE_f) == sizeof(float)) { - if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; } /*end if */ else if (sizeof(real_C_DOUBLE_f) == sizeof(double)) { - if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; + if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; } /*end if */ #if H5_SIZEOF_LONG_DOUBLE!=0 else if (sizeof(real_C_DOUBLE_f) == sizeof(long double)) { - if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; + if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; } /*end else */ #endif /* @@ -229,60 +196,35 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes */ #if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(float)) { - if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; } /*end if */ else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(double)) { - if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; + if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; } /*end if */ # if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0 else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(long double)) { if ( H5_PAC_C_MAX_REAL_PRECISION >= H5_PAC_FC_MAX_REAL_PRECISION) { - if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; + if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; } else { - if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; - if ( H5Tset_precision (types[12], 128) < 0) return ret_value; + if ((types[13] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ( H5Tset_precision (types[13], 128) < 0) return ret_value; } } # else - if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; - if ( H5Tset_precision (types[12], 64) < 0) return ret_value; + if ((types[13] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ( H5Tset_precision (types[13], 64) < 0) return ret_value; # endif #else - if ((types[12] = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; + if ((types[13] = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; #endif /* * FIND H5T_NATIVE_B_8 */ - if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_B8)) < 0) return ret_value; - if ((types[14] = (hid_t_f)H5Tcopy(H5T_NATIVE_B16)) < 0) return ret_value; - if ((types[15] = (hid_t_f)H5Tcopy(H5T_NATIVE_B32)) < 0) return ret_value; - if ((types[16] = (hid_t_f)H5Tcopy(H5T_NATIVE_B64)) < 0) return ret_value; - -#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 - /* - * FIND H5T_NATIVE_INTEGER_16 - */ - if (sizeof(int_16_f) == sizeof(char)) { - if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_16_f) == sizeof(short)) { - if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_16_f) == sizeof(int)) { - if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_16_f) == sizeof(long long)) { - if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; - } /*end else */ - else { - if ((types[17] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[17], 128) < 0) return ret_value; - } /*end else */ -#else - if ((types[17] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[17], 128) < 0) return ret_value; -#endif + if ((types[14] = (hid_t_f)H5Tcopy(H5T_NATIVE_B8)) < 0) return ret_value; + if ((types[15] = (hid_t_f)H5Tcopy(H5T_NATIVE_B16)) < 0) return ret_value; + if ((types[16] = (hid_t_f)H5Tcopy(H5T_NATIVE_B32)) < 0) return ret_value; + if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_B64)) < 0) return ret_value; /* * FIND H5T_NATIVE_FLOAT_128 diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 169864f..9717d17 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -379,27 +379,24 @@ CONTAINS IMPLICIT NONE INTEGER, INTENT(IN) :: ikind INTEGER, INTENT(IN) :: flag -#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 - INTEGER :: Fortran_INTEGER_16 - Fortran_INTEGER_16=SELECTED_INT_KIND(36) !should map to INTEGER*16 on most modern processors -#endif - - + INTEGER :: i !***** + +!#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 +! ! (1) The array index assumes INTEGER*16 the last integer in the series, and +! ! (2) it should map to INTEGER*16 on most modern processors +! H5T_NATIVE_INTEGER_KIND(H5_FORTRAN_NUM_INTEGER_KINDS)=SELECTED_INT_KIND(36) +!#endif + + h5_type = -1 IF(flag.EQ.H5_INTEGER_KIND)THEN - IF(ikind.EQ.Fortran_INTEGER_1)THEN - h5_type = H5T_NATIVE_INTEGER_1 - ELSE IF(ikind.EQ.Fortran_INTEGER_2)THEN - h5_type = H5T_NATIVE_INTEGER_2 - ELSE IF(ikind.EQ.Fortran_INTEGER_4)THEN - h5_type = H5T_NATIVE_INTEGER_4 - ELSE IF(ikind.EQ.Fortran_INTEGER_8)THEN - h5_type = H5T_NATIVE_INTEGER_8 -#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 - ELSE IF(ikind.EQ.Fortran_INTEGER_16)THEN - h5_type = H5T_NATIVE_INTEGER_16 -#endif - ENDIF + do_kind: DO i = 1, H5_FORTRAN_NUM_INTEGER_KINDS + IF(ikind.EQ.Fortran_INTEGER_AVAIL_KINDS(i))THEN + !PRINT*,ikind, Fortran_INTEGER_AVAIL_KINDS(i),H5T_NATIVE_INTEGER_KIND(i) + h5_type = H5T_NATIVE_INTEGER_KIND(i) + EXIT do_kind + ENDIF + END DO do_kind ELSE IF(flag.EQ.H5_REAL_KIND)THEN IF(ikind.EQ.KIND(1.0_C_FLOAT))THEN h5_type = H5T_NATIVE_REAL_C_FLOAT @@ -414,9 +411,6 @@ CONTAINS ELSE h5_type = H5T_NATIVE_FLOAT_128 #endif -#else - ELSE - h5_type = -1 #endif ENDIF ENDIF diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index af0a000..aef3e4d 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -115,8 +115,11 @@ MODULE H5GLOBAL H5T_STD_U16BE, & H5T_STD_U16LE, & H5T_STD_U32BE - - INTEGER(HID_T) :: H5T_NATIVE_INTEGER_16 ! NEED IFDEF -MSB- + + INTEGER, PARAMETER :: NUM_NATIVE_INTEGER_KIND = 5 + ! INTEGER*1, INTEGER*2, INTEGER*4, INTEGER*8, INTEGER*16 + INTEGER(HID_T), DIMENSION(1:NUM_NATIVE_INTEGER_KIND) :: H5T_NATIVE_INTEGER_KIND + INTEGER(HID_T) :: H5T_NATIVE_FLOAT_128 ! NEED IFDEF -MSB- ! NOTE: Splitting the line since the Fortran 95 standard limits the number of @@ -144,24 +147,24 @@ MODULE H5GLOBAL INTEGER(HID_T), DIMENSION(PREDEF_TYPES_LEN) :: predef_types - EQUIVALENCE (predef_types(1), H5T_NATIVE_INTEGER) - EQUIVALENCE (predef_types(2), H5T_NATIVE_REAL) - EQUIVALENCE (predef_types(3), H5T_NATIVE_DOUBLE) - EQUIVALENCE (predef_types(4), H5T_NATIVE_CHARACTER) - EQUIVALENCE (predef_types(5), H5T_STD_REF_OBJ) - EQUIVALENCE (predef_types(6), H5T_STD_REF_DSETREG) - EQUIVALENCE (predef_types(7), H5T_NATIVE_INTEGER_1) - EQUIVALENCE (predef_types(8), H5T_NATIVE_INTEGER_2) - EQUIVALENCE (predef_types(9), H5T_NATIVE_INTEGER_4) - EQUIVALENCE (predef_types(10), H5T_NATIVE_INTEGER_8) - EQUIVALENCE (predef_types(11), H5T_NATIVE_REAL_C_FLOAT) - EQUIVALENCE (predef_types(12), H5T_NATIVE_REAL_C_DOUBLE) - EQUIVALENCE (predef_types(13), H5T_NATIVE_REAL_C_LONG_DOUBLE) - EQUIVALENCE (predef_types(14), H5T_NATIVE_B8 ) - EQUIVALENCE (predef_types(15), H5T_NATIVE_B16) - EQUIVALENCE (predef_types(16), H5T_NATIVE_B32) - EQUIVALENCE (predef_types(17), H5T_NATIVE_B64) - EQUIVALENCE (predef_types(18), H5T_NATIVE_INTEGER_16) ! ADDED NEW TYPE -MSB- + EQUIVALENCE (predef_types(1), H5T_NATIVE_INTEGER_KIND(1)) + EQUIVALENCE (predef_types(2), H5T_NATIVE_INTEGER_KIND(2)) + EQUIVALENCE (predef_types(3), H5T_NATIVE_INTEGER_KIND(3)) + EQUIVALENCE (predef_types(4), H5T_NATIVE_INTEGER_KIND(4)) + EQUIVALENCE (predef_types(5), H5T_NATIVE_INTEGER_KIND(5)) + EQUIVALENCE (predef_types(6), H5T_NATIVE_INTEGER) + EQUIVALENCE (predef_types(7), H5T_NATIVE_REAL) + EQUIVALENCE (predef_types(8), H5T_NATIVE_DOUBLE) + EQUIVALENCE (predef_types(9), H5T_NATIVE_CHARACTER) + EQUIVALENCE (predef_types(10), H5T_STD_REF_OBJ) + EQUIVALENCE (predef_types(11), H5T_STD_REF_DSETREG) + EQUIVALENCE (predef_types(12), H5T_NATIVE_REAL_C_FLOAT) + EQUIVALENCE (predef_types(13), H5T_NATIVE_REAL_C_DOUBLE) + EQUIVALENCE (predef_types(14), H5T_NATIVE_REAL_C_LONG_DOUBLE) + EQUIVALENCE (predef_types(15), H5T_NATIVE_B8 ) + EQUIVALENCE (predef_types(16), H5T_NATIVE_B16) + EQUIVALENCE (predef_types(17), H5T_NATIVE_B32) + EQUIVALENCE (predef_types(18), H5T_NATIVE_B64) EQUIVALENCE (predef_types(19), H5T_NATIVE_FLOAT_128) ! ADDED NEW TYPE -MSB- INTEGER(HID_T), DIMENSION(FLOATING_TYPES_LEN) :: floating_types diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 98128db..6f5af49 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -100,7 +100,7 @@ initFfile(void) ! access to either file, you may request a copy from help@hdfgroup.org. *\n\ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ !\n!\n\ -! This file is automatically generated and contains HDF5 Fortran90 type definitions.\n!\n\ +! This file is automatically generated by H5match_types.c and contains HDF5 Fortran90 type definitions.\n!\n\ MODULE H5FORTRAN_TYPES\n\ USE ISO_C_BINDING\n\ !\n\ @@ -175,6 +175,11 @@ int main(void) H5_FORTRAN_NUM_INTEGER_KINDS = (int)(sizeof(IntKinds)/sizeof(IntKinds[0])); H5_FORTRAN_NUM_REAL_KINDS = (int)(sizeof(RealKinds)/sizeof(RealKinds[0])); + + + fprintf(fort_header," INTEGER, PARAMETER :: H5_FORTRAN_NUM_INTEGER_KINDS = %d\n", H5_FORTRAN_NUM_INTEGER_KINDS); + + for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if(sizeof(long long) == IntKinds_SizeOf[i]) writeTypedef("int", "long long", IntKinds[i]); @@ -258,7 +263,7 @@ int main(void) /* haddr_t */ for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HADDR_T) { - writeToFiles("int","HADDR_T", "haddr_t_f", H5_SIZEOF_HADDR_T, IntKinds[i]); + writeToFiles("int","HADDR_T", "haddr_t_f", IntKinds[i], IntKinds[i]); break; } if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -269,7 +274,7 @@ int main(void) /* hsize_t */ for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HSIZE_T) { - writeToFiles("hsize_t","HSIZE_T", "hsize_t_f", H5_SIZEOF_HSIZE_T, IntKinds[i]); + writeToFiles("hsize_t","HSIZE_T", "hsize_t_f", IntKinds[i], IntKinds[i]); break; } if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -280,7 +285,7 @@ int main(void) /* hssize_t */ for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HSSIZE_T) { - writeToFiles("int","HSSIZE_T", "hssize_t_f", H5_SIZEOF_HSSIZE_T, IntKinds[i]); + writeToFiles("int","HSSIZE_T", "hssize_t_f", IntKinds[i], IntKinds[i]); break; } if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -291,7 +296,7 @@ int main(void) /* off_t */ for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_OFF_T) { - writeToFiles("int","OFF_T", "off_t_f", H5_SIZEOF_OFF_T, IntKinds[i]); + writeToFiles("int","OFF_T", "off_t_f", IntKinds[i], IntKinds[i]); break; } if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -302,7 +307,7 @@ int main(void) /* size_t */ for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_SIZE_T) { - writeToFiles("size_t","SIZE_T", "size_t_f", H5_SIZEOF_SIZE_T, IntKinds[i]); + writeToFiles("size_t","SIZE_T", "size_t_f", IntKinds[i], IntKinds[i]); break; } if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -311,7 +316,7 @@ int main(void) } /* int */ - writeToFiles("int","Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_SIZEOF, H5_FORTRAN_NATIVE_INTEGER_KIND); + writeToFiles("int","Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_KIND, H5_FORTRAN_NATIVE_INTEGER_KIND); /* int_1, int_2, int_4, int_8 */ @@ -327,16 +332,29 @@ int main(void) FoundIntSize[3] = -1; FoundIntSize[4] = -1; + fprintf(fort_header," INTEGER, DIMENSION(1:%d), PARAMETER :: Fortran_INTEGER_AVAIL_KINDS = (/", H5_FORTRAN_NUM_INTEGER_KINDS); + for(i=0;i 0) /* Found the integer type */ { - sprintf(chrA, "Fortran_INTEGER_%d", FoundIntSize[i]); + sprintf(chrA, "Fortran_INTEGER_KINDS_%d", FoundIntSizeKind[i]); sprintf(chrB, "int_%d_f", FoundIntSize[i]); writeToFiles("int",chrA, chrB, FoundIntSize[i], FoundIntSizeKind[i]); } @@ -347,7 +365,7 @@ int main(void) { if( FoundIntSize[j] > 0) /* Found the next highest */ { - sprintf(chrA, "Fortran_INTEGER_%d", (-1)*FoundIntSize[i]); + sprintf(chrA, "Fortran_INTEGER_KINDS_%d", (-1)*FoundIntSizeKind[i]); sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]); writeToFiles("int",chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]); flag = 1; @@ -360,7 +378,7 @@ int main(void) { if( FoundIntSize[j] > 0) /* Found the next lowest */ { - sprintf(chrA, "Fortran_INTEGER_%d", (-1)*FoundIntSize[i]); + sprintf(chrA, "Fortran_INTEGER_KINDS_%d", (-1)*FoundIntSizeKind[i]); sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]); writeToFiles("int",chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]); flag = 1; @@ -391,7 +409,7 @@ int main(void) /* hid_t */ for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HID_T) { - writeToFiles("int","HID_T", "hid_t_f", H5_SIZEOF_HID_T, IntKinds[i]); + writeToFiles("int","HID_T", "hid_t_f", IntKinds[i], IntKinds[i]); break; } if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) diff --git a/fortran/test/fortranlib_test_F03.F90 b/fortran/test/fortranlib_test_F03.F90 index 070cd73..5f5fd2d 100644 --- a/fortran/test/fortranlib_test_F03.F90 +++ b/fortran/test/fortranlib_test_F03.F90 @@ -131,7 +131,7 @@ PROGRAM fortranlibtest_F03 ret_total_error = 0 CALL test_array_bkg(ret_total_error) - CALL write_test_status(ret_total_error, ' Testing Partial I/O of Array Fields in Compound Datatype FunctionalityT', total_error) + CALL write_test_status(ret_total_error, ' Testing Partial I/O of Array Fields in Compound Datatype Functionality', total_error) ret_total_error = 0 CALL test_genprop_class_callback(ret_total_error) diff --git a/fortran/test/tH5T_F03.F90 b/fortran/test/tH5T_F03.F90 index 6ddded4..a9148a7 100644 --- a/fortran/test/tH5T_F03.F90 +++ b/fortran/test/tH5T_F03.F90 @@ -1144,33 +1144,33 @@ END SUBROUTINE test_array_compound_atomic ! ! Read data back into an integer size that is larger then the original size used for ! writing the data - f_ptr = C_LOC(data_out_i1) + f_ptr = C_LOC(data_out_i1(1)) CALL h5dread_f(dset_id1, h5kind_to_type(int_kind_1,H5_INTEGER_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) - f_ptr = C_LOC(data_out_i4) + f_ptr = C_LOC(data_out_i4(1)) CALL h5dread_f(dset_id4, h5kind_to_type(int_kind_4,H5_INTEGER_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) - f_ptr = C_LOC(data_out_i8) + f_ptr = C_LOC(data_out_i8(1)) CALL h5dread_f(dset_id8, h5kind_to_type(int_kind_8,H5_INTEGER_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) - f_ptr = C_LOC(data_out_i16) + f_ptr = C_LOC(data_out_i16(1)) CALL h5dread_f(dset_id16, h5kind_to_type(int_kind_16,H5_INTEGER_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) #if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 - f_ptr = C_LOC(data_out_i32) + f_ptr = C_LOC(data_out_i32(1)) CALL h5dread_f(dset_id32, h5kind_to_type(int_kind_32,H5_INTEGER_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) #endif - f_ptr = C_LOC(data_out_r) + f_ptr = C_LOC(data_out_r(1)) CALL h5dread_f(dset_idr, H5T_NATIVE_REAL, f_ptr, error) CALL check("h5dread_f",error, total_error) - f_ptr = C_LOC(data_out_r7) + f_ptr = C_LOC(data_out_r7(1)) CALL h5dread_f(dset_idr4, h5kind_to_type(real_kind_7,H5_REAL_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) - f_ptr = C_LOC(data_out_r15) + f_ptr = C_LOC(data_out_r15(1)) CALL h5dread_f(dset_idr8, h5kind_to_type(real_kind_15,H5_REAL_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) - f_ptr = C_LOC(data_out_r31) + f_ptr = C_LOC(data_out_r31(1)) CALL h5dread_f(dset_idr16, h5kind_to_type(real_kind_31,H5_REAL_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) DO i = 1, 4 @@ -2000,7 +2000,7 @@ SUBROUTINE t_regref(total_error) CALL h5dcreate_f(file,dataset2, H5T_STD_I8LE, space, dset2, error) CALL check("h5dcreate_f",error, total_error) f_ptr = C_LOC(wdata2(1,1)) - CALL h5dwrite_f(dset2, H5T_NATIVE_INTEGER_1, f_ptr, error) + CALL h5dwrite_f(dset2, H5T_NATIVE_INTEGER_KIND(1), f_ptr, error) CALL check("h5dwrite_f",error, total_error) ! ! Create reference to a list of elements in dset2. @@ -2112,7 +2112,7 @@ SUBROUTINE t_regref(total_error) CALL check("h5screate_simple_f",error, total_error) f_ptr = C_LOC(rdata2(1)(1:1)) - CALL h5dread_f( dset2, H5T_NATIVE_INTEGER_1, f_ptr, error, memspace, space) + CALL h5dread_f( dset2, H5T_NATIVE_INTEGER_KIND(1), f_ptr, error, memspace, space) CALL check("H5Dread_f",error, total_error) CALL verify("h5dread_f",rdata2(1)(1:npoints),TRIM(chrref_correct(i)), total_error) @@ -2886,33 +2886,23 @@ SUBROUTINE setup_buffer(data_in, line_lengths, char_type) CHARACTER(len=10), DIMENSION(:) :: data_in INTEGER(size_t), DIMENSION(:) :: line_lengths - INTEGER, DIMENSION(1:3) :: letters - CHARACTER(LEN=3) :: lets + CHARACTER(LEN=3) :: lets = 'abc' CHARACTER(KIND=C_CHAR,LEN=*) :: char_type - CHARACTER(KIND=C_CHAR,LEN=1) :: char_tmp - INTEGER :: i, j, n, ff + INTEGER :: i, j, n - ! Convert the letters and special character to integers - lets = 'abc' - - READ(lets,'(3A1)') letters - READ(char_type,'(A1)') ff n = SIZE(data_in) j = 1 DO i=1,n-1 IF( j .EQ. 4 )THEN - WRITE(char_tmp,'(A1)') ff - data_in(i:i) = char_tmp + data_in(i:i) = char_type(1:1) ELSE - WRITE(char_tmp,'(A1)') letters(j) - data_in(i:i) = char_tmp + data_in(i:i) = lets(j:j) ENDIF line_lengths(i) = LEN_TRIM(data_in(i)) j = j + 1 IF( j .EQ. 5 ) j = 1 END DO - WRITE(char_tmp,'(A1)') ff - data_in(n:n) = char_tmp + data_in(n:n) = char_type(1:1) line_lengths(n) = 1 END SUBROUTINE setup_buffer -- cgit v0.12 From 362233bd452ea7997b5961a753ebd8be3876e64f Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 22 Sep 2016 15:22:11 -0500 Subject: Code clean-up. --- fortran/src/H5_ff.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 9717d17..228e148 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -392,7 +392,6 @@ CONTAINS IF(flag.EQ.H5_INTEGER_KIND)THEN do_kind: DO i = 1, H5_FORTRAN_NUM_INTEGER_KINDS IF(ikind.EQ.Fortran_INTEGER_AVAIL_KINDS(i))THEN - !PRINT*,ikind, Fortran_INTEGER_AVAIL_KINDS(i),H5T_NATIVE_INTEGER_KIND(i) h5_type = H5T_NATIVE_INTEGER_KIND(i) EXIT do_kind ENDIF @@ -406,7 +405,7 @@ CONTAINS ELSE IF(ikind.EQ.KIND(1.0_C_LONG_DOUBLE))THEN h5_type = H5T_NATIVE_REAL_C_LONG_DOUBLE #endif -#if H5_PAC_FC_MAX_REAL_PRECISION > 28 +#if H5_PAC_FC_MAX_REAL_PRECISION > 28 #if H5_HAVE_FLOAT128 == 1 ELSE h5_type = H5T_NATIVE_FLOAT_128 -- cgit v0.12 From 3c37126585bbb2f788d6a71449ffbb61efc5141f Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 22 Sep 2016 15:24:35 -0500 Subject: Removed the use of hard-coded integer KINDs. --- hl/fortran/test/tsttable.F90 | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index 62d291f..bffbb03 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -185,7 +185,7 @@ SUBROUTINE test_table1() ! make table !------------------------------------------------------------------------- - test_txt = " Make table" + test_txt = "Make table" CALL test_begin(test_txt) CALL h5tbmake_table_f(dsetname1,& @@ -508,7 +508,6 @@ SUBROUTINE test_table1() WRITE(*,'(/,5X,"H5TBGET_FIELD_INFO_F: RETURN ERROR")') STOP ENDIF - ! "field4abc" was deleted and "field5" was added. field_names(4) = "field5" @@ -538,7 +537,6 @@ SUBROUTINE test_table1() ! CALL h5fclose_f(file_id, errcode) - ! ! end function. ! @@ -557,15 +555,15 @@ SUBROUTINE test_table2() IMPLICIT NONE - INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors - INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(9) ! (18) !should map to INTEGER*8 on most modern processors + INTEGER, PARAMETER :: i8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors + INTEGER, PARAMETER :: i16 = SELECTED_INT_KIND(9) ! (18) !should map to INTEGER*8 on most modern processors INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(5) ! This should map to REAL*4 on most modern processors INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors TYPE particle_t CHARACTER(LEN=11) :: name - INTEGER(KIND=int_kind_8) :: lati - INTEGER(KIND=int_kind_16) :: long + INTEGER(KIND=i8) :: lati + INTEGER(KIND=i16) :: long REAL(KIND=sp) :: pressure REAL(KIND=dp) :: temperature END TYPE particle_t @@ -607,23 +605,23 @@ SUBROUTINE test_table2() test_txt = "Testing H5TBread_table_f and H5TBmake_table_f (F2003)" CALL test_begin(test_txt) + ! Define an array of Particles p_data(1:nrecords) = (/ & - particle_t("zero ",0_int_kind_8,0_int_kind_16,0.0_sp,0.0_dp), & - particle_t("one ",10_int_kind_8,10_int_kind_16,10.0_sp,10.0_dp), & - particle_t("two ",20_int_kind_8,20_int_kind_16,20.0_sp,20.0_dp), & - particle_t("three ",30_int_kind_8,30_int_kind_16,30.0_sp,30.0_dp),& - particle_t("four ",40_int_kind_8,40_int_kind_16,40.0_sp,40.0_dp), & - particle_t("five ",50_int_kind_8,50_int_kind_16,50.0_sp,50.0_dp), & - particle_t("six ",60_int_kind_8,60_int_kind_16,60.0_sp,60.0_dp), & - particle_t("seven ",70_int_kind_8,70_int_kind_16,70.0_sp,70.0_dp) & + particle_t("zero ",0_i8,0_i16,0.0_sp,0.0_dp), & + particle_t("one ",10_i8,10_i16,10.0_sp,10.0_dp), & + particle_t("two ",20_i8,20_i16,20.0_sp,20.0_dp), & + particle_t("three ",30_i8,30_i16,30.0_sp,30.0_dp),& + particle_t("four ",40_i8,40_i16,40.0_sp,40.0_dp), & + particle_t("five ",50_i8,50_i16,50.0_sp,50.0_dp), & + particle_t("six ",60_i8,60_i16,60.0_sp,60.0_dp), & + particle_t("seven ",70_i8,70_i16,70.0_sp,70.0_dp) & /) - fill_data(1:nrecords) = particle_t("no data",-1_int_kind_8, -2_int_kind_16, -99.0_sp, -100.0_dp) + fill_data(1:nrecords) = particle_t("no data",-1_i8, -2_i16, -99.0_sp, -100.0_dp) compress = 0 - dst_size = H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(2))) #ifdef H5_FORTRAN_HAVE_STORAGE_SIZE -- cgit v0.12 From 7cbf491e29cb9c2cfa3fbbd232f48a51cfaebff4 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 22 Sep 2016 17:19:48 -0500 Subject: misc. format code-cleanup --- fortran/src/H5match_types.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 6f5af49..b19d7b1 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -175,8 +175,6 @@ int main(void) H5_FORTRAN_NUM_INTEGER_KINDS = (int)(sizeof(IntKinds)/sizeof(IntKinds[0])); H5_FORTRAN_NUM_REAL_KINDS = (int)(sizeof(RealKinds)/sizeof(RealKinds[0])); - - fprintf(fort_header," INTEGER, PARAMETER :: H5_FORTRAN_NUM_INTEGER_KINDS = %d\n", H5_FORTRAN_NUM_INTEGER_KINDS); @@ -347,10 +345,6 @@ int main(void) } - - - - for(i=0;i 0) /* Found the integer type */ { -- cgit v0.12 From 430ff33b5c6e5e020afae7f150b8442c223353ca Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 23 Sep 2016 01:18:11 -0400 Subject: Added "Purpose:" information to the API call comments for the new functions. --- src/H5Pfapl.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index d96bd54..8801061 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -3621,7 +3621,13 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_evict_on_close * - * Purpose: + * Purpose: Sets the evict_on_close property value. + * + * When this property is set, closing an HDF5 object will + * cause the object's metadata cache entries to be flushed + * and evicted from the cache. + * + * Currently only implemented for datasets. * * Return: SUCCEED/FAIL * @@ -3659,7 +3665,13 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_evict_on_close * - * Purpose: + * Purpose: Gets the evict_on_close property value. + * + * When this property is set, closing an HDF5 object will + * cause the object's metadata cache entries to be flushed + * and evicted from the cache. + * + * Currently only implemented for datasets. * * Return: SUCCEED/FAIL * -- cgit v0.12 From 7b056aadff59de5760246d6dff3f5402d0b887bf Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 23 Sep 2016 11:31:43 -0500 Subject: Added SEQUENCE to derived types for NAG: Section 81 of the compiler manual, e.g. at http://www.nag.co.uk/nagware/np/r61_doc/np61_manual.pdf covers details about the compiler's internal representations, including " Fortran derived types are translated into C structs. If BIND(C) or SEQUENCE is used, the order of the items within the struct is the same as the order within the derived type definition. Otherwise, the order of items is permuted to put larger types at the front of the struct so as to improve alignment and reduce storage; the C output code can be inspected to determine the ordering used. " Removed INTENT(IN) to fix segfaults in C APIs for TYPE(C_PTR). Tested: NAG (gnu) --- hl/fortran/src/H5TBff.F90 | 3 ++- hl/fortran/test/tsttable.F90 | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index a31c751..5d1ee35 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -376,7 +376,8 @@ CONTAINS INTEGER(size_t), INTENT(in) :: dst_size ! The size of the structure type INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the offsets of the fields INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields - TYPE(C_PTR), INTENT(OUT) :: dst_buf ! Buffer with data + TYPE(C_PTR) :: dst_buf ! Buffer with data !! do not use INTENT, causes NAG + ! to segfault in C APIs INTEGER :: errcode ! error code INTEGER(size_t) :: namelen ! name length diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index bffbb03..3cf8fed 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -561,6 +561,7 @@ SUBROUTINE test_table2() INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors TYPE particle_t + SEQUENCE CHARACTER(LEN=11) :: name INTEGER(KIND=i8) :: lati INTEGER(KIND=i16) :: long @@ -671,11 +672,10 @@ SUBROUTINE test_table2() f_ptr1 = C_NULL_PTR f_ptr2 = C_LOC(fill_data(1)%name(1:1)) - CALL h5tbmake_table_f("Table Title Fill", file_id, table_name_fill, nfields, nrecords, & dst_size, field_names, dst_offset, field_type, & chunk_size, f_ptr2, compress, f_ptr1, errcode ) - + f_ptr3 = C_LOC(r_data(1)%name(1:1)) CALL h5tbread_table_f(file_id, table_name_fill, nfields, dst_size, dst_offset, dst_sizes, f_ptr3, errcode) -- cgit v0.12 From 3a89114ce59796045079e0a1ed83237cf395c333 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 23 Sep 2016 14:08:04 -0500 Subject: Misc. cleaning up of the program. --- fortran/src/H5_f.c | 49 ++++++++++---------------------------- fortran/src/H5match_types.c | 58 ++------------------------------------------- 2 files changed, 15 insertions(+), 92 deletions(-) diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 9d4c297..db05f67 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -66,9 +66,9 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes */ /* - * FIND H5T_NATIVE_INTEGER_# + * Find the HDF5 type of the Fortran Integer KIND. */ - for(i=0;i<4;i++) { + for(i=0;i<5;i++) { if ( IntKinds_SizeOf[i] == sizeof(char)) { if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; @@ -89,52 +89,27 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes } -#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 - /* - * FIND H5T_NATIVE_INTEGER_KIND(5), INTEGER*16 - */ - if (sizeof(int_16_f) == sizeof(char)) { - if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_16_f) == sizeof(short)) { - if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_16_f) == sizeof(int)) { - if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; - } /*end if */ - else if (sizeof(int_16_f) == sizeof(long long)) { - if ((types[4] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; - } /*end else */ - else { - if ((types[4] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[4], 128) < 0) return ret_value; - } /*end else */ -#else - if ((types[4] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; - if ( H5Tset_precision (types[4], 128) < 0) return ret_value; -#endif - if (sizeof(int_f) == sizeof(int)) { - if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; + if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; } /*end if */ else if (sizeof(int_f) == sizeof(long)) { - if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0) return ret_value; + if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0) return ret_value; } /*end if */ else - if (sizeof(int_f) == sizeof(long long)) { - if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; + if (sizeof(int_f) == sizeof(long long)) { + if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; } /*end else */ - + /* Find appropriate size to store Fortran REAL */ if(sizeof(real_f)==sizeof(float)) { - if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; } /* end if */ else if(sizeof(real_f)==sizeof(double)){ - if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; + if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; } /* end if */ #if H5_SIZEOF_LONG_DOUBLE!=0 else if (sizeof(real_f) == sizeof(long double)) { - if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; + if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; } /* end else */ #endif @@ -226,12 +201,14 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes if ((types[16] = (hid_t_f)H5Tcopy(H5T_NATIVE_B32)) < 0) return ret_value; if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_B64)) < 0) return ret_value; - /* + /* * FIND H5T_NATIVE_FLOAT_128 */ if ((types[18] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; if ( H5Tset_precision (types[18], 128) < 0) return ret_value; + /*--------------------------------------------------------------------------------------*/ + if ((floatingtypes[0] = (hid_t_f)H5Tcopy(H5T_IEEE_F32BE)) < 0) return ret_value; if ((floatingtypes[1] = (hid_t_f)H5Tcopy(H5T_IEEE_F32LE)) < 0) return ret_value; if ((floatingtypes[2] = (hid_t_f)H5Tcopy(H5T_IEEE_F64BE)) < 0) return ret_value; diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index b19d7b1..7340b13 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -52,6 +52,7 @@ FILE * fort_header; void writeTypedef(const char* c_typedef, const char* c_type, int size); void writeTypedefDefault(const char* c_typedef, int size); void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int size, int kind); +void writeToCFileOnly(const char* c_typedef, const char* fortran_type, const char* c_type, int size); void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, const char* kind); static void @@ -147,8 +148,6 @@ void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char } int main(void) { - int FoundIntSize[10]; - int FoundIntSizeKind[10]; int i, j,flag; char chrA[32],chrB[32]; @@ -318,24 +317,11 @@ int main(void) /* int_1, int_2, int_4, int_8 */ -/* Defined different KINDs of integers: */ -/* if the integer kind is not available then we assign */ -/* it a value of the next larger one, but if the next */ -/* higher one is not available we assigned it the next lowest */ +/* Defined different KINDs of integers */ - - FoundIntSize[0] = -1; - FoundIntSize[1] = -1; - FoundIntSize[2] = -1; - FoundIntSize[3] = -1; - FoundIntSize[4] = -1; - fprintf(fort_header," INTEGER, DIMENSION(1:%d), PARAMETER :: Fortran_INTEGER_AVAIL_KINDS = (/", H5_FORTRAN_NUM_INTEGER_KINDS); for(i=0;i 0) /* Found the integer type */ - { - sprintf(chrA, "Fortran_INTEGER_KINDS_%d", FoundIntSizeKind[i]); - sprintf(chrB, "int_%d_f", FoundIntSize[i]); - writeToFiles("int",chrA, chrB, FoundIntSize[i], FoundIntSizeKind[i]); - } - else /* Did not find the integer type */ - { - flag = 0; /* flag indicating if found the next highest */ - for(j=i+1;j<4;j++) /* search for next highest */ - { - if( FoundIntSize[j] > 0) /* Found the next highest */ - { - sprintf(chrA, "Fortran_INTEGER_KINDS_%d", (-1)*FoundIntSizeKind[i]); - sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]); - writeToFiles("int",chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]); - flag = 1; - break; - } - } - if(flag == 0) /* No higher one found, so find next lowest */ - { - for(j=2;j>-1;j--) /* Search for next lowest */ - { - if( FoundIntSize[j] > 0) /* Found the next lowest */ - { - sprintf(chrA, "Fortran_INTEGER_KINDS_%d", (-1)*FoundIntSizeKind[i]); - sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]); - writeToFiles("int",chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]); - flag = 1; - break; - } - } - } - if(flag == 0) /* No higher or lower one found, indicating an error */ - return -1; - } - } - /* real_4, real_8, real_16 */ /* Defined different KINDs of reals: */ -- cgit v0.12 From 36fd53f70f3a13d5437def00377fc002bc75c116 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 24 Sep 2016 02:54:00 -0400 Subject: Fixed typo --- test/h5test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/h5test.c b/test/h5test.c index aea5dc7..591266b 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -196,7 +196,7 @@ h5_clean_files(const char *base_name[], hid_t fapl) * * Purpose Clean up temporary test files. * - * When a test calls h5_fixname() get a VFD-dependent + * When a test calls h5_fixname() to get a VFD-dependent * test file name, this function can be used to clean it up. * * Return: void -- cgit v0.12 From 2638cbbbffcaf52bf8f97133257c680fa5b14bd8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 24 Sep 2016 02:54:27 -0400 Subject: Added the beginnings of a file generator to the test. --- test/evict_on_close.c | 202 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 186 insertions(+), 16 deletions(-) diff --git a/test/evict_on_close.c b/test/evict_on_close.c index bcbd030..bc47cef 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -24,7 +24,128 @@ #include "h5test.h" +const char *FILENAMES[] = { + "evict-on-close", /* 0 */ + NULL +}; +#define FILENAME_BUF_SIZE 1024 + +//#define DSET_NAME_COMPACT "compact" +//#define DSET_NAME_CONTIGUOUS "contiguous" +#define DSET_NAME_V1_BTREE "v1_btree" +//#define DSET_NAME_V2_BTREE "v2_btree" +//#define DSET_NAME_EARRAY "earray" +//#define DSET_NAME_FARRAY "farray" +//#define DSET_NAME_SINGLE "single" + static herr_t check_evict_on_close_api(void); +static herr_t generate_eoc_test_file(hid_t fapl_id); + + +/*------------------------------------------------------------------------- + * Function: generate_eoc_test_file() + * + * Purpose: Generate the evict-on-close test file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +generate_eoc_test_file(hid_t fapl_id) +{ + char filename[FILENAME_BUF_SIZE]; /* decorated file name */ + hid_t fid = -1; /* file ID */ + hid_t fapl_copy_id = -1; /* ID of copied fapl */ + hid_t sid = -1; /* dataspace ID */ + hid_t dcpl_id = -1; /* dataset creation plist */ + hid_t did = -1; /* dataset ID */ + int rank; /* # of array dimensions */ + hsize_t current_dims[2]; /* current dataset size */ + hsize_t maximum_dims[2]; /* maximum dataset size */ + hsize_t chunk_dims[2]; /* chunk dimensions */ + int *data = NULL; /* buffer for fake data */ + int n; /* # of data elements */ + + TESTING("generating evict-on-close test file"); + + /* Get a VFD-specific filename */ + h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename)); + + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + + /***********************************************************/ + /* Generate datasets and ensure that the scheme is correct */ + /***********************************************************/ + + /* Create the data buffer */ + if(NULL == (data = (int *)HDcalloc(1024, sizeof(int)))) + TEST_ERROR; + + /********************/ + /* Version 1 B-tree */ + /********************/ + + /* Create dataspace */ + n = 100; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = H5S_UNLIMITED; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + + /* Close everything else */ + if(H5Fclose(fid) < 0) + TEST_ERROR; + HDfree(data); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dcpl_id); + H5Pclose(fapl_copy_id); + } H5E_END_TRY; + + HDfree(data); + + H5_FAILED(); + return FAIL; + +} /* end generate_eoc_test_file() */ /*------------------------------------------------------------------------- @@ -52,37 +173,37 @@ check_evict_on_close_api(void) /* Create a fapl */ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Check the default */ evict_on_close = TRUE; if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if(evict_on_close != FALSE) FAIL_PUTS_ERROR("Incorrect default evict on close value."); /* Set the evict on close property */ evict_on_close = TRUE; if(H5Pset_evict_on_close(fapl_id, evict_on_close) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Make sure we can get it back out */ evict_on_close = FALSE; if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if(evict_on_close != TRUE) FAIL_PUTS_ERROR("Incorrect evict on close value."); /* close fapl */ if(H5Pclose(fapl_id) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /**********************************************/ /* Trying passing in a non-fapl property list */ /**********************************************/ if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* ensure using an incorrect access plist fails */ H5E_BEGIN_TRY { @@ -100,7 +221,7 @@ check_evict_on_close_api(void) /* close dapl */ if(H5Pclose(dapl_id) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; PASSED(); return SUCCEED; @@ -125,20 +246,69 @@ error: int main(void) { - unsigned nerrors = 0; + hid_t fapl_id = -1; + unsigned nerrors = 0; + + HDprintf("Testing evict-on-close cache behavior.\n"); - printf("Testing evict-on-close cache behavior.\n"); + /* Initialize */ + h5_reset(); + /* Test H5P call to set up EoC (does not require VFD-specific fapl) */ nerrors += check_evict_on_close_api() < 0 ? 1 : 0; - if(nerrors) { - printf("***** %u evict-on-close test%s FAILED! *****\n", - nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; - } + /* Set up VFD-specific fapl */ + if((fapl_id = h5_fileaccess()) < 0) { + nerrors++; + PUTS_ERROR("Unable to get VFD-specific fapl\n"); + } /* end if */ + + /* Set evict-on-close property */ + if(H5Pset_evict_on_close(fapl_id, TRUE) < 0) { + nerrors++; + PUTS_ERROR("Unable to set evict-on-close property\n"); + } /* end if */ - printf("All evict-on-close tests passed.\n"); + /* Generate the test file */ + if(generate_eoc_test_file(fapl_id) < 0) { + nerrors++; + PUTS_ERROR("Unable to generate test file\n"); + } /* end if */ + + /*************************/ + /* Test EoC for datasets */ + /*************************/ + +#ifdef NOTYET + nerrors += check_v1_btree_chunk_index(fapl_id); +#endif + + /* Clean up files and close the VFD-specific fapl */ + //h5_delete_all_test_files(FILENAMES, fapl_id); + if(H5Pclose(fapl_id) < 0) { + nerrors++; + PUTS_ERROR("Unable to close VFD-specific fapl\n"); + } /* end if */ + + + if(nerrors) + goto error; + + HDprintf("All evict-on-close tests passed.\n"); return EXIT_SUCCESS; -} + +error: + + HDprintf("***** %u evict-on-close test%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + + h5_delete_all_test_files(FILENAMES, fapl_id); + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + } H5E_END_TRY; + + return EXIT_FAILURE; + +} /* end main() */ -- cgit v0.12 From 7e5fcd3a4a4f4949505b47d48d0292e944b3e670 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 26 Sep 2016 11:49:06 -0500 Subject: Added rule to build buildiface program, without a rule, build would add repeated compile options when using the NAG compiler. --- fortran/src/Makefile.am | 3 +++ fortran/test/Makefile.am | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index a271666..bbdae2f 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -138,6 +138,9 @@ H5_buildiface_SOURCES = H5_buildiface.F90 # Mark this directory as part of the Fortran API FORTRAN_API=yes +H5_buildiface$(EXEEXT): $(H5_buildiface_SOURCES) H5config_f.inc + $(FC) $(FCFLAGS) $< -o $@ -I. + # Hardcode the dependencies of these files. There isn't a known way of # determining this automagically (like we do with the C files). So, when # doing a parallel make, some modules could be made way before the diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 60f9f53..67b39e2 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -92,10 +92,14 @@ tf_gen.F90: H5_test_buildiface$(EXEEXT) H5_test_buildiface_SOURCES = H5_test_buildiface.F90 -# The build of the H5_test_buildiface does depend on any libraries, so set it +# The build of the H5_test_buildiface does not depend on any libraries, so set it # to nothing. -H5_test_buildiface_LDADD = +H5_test_buildiface_LDADD = + + +H5_test_buildiface$(EXEEXT): $(H5_test_buildiface_SOURCES) + $(FC) $(FCFLAGS) $< -o $@ -I. # fflush2 depends on files created by fflush1 fflush2.chkexe_: fflush1.chkexe_ -- cgit v0.12 From 41b22417b7e194f48c612c69c9259e83ddc3a3ac Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 26 Sep 2016 12:08:18 -0500 Subject: Added path to source include files when building buidiface. --- fortran/src/Makefile.am | 2 +- fortran/test/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index bbdae2f..4ec02b7 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -139,7 +139,7 @@ H5_buildiface_SOURCES = H5_buildiface.F90 FORTRAN_API=yes H5_buildiface$(EXEEXT): $(H5_buildiface_SOURCES) H5config_f.inc - $(FC) $(FCFLAGS) $< -o $@ -I. + $(FC) $(FCFLAGS) $< -o $@ -I$(top_builddir)/fortran/src # Hardcode the dependencies of these files. There isn't a known way of # determining this automagically (like we do with the C files). So, when diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 67b39e2..36b9adc 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -99,7 +99,7 @@ H5_test_buildiface_LDADD = H5_test_buildiface$(EXEEXT): $(H5_test_buildiface_SOURCES) - $(FC) $(FCFLAGS) $< -o $@ -I. + $(FC) $(FCFLAGS) $< -o $@ -I$(top_builddir)/fortran/src # fflush2 depends on files created by fflush1 fflush2.chkexe_: fflush1.chkexe_ -- cgit v0.12 From 3befe647ee9783b763208a581675988fbaabd321 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 26 Sep 2016 13:27:50 -0500 Subject: Added number of integer KINDs found to the header files. --- config/cmake/HDF5UseFortran.cmake | 3 +++ configure.ac | 1 + fortran/src/H5_f.c | 21 ++++++++++++-------- fortran/src/H5fort_type_defines.h.in | 1 + fortran/src/H5match_types.c | 38 ++++++++++++++++++------------------ m4/aclocal_fc.m4 | 5 ++++- 6 files changed, 41 insertions(+), 28 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 41efadc..2658ccf 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -159,9 +159,12 @@ set(PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") list(GET PROG_OUTPUT 3 NUM_IKIND) list(GET PROG_OUTPUT 4 NUM_RKIND) +set(PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}" + set(H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") set(H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") +message (STATUS "....NUMBER OF INTEGER KINDS FOUND ${PAC_FORTRAN_NUM_INTEGER_KINDS}") message (STATUS "....REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") message (STATUS "....INTEGER KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") message (STATUS "....MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") diff --git a/configure.ac b/configure.ac index 59d1bef..afbd474 100644 --- a/configure.ac +++ b/configure.ac @@ -551,6 +551,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([PAC_FC_ALL_REAL_KINDS]) AC_SUBST([PAC_FC_MAX_REAL_PRECISION]) + AC_SUBST([PAC_FORTRAN_NUM_INTEGER_KINDS]) AC_SUBST([PAC_FC_ALL_INTEGER_KINDS]) AC_SUBST([PAC_FC_ALL_REAL_KINDS_SIZEOF]) AC_SUBST([PAC_FC_ALL_INTEGER_KINDS_SIZEOF]) diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index db05f67..f9fe927 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -34,16 +34,16 @@ int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; * Initialize predefined datatypes in Fortran * INPUTS * types - array with the predefined Native Fortran - * type, its element and length must be the - * same as the types array defined in the + * type, its element and length must be the + * same as the types array defined in the * H5f90global.F90 * floatingtypes - array with the predefined Floating Fortran - * type, its element and length must be the - * same as the floatingtypes array defined in the - * H5f90global.F90 + * type, its element and length must be the + * same as the floatingtypes array defined in the + * H5f90global.F90 * integertypes - array with the predefined Integer Fortran - * type, its element and length must be the - * same as the integertypes array defined in the + * type, its element and length must be the + * same as the integertypes array defined in the * H5f90global.F90 * RETURNS * 0 on success, -1 on failure @@ -68,8 +68,13 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes /* * Find the HDF5 type of the Fortran Integer KIND. */ + + /* Initialized INTEGER KIND types to default to native integer */ for(i=0;i<5;i++) { + if ((types[i] = (hid_t_f)H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + } + for(i=0;i Date: Tue, 27 Sep 2016 10:29:16 -0700 Subject: Description: Further warning cleanups: from 667 warnings to 503. --- hl/test/test_ds.c | 9 ++++- hl/tools/gif2h5/h52gifgentst.c | 8 ++++- src/H5Aint.c | 5 ++- test/cmpd_dset.c | 53 ++++++++++++++++++++++----- test/dsets.c | 82 +++++++++++++++++++++++++++++++++++------- test/dt_arith.c | 7 ++-- test/gheap.c | 51 +++++++++++++++++++++++--- test/h5test.c | 29 +++++++++++---- test/tattr.c | 44 ++++++++++++++++------- test/tchecksum.c | 23 +++++++----- test/th5o.c | 32 ++++++++++------- test/theap.c | 44 ++++++++++++++++++----- test/titerate.c | 13 ++++--- test/tskiplist.c | 48 +++++++++++++++++++------ test/tvltypes.c | 12 +++++-- tools/h5dump/h5dumpgentest.c | 69 +++++++++++++++++++++++------------ 16 files changed, 409 insertions(+), 120 deletions(-) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 47929e6..3ca1e4d 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -389,7 +389,7 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int int rank = 4; int rankds = 1; hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE}; - long buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE*DIM4_SIZE]; + long *buf; hsize_t s1_dim[1] = {DIM1_SIZE}; hsize_t s2_dim[1] = {DIM2_SIZE}; hsize_t s3_dim[1] = {DIM3_SIZE}; @@ -409,6 +409,10 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int long s43_wbuf[DIM4_SIZE] = {180,180}; long s44_wbuf[DIM4_SIZE] = {280,280}; + /* Allocate buffer */ + buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE); + HDassert(buf); + /* make a dataset */ if(H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) { if(fulldims==0) { @@ -444,6 +448,9 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int } else return FAIL; + + HDfree(buf); + return SUCCEED; } diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c index 3433d0a..6a41028 100644 --- a/hl/tools/gif2h5/h52gifgentst.c +++ b/hl/tools/gif2h5/h52gifgentst.c @@ -13,6 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include #include #include #include "hdf5.h" @@ -49,12 +50,15 @@ int main(void) { hid_t fid; int i, j, n, space; - unsigned char buf [ WIDTH*HEIGHT ]; + unsigned char *buf; unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */ hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */ hsize_t width = WIDTH; hsize_t height = HEIGHT; + /* Allocate buffer */ + buf = (unsigned char *)malloc(WIDTH * HEIGHT); + assert(buf); /* create a file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) @@ -99,6 +103,8 @@ int main(void) if(H5Fclose(fid)<0) return EXIT_FAILURE; + free(buf); + return EXIT_SUCCESS; } diff --git a/src/H5Aint.c b/src/H5Aint.c index ea90118..66af0ff 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2106,10 +2106,9 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si HDmemcpy(buf, attr_src->shared->data, attr_src->shared->data_size); /* Allocate background memory */ - if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) { + if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") - } + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Convert from source file to memory */ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf, dxpl_id) < 0) diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 311b9bb..a7f3902 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -154,30 +154,28 @@ static unsigned test_compound (char *filename, hid_t fapl) { /* First dataset */ - static s1_t s1[NX*NY]; + s1_t *s1 = NULL; hid_t s1_tid; /* Second dataset */ - static s2_t s2[NX*NY]; + s2_t *s2 = NULL; hid_t s2_tid; /* Third dataset */ - static s3_t s3[NX*NY]; + s3_t *s3 = NULL; hid_t s3_tid; /* Fourth dataset */ - static s4_t s4[NX*NY]; + s4_t *s4 = NULL; hid_t s4_tid; /* Fifth dataset */ - static s5_t s5[NX*NY]; + s5_t *s5 = NULL; hid_t s5_tid; - static s6_t s6[NX*NY]; - hid_t s6_tid; - - /* Sixth dataset */ + s6_t *s6 = NULL; + hid_t s6_tid; /* Seventh dataset */ hid_t s7_sid; @@ -204,6 +202,20 @@ test_compound (char *filename, hid_t fapl) hsize_t memb_size[1] = {4}; int ret_code; + /* Allocate buffers for datasets */ + if(NULL == (s1 = (s1_t *)HDmalloc(sizeof(s1_t) * NX * NY))) + goto error; + if(NULL == (s2 = (s2_t *)HDmalloc(sizeof(s2_t) * NX * NY))) + goto error; + if(NULL == (s3 = (s3_t *)HDmalloc(sizeof(s3_t) * NX * NY))) + goto error; + if(NULL == (s4 = (s4_t *)HDmalloc(sizeof(s4_t) * NX * NY))) + goto error; + if(NULL == (s5 = (s5_t *)HDmalloc(sizeof(s5_t) * NX * NY))) + goto error; + if(NULL == (s6 = (s6_t *)HDmalloc(sizeof(s6_t) * NX * NY))) + goto error; + /* Create the file */ if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { goto error; @@ -848,11 +860,34 @@ test_compound (char *filename, hid_t fapl) H5Dclose (dataset); H5Fclose (file); + /* Release buffers */ + HDfree(s1); + HDfree(s2); + HDfree(s3); + HDfree(s4); + HDfree(s5); + HDfree(s6); + PASSED(); return 0; error: puts("*** DATASET TESTS FAILED ***"); + + /* Release resources */ + if(s1) + HDfree(s1); + if(s2) + HDfree(s2); + if(s3) + HDfree(s3); + if(s4) + HDfree(s4); + if(s5) + HDfree(s5); + if(s6) + HDfree(s6); + return 1; } diff --git a/test/dsets.c b/test/dsets.c index fe6a0c0..4a52539 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -7942,11 +7942,10 @@ test_big_chunks_bypass_cache(hid_t fapl) int fvalue = BYPASS_FILL_VALUE; /* Fill value */ hsize_t count, stride, offset, block; /* Setting for hyperslab (1-D) */ hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */ - /* Buffer for reading and writing data (1-D) */ - static int wdata[BYPASS_CHUNK_DIM/2], rdata1[BYPASS_DIM], - rdata2[BYPASS_CHUNK_DIM/2]; + /* Buffers for reading and writing data (1-D) */ + int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL; /* Buffer for reading and writing data (2-D) */ - static int t_wdata[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2], t_rdata1[BYPASS_DIM][BYPASS_DIM], + int t_wdata[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2], t_rdata1[BYPASS_DIM][BYPASS_DIM], t_rdata2[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2]; int i, j; /* Local index variables */ H5F_libver_t low; /* File format low bound */ @@ -8031,6 +8030,14 @@ test_big_chunks_bypass_cache(hid_t fapl) if(H5Sselect_hyperslab(t_sid, H5S_SELECT_SET, t_offset, t_stride, t_count, t_block) < 0) FAIL_STACK_ERROR + /* Allocate buffers */ + if(NULL == (wdata = (int *)HDmalloc(sizeof(int) * (BYPASS_CHUNK_DIM / 2)))) + TEST_ERROR + if(NULL == (rdata1 = (int *)HDmalloc(sizeof(int) * BYPASS_DIM))) + TEST_ERROR + if(NULL == (rdata2 = (int *)HDmalloc(sizeof(int) * (BYPASS_CHUNK_DIM / 2)))) + TEST_ERROR + /* Initialize data to write for 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) wdata[i] = i; @@ -8165,6 +8172,11 @@ test_big_chunks_bypass_cache(hid_t fapl) if(H5Pclose(fapl_local) < 0) FAIL_STACK_ERROR if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Release buffers */ + HDfree(wdata); + HDfree(rdata1); + HDfree(rdata2); + PASSED(); return 0; @@ -8179,6 +8191,12 @@ error: H5Sclose(t_sid); H5Fclose(fid); } H5E_END_TRY; + if(wdata) + HDfree(wdata); + if(rdata1) + HDfree(rdata1); + if(rdata2) + HDfree(rdata2); return -1; } /* end test_big_chunks_bypass_cache() */ @@ -9265,9 +9283,9 @@ test_fixed_array(hid_t fapl) hsize_t msize_big[1] = {POINTS_BIG}; /* Size of memory space for big dataset */ int wbuf[POINTS]; /* write buffer */ - int wbuf_big[POINTS_BIG]; /* write buffer for big dataset */ + int *wbuf_big = NULL; /* write buffer for big dataset */ int rbuf[POINTS]; /* read buffer */ - int rbuf_big[POINTS_BIG]; /* read buffer for big dataset */ + int *rbuf_big = NULL; /* read buffer for big dataset */ hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */ int chunks[12][6]; /* # of chunks for dataset dimensions */ @@ -9309,6 +9327,12 @@ test_fixed_array(hid_t fapl) if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + /* Allocate the "big" buffers */ + if(NULL == (wbuf_big = (int *)HDmalloc(sizeof(int) * POINTS_BIG))) + TEST_ERROR + if(NULL == (rbuf_big = (int *)HDmalloc(sizeof(int) * POINTS_BIG))) + TEST_ERROR + #ifdef H5_HAVE_FILTER_DEFLATE /* Loop over compressing chunks */ for(compress = FALSE; compress <= TRUE; compress++) { @@ -9567,7 +9591,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS_BIG; i++) - if(rbuf_big[i] != wbuf_big[i]){ + if(rbuf_big[i] != wbuf_big[i]) { printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); TEST_ERROR; @@ -9599,6 +9623,10 @@ test_fixed_array(hid_t fapl) } /* end for */ #endif /* H5_HAVE_FILTER_DEFLATE */ + /* Release buffers */ + HDfree(wbuf_big); + HDfree(rbuf_big); + PASSED(); return 0; @@ -9610,6 +9638,10 @@ error: H5Sclose(mem_id); H5Fclose(fid); } H5E_END_TRY; + if(wbuf_big) + HDfree(wbuf_big); + if(rbuf_big) + HDfree(rbuf_big); return -1; } /* end test_fixed_array() */ @@ -9650,11 +9682,11 @@ test_single_chunk(hid_t fapl) hid_t sid = -1, sid_max = -1; /* Dataspace ID for dataset with fixed dimensions */ hid_t did = -1, did_max = -1; /* Dataset ID for dataset with fixed dimensions */ hsize_t dim2[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */ - hsize_t t_dim2[2] = {50, 100}; /* Dataset dimensions */ - int wbuf[DSET_DIM1*DSET_DIM2]; /* write buffer */ - int t_wbuf[50*100]; /* write buffer */ - int rbuf[DSET_DIM1*DSET_DIM2]; /* read buffer */ - int t_rbuf[50*100]; /* read buffer */ + hsize_t t_dim2[2] = {50, 100}; /* Dataset dimensions */ + int *wbuf = NULL; /* write buffer */ + int *t_wbuf = NULL; /* write buffer */ + int *rbuf = NULL; /* read buffer */ + int *t_rbuf = NULL; /* read buffer */ H5D_chunk_index_t idx_type; /* Dataset chunk index type */ H5F_libver_t low, high; /* File format bounds */ @@ -9686,6 +9718,16 @@ test_single_chunk(hid_t fapl) if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + /* Allocate the buffers */ + if(NULL == (wbuf = (int *)HDmalloc(sizeof(int) * (DSET_DIM1 * DSET_DIM2)))) + TEST_ERROR + if(NULL == (rbuf = (int *)HDmalloc(sizeof(int) * (DSET_DIM1 * DSET_DIM2)))) + TEST_ERROR + if(NULL == (t_wbuf = (int *)HDmalloc(sizeof(int) * (50 * 100)))) + TEST_ERROR + if(NULL == (t_rbuf = (int *)HDmalloc(sizeof(int) * (50 * 100)))) + TEST_ERROR + for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++) wbuf[i] = (int)n++; @@ -9800,7 +9842,7 @@ test_single_chunk(hid_t fapl) /* Open the second dataset */ if((did = H5Dopen2(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR; - HDmemset(rbuf, 0, sizeof(rbuf)); + HDmemset(rbuf, 0, sizeof(int) * (DSET_DIM1 * DSET_DIM2)); /* Read from dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rbuf) < 0) TEST_ERROR; @@ -9836,6 +9878,12 @@ test_single_chunk(hid_t fapl) } /* end for */ #endif /* H5_HAVE_FILTER_DEFLATE */ + /* Release buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(t_wbuf); + HDfree(t_rbuf); + PASSED(); return 0; @@ -9849,6 +9897,14 @@ error: H5Sclose(sid_max); H5Fclose(fid); } H5E_END_TRY; + if(wbuf) + HDfree(wbuf); + if(rbuf) + HDfree(rbuf); + if(t_wbuf) + HDfree(t_wbuf); + if(t_rbuf) + HDfree(t_rbuf); return -1; } /* end test_single_chunk() */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 064ee69..cdfe182 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -2673,12 +2673,14 @@ test_conv_int_2(void) { int i, j; hid_t src_type, dst_type; - char buf[32*100]; + char *buf; printf("%-70s", "Testing overlap calculations"); HDfflush(stdout); - HDmemset(buf, 0, sizeof buf); + buf = (char *)HDcalloc(32, 100); + HDassert(buf); + for (i=1; i<=32; i++) { for (j=1; j<=32; j++) { @@ -2700,6 +2702,7 @@ test_conv_int_2(void) } } PASSED(); + HDfree(buf); return 0; } diff --git a/test/gheap.c b/test/gheap.c index 317e306..3e88ca6 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -78,7 +78,7 @@ test_1 (hid_t fapl) { hid_t file = -1; H5F_t *f = NULL; - H5HG_t obj[1024]; + H5HG_t *obj = NULL; uint8_t out[1024]; uint8_t in[1024]; size_t u; @@ -89,6 +89,10 @@ test_1 (hid_t fapl) TESTING("monotonically increasing lengths"); + /* Allocate buffer for H5HG_t */ + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -138,6 +142,10 @@ test_1 (hid_t fapl) } } + /* Release buffer */ + HDfree(obj); + obj = NULL; + if(H5Fclose(file) < 0) goto error; if(nerrors) goto error; @@ -148,6 +156,8 @@ error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; + if(obj) + HDfree(obj); return MAX(1, nerrors); } @@ -174,7 +184,7 @@ test_2 (hid_t fapl) { hid_t file = -1; H5F_t *f = NULL; - H5HG_t obj[1024]; + H5HG_t *obj = NULL; uint8_t out[1024]; uint8_t in[1024]; size_t u; @@ -184,6 +194,10 @@ test_2 (hid_t fapl) TESTING("monotonically decreasing lengths"); + /* Allocate buffer for H5HG_t */ + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -226,8 +240,13 @@ test_2 (hid_t fapl) } } + /* Release buffer */ + HDfree(obj); + obj = NULL; + if (H5Fclose(file)<0) goto error; if (nerrors) goto error; + PASSED(); return 0; @@ -235,6 +254,8 @@ test_2 (hid_t fapl) H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; + if(obj) + HDfree(obj); return MAX(1, nerrors); } @@ -261,7 +282,7 @@ test_3 (hid_t fapl) { hid_t file = -1; H5F_t *f = NULL; - H5HG_t obj[1024]; + H5HG_t *obj = NULL; uint8_t out[1024]; size_t u; size_t size; @@ -271,6 +292,10 @@ test_3 (hid_t fapl) TESTING("complete object removal"); + /* Allocate buffer for H5HG_t */ + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -304,8 +329,13 @@ test_3 (hid_t fapl) } } + /* Release buffer */ + HDfree(obj); + obj = NULL; + if (H5Fclose(file)<0) goto error; if (nerrors) goto error; + PASSED(); return 0; @@ -313,6 +343,8 @@ test_3 (hid_t fapl) H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; + if(obj) + HDfree(obj); return MAX(1, nerrors); } @@ -340,7 +372,7 @@ test_4 (hid_t fapl) { hid_t file = -1; H5F_t *f = NULL; - H5HG_t obj[1024]; + H5HG_t *obj = NULL; uint8_t out[1024]; size_t u; size_t size; @@ -350,6 +382,10 @@ test_4 (hid_t fapl) TESTING("partial object removal"); + /* Allocate buffer for H5HG_t */ + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -389,8 +425,13 @@ test_4 (hid_t fapl) } } + /* Release buffer */ + HDfree(obj); + obj = NULL; + if (H5Fclose(file)<0) goto error; if (nerrors) goto error; + PASSED(); return 0; @@ -398,6 +439,8 @@ test_4 (hid_t fapl) H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; + if(obj) + HDfree(obj); return MAX(1, nerrors); } diff --git a/test/h5test.c b/test/h5test.c index aea5dc7..974f2e7 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -74,7 +74,7 @@ char *paraprefix = NULL; /* for command line option para-prefix */ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ #endif -#define READ_BUF_SIZE 4096 +#define READ_BUF_SIZE 65536 /* * These are the letters that are appended to the file name when generating @@ -855,7 +855,7 @@ h5_fileaccess(void) H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; + char *sv[H5FD_MEM_NTYPES]; haddr_t memb_addr[H5FD_MEM_NTYPES]; H5FD_mem_t mt; @@ -867,6 +867,8 @@ h5_fileaccess(void) HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { memb_fapl[mt] = H5P_DEFAULT; + sv[mt] = (char *)HDmalloc(1024); + HDassert(sv[mt]); HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); @@ -874,6 +876,9 @@ h5_fileaccess(void) if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) return -1; + + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + HDfree(sv[mt]); } else if(!HDstrcmp(name, "family")) { hsize_t fam_size = 100*1024*1024; /*100 MB*/ @@ -989,7 +994,7 @@ h5_get_vfd_fapl(void) H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; + char *sv[H5FD_MEM_NTYPES]; haddr_t memb_addr[H5FD_MEM_NTYPES]; H5FD_mem_t mt; @@ -1001,15 +1006,18 @@ h5_get_vfd_fapl(void) HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { memb_fapl[mt] = H5P_DEFAULT; + sv[mt] = (char *)HDmalloc(1024); + HDassert(sv[mt]); HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } /* end for */ - if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, - memb_addr, FALSE) < 0) { + if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) return -1; - } /* end if */ + + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + HDfree(sv[mt]); } else if(!HDstrcmp(tok, "family")) { /* Family of files, each 1MB and using the default driver */ hsize_t fam_size = 100*1024*1024; /*100 MB*/ @@ -1573,9 +1581,13 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) { int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ ssize_t nread; /* Number of bytes read in */ - char buf[READ_BUF_SIZE]; /* Buffer for copying data */ + void *buf; /* Buffer for copying data */ const char *filename = H5_get_srcdir_filename(origfilename);; /* Get the test file name to copy */ + /* Allocate copy buffer */ + if(NULL == (buf = HDmalloc(READ_BUF_SIZE))) + return -1; + /* Copy old file into temporary file */ if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1; @@ -1586,6 +1598,9 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0) if(HDwrite(fd_new, buf, (size_t)nread) < 0) return -1; + + /* Release memory */ + HDfree(buf); /* Close files */ if(HDclose(fd_old) < 0) return -1; diff --git a/test/tattr.c b/test/tattr.c index e7b3ece..6f55081 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -8029,7 +8029,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + unsigned *big_value; /* Data for "big" attribute */ size_t mesg_count; /* # of shared messages */ unsigned test_shared; /* Index over shared component type */ unsigned u; /* Local index variable */ @@ -8040,8 +8040,10 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Writing Shared & Unshared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -8328,6 +8330,9 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_write() */ /**************************************************************** @@ -8355,7 +8360,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + unsigned *big_value; /* Data for "big" attribute */ size_t mesg_count; /* # of shared messages */ unsigned test_shared; /* Index over shared component type */ unsigned u; /* Local index variable */ @@ -8366,8 +8371,10 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Shared & Unshared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -8770,6 +8777,9 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_rename() */ /**************************************************************** @@ -8796,7 +8806,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + unsigned *big_value; /* Data for "big" attribute */ size_t mesg_count; /* # of shared messages */ unsigned test_shared; /* Index over shared component type */ unsigned u; /* Local index variable */ @@ -8807,8 +8817,10 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Shared & Unshared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -9134,6 +9146,9 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_delete() */ /**************************************************************** @@ -9160,7 +9175,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + unsigned *big_value; /* Data for "big" attribute */ size_t mesg_count; /* # of shared messages */ unsigned test_shared; /* Index over shared component type */ unsigned u; /* Local index variable */ @@ -9171,8 +9186,10 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Shared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -9484,6 +9501,9 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_unlink() */ /**************************************************************** diff --git a/test/tchecksum.c b/test/tchecksum.c index ca6c227..cf519c0 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -37,7 +37,6 @@ /*******************/ /* Local variables */ /*******************/ -uint8_t large_buf[BUF_LEN]; /**************************************************************** @@ -184,33 +183,41 @@ test_chksum_size_four(void) static void test_chksum_large(void) { + uint8_t *large_buf; /* Buffer for checksum calculations */ uint32_t chksum; /* Checksum value */ size_t u; /* Local index variable */ + /* Allocate the buffer */ + large_buf = (uint8_t *)HDmalloc((size_t)BUF_LEN); + CHECK(large_buf, NULL, "HDmalloc"); + /* Initialize buffer w/known data */ for(u = 0; u < BUF_LEN; u++) large_buf[u] = (uint8_t)(u * 3); /* Buffer w/real data */ - chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf)); + chksum = H5_checksum_fletcher32(large_buf, (size_t)BUF_LEN); VERIFY(chksum, 0x85b4e2a, "H5_checksum_fletcher32"); - chksum = H5_checksum_crc(large_buf, sizeof(large_buf)); + chksum = H5_checksum_crc(large_buf, (size_t)BUF_LEN); VERIFY(chksum, 0xfbd0f7c0, "H5_checksum_crc"); - chksum = H5_checksum_lookup3(large_buf, sizeof(large_buf), 0); + chksum = H5_checksum_lookup3(large_buf, (size_t)BUF_LEN, 0); VERIFY(chksum, 0x1bd2ee7b, "H5_checksum_lookup3"); /* Buffer w/zero(s) for data */ - HDmemset(large_buf, 0, sizeof(large_buf)); - chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf)); + HDmemset(large_buf, 0, (size_t)BUF_LEN); + chksum = H5_checksum_fletcher32(large_buf, (size_t)BUF_LEN); VERIFY(chksum, 0, "H5_checksum_fletcher32"); - chksum = H5_checksum_crc(large_buf, sizeof(large_buf)); + chksum = H5_checksum_crc(large_buf, (size_t)BUF_LEN); VERIFY(chksum, 0xfac8b4c4, "H5_checksum_crc"); - chksum = H5_checksum_lookup3(large_buf, sizeof(large_buf), 0); + chksum = H5_checksum_lookup3(large_buf, (size_t)BUF_LEN, 0); VERIFY(chksum, 0x930c7afc, "H5_checksum_lookup3"); + + /* Release memory for buffer */ + HDfree(large_buf); } /* test_chksum_large() */ diff --git a/test/th5o.c b/test/th5o.c index 125e11b..c2c4034 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -777,15 +777,21 @@ test_h5o_link(void) hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2}; htri_t committed; /* Whether the named datatype is committed */ unsigned new_format; /* Whether to use the new format or not */ - int wdata[TEST6_DIM1][TEST6_DIM2]; - int rdata[TEST6_DIM1][TEST6_DIM2]; - int i, n, j; + int *wdata; + int *rdata; + int i, n; herr_t ret; /* Value returned from API calls */ + /* Allocate memory buffers */ + /* (These are treated as 2-D buffers) */ + wdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); + CHECK(wdata, NULL, "HDmalloc"); + rdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); + CHECK(rdata, NULL, "HDmalloc"); + /* Initialize the raw data */ - for(i = n = 0; i < TEST6_DIM1; i++) - for(j = 0; j < TEST6_DIM2; j++) - wdata[i][j] = n++; + for(i = n = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++) + wdata[i] = n++; /* Create the dataspace */ space_id = H5Screate_simple(2 ,dims, NULL); @@ -840,9 +846,8 @@ test_h5o_link(void) CHECK(ret, FAIL, "H5Dread"); /* Verify the data */ - for(i = 0; i < TEST6_DIM1; i++) - for(j = 0; j < TEST6_DIM2; j++) - VERIFY(wdata[i][j], rdata[i][j], "H5Dread"); + for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++) + VERIFY(wdata[i], rdata[i], "H5Dread"); /* Create a group with no name*/ group_id = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT); @@ -879,9 +884,8 @@ test_h5o_link(void) /* Read data from dataset */ ret = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); - for(i = 0; i < TEST6_DIM1; i++) - for(j = 0; j < TEST6_DIM2; j++) - VERIFY(wdata[i][j], rdata[i][j], "H5Dread"); + for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++) + VERIFY(wdata[i], rdata[i], "H5Dread"); /* Close open IDs */ ret = H5Dclose(dset_id); @@ -897,6 +901,10 @@ test_h5o_link(void) CHECK(ret, FAIL, "H5Sclose"); ret = H5Pclose(lcpl_id); CHECK(ret, FAIL, "H5Pclose"); + + /* Release buffers */ + HDfree(wdata); + HDfree(rdata); } /* end test_h5o_link() */ diff --git a/test/theap.c b/test/theap.c index 2d509bf..b19e08f 100644 --- a/test/theap.c +++ b/test/theap.c @@ -44,13 +44,13 @@ typedef struct test_obj { } test_obj; /* Array of random element values */ -static test_obj rand_num[NUM_ELEMS]; +static test_obj *rand_num; /* Array of random elements values, sorted in increasing order */ -static test_obj inc_sort_num[NUM_ELEMS]; +static test_obj *inc_sort_num; /* Array of random elements values, sorted in decreasing order */ -static test_obj dec_sort_num[NUM_ELEMS]; +static test_obj *dec_sort_num; static int tst_dec_sort(const void *_i1, const void *_i2) { @@ -88,21 +88,29 @@ test_heap_init(void) time_t curr_time; /* Current time, for seeding random number generator */ size_t u; /* Local index variables */ + /* Allocate arrays */ + rand_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); + HDassert(rand_num); + inc_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); + HDassert(inc_sort_num); + dec_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); + HDassert(dec_sort_num); + /* Create randomized set of numbers */ - curr_time=time(NULL); + curr_time = HDtime(NULL); HDsrandom((unsigned)curr_time); - for(u=0; u= 0); } + /* * Close and release resources. */ @@ -3505,6 +3510,7 @@ static void gent_array8(void) HDassert(status >= 0); status = H5Fclose (file); HDassert(status >= 0); + HDfree(wdata); } static void gent_empty(void) @@ -7585,7 +7591,7 @@ static void gent_compound_intsizes(void) { int64_t dset64[F70_XDIM][F70_YDIM64]; double dsetdbl[F70_XDIM][F70_YDIM8]; } Array1Struct; - Array1Struct Array1[F70_LENGTH]; + Array1Struct *Array1; hid_t Array1Structid; /* File datatype identifier */ herr_t status; /* Error checking variable */ @@ -7593,6 +7599,10 @@ static void gent_compound_intsizes(void) { int m, n, o; /* Array init loop vars */ + /* Allocate buffer */ + Array1 = (Array1Struct *)HDmalloc(sizeof(Array1Struct) * F70_LENGTH); + HDassert(Array1); + /* Initialize the data in the arrays/datastructure */ for (m = 0; m < F70_LENGTH; m++) { @@ -7602,9 +7612,8 @@ static void gent_compound_intsizes(void) { valu8bits = (uint8_t) ~0u; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu8[n][0] = valu8bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1); - } valu8bits = (uint8_t)(valu8bits << 1); } @@ -7614,9 +7623,8 @@ static void gent_compound_intsizes(void) { valu16bits = (uint16_t) ~0u; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu16[n][0] = valu16bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1); - } valu16bits = (uint16_t)(valu16bits << 1); } @@ -7626,9 +7634,8 @@ static void gent_compound_intsizes(void) { valu32bits = (uint32_t) ~0u; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu32[n][0] = valu32bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1; - } valu32bits <<= 1; } @@ -7638,9 +7645,8 @@ static void gent_compound_intsizes(void) { valu64bits = (uint64_t) ~0Lu; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu64[n][0] = valu64bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1; - } valu64bits <<= 1; } @@ -7650,9 +7656,8 @@ static void gent_compound_intsizes(void) { val8bits = (int8_t) ~0; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset8[n][0] = val8bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1); - } val8bits = (int8_t)(val8bits << 1); } @@ -7662,9 +7667,8 @@ static void gent_compound_intsizes(void) { val16bits = (int16_t) ~0; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset16[n][0] = val16bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1); - } val16bits = (int16_t)(val16bits << 1); } @@ -7674,9 +7678,8 @@ static void gent_compound_intsizes(void) { val32bits = (int32_t) ~0; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset32[n][0] = val32bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1; - } val32bits <<= 1; } @@ -7686,9 +7689,8 @@ static void gent_compound_intsizes(void) { val64bits = (int64_t) ~0L; /* all 1s */ for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset64[n][0] = val64bits; - for(o = 1; o < (int)dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1; - } val64bits <<= 1; } @@ -7822,6 +7824,8 @@ static void gent_compound_intsizes(void) { status = H5Fclose(fid); HDassert(status >= 0); + + HDfree(Array1); } static void gent_compound_attr_intsizes(void) { @@ -8736,7 +8740,7 @@ static void gent_compound_int_array(void) { int64_t dset64[F76_DIM64]; double dsetdbl[F76_DIM8]; } Cmpd1Struct; - Cmpd1Struct Cmpd1[F76_LENGTH]; + Cmpd1Struct *Cmpd1; hid_t Cmpd1Structid; /* File datatype identifier */ herr_t status; /* Error checking variable */ @@ -8744,6 +8748,10 @@ static void gent_compound_int_array(void) { int m, n; /* Array init loop vars */ + /* Allocate buffer */ + Cmpd1 = (Cmpd1Struct *)HDmalloc(sizeof(Cmpd1Struct) * F76_LENGTH); + HDassert(Cmpd1); + /* Initialize the data in the arrays/datastructure */ for (m = 0; m < F76_LENGTH; m++) { @@ -8948,6 +8956,8 @@ static void gent_compound_int_array(void) { status = H5Fclose(fid); HDassert(status >= 0); + + HDfree(Cmpd1); } static void gent_compound_ints(void) { @@ -8972,7 +8982,7 @@ static void gent_compound_ints(void) { int64_t dset64; double dsetdbl; } Cmpd1Struct; - Cmpd1Struct Cmpd1[F77_LENGTH]; + Cmpd1Struct *Cmpd1; typedef struct Cmpd2Struct { uint64_t dsetu64; @@ -8985,7 +8995,7 @@ static void gent_compound_ints(void) { int8_t dset8; double dsetdbl; } Cmpd2Struct; - Cmpd2Struct Cmpd2[F77_LENGTH]; + Cmpd2Struct *Cmpd2; hid_t Cmpd1Structid; /* File datatype identifier */ hid_t Cmpd2Structid; /* File datatype identifier */ @@ -8994,6 +9004,12 @@ static void gent_compound_ints(void) { int m; /* Array init loop vars */ + /* Allocate buffers */ + Cmpd1 = (Cmpd1Struct *)HDmalloc(sizeof(Cmpd1Struct) * F77_LENGTH); + HDassert(Cmpd1); + Cmpd2 = (Cmpd2Struct *)HDmalloc(sizeof(Cmpd2Struct) * F77_LENGTH); + HDassert(Cmpd2); + /* Initialize the data in the arrays/datastructure */ for (m = 0; m < F77_LENGTH; m++) { @@ -9170,6 +9186,9 @@ static void gent_compound_ints(void) { status = H5Fclose(fid); HDassert(status >= 0); + + HDfree(Cmpd1); + HDfree(Cmpd2); } /*------------------------------------------------------------------------- @@ -9918,7 +9937,7 @@ static void gent_compound_complex2(void) multiple_nested_compound e; /* Compound inside compound with further nested compound */ } compound; - compound buf[F82_DIM32]; /* compound */ + compound *buf; /* compound */ hid_t file, type=-1, space=-1, dset=-1; hid_t dset_array_a, dset_array_b, dset_array_c; @@ -9929,6 +9948,10 @@ static void gent_compound_complex2(void) hsize_t dset_array_a_dims[1], dset_array_b_dims[1], dset_array_c_dims[2]; hsize_t nelmts = F82_DIM32; + /* Allocate buffer */ + buf = (compound *)HDmalloc(sizeof(compound) * F82_DIM32); + HDassert(buf); + file = H5Fcreate(FILE82, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) { @@ -10176,6 +10199,8 @@ static void gent_compound_complex2(void) // } H5Fclose(file); + + HDfree(buf); } /*------------------------------------------------------------------------- -- cgit v0.12 From 064073307a45f51b358431aae9e6ae47ce91716e Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 29 Sep 2016 10:49:08 -0500 Subject: Removed duplicate FCFLAG. --- config/conclude_fc.am | 4 ++-- fortran/test/Makefile.am | 4 ---- hl/fortran/src/Makefile.am | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/config/conclude_fc.am b/config/conclude_fc.am index d9e7b56..6402412 100644 --- a/config/conclude_fc.am +++ b/config/conclude_fc.am @@ -26,8 +26,8 @@ LTPPFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=co # Treat all .f90 and .F90 files as preprocessed Fortran. .f90.o: - $(PPFCCOMPILE) -c -o $@ $(FCFLAGS) $< + $(PPFCCOMPILE) -c -o $@ $< .F90.o: - $(PPFCCOMPILE) -c -o $@ $(FCFLAGS) $< + $(PPFCCOMPILE) -c -o $@ $< include $(top_srcdir)/config/conclude.am diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 36b9adc..3def26e 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -97,10 +97,6 @@ H5_test_buildiface_SOURCES = H5_test_buildiface.F90 H5_test_buildiface_LDADD = - -H5_test_buildiface$(EXEEXT): $(H5_test_buildiface_SOURCES) - $(FC) $(FCFLAGS) $< -o $@ -I$(top_builddir)/fortran/src - # fflush2 depends on files created by fflush1 fflush2.chkexe_: fflush1.chkexe_ diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index 571ca45..7ac18cd 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -86,8 +86,6 @@ H5LTff_gen.F90: H5HL_buildiface$(EXEEXT) H5TBff_gen.F90: H5HL_buildiface$(EXEEXT) -#H5TBff_gen.F90: H5HL_buildiface$(EXEEXT) - # H5HL_buildiface.F90 is included in the distribution, and Automake knows # how to compile a fortran program given its sources. -- cgit v0.12 From c28c6873fedb6a4bec9dfa500d8648610c7ba88f Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 29 Sep 2016 10:50:12 -0500 Subject: Removed duplicate FCFLAG --- fortran/src/Makefile.am | 3 --- 1 file changed, 3 deletions(-) diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 4ec02b7..a271666 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -138,9 +138,6 @@ H5_buildiface_SOURCES = H5_buildiface.F90 # Mark this directory as part of the Fortran API FORTRAN_API=yes -H5_buildiface$(EXEEXT): $(H5_buildiface_SOURCES) H5config_f.inc - $(FC) $(FCFLAGS) $< -o $@ -I$(top_builddir)/fortran/src - # Hardcode the dependencies of these files. There isn't a known way of # determining this automagically (like we do with the C files). So, when # doing a parallel make, some modules could be made way before the -- cgit v0.12 From 9fbebbe6d7c1b873006e24b8b21c88b3d7ba9ab8 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 29 Sep 2016 11:52:12 -0500 Subject: Fixed: Fortran_DOUBLE was being set to C_LONG_DOUBLE when C_LONG_DOUBLE is not available. --- fortran/src/H5match_types.c | 25 +++++++++++++++---------- fortran/test/tH5T_F03.F90 | 4 +++- fortran/test/tf.F90 | 3 ++- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 4d62402..2ae78ee 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -342,7 +342,7 @@ int main(void) if (RealKinds[i] > 0) { sprintf(chrA, "Fortran_REAL_%s", Real_C_TYPES[i]); sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); - writeToFiles("float",chrA, chrB, RealKinds[i], RealKinds_SizeOf[i]); + writeToFiles("float",chrA, chrB, RealKinds[i], RealKinds[i]); } } @@ -356,13 +356,15 @@ int main(void) /* Error: couldn't find a size for hid_t */ return -1; } - /* real_f */ - if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(long double)) +#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0 + if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(long double)) { writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE"); - else if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(double)) + } else +#endif + if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(double)) { writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE"); - else if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(float)) + } else if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(float)) writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT"); else { /* No exact match, choose the next highest */ @@ -380,20 +382,23 @@ int main(void) } /* double_f */ - if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(long double)) +#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0 + if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(long double)){ writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_LONG_DOUBLE"); - else if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(double)) + } else +#endif + if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(double)) { writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_DOUBLE"); - else if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(float)) + } else if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(float)) writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_FLOAT"); #ifdef H5_HAVE_FLOAT128 /* Don't select a higher precision than Fortran can support */ else if(sizeof(__float128) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) { - writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_FLOAT128"); + writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "Fortran_REAL_C_FLOAT128"); } #else else if(sizeof(long double) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) { - writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_FLOAT128"); + writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "Fortran_REAL_C_FLOAT128"); } #endif else { diff --git a/fortran/test/tH5T_F03.F90 b/fortran/test/tH5T_F03.F90 index a9148a7..c8be606 100644 --- a/fortran/test/tH5T_F03.F90 +++ b/fortran/test/tH5T_F03.F90 @@ -66,6 +66,7 @@ SUBROUTINE test_array_compound_atomic(total_error) CHARACTER(LEN=10), PARAMETER :: FILENAME = "tarray1.h5" TYPE s1_t + SEQUENCE INTEGER :: i REAL :: f END TYPE s1_t @@ -298,7 +299,8 @@ END SUBROUTINE test_array_compound_atomic INTEGER, PARAMETER :: SPACE1_DIM1 = 4 CHARACTER(LEN=10), PARAMETER :: FILENAME = "tarray2.h5" - TYPE st_t_struct ! Typedef for compound datatype + TYPE st_t_struct ! Typedef for compound datatype + SEQUENCE INTEGER :: i REAL, DIMENSION(1:ARRAY2_DIM1) :: f CHARACTER(LEN=2), DIMENSION(1:ARRAY2_DIM1) :: c diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 index 219254b..8797cc3 100644 --- a/fortran/test/tf.F90 +++ b/fortran/test/tf.F90 @@ -40,7 +40,8 @@ MODULE TH5_MISC INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors ! generic compound datatype - TYPE, BIND(C) :: comp_datatype + TYPE :: comp_datatype + SEQUENCE REAL :: a INTEGER :: x DOUBLE PRECISION :: y -- cgit v0.12 From ce11185fbb8489b94758ca810652760ce98180bc Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 29 Sep 2016 13:26:32 -0400 Subject: Fleshed out evict on close test that inspects cache. --- test/evict_on_close.c | 218 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 194 insertions(+), 24 deletions(-) diff --git a/test/evict_on_close.c b/test/evict_on_close.c index bc47cef..562c167 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -22,7 +22,23 @@ * are located in cache.c. */ +#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_TESTING +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_TESTING +#define H5I_FRIEND /*suppress error about including H5Ipkg */ +#define H5I_TESTING + + #include "h5test.h" +#include "H5Cpkg.h" +#include "H5Dpkg.h" +#include "H5Fpkg.h" +#include "H5Ipkg.h" + +/* Uncomment to manually inspect cache states */ +#define EOC_MANUAL_INSPECTION const char *FILENAMES[] = { "evict-on-close", /* 0 */ @@ -32,14 +48,60 @@ const char *FILENAMES[] = { //#define DSET_NAME_COMPACT "compact" //#define DSET_NAME_CONTIGUOUS "contiguous" -#define DSET_NAME_V1_BTREE "v1_btree" +#define DSET_NAME_V1_BTREE_NAME "v1_btree" //#define DSET_NAME_V2_BTREE "v2_btree" //#define DSET_NAME_EARRAY "earray" //#define DSET_NAME_FARRAY "farray" //#define DSET_NAME_SINGLE "single" + +#define DSET_NAME_V1_BTREE_NELEMENTS 1024 + +static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); -static herr_t generate_eoc_test_file(hid_t fapl_id); +static hid_t generate_eoc_test_file(hid_t fapl_id); +static herr_t check_v1_btree_chunk_index(hid_t fid); + + +/*------------------------------------------------------------------------- + * Function: verify_tag_not_in_cache() + * + * Purpose: Ensure that metadata cache entries with a given tag are not + * present in the cache. + * + * Return: TRUE/FALSE + * + * Programmer: Dana Robinson + * Fall 2016 + * + *------------------------------------------------------------------------- + */ +static hbool_t +verify_tag_not_in_cache(H5F_t *f, haddr_t tag) +{ + H5C_t *cache_ptr = NULL; /* cache pointer */ + int i = 0; /* iterator */ + H5C_cache_entry_t *entry_ptr = NULL; /* entry pointer */ + + cache_ptr = f->shared->cache; + + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + entry_ptr = cache_ptr->index[i]; + + while(entry_ptr != NULL) { + + if(tag == entry_ptr->tag) + return TRUE; + else + entry_ptr = entry_ptr->ht_next; + + } /* end while */ + } /* end for */ + + return FALSE; + +} /* end verify_tag_not_in_cache() */ /*------------------------------------------------------------------------- @@ -47,18 +109,19 @@ static herr_t generate_eoc_test_file(hid_t fapl_id); * * Purpose: Generate the evict-on-close test file. * - * Return: SUCCEED/FAIL + * Return: Success: The file ID of the created file + * Failure: -1 * * Programmer: Dana Robinson * Fall 2016 * *------------------------------------------------------------------------- */ -static herr_t +static hid_t generate_eoc_test_file(hid_t fapl_id) { char filename[FILENAME_BUF_SIZE]; /* decorated file name */ - hid_t fid = -1; /* file ID */ + hid_t fid = -1; /* file ID (returned) */ hid_t fapl_copy_id = -1; /* ID of copied fapl */ hid_t sid = -1; /* dataspace ID */ hid_t dcpl_id = -1; /* dataset creation plist */ @@ -84,7 +147,7 @@ generate_eoc_test_file(hid_t fapl_id) /***********************************************************/ /* Create the data buffer */ - if(NULL == (data = (int *)HDcalloc(1024, sizeof(int)))) + if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) TEST_ERROR; /********************/ @@ -92,7 +155,7 @@ generate_eoc_test_file(hid_t fapl_id) /********************/ /* Create dataspace */ - n = 100; + n = DSET_NAME_V1_BTREE_NELEMENTS; rank = 1; current_dims[0] = (hsize_t)n; maximum_dims[0] = H5S_UNLIMITED; @@ -107,7 +170,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write a bunch of fake data */ @@ -123,13 +186,11 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; - /* Close everything else */ - if(H5Fclose(fid) < 0) - TEST_ERROR; + /* Close/free everything else */ HDfree(data); PASSED(); - return SUCCEED; + return fid; error: H5E_BEGIN_TRY { @@ -143,12 +204,115 @@ error: HDfree(data); H5_FAILED(); - return FAIL; + return -1; } /* end generate_eoc_test_file() */ /*------------------------------------------------------------------------- + * Function: check_v1_btree_chunk_index() + * + * Purpose: Verify that datasets using version 1 B-trees are evicted + * correctly. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +check_v1_btree_chunk_index(hid_t fid) +{ + H5F_t *file_ptr = NULL; /* ptr to internal file struct */ + hid_t did = -1; /* dataset ID */ + H5D_t *dset_ptr = NULL; /* ptr to internal dset struct */ + haddr_t tag; /* MD cache tag for dataset */ + int *data = NULL; /* buffer for fake data */ + int32_t before, during, after; /* cache sizes */ + + TESTING("evict on close with version 1 B-trees"); + + /* Get a pointer to the file struct */ + if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + TEST_ERROR; + + /* Create the data buffer */ + if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) + TEST_ERROR; + + /* Record the number of cache entries */ + before = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE BEFORE DATASET OPEN:\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", before); +#endif + + /* Open dataset and get the metadata tag */ + if((did = H5Dopen2(fid, DSET_NAME_V1_BTREE_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + TEST_ERROR; + tag = dset_ptr->oloc.addr; + + /* Read data from the dataset so the cache gets populated with chunk indices */ + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Record the number of cache entries */ + during = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE AFTER DATA READ (WHILE OPEN):\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("TAG: %#X\n", tag); + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", during); +#endif + + /* Close the dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + + /* Record the number of cache entries */ + after = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE AFTER DATASET CLOSE:\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); +#endif + + /* Ensure that the cache does not contain data items with the tag */ + if(TRUE == verify_tag_not_in_cache(file_ptr, tag)) + TEST_ERROR; + + /* Compare the number of cache entries */ + if(before != after || before == during) + TEST_ERROR; + + HDfree(data); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(did); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; + +} /* check_v1_btree_chunk_index() */ + + +/*------------------------------------------------------------------------- * Function: check_evict_on_close_api() * * Purpose: Verify that the H5Pset/get_evict_on_close() calls behave @@ -246,8 +410,9 @@ error: int main(void) { - hid_t fapl_id = -1; - unsigned nerrors = 0; + hid_t fapl_id = -1; /* VFD-specific fapl */ + hid_t fid = -1; /* file ID */ + unsigned nerrors = 0; /* number of test errors */ HDprintf("Testing evict-on-close cache behavior.\n"); @@ -269,28 +434,32 @@ main(void) PUTS_ERROR("Unable to set evict-on-close property\n"); } /* end if */ + /*************************/ + /* Test EoC for datasets */ + /*************************/ + /* Generate the test file */ - if(generate_eoc_test_file(fapl_id) < 0) { + if((fid = generate_eoc_test_file(fapl_id)) < 0) { nerrors++; PUTS_ERROR("Unable to generate test file\n"); } /* end if */ - /*************************/ - /* Test EoC for datasets */ - /*************************/ + /* Run tests with a variety of dataset configurations */ + nerrors += check_v1_btree_chunk_index(fid) < 0 ? 1 : 0; -#ifdef NOTYET - nerrors += check_v1_btree_chunk_index(fapl_id); -#endif + /* Close the test file */ + if(H5Fclose(fid) < 0) { + nerrors++; + PUTS_ERROR("Unable to close the test file.\n"); + } /* end if */ /* Clean up files and close the VFD-specific fapl */ //h5_delete_all_test_files(FILENAMES, fapl_id); if(H5Pclose(fapl_id) < 0) { nerrors++; - PUTS_ERROR("Unable to close VFD-specific fapl\n"); + PUTS_ERROR("Unable to close VFD-specific fapl.\n"); } /* end if */ - if(nerrors) goto error; @@ -305,6 +474,7 @@ error: h5_delete_all_test_files(FILENAMES, fapl_id); H5E_BEGIN_TRY { + H5Fclose(fid); H5Pclose(fapl_id); } H5E_END_TRY; -- cgit v0.12 From 678d116eebe41a960d6a229aef8d5fa748ff29a3 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 29 Sep 2016 12:56:07 -0500 Subject: Removed unused variables. --- fortran/src/H5match_types.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 2ae78ee..2337fb3 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -51,7 +51,7 @@ FILE * fort_header; /* Prototypes for the write routines */ void writeTypedef(const char* c_typedef, const char* c_type, int size); void writeTypedefDefault(const char* c_typedef, int size); -void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int size, int kind); +void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int kind); void writeToCFileOnly(const char* c_typedef, const char* fortran_type, const char* c_type, int size); void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, const char* kind); @@ -136,10 +136,10 @@ void writeTypedefDefault(const char* c_typedef, int size) } /* Create matching Fortran and C types by writing to both files */ -void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int size, int kind) +void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int kind) { fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, kind); - fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, size, c_type); + fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, kind, c_type); } void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, const char* kind) { @@ -148,7 +148,7 @@ void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char } int main(void) { - int i, j,flag; + int i; char chrA[32],chrB[32]; int IntKinds[] = H5_FORTRAN_INTEGER_KINDS; @@ -260,7 +260,7 @@ int main(void) /* haddr_t */ for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HADDR_T) { - writeToFiles("int","HADDR_T", "haddr_t_f", IntKinds[i], IntKinds[i]); + writeToFiles("int","HADDR_T", "haddr_t_f", IntKinds[i]); break; } if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -271,7 +271,7 @@ int main(void) /* hsize_t */ for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HSIZE_T) { - writeToFiles("hsize_t","HSIZE_T", "hsize_t_f", IntKinds[i], IntKinds[i]); + writeToFiles("hsize_t","HSIZE_T", "hsize_t_f", IntKinds[i]); break; } if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -282,7 +282,7 @@ int main(void) /* hssize_t */ for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HSSIZE_T) { - writeToFiles("int","HSSIZE_T", "hssize_t_f", IntKinds[i], IntKinds[i]); + writeToFiles("int","HSSIZE_T", "hssize_t_f", IntKinds[i]); break; } if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -293,7 +293,7 @@ int main(void) /* off_t */ for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_OFF_T) { - writeToFiles("int","OFF_T", "off_t_f", IntKinds[i], IntKinds[i]); + writeToFiles("int","OFF_T", "off_t_f", IntKinds[i]); break; } if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -304,7 +304,7 @@ int main(void) /* size_t */ for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_SIZE_T) { - writeToFiles("size_t","SIZE_T", "size_t_f", IntKinds[i], IntKinds[i]); + writeToFiles("size_t","SIZE_T", "size_t_f", IntKinds[i]); break; } if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) @@ -313,7 +313,7 @@ int main(void) } /* int */ - writeToFiles("int","Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_KIND, H5_FORTRAN_NATIVE_INTEGER_KIND); + writeToFiles("int","Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_KIND); /* int_1, int_2, int_4, int_8 */ @@ -342,14 +342,14 @@ int main(void) if (RealKinds[i] > 0) { sprintf(chrA, "Fortran_REAL_%s", Real_C_TYPES[i]); sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); - writeToFiles("float",chrA, chrB, RealKinds[i], RealKinds[i]); + writeToFiles("float",chrA, chrB, RealKinds[i]); } } /* hid_t */ for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HID_T) { - writeToFiles("int","HID_T", "hid_t_f", IntKinds[i], IntKinds[i]); + writeToFiles("int","HID_T", "hid_t_f", IntKinds[i]); break; } if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) -- cgit v0.12 From 1853868fdc9433f29adae5418d1fd0d65a45fabe Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 29 Sep 2016 11:01:23 -0700 Subject: Description: Cleanups from Dana's review. Tested on: MacOSX/64 10.11.5 (amazon) w/C++ & FORTRAN (h5committest forthcoming) --- hl/test/test_ds.c | 4 ++-- hl/tools/gif2h5/h52gifgentst.c | 4 ++-- test/h5test.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 3ca1e4d..091a98b 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -410,8 +410,8 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int long s44_wbuf[DIM4_SIZE] = {280,280}; /* Allocate buffer */ - buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE); - HDassert(buf); + if(NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE))) + return FAIL; /* make a dataset */ if(H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) { diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c index 6a41028..39e950b 100644 --- a/hl/tools/gif2h5/h52gifgentst.c +++ b/hl/tools/gif2h5/h52gifgentst.c @@ -57,8 +57,8 @@ int main(void) hsize_t height = HEIGHT; /* Allocate buffer */ - buf = (unsigned char *)malloc(WIDTH * HEIGHT); - assert(buf); + if(NULL == (buf = (unsigned char *)malloc(WIDTH * HEIGHT))) + return EXIT_FAILURE; /* create a file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) diff --git a/test/h5test.c b/test/h5test.c index 974f2e7..92b90c5 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -867,8 +867,8 @@ h5_fileaccess(void) HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { memb_fapl[mt] = H5P_DEFAULT; - sv[mt] = (char *)HDmalloc(1024); - HDassert(sv[mt]); + if(NULL == (sv[mt] = (char *)HDmalloc(1024))) + return -1; HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); -- cgit v0.12 From cd702dd0515814012093dccb31e9580476c58772 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 29 Sep 2016 13:12:07 -0500 Subject: fixed missing closing bracket --- config/cmake/HDF5UseFortran.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 2658ccf..eba448c 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -159,7 +159,7 @@ set(PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") list(GET PROG_OUTPUT 3 NUM_IKIND) list(GET PROG_OUTPUT 4 NUM_RKIND) -set(PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}" +set(PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}") set(H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") set(H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") -- cgit v0.12 From e45ee9fa961b7c375c244757609f297d2cf46eea Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 29 Sep 2016 14:52:26 -0500 Subject: Fixed test to use storage_size instead of c_sizeof when available. --- fortran/test/tf.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 index 8797cc3..ee5a857 100644 --- a/fortran/test/tf.F90 +++ b/fortran/test/tf.F90 @@ -337,11 +337,11 @@ CONTAINS IMPLICIT NONE TYPE(comp_datatype), INTENT(in) :: a -#ifdef H5_FORTRAN_HAVE_C_SIZEOF - H5_SIZEOF_CMPD = C_SIZEOF(a) +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + H5_SIZEOF_CMPD = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) #else -# ifdef H5_FORTRAN_HAVE_STORAGE_SIZE - H5_SIZEOF_CMPD = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) +# ifdef H5_FORTRAN_HAVE_C_SIZEOF + H5_SIZEOF_CMPD = C_SIZEOF(a) # else H5_SIZEOF_CMPD = SIZEOF(a) # endif -- cgit v0.12 From 5a7880183025f56421cf6f2274d9f1ac36f59641 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 29 Sep 2016 13:17:55 -0700 Subject: Clean up hardcoded constants and check return values better. (Comments from group code review) --- test/dsets.c | 16 ++++++++++------ test/dt_arith.c | 11 +++++++---- test/gheap.c | 41 ++++++++++++++++++++++------------------- test/h5test.c | 7 +++++-- test/theap.c | 15 +++++++++------ test/tskiplist.c | 15 +++++++++------ 6 files changed, 62 insertions(+), 43 deletions(-) diff --git a/test/dsets.c b/test/dsets.c index 4a52539..8aa073f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -240,6 +240,10 @@ double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2]; size_t count_nbytes_read = 0; size_t count_nbytes_written = 0; +/* Temporary buffer dimensions */ +#define DSET_TMP_DIM1 50 +#define DSET_TMP_DIM2 100 + /* Declarations for test_idx_compatible() */ #define DSET "dset" #define DSET_FILTER "dset_filter" @@ -9682,7 +9686,7 @@ test_single_chunk(hid_t fapl) hid_t sid = -1, sid_max = -1; /* Dataspace ID for dataset with fixed dimensions */ hid_t did = -1, did_max = -1; /* Dataset ID for dataset with fixed dimensions */ hsize_t dim2[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */ - hsize_t t_dim2[2] = {50, 100}; /* Dataset dimensions */ + hsize_t t_dim2[2] = {DSET_TMP_DIM1, DSET_TMP_DIM2}; /* Dataset dimensions */ int *wbuf = NULL; /* write buffer */ int *t_wbuf = NULL; /* write buffer */ int *rbuf = NULL; /* read buffer */ @@ -9723,15 +9727,15 @@ test_single_chunk(hid_t fapl) TEST_ERROR if(NULL == (rbuf = (int *)HDmalloc(sizeof(int) * (DSET_DIM1 * DSET_DIM2)))) TEST_ERROR - if(NULL == (t_wbuf = (int *)HDmalloc(sizeof(int) * (50 * 100)))) + if(NULL == (t_wbuf = (int *)HDmalloc(sizeof(int) * (DSET_TMP_DIM1 * DSET_TMP_DIM2)))) TEST_ERROR - if(NULL == (t_rbuf = (int *)HDmalloc(sizeof(int) * (50 * 100)))) + if(NULL == (t_rbuf = (int *)HDmalloc(sizeof(int) * (DSET_TMP_DIM1 * DSET_TMP_DIM2)))) TEST_ERROR for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++) wbuf[i] = (int)n++; - for(i = n = 0; i < (50* 100); i++) + for(i = n = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) t_wbuf[i] = (int)n++; #ifdef H5_HAVE_FILTER_DEFLATE @@ -9848,8 +9852,8 @@ test_single_chunk(hid_t fapl) if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rbuf) < 0) TEST_ERROR; /* Verify that written and read data are the same */ - for(i = 0; i < (50* 100); i++) - if(t_rbuf[i] != t_wbuf[i]){ + for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) + if(t_rbuf[i] != t_wbuf[i]) { printf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]); TEST_ERROR; diff --git a/test/dt_arith.c b/test/dt_arith.c index cdfe182..1ebcf74 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -94,6 +94,9 @@ static int skip_overflow_tests_g = 0; #define TEST_DENORM 2 #define TEST_SPECIAL 3 +/* Temporary buffer sizes */ +#define TMP_BUF_DIM1 32 +#define TMP_BUF_DIM2 100 /* Don't use hardware conversions if set */ static int without_hardware_g = 0; @@ -2678,11 +2681,11 @@ test_conv_int_2(void) printf("%-70s", "Testing overlap calculations"); HDfflush(stdout); - buf = (char *)HDcalloc(32, 100); + buf = (char *)HDcalloc(TMP_BUF_DIM1, TMP_BUF_DIM2); HDassert(buf); - for (i=1; i<=32; i++) { - for (j=1; j<=32; j++) { + for(i = 1; i <= TMP_BUF_DIM1; i++) { + for(j = 1; j <= TMP_BUF_DIM1; j++) { /* Source type */ src_type = H5Tcopy(H5T_NATIVE_CHAR); @@ -2696,7 +2699,7 @@ test_conv_int_2(void) * Conversion. If overlap calculations aren't right then an * assertion will fail in H5T__conv_i_i() */ - H5Tconvert(src_type, dst_type, (size_t)100, buf, NULL, H5P_DEFAULT); + H5Tconvert(src_type, dst_type, (size_t)TMP_BUF_DIM2, buf, NULL, H5P_DEFAULT); H5Tclose(src_type); H5Tclose(dst_type); } diff --git a/test/gheap.c b/test/gheap.c index 3e88ca6..eafc49d 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -35,6 +35,9 @@ * GHEAP_REPEATED_ERR_LIM errors, and suppress the rest */ #define GHEAP_REPEATED_ERR_LIM 20 +/* Number of heap objects to test */ +#define GHEAP_TEST_NOBJS 1024 + #define GHEAP_REPEATED_ERR(MSG) \ { \ nerrors++; \ @@ -79,8 +82,8 @@ test_1 (hid_t fapl) hid_t file = -1; H5F_t *f = NULL; H5HG_t *obj = NULL; - uint8_t out[1024]; - uint8_t in[1024]; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; size_t u; size_t size; herr_t status; @@ -90,7 +93,7 @@ test_1 (hid_t fapl) TESTING("monotonically increasing lengths"); /* Allocate buffer for H5HG_t */ - if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS))) goto error; /* Open a clean file */ @@ -108,7 +111,7 @@ test_1 (hid_t fapl) * a clean file, the addresses allocated for the collections should also * be monotonically increasing. */ - for(u = 0; u < 1024; u++) { + for(u = 0; u < GHEAP_TEST_NOBJS; u++) { size = u + 1; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); @@ -127,7 +130,7 @@ test_1 (hid_t fapl) /* * Now try to read each object back. */ - for(u = 0; u < 1024; u++) { + for(u = 0; u < GHEAP_TEST_NOBJS; u++) { size = u + 1; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); @@ -185,8 +188,8 @@ test_2 (hid_t fapl) hid_t file = -1; H5F_t *f = NULL; H5HG_t *obj = NULL; - uint8_t out[1024]; - uint8_t in[1024]; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; size_t u; size_t size; int nerrors = 0; @@ -195,7 +198,7 @@ test_2 (hid_t fapl) TESTING("monotonically decreasing lengths"); /* Allocate buffer for H5HG_t */ - if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS))) goto error; /* Open a clean file */ @@ -211,8 +214,8 @@ test_2 (hid_t fapl) /* * Write the objects, monotonically decreasing in length. */ - for(u = 0; u < 1024; u++) { - size = 1024 - u; + for(u = 0; u < GHEAP_TEST_NOBJS; u++) { + size = GHEAP_TEST_NOBJS - u; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u) < 0) { @@ -225,8 +228,8 @@ test_2 (hid_t fapl) /* * Now try to read each object back. */ - for(u = 0; u < 1024; u++) { - size = 1024 - u; + for(u = 0; u < GHEAP_TEST_NOBJS; u++) { + size = GHEAP_TEST_NOBJS - u; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) { @@ -283,7 +286,7 @@ test_3 (hid_t fapl) hid_t file = -1; H5F_t *f = NULL; H5HG_t *obj = NULL; - uint8_t out[1024]; + uint8_t out[GHEAP_TEST_NOBJS]; size_t u; size_t size; herr_t status; @@ -293,7 +296,7 @@ test_3 (hid_t fapl) TESTING("complete object removal"); /* Allocate buffer for H5HG_t */ - if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS))) goto error; /* Open a clean file */ @@ -307,7 +310,7 @@ test_3 (hid_t fapl) } /* Create some stuff */ - for(u = 0; u < 1024; u++) { + for(u = 0; u < GHEAP_TEST_NOBJS; u++) { size = u % 30 + 100; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); @@ -320,7 +323,7 @@ test_3 (hid_t fapl) } /* Remove everything */ - for(u = 0; u < 1024; u++) { + for(u = 0; u < GHEAP_TEST_NOBJS; u++) { status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u); if (status<0) { H5_FAILED(); @@ -373,7 +376,7 @@ test_4 (hid_t fapl) hid_t file = -1; H5F_t *f = NULL; H5HG_t *obj = NULL; - uint8_t out[1024]; + uint8_t out[GHEAP_TEST_NOBJS]; size_t u; size_t size; herr_t status; @@ -383,7 +386,7 @@ test_4 (hid_t fapl) TESTING("partial object removal"); /* Allocate buffer for H5HG_t */ - if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024))) + if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS))) goto error; /* Open a clean file */ @@ -396,7 +399,7 @@ test_4 (hid_t fapl) goto error; } - for(u = 0; u < 1024; u++) { + for(u = 0; u < GHEAP_TEST_NOBJS; u++) { /* Insert */ size = u % 30 + 100; HDmemset(out, (int)('A' + u % 26), size); diff --git a/test/h5test.c b/test/h5test.c index 92b90c5..2ab8855 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -90,6 +90,9 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ */ static const char *multi_letters = "msbrglo"; +/* Length of multi-file VFD filename buffers */ +#define H5TEST_MULTI_FILENAME_LEN 1024 + /* Previous error reporting function */ static H5E_auto2_t err_func = NULL; @@ -867,7 +870,7 @@ h5_fileaccess(void) HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { memb_fapl[mt] = H5P_DEFAULT; - if(NULL == (sv[mt] = (char *)HDmalloc(1024))) + if(NULL == (sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN))) return -1; HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; @@ -1006,7 +1009,7 @@ h5_get_vfd_fapl(void) HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { memb_fapl[mt] = H5P_DEFAULT; - sv[mt] = (char *)HDmalloc(1024); + sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN); HDassert(sv[mt]); HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; diff --git a/test/theap.c b/test/theap.c index b19e08f..9c509a1 100644 --- a/test/theap.c +++ b/test/theap.c @@ -90,11 +90,11 @@ test_heap_init(void) /* Allocate arrays */ rand_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - HDassert(rand_num); + CHECK(rand_num, NULL, "HDmalloc"); inc_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - HDassert(inc_sort_num); + CHECK(inc_sort_num, NULL, "HDmalloc"); dec_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - HDassert(dec_sort_num); + CHECK(dec_sort_num, NULL, "HDmalloc"); /* Create randomized set of numbers */ curr_time = HDtime(NULL); @@ -1039,9 +1039,12 @@ static void test_heap_term(void) { /* Release arrays */ - HDfree(rand_num); - HDfree(inc_sort_num); - HDfree(dec_sort_num); + if(rand_num) + HDfree(rand_num); + if(inc_sort_num) + HDfree(inc_sort_num); + if(dec_sort_num) + HDfree(dec_sort_num); } /* end test_tst_term() */ /**************************************************************** diff --git a/test/tskiplist.c b/test/tskiplist.c index 5738aad..f30948e 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -68,11 +68,11 @@ test_skiplist_init(void) /* Allocate arrays */ rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); - HDassert(rand_num); + CHECK(rand_num, NULL, "HDmalloc"); sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); - HDassert(sort_rand_num); + CHECK(sort_rand_num, NULL, "HDmalloc"); rev_sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); - HDassert(rev_sort_rand_num); + CHECK(rev_sort_rand_num, NULL, "HDmalloc"); /* Initialize random number seed */ curr_time = HDtime(NULL); @@ -1762,9 +1762,12 @@ static void test_skiplist_term(void) { /* Release arrays */ - HDfree(rand_num); - HDfree(sort_rand_num); - HDfree(rev_sort_rand_num); + if(rand_num) + HDfree(rand_num); + if(sort_rand_num) + HDfree(sort_rand_num); + if(rev_sort_rand_num) + HDfree(rev_sort_rand_num); } /* end test_skiplist_term() */ /**************************************************************** -- cgit v0.12 From a2fe6f7db93bb1e83cc030df0e4181119900c9e5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 03:24:44 -0400 Subject: Added code to create the test file for all chunk index and layout types. --- src/H5Dpkg.h | 1 + src/H5Dtest.c | 41 +++++++ test/evict_on_close.c | 308 +++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 335 insertions(+), 15 deletions(-) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 05f49d1..2190f8c 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -770,6 +770,7 @@ H5_DLL htri_t H5D__mpio_opt_possible(const H5D_io_info_t *io_info, H5_DLL herr_t H5D__layout_version_test(hid_t did, unsigned *version); H5_DLL herr_t H5D__layout_contig_size_test(hid_t did, hsize_t *size); H5_DLL herr_t H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type); +H5_DLL herr_t H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type); H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused); #endif /* H5D_TESTING */ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index c3b0b19..56f14f7 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -144,6 +144,47 @@ done: /*-------------------------------------------------------------------------- NAME + H5D__layout_type_test + PURPOSE + Determine the storage layout type for a dataset + USAGE + herr_t H5D__layout_type_test(did, layout_type) + hid_t did; IN: Dataset to query + H5D_layout_t *layout_type; OUT: Pointer to location to place layout info + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Checks the layout type for a dataset. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type) +{ + H5D_t *dset; /* Pointer to dataset to query */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_PACKAGE + + HDassert(layout_type); + + /* Check args */ + if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + if(layout_type) + *layout_type = dset->shared->layout.type; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__layout_type_test() */ + + +/*-------------------------------------------------------------------------- + NAME H5D__layout_idx_type_test PURPOSE Determine the storage layout index type for a dataset's layout information diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 562c167..b09c1bf 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -46,16 +46,17 @@ const char *FILENAMES[] = { }; #define FILENAME_BUF_SIZE 1024 -//#define DSET_NAME_COMPACT "compact" -//#define DSET_NAME_CONTIGUOUS "contiguous" -#define DSET_NAME_V1_BTREE_NAME "v1_btree" -//#define DSET_NAME_V2_BTREE "v2_btree" -//#define DSET_NAME_EARRAY "earray" -//#define DSET_NAME_FARRAY "farray" -//#define DSET_NAME_SINGLE "single" - - -#define DSET_NAME_V1_BTREE_NELEMENTS 1024 +/* Dataset names */ +#define DSET_COMPACT_NAME "compact" +#define DSET_CONTIGUOUS_NAME "contiguous" +#define DSET_BTREE_NAME "v1_btree" +#define DSET_EARRAY_NAME "earray" +#define DSET_BT2_NAME "v2_btree" +#define DSET_FARRAY_NAME "farray" +#define DSET_SINGLE_NAME "single" + +/* All datasets store 1000 elements */ +#define NELEMENTS 1024 static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); @@ -130,6 +131,8 @@ generate_eoc_test_file(hid_t fapl_id) hsize_t current_dims[2]; /* current dataset size */ hsize_t maximum_dims[2]; /* maximum dataset size */ hsize_t chunk_dims[2]; /* chunk dimensions */ + H5D_chunk_index_t idx_type; /* dataset chunk index type */ + H5D_layout_t layout_type; /* dataset layout type */ int *data = NULL; /* buffer for fake data */ int n; /* # of data elements */ @@ -147,15 +150,78 @@ generate_eoc_test_file(hid_t fapl_id) /***********************************************************/ /* Create the data buffer */ - if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) + if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int)))) TEST_ERROR; + /****************************************************/ + /* Old file format data structures (v1 B-tree only) */ + /****************************************************/ + /********************/ /* Version 1 B-tree */ /********************/ /* Create dataspace */ - n = DSET_NAME_V1_BTREE_NELEMENTS; + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = H5S_UNLIMITED; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using version 1 B-tree as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /***********************************/ + /* New file format data structures */ + /***********************************/ + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR; + + /* Copy the fapl and set the latest file format */ + if((fapl_copy_id = H5Pcopy(fapl_id)) < 0) + TEST_ERROR; + if(H5Pset_libver_bounds(fapl_copy_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Reopen the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_copy_id)) < 0) + TEST_ERROR; + + /********************/ + /* Extensible Array */ + /********************/ + + /* Create dataspace */ + n = NELEMENTS; rank = 1; current_dims[0] = (hsize_t)n; maximum_dims[0] = H5S_UNLIMITED; @@ -170,8 +236,214 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate(fid, DSET_EARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_EARRAY) + FAIL_PUTS_ERROR("should be using extensible array as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /********************/ + /* Version 2 B-Tree */ + /********************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 2; + current_dims[0] = (hsize_t)2; + current_dims[1] = (hsize_t)(n/2); + maximum_dims[0] = H5S_UNLIMITED; + maximum_dims[1] = H5S_UNLIMITED; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + chunk_dims[1] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_BT2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_BT2) + FAIL_PUTS_ERROR("should be using version 2 B-tree as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /***************/ + /* Fixed Array */ + /***************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + chunk_dims[1] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_FARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using fixed array as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /****************/ + /* Single Chunk */ + /****************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = (hsize_t)n; + chunk_dims[1] = (hsize_t)n; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_SINGLE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_SINGLE) + FAIL_PUTS_ERROR("should be using single chunk as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /**************/ + /* Contiguous */ + /**************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_CONTIGUOUS_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct layout scheme */ + if(H5D__layout_type_test(did, &layout_type) < 0) + TEST_ERROR; + if(layout_type != H5D_CONTIGUOUS) + FAIL_PUTS_ERROR("should be using contiguous layout"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + + /***********/ + /* Compact */ + /***********/ + + /* Create dataspace */ + n = 1; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up compact layout */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if(H5Pset_layout(dcpl_id, H5D_COMPACT) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_COMPACT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct layout scheme */ + if(H5D__layout_type_test(did, &layout_type) < 0) TEST_ERROR; + if(layout_type != H5D_COMPACT) + FAIL_PUTS_ERROR("should be using compact layout"); /* Write a bunch of fake data */ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) @@ -185,8 +457,14 @@ generate_eoc_test_file(hid_t fapl_id) if(H5Pclose(dcpl_id) < 0) TEST_ERROR; + /********/ + /* DONE */ + /********/ /* Close/free everything else */ + if(H5Pclose(fapl_copy_id) < 0) + TEST_ERROR; + HDfree(data); PASSED(); @@ -239,7 +517,7 @@ check_v1_btree_chunk_index(hid_t fid) TEST_ERROR; /* Create the data buffer */ - if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) + if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int)))) TEST_ERROR; /* Record the number of cache entries */ @@ -253,7 +531,7 @@ check_v1_btree_chunk_index(hid_t fid) #endif /* Open dataset and get the metadata tag */ - if((did = H5Dopen2(fid, DSET_NAME_V1_BTREE_NAME, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(fid, DSET_BTREE_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) TEST_ERROR; -- cgit v0.12 From 31b033e214762dc2beced02af37d47b668126105 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 04:26:39 -0400 Subject: Added full implementation of EoC cache test. --- test/evict_on_close.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/test/evict_on_close.c b/test/evict_on_close.c index b09c1bf..0657b1b 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -38,7 +38,7 @@ #include "H5Ipkg.h" /* Uncomment to manually inspect cache states */ -#define EOC_MANUAL_INSPECTION +/* #define EOC_MANUAL_INSPECTION */ const char *FILENAMES[] = { "evict-on-close", /* 0 */ @@ -61,7 +61,7 @@ const char *FILENAMES[] = { static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); static hid_t generate_eoc_test_file(hid_t fapl_id); -static herr_t check_v1_btree_chunk_index(hid_t fid); +static herr_t check_configuration(hid_t fid, const char *dset_name); /*------------------------------------------------------------------------- @@ -488,10 +488,10 @@ error: /*------------------------------------------------------------------------- - * Function: check_v1_btree_chunk_index() + * Function: check_configuration() * - * Purpose: Verify that datasets using version 1 B-trees are evicted - * correctly. + * Purpose: Verify that the evict-on-close feature works for a given + * dataset layout and/or chunk index. * * Return: SUCCEED/FAIL * @@ -501,7 +501,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -check_v1_btree_chunk_index(hid_t fid) +check_configuration(hid_t fid, const char *dset_name) { H5F_t *file_ptr = NULL; /* ptr to internal file struct */ hid_t did = -1; /* dataset ID */ @@ -510,7 +510,7 @@ check_v1_btree_chunk_index(hid_t fid) int *data = NULL; /* buffer for fake data */ int32_t before, during, after; /* cache sizes */ - TESTING("evict on close with version 1 B-trees"); + /* NOTE: The TESTING() macro is called in main() */ /* Get a pointer to the file struct */ if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) @@ -531,13 +531,15 @@ check_v1_btree_chunk_index(hid_t fid) #endif /* Open dataset and get the metadata tag */ - if((did = H5Dopen2(fid, DSET_BTREE_NAME, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0) TEST_ERROR; if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) TEST_ERROR; tag = dset_ptr->oloc.addr; - /* Read data from the dataset so the cache gets populated with chunk indices */ + /* Read data from the dataset so the cache gets populated with chunk + * and the like. + */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR; @@ -587,7 +589,7 @@ error: H5_FAILED(); return FAIL; -} /* check_v1_btree_chunk_index() */ +} /* check_configuration() */ /*------------------------------------------------------------------------- @@ -722,8 +724,23 @@ main(void) PUTS_ERROR("Unable to generate test file\n"); } /* end if */ - /* Run tests with a variety of dataset configurations */ - nerrors += check_v1_btree_chunk_index(fid) < 0 ? 1 : 0; + /* Run tests with a variety of dataset configurations + * PASSED() and H5_FAILED() are handled in check_configuration() + */ + TESTING("evict on close with version 1 B-tree chunk index"); + nerrors += check_configuration(fid, DSET_BTREE_NAME) < 0 ? 1 : 0; + TESTING("evict on close with extensible array chunk index"); + nerrors += check_configuration(fid, DSET_EARRAY_NAME) < 0 ? 1 : 0; + TESTING("evict on close with version 2 B-tree chunk index"); + nerrors += check_configuration(fid, DSET_BT2_NAME) < 0 ? 1 : 0; + TESTING("evict on close with fixed array chunk index"); + nerrors += check_configuration(fid, DSET_FARRAY_NAME) < 0 ? 1 : 0; + TESTING("evict on close with \'single chunk\' chunk index"); + nerrors += check_configuration(fid, DSET_SINGLE_NAME) < 0 ? 1 : 0; + TESTING("evict on close with contiguous layout"); + nerrors += check_configuration(fid, DSET_CONTIGUOUS_NAME) < 0 ? 1 : 0; + TESTING("evict on close with compact layout"); + nerrors += check_configuration(fid, DSET_COMPACT_NAME) < 0 ? 1 : 0; /* Close the test file */ if(H5Fclose(fid) < 0) { @@ -732,7 +749,7 @@ main(void) } /* end if */ /* Clean up files and close the VFD-specific fapl */ - //h5_delete_all_test_files(FILENAMES, fapl_id); + h5_delete_all_test_files(FILENAMES, fapl_id); if(H5Pclose(fapl_id) < 0) { nerrors++; PUTS_ERROR("Unable to close VFD-specific fapl.\n"); -- cgit v0.12 From 5088217e4256aa2ba5b7590b7de91aeae415a1ce Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 05:04:11 -0400 Subject: - Removed non-implemented code from H5Gint.c - Removed commented-out debug code from H5Dint.c - Added blank lines to eliminate delta in a fortran file. --- fortran/src/H5Eff.F90 | 2 ++ src/H5Dint.c | 8 -------- src/H5Gint.c | 19 ------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index 2fc77f4..4198321 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -136,10 +136,12 @@ CONTAINS CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name END FUNCTION h5eprint_c1 END INTERFACE + INTERFACE INTEGER FUNCTION h5eprint_c2() BIND(C,NAME='h5eprint_c2') END FUNCTION h5eprint_c2 END INTERFACE + IF (PRESENT(name)) THEN namelen = LEN(NAME) hdferr = h5eprint_c1(name, namelen) diff --git a/src/H5Dint.c b/src/H5Dint.c index 5ae3bd3..7f90f16 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1920,17 +1920,10 @@ H5D_close(H5D_t *dataset) /* Evict dataset metadata if evicting on close */ if(H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { -// printf("EVICTING DATASET (TAG: 0x%3llx)\n", dataset->oloc.addr); -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(dataset->oloc.file); if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(dataset->oloc.file); if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(dataset->oloc.file); } /* end if */ /* @@ -2672,7 +2665,6 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATT /* Read in the point (with the custom VL memory allocator) */ if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gint.c b/src/H5Gint.c index 4b34015..a0e06f3 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -501,25 +501,6 @@ H5G_close(H5G_t *grp) if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") -#ifdef DER - /* XXX - NOT IMPLEMENTED */ - /* Evict group metadata if evicting on close */ - if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { - /* I've left in the cache dump code for now - DER */ - printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); - printf("DUMPING CACHE - BEFORE FLUSH\n"); - H5AC_dump_cache(grp->oloc.file); - if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") - printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); - H5AC_dump_cache(grp->oloc.file); - if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") - printf("DUMPING CACHE - AFTER EVICT\n"); - H5AC_dump_cache(grp->oloc.file); - } /* end if */ -#endif /* DER */ - /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } else { -- cgit v0.12 From fe71ac8d0ee13e3ed4656cd84720bd644729b74d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 30 Sep 2016 09:35:09 -0500 Subject: Fix error reporting --- config/cmake/HDF518_Examples.cmake.in | 15 ++++++++++++--- config/cmake/HDF5_Examples.cmake.in | 15 ++++++++++++--- config/cmake/scripts/CTestScript.cmake | 12 +++++++++--- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index efabbe6..309c1d6 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -171,19 +171,28 @@ ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ## NORMAL process ## -------------------------- ctest_start (Experimental) -ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") +ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +if(${res} LESS 0 OR ${res} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") +endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Configure Notes) endif() -ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) +ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND APPEND RETURN_VALUE res NUMBER_ERRORS errval) +if(${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") +endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Build) endif() ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) +if(${res} LESS 0 OR ${res} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") +endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Test) endif() -if(res GREATER 0) +if(${res} LESS 0 OR ${res} GREATER 0) message (FATAL_ERROR "tests FAILED") endif() #----------------------------------------------------------------------------- diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 8ea6d18..058dd7a 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -182,19 +182,28 @@ ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ## NORMAL process ## -------------------------- ctest_start (Experimental) -ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") +ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +if(${res} LESS 0 OR ${res} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") +endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Configure Notes) endif() -ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) +ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND APPEND RETURN_VALUE res NUMBER_ERRORS errval) +if(${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") +endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Build) endif() ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) +if(${res} LESS 0 OR ${res} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") +endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Test) endif() -if(res GREATER 0) +if(${res} LESS 0 OR ${res} GREATER 0) message (FATAL_ERROR "tests FAILED") endif() #----------------------------------------------------------------------------- diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 8a08caa..322f0e5 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -257,12 +257,18 @@ message(STATUS "Dashboard script configuration:\n${vars}\n") endif() configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") - ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") + ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) + if(${res} LESS 0 OR ${res} GREATER 0) + message(FATAL_ERROR "Failed configure: ${res}\n") + endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Update Configure Notes) endif() - ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res NUMBER_ERRORS errval) + if(${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) + message(FATAL_ERROR "Failed build: ${res} with Errors=${errval}\n") + endif() if(LOCAL_SUBMIT) ctest_submit (PARTS Build) endif() @@ -273,7 +279,7 @@ message(STATUS "Dashboard script configuration:\n${vars}\n") if(LOCAL_SUBMIT) ctest_submit (PARTS Test) endif() - if(res GREATER 0) + if(${res} LESS 0 OR ${res} GREATER 0) message(FATAL_ERROR "Failed tests: ${res}\n") endif() else() -- cgit v0.12 From 2299ff06c3dd9d5dee5320999a282f1526c27be7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 30 Sep 2016 09:41:18 -0500 Subject: Correct variable name --- config/cmake/HDF518_Examples.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index 309c1d6..e1cb781 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -85,9 +85,9 @@ else(WIN32) set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") endif(WIN32) if(${FORTRANLIBRARIES}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") else() - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") endif() if(${CDASH_LOCAL}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") -- cgit v0.12 From cbc260e636e258cc55d9fb8fdafd3bff0877ac23 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 13:06:12 -0400 Subject: - Removed BRANCH.txt and MANIFEST entry - Fixed a missing line in H5Dint.c --- BRANCH.txt | 22 ---------------------- MANIFEST | 1 - src/H5Dint.c | 1 + 3 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 BRANCH.txt diff --git a/BRANCH.txt b/BRANCH.txt deleted file mode 100644 index 6c4ee6c..0000000 --- a/BRANCH.txt +++ /dev/null @@ -1,22 +0,0 @@ -evict_on_close - -This branch is for the development of the "evict on close" feature -which will cause the library to evict all cached information -on object close. - -Dana Robinson is in charge of the branch, which follows the trunk. -It will be deleted when the feature is merged to the trunk. - -Key changes: - -* New H5Pset/get_evict_on_close() functions that enable and disable - the feature (default: disabled). - -* New property: H5F_ACS_EVICT_ON_CLOSE_FLAG - -* Added match_global flag to H5AC_evict_tagged_metadata() and - H5C_evict_tagged_entries() parameter lists. - -* H5D_close() updated to evict on close, when the property is set. - -* New evict_on_close test to exercise the function. diff --git a/MANIFEST b/MANIFEST index 3ed99e7..fb454c5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -25,7 +25,6 @@ ./.autom4te.cfg _DO_NOT_DISTRIBUTE_ ./.h5chkright.ini _DO_NOT_DISTRIBUTE_ ./ACKNOWLEDGMENTS -./BRANCH.txt ./COPYING ./MANIFEST ./Makefile.dist diff --git a/src/H5Dint.c b/src/H5Dint.c index 7f90f16..59fe3e9 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2665,6 +2665,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATT /* Read in the point (with the custom VL memory allocator) */ if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From dd47e42313fd4d76da95b7e48013bcd0d8879434 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 1 Oct 2016 07:23:57 -0400 Subject: Changed H5Dcreate to H5Dcreate2 in test/evict_on_close.c --- test/evict_on_close.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 0657b1b..1f515b2 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -177,7 +177,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Ensure we're using the correct chunk indexing scheme */ @@ -236,7 +236,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_EARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_EARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Ensure we're using the correct chunk indexing scheme */ @@ -280,7 +280,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_BT2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_BT2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Ensure we're using the correct chunk indexing scheme */ @@ -322,7 +322,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_FARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_FARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Ensure we're using the correct chunk indexing scheme */ @@ -364,7 +364,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_SINGLE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_SINGLE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Ensure we're using the correct chunk indexing scheme */ @@ -398,7 +398,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_CONTIGUOUS_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_CONTIGUOUS_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Ensure we're using the correct layout scheme */ @@ -436,7 +436,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_COMPACT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_COMPACT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Ensure we're using the correct layout scheme */ -- cgit v0.12 From 6cb0d90338ca9e16f793b3ae38aac4b77c499d42 Mon Sep 17 00:00:00 2001 From: lrknox Date: Sat, 1 Oct 2016 09:41:26 -0500 Subject: Snapshot release: increment version. --- README.txt | 2 +- bin/release | 2 +- c++/src/cpp_doc_config | 2 +- configure.ac | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 6dfd021..151e92c 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.234 currently under development +HDF5 version 1.9.235 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/bin/release b/bin/release index 703916b..d8dcd5c 100755 --- a/bin/release +++ b/bin/release @@ -152,7 +152,7 @@ tar2zip() # This command must be run at the top level of the hdf5 source directory. # Verify this requirement. -if [ ! \( -f configure -a -f bin/release \) ]; then +if [ ! \( -f configure.ac-a -f bin/release \) ]; then echo "$0 must be run at the top level of the hdf5 source directory" exit 1 fi diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 623f9c7..c024c45 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.9.234 currently under development" +PROJECT_NUMBER = "1.9.235 currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/configure.ac b/configure.ac index 59d1bef..028bd5f 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.234], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.235], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4d9b832..87eb732 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.234 currently under development +HDF5 version 1.9.235 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index 2f21648..84c98fa 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 234 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 235 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.234" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.235" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) -- cgit v0.12 From 4a2669d51f8f839a63c1257c184318cd8c0ce1ae Mon Sep 17 00:00:00 2001 From: lrknox Date: Sat, 1 Oct 2016 09:47:31 -0500 Subject: Correct typo: add ' ' --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index d8dcd5c..1d3c9c5 100755 --- a/bin/release +++ b/bin/release @@ -152,7 +152,7 @@ tar2zip() # This command must be run at the top level of the hdf5 source directory. # Verify this requirement. -if [ ! \( -f configure.ac-a -f bin/release \) ]; then +if [ ! \( -f configure.ac -a -f bin/release \) ]; then echo "$0 must be run at the top level of the hdf5 source directory" exit 1 fi -- cgit v0.12 From f9364c0080405bb36d704eb3f9505029d3da41f4 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 3 Oct 2016 13:26:39 -0500 Subject: removed the use of C_SIZEOF for non BIND(C) derived type --- fortran/test/tf.F90 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 index ee5a857..26b3e99 100644 --- a/fortran/test/tf.F90 +++ b/fortran/test/tf.F90 @@ -340,11 +340,7 @@ CONTAINS #ifdef H5_FORTRAN_HAVE_STORAGE_SIZE H5_SIZEOF_CMPD = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) #else -# ifdef H5_FORTRAN_HAVE_C_SIZEOF - H5_SIZEOF_CMPD = C_SIZEOF(a) -# else - H5_SIZEOF_CMPD = SIZEOF(a) -# endif + H5_SIZEOF_CMPD = SIZEOF(a) #endif END FUNCTION H5_SIZEOF_CMPD -- cgit v0.12 From 869ef118e914f127e9f1a2f949b760f1585dba0f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 3 Oct 2016 14:50:41 -0500 Subject: Move clear-objects inside runTest --- config/cmake_ext_mod/runTest.cmake | 8 ++++++++ tools/h5ls/CMakeTests.cmake | 10 +++++----- tools/h5ls/CMakeTestsVDS.cmake | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 21a65e6..8b47693 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -25,6 +25,14 @@ if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + # if there is not an error reference file add the error output to the stdout file if (NOT TEST_ERRREF) set (ERROR_APPEND 1) diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index 2367df8..4e6a08f 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -119,11 +119,11 @@ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err - ) +# add_test ( +# NAME H5LS-${resultfile}-clear-objects +# COMMAND ${CMAKE_COMMAND} +# -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err +# ) add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/tools/h5ls/CMakeTestsVDS.cmake b/tools/h5ls/CMakeTestsVDS.cmake index e6c216d..240eed0 100644 --- a/tools/h5ls/CMakeTestsVDS.cmake +++ b/tools/h5ls/CMakeTestsVDS.cmake @@ -70,11 +70,11 @@ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/vds/${resultfile}.out ./testfiles/vds/${resultfile}.out.err - ) +# add_test ( +# NAME H5LS-${resultfile}-clear-objects +# COMMAND ${CMAKE_COMMAND} +# -E remove ./testfiles/vds/${resultfile}.out ./testfiles/vds/${resultfile}.out.err +# ) add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" -- cgit v0.12 From dd9caf37d2e1191ed9abce4c34564ab22a8d53a8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 3 Oct 2016 15:34:11 -0500 Subject: Merge test output file clearing into runTest.cmake --- hl/tools/gif2h5/CMakeTests.cmake | 5 ++++ java/examples/datasets/CMakeLists.txt | 4 --- java/examples/datatypes/CMakeLists.txt | 2 -- java/examples/groups/CMakeLists.txt | 11 --------- java/examples/intro/CMakeLists.txt | 2 -- tools/h5copy/CMakeTests.cmake | 2 -- tools/h5diff/CMakeTests.cmake | 43 --------------------------------- tools/h5dump/CMakeTests.cmake | 38 ++++------------------------- tools/h5dump/CMakeTestsPBITS.cmake | 7 ------ tools/h5dump/CMakeTestsVDS.cmake | 13 ---------- tools/h5dump/CMakeTestsXML.cmake | 7 ------ tools/h5format_convert/CMakeTests.cmake | 8 +++--- tools/h5import/CMakeTests.cmake | 20 +-------------- tools/h5jam/CMakeTests.cmake | 35 ++------------------------- tools/h5ls/CMakeTests.cmake | 6 ----- tools/h5ls/CMakeTestsVDS.cmake | 6 ----- tools/h5repack/CMakeTests.cmake | 10 -------- tools/h5stat/CMakeTests.cmake | 6 ----- tools/misc/CMakeTests.cmake | 4 --- 19 files changed, 17 insertions(+), 212 deletions(-) diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 1cffe55..1dda0f5 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -26,16 +26,21 @@ add_test ( image.gif image24.gif ) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) #add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") +set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 0ba2331..3a69359 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -108,8 +108,6 @@ if (BUILD_TESTING) -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data - ${example}.out - ${example}.out.err ) else (${example} STREQUAL "H5Ex_D_External") add_test ( @@ -117,8 +115,6 @@ if (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 - ${example}.out - ${example}.out.err ) endif (${example} STREQUAL "H5Ex_D_External") if (NOT "${last_test}" STREQUAL "") diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 5ab513c..3eae115 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -96,8 +96,6 @@ if (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 - ${example}.out - ${example}.out.err ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index c23b7d3..2cab211 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -90,17 +90,6 @@ ENDMACRO (ADD_H5_TEST file) if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) - add_test ( - NAME JAVA_groups-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${example}.out - ${example}.out.err - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (JAVA_groups-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - set (last_test "JAVA_groups-${example}-clear-objects") if (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") if (${example} STREQUAL "H5Ex_G_Compact") add_test ( diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 6b77382..2d0c218 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -98,8 +98,6 @@ if (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 - ${example}.out - ${example}.out.err ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) diff --git a/tools/h5copy/CMakeTests.cmake b/tools/h5copy/CMakeTests.cmake index 96dc92b..a32c766 100644 --- a/tools/h5copy/CMakeTests.cmake +++ b/tools/h5copy/CMakeTests.cmake @@ -211,8 +211,6 @@ COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 - ./testfiles/${testname}.out.out - ./testfiles/${testname}.out.out.err ) add_test ( NAME H5COPY-CMP-${testname} diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake index a649b78..5d3d433 100644 --- a/tools/h5diff/CMakeTests.cmake +++ b/tools/h5diff/CMakeTests.cmake @@ -310,11 +310,6 @@ endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err - ) - add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -326,7 +321,6 @@ -D "TEST_APPEND=EXIT CODE:" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS "H5DIFF-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) if (H5_HAVE_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) @@ -346,11 +340,6 @@ endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME PH5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${resultfile}_p.out ./testfiles/${resultfile}_p.out.err - ) - add_test ( NAME PH5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=${MPIEXEC};${MPIEXEC_PREFLAGS};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_POSTFLAGS};$" @@ -364,41 +353,9 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/prunTest.cmake" ) - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS "PH5DIFF-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_PH5_TEST file) - # ADD_H5_NO_OUTPUT_TEST - # Purpose to verify only exitcode without output comparison - # Don't use this if possible; this may be removed. - MACRO (ADD_H5_NO_OUTPUT_TEST testname resultcode) - # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5DIFF-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err - ) - # if there was a previous test - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - - add_test (NAME H5DIFF-${testname} COMMAND $ ${ARGN}) - if (NOT ${resultcode} STREQUAL "0") - set_tests_properties (H5DIFF-${testname} PROPERTIES WILL_FAIL "true") - endif () - - if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - else (HDF5_ENABLE_USING_MEMCHECKER) - set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS H5DIFF-${testname}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_NO_OUTPUT_TEST) - ############################################################################## ############################################################################## ### T H E T E S T S ### diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index e376b50..895855c 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -381,12 +381,6 @@ set (last_test "H5DUMP-${testname}") else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-h5dump-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove h5dump-${testname}.out h5dump-${testname}.out.err - ) - set_tests_properties (H5DUMP-h5dump-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - add_test ( NAME H5DUMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -397,7 +391,6 @@ -D "TEST_REFERENCE=h5dump-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-h5dump-${testname} PROPERTIES DEPENDS "H5DUMP-h5dump-${testname}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_HELP_TEST) @@ -429,7 +422,7 @@ add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.bin ${resultfile}.out ${resultfile}.out.err + -E remove ${resultfile}.bin ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -462,7 +455,7 @@ add_test ( NAME H5DUMP-N-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}-N.bin ${resultfile}-N.out ${resultfile}-N.out.err + -E remove ${resultfile}-N.bin ) set_tests_properties (H5DUMP-N-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -495,7 +488,7 @@ add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.txt ${resultfile}.out ${resultfile}.out.err + -E remove ${resultfile}.txt ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -535,7 +528,7 @@ add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${ddlfile}.txt ${resultfile}.txt ${resultfile}.out ${resultfile}.out.err + -E remove ${ddlfile}.txt ${resultfile}.txt ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -594,12 +587,6 @@ MACRO (ADD_H5_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -611,19 +598,12 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_MASK_TEST file) MACRO (ADD_H5ERR_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -636,19 +616,12 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5ERR_MASK_TEST file) MACRO (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -663,7 +636,6 @@ -D "TEST_ENV_VALUE:STRING=${envval}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5ERR_MASK_ENV_TEST) @@ -673,7 +645,7 @@ add_test ( NAME H5DUMP-IMPORT-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${conffile}.out ${conffile}.out.err ${resultfile}.bin ${resultfile}.h5 + -E remove ${resultfile}.bin ${resultfile}.h5 ) set_tests_properties (H5DUMP-IMPORT-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( diff --git a/tools/h5dump/CMakeTestsPBITS.cmake b/tools/h5dump/CMakeTestsPBITS.cmake index 28514fb..681479a 100644 --- a/tools/h5dump/CMakeTestsPBITS.cmake +++ b/tools/h5dump/CMakeTestsPBITS.cmake @@ -121,12 +121,6 @@ endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -137,7 +131,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_PBITS_TEST file) diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake index 68a62e8..32056db 100644 --- a/tools/h5dump/CMakeTestsVDS.cmake +++ b/tools/h5dump/CMakeTestsVDS.cmake @@ -100,12 +100,6 @@ endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -116,7 +110,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_VDS_TEST file) @@ -133,12 +126,6 @@ endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" diff --git a/tools/h5dump/CMakeTestsXML.cmake b/tools/h5dump/CMakeTestsXML.cmake index 6e8dd15..79d3ff8 100644 --- a/tools/h5dump/CMakeTestsXML.cmake +++ b/tools/h5dump/CMakeTestsXML.cmake @@ -169,12 +169,6 @@ endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-XML-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-XML-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - add_test ( NAME H5DUMP-XML-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -185,7 +179,6 @@ -D "TEST_REFERENCE=${resultfile}.xml" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS "H5DUMP-XML-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_XML_H5_TEST file) diff --git a/tools/h5format_convert/CMakeTests.cmake b/tools/h5format_convert/CMakeTests.cmake index 37ee824..929230a 100644 --- a/tools/h5format_convert/CMakeTests.cmake +++ b/tools/h5format_convert/CMakeTests.cmake @@ -83,7 +83,7 @@ add_test ( NAME H5FC-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/outtmp.h5 + -E remove ./testfiles/outtmp.h5 ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) @@ -132,7 +132,7 @@ add_test ( NAME H5FC-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/tmp.h5 + -E remove ./testfiles/tmp.h5 ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) @@ -176,7 +176,7 @@ add_test ( NAME H5FC-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/chktmp.h5 + -E remove ./testfiles/chktmp.h5 ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) @@ -214,7 +214,7 @@ add_test ( NAME H5FC-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/dmptmp.h5 + -E remove ./testfiles/dmptmp.h5 ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) diff --git a/tools/h5import/CMakeTests.cmake b/tools/h5import/CMakeTests.cmake index ef029e9..54e7abe 100644 --- a/tools/h5import/CMakeTests.cmake +++ b/tools/h5import/CMakeTests.cmake @@ -88,20 +88,8 @@ set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5IMPORT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${testfile} - ${testfile}.new - ${testfile}.new.err - ${testfile}.out - ${testfile}.out.err - ) - set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) - set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) + set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) add_test ( NAME H5IMPORT-${testname}-H5DMP @@ -141,12 +129,6 @@ -E remove d${testfile} d${testfile}.bin - d${testfile}.imp - d${testfile}.imp.err - d${testfile}.dmp - d${testfile}.dmp.err - d${testfile}.dff - d${testfile}.dff.err ) set_tests_properties (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) diff --git a/tools/h5jam/CMakeTests.cmake b/tools/h5jam/CMakeTests.cmake index 6752c9a..96061b0 100644 --- a/tools/h5jam/CMakeTests.cmake +++ b/tools/h5jam/CMakeTests.cmake @@ -49,13 +49,6 @@ endif (NOT "${resultcode}" STREQUAL "0") else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5JAM-${expectfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${expectfile}.out - ${expectfile}.out.err - ) - add_test ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -66,7 +59,6 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-${expectfile} PROPERTIES DEPENDS H5JAM-${expectfile}-clear-objects) endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (TEST_H5JAM_OUTPUT) @@ -83,13 +75,6 @@ endif (NOT "${resultcode}" STREQUAL "0") else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5JAM-UNJAM-${expectfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${expectfile}.out - ${expectfile}.out.err - ) - add_test ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -100,7 +85,6 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES DEPENDS H5JAM-UNJAM-${expectfile}-clear-objects) endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (TEST_H5UNJAM_OUTPUT) @@ -108,16 +92,6 @@ # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5JAM-${testname}-CHECKFILE-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${actual}.new - ${actual}.new.err - ${actual}.out - ${actual}.out.err - ) - set_tests_properties (H5JAM-${testname}-CHECKFILE-clear-objects PROPERTIES DEPENDS ${testdepends}) - add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -129,7 +103,7 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-clear-objects) + set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS ${testdepends}) add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" @@ -174,11 +148,6 @@ else (NOT "${ufile}" STREQUAL "NONE") if (NOT "${ARGN}" STREQUAL "--delete") add_test ( - NAME H5JAM-${testname}-UNJAM_D-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${outfile}.ufile.txt ${outfile}.ufile.txt.err - ) - set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) - add_test ( NAME H5JAM-${testname}-UNJAM COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -189,7 +158,7 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) + set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") else (NOT "${ARGN}" STREQUAL "--delete") add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index 4e6a08f..816907c 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -119,11 +119,6 @@ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) -# add_test ( -# NAME H5LS-${resultfile}-clear-objects -# COMMAND ${CMAKE_COMMAND} -# -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err -# ) add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -135,7 +130,6 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS "H5LS-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_TEST file) diff --git a/tools/h5ls/CMakeTestsVDS.cmake b/tools/h5ls/CMakeTestsVDS.cmake index 240eed0..0c825cb 100644 --- a/tools/h5ls/CMakeTestsVDS.cmake +++ b/tools/h5ls/CMakeTestsVDS.cmake @@ -70,11 +70,6 @@ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) -# add_test ( -# NAME H5LS-${resultfile}-clear-objects -# COMMAND ${CMAKE_COMMAND} -# -E remove ./testfiles/vds/${resultfile}.out ./testfiles/vds/${resultfile}.out.err -# ) add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -86,7 +81,6 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS "H5LS_VDS-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_VDS_TEST file) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index d0aa6c8..561072d 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -146,11 +146,6 @@ endif () set (last_test "H5REPACK-${testname}") else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK-h5repack-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove h5repack-${testname}.out h5repack-${testname}.out.err - ) set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( NAME H5REPACK-h5repack-${testname} @@ -163,7 +158,6 @@ -D "TEST_REFERENCE=h5repack-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS "H5REPACK-h5repack-${testname}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_HELP_TEST) @@ -442,10 +436,6 @@ COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} - testfiles/${testname}.${resultfile}.out - testfiles/${testname}.${resultfile}.out.err - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err ) add_test ( NAME H5REPACK_UD-${testname} diff --git a/tools/h5stat/CMakeTests.cmake b/tools/h5stat/CMakeTests.cmake index a371b81..fea358a 100644 --- a/tools/h5stat/CMakeTests.cmake +++ b/tools/h5stat/CMakeTests.cmake @@ -75,11 +75,6 @@ endif (NOT "${last_test}" STREQUAL "") else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5STAT-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err - ) - add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -90,7 +85,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS "H5STAT-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_TEST file) diff --git a/tools/misc/CMakeTests.cmake b/tools/misc/CMakeTests.cmake index 6822be5..bc2760b 100644 --- a/tools/misc/CMakeTests.cmake +++ b/tools/misc/CMakeTests.cmake @@ -76,8 +76,6 @@ COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err ) set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -118,8 +116,6 @@ COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err ) set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( -- cgit v0.12 From 031633c4791ce31b94f655148912e987df078025 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 3 Oct 2016 15:42:31 -0500 Subject: Revert clear objects for testfile removal --- tools/h5import/CMakeTests.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/h5import/CMakeTests.cmake b/tools/h5import/CMakeTests.cmake index 54e7abe..0fdf9dd 100644 --- a/tools/h5import/CMakeTests.cmake +++ b/tools/h5import/CMakeTests.cmake @@ -88,8 +88,16 @@ set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () else (HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5IMPORT-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${testfile} + ) + set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) + add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) - set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) + set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) add_test ( NAME H5IMPORT-${testname}-H5DMP -- cgit v0.12 From 9fd74f83e656be95ef456d4fa275a598153a6e61 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 3 Oct 2016 15:45:31 -0500 Subject: Remove hanging property set --- tools/h5repack/CMakeTests.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index 561072d..666f28e 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -146,7 +146,6 @@ endif () set (last_test "H5REPACK-${testname}") else (HDF5_ENABLE_USING_MEMCHECKER) - set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" -- cgit v0.12 From ec991ed4b813adb3300bc82ed64c550eb505e3d0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 3 Oct 2016 17:07:21 -0500 Subject: Fix missing defines for standalone perf --- tools/perform/sio_standalone.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/perform/sio_standalone.h b/tools/perform/sio_standalone.h index 258eafb..63dc7b0 100644 --- a/tools/perform/sio_standalone.h +++ b/tools/perform/sio_standalone.h @@ -56,6 +56,14 @@ # define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) #endif +#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON) +#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON) +#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON) + +#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf(((Y)-(X)) / (X)) < (M)) +#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs (((Y)-(X)) / (X)) < (M)) +#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl(((Y)-(X)) / (X)) < (M)) + /* * Redefine all the POSIX functions. We should never see a POSIX * function (or any other non-HDF5 function) in the source! @@ -183,20 +191,32 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDstat(S,B) _stati64(S,B) typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; + #define HDoff_t __int64 #elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64) #define HDfstat(F,B) fstat64(F,B) #define HDlstat(S,B) lstat64(S,B) #define HDstat(S,B) stat64(S,B) typedef struct stat64 h5_stat_t; typedef off64_t h5_stat_size_t; + #define HDoff_t off64_t #else #define HDfstat(F,B) fstat(F,B) #define HDlstat(S,B) lstat(S,B) #define HDstat(S,B) stat(S,B) typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; + #define HDoff_t off_t #endif +#ifndef H5_HAVE_WIN32_API +/* These definitions differ in Windows and are defined in + * H5win32defs for that platform. + */ +typedef struct stat h5_stat_t; +typedef off_t h5_stat_size_t; +#define HDoff_t off_t +#endif /* H5_HAVE_WIN32_API */ + #define HDftell(F) ftell(F) #define HDftruncate(F,L) ftruncate(F,L) #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) @@ -402,6 +422,11 @@ H5_DLL void HDsrand(unsigned int seed); #define HDstrtol(S,R,N) strtol(S,R,N) H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDstrtoul(S,R,N) strtoul(S,R,N) +#ifdef H5_HAVE_WIN32_API +#define HDstrtoull(S,R,N) _strtoui64(S,R,N) +#else +#define HDstrtoull(S,R,N) strtoull(S,R,N) +#endif #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) #define HDsysconf(N) sysconf(N) #define HDsystem(S) system(S) -- cgit v0.12 From 8c49b6e05a7d40218b8129b29bd74bbd2b39758d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 4 Oct 2016 09:36:01 -0500 Subject: HDFFV-9991: Remove uneeded file --- CMakeInstallation.cmake | 15 -------- MANIFEST | 1 - config/cmake/FindHDF5.cmake.in | 86 ------------------------------------------ 3 files changed, 102 deletions(-) delete mode 100644 config/cmake/FindHDF5.cmake.in diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 8dcaf85..6817d5c 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -75,21 +75,6 @@ configure_package_config_file ( ) #----------------------------------------------------------------------------- -# Configure the FindHDF5.cmake file for the install directory -#----------------------------------------------------------------------------- -if (NOT HDF5_EXTERNALLY_CONFIGURED) - configure_file ( - ${HDF_RESOURCES_DIR}/FindHDF5.cmake.in - ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindHDF5${HDF_PACKAGE_EXT}.cmake @ONLY - ) - install ( - FILES ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindHDF5${HDF_PACKAGE_EXT}.cmake - DESTINATION ${HDF5_INSTALL_CMAKE_DIR} - COMPONENT configinstall - ) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) - -#----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the install directory #----------------------------------------------------------------------------- set (INCLUDE_INSTALL_DIR ${HDF5_INSTALL_INCLUDE_DIR}) diff --git a/MANIFEST b/MANIFEST index fb454c5..98ecdb5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2840,7 +2840,6 @@ ./config/cmake/ConfigureChecks.cmake ./config/cmake/CPack.Info.plist.in ./config/cmake/CTestCustom.cmake -./config/cmake/FindHDF5.cmake.in ./config/cmake/FindHDFJAVA.cmake.in ./config/cmake/FindJNI.cmake ./config/cmake/H5cxx_config.h.in diff --git a/config/cmake/FindHDF5.cmake.in b/config/cmake/FindHDF5.cmake.in deleted file mode 100644 index fbc49f1..0000000 --- a/config/cmake/FindHDF5.cmake.in +++ /dev/null @@ -1,86 +0,0 @@ -# -# To be used by projects that make use of Cmakeified hdf5-@HDF5_PACKAGE_VERSION@ -# - -# -# Find the HDF5 includes and get all installed hdf5 library settings from -# HDF5-config.cmake file : Requires a CMake compatible hdf5-1.8.5 or later -# for this feature to work. The following vars are set if hdf5 is found. -# -# HDF5_FOUND - True if found, otherwise all other vars are undefined -# HDF5_INCLUDE_DIR - The include dir for main *.h files -# HDF5_FORTRAN_INCLUDE_DIR - The include dir for fortran modules and headers -# HDF5_VERSION_STRING - full version (e.g. @HDF5_PACKAGE_VERSION@) -# HDF5_VERSION_MAJOR - major part of version (e.g. @HDF5_PACKAGE_VERSION_MAJOR@) -# HDF5_VERSION_MINOR - minor part (e.g. @HDF5_PACKAGE_VERSION_MINOR@) -# -# The following boolean vars will be defined -# HDF5_ENABLE_PARALLEL - 1 if HDF5 parallel supported -# HDF5_BUILD_FORTRAN - 1 if HDF5 was compiled with fortran on -# HDF5_BUILD_CPP_LIB - 1 if HDF5 was compiled with cpp on -# HDF5_BUILD_TOOLS - 1 if HDF5 was compiled with tools on -# HDF5_BUILD_HL_LIB - 1 if HDF5 was compiled with high level on -# HDF5_BUILD_HL_CPP_LIB - 1 if HDF5 was compiled with high level and cpp on -# -# Target names that are valid (depending on enabled options) -# will be the following -# -# hdf5 : HDF5 C library -# hdf5_tools : the tools library -# hdf5_f90cstub : used by Fortran to C interface -# hdf5_fortran : Fortran HDF5 library -# hdf5_cpp : HDF5 cpp interface library -# hdf5_hl : High Level library -# hdf5_hl_f90cstub : used by Fortran to C interface to High Level library -# hdf5_hl_fortran : Fortran High Level library -# hdf5_hl_cpp : High Level cpp interface library -# -# To aid in finding HDF5 as part of a subproject set -# HDF5_ROOT_DIR_HINT to the location where @HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies - -include (SelectLibraryConfigurations) -include (FindPackageHandleStandardArgs) - -# The HINTS option should only be used for values computed from the system. -set (_HDF5_HINTS - $ENV{HOME}/.local - $ENV{HDF5_ROOT} - $ENV{HDF5_ROOT_DIR_HINT} -) -# Hard-coded guesses should still go in PATHS. This ensures that the user -# environment can always override hard guesses. -set (_HDF5_PATHS - $ENV{HOME}/.local - $ENV{HDF5_ROOT} - $ENV{HDF5_ROOT_DIR_HINT} - /usr/lib/@HDF5_PACKAGE@ - /usr/share/@HDF5_PACKAGE@ - /usr/local/@HDF5_PACKAGE@ - /usr/local/@HDF5_PACKAGE@/share -) - -FIND_PATH (HDF5_ROOT_DIR "@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake" - HINTS ${_HDF5_HINTS} - PATHS ${_HDF5_PATHS} - PATH_SUFFIXES - cmake/@HDF5_PACKAGE@ - lib/cmake/@HDF5_PACKAGE@ - share/cmake/@HDF5_PACKAGE@ -) - -FIND_PATH (HDF5_INCLUDE_DIRS "H5public.h" - HINTS ${_HDF5_HINTS} - PATHS ${_HDF5_PATHS} - PATH_SUFFIXES - include - Include -) - -# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of -# HDF5_INCLUDE_DIRS -set ( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) - -if (HDF5_INCLUDE_DIR) - set (HDF5_FOUND "YES") - include (${HDF5_ROOT_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) -endif (HDF5_INCLUDE_DIR) -- cgit v0.12 From 0d0c711e88a4032237554fc681a44255e8f78bd8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 4 Oct 2016 14:53:21 -0500 Subject: Update copyright to latest from kitware --- config/cmake/FindJNI.cmake | 18 ++++-------------- config/cmake/UseJava.cmake | 20 ++++---------------- config/cmake/UseJavaClassFilelist.cmake | 16 +++------------- config/cmake/UseJavaSymlinks.cmake | 16 +++------------- 4 files changed, 14 insertions(+), 56 deletions(-) diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake index 9105f3d..468b1304 100644 --- a/config/cmake/FindJNI.cmake +++ b/config/cmake/FindJNI.cmake @@ -1,3 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + #.rst: # FindJNI # ------- @@ -22,19 +25,6 @@ # JAVA_INCLUDE_PATH2 = the include path to jni_md.h # JAVA_AWT_INCLUDE_PATH = the include path to jawt.h -#============================================================================= -# Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - # Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} macro(java_append_library_directories _var) # Determine java arch-specific library subdir @@ -53,7 +43,7 @@ macro(java_append_library_directories _var) set(_java_libarch "alpha") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") # Subdir is "arm" for both big-endian (arm) and little-endian (armel). - set(_java_libarch "arm") + set(_java_libarch "arm" "aarch32") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") # mips* machines are bi-endian mostly so processor does not tell # endianess of the underlying system. diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 4f8e4c8..3ec2ddb 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -1,3 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + #.rst: # UseJava # ------- @@ -400,22 +403,7 @@ # Sets the directory where the header files will be generated. Same behavior as option # '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory. -#============================================================================= -# Copyright 2013 OpenGamma Ltd. -# Copyright 2010-2011 Andreas schneider -# Copyright 2010-2013 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -include(CMakeParseArguments) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) function (__java_copy_file src dest comment) add_custom_command( diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake index e8e6f01..c2f9afa 100644 --- a/config/cmake/UseJavaClassFilelist.cmake +++ b/config/cmake/UseJavaClassFilelist.cmake @@ -1,3 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + #.rst: # UseJavaClassFilelist # -------------------- @@ -10,19 +13,6 @@ # a jar file. This avoids including cmake files which get created in # the binary directory. -#============================================================================= -# Copyright 2010-2011 Andreas schneider -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - if (CMAKE_JAVA_CLASS_OUTPUT_PATH) if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake index 90ffdd5..358b9ef 100644 --- a/config/cmake/UseJavaSymlinks.cmake +++ b/config/cmake/UseJavaSymlinks.cmake @@ -1,3 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + #.rst: # UseJavaSymlinks # --------------- @@ -8,19 +11,6 @@ # # Helper script for UseJava.cmake -#============================================================================= -# Copyright 2010-2011 Andreas schneider -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) if (_JAVA_TARGET_OUTPUT_NAME) find_program(LN_EXECUTABLE -- cgit v0.12 From c6bc6dbbfb8147cba40f8b4d1fcc9795c2ac1abc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 4 Oct 2016 16:46:13 -0500 Subject: HDFFV-9961: Add GIT option to ext lib macros --- CMakeFilters.cmake | 2 ++ config/cmake_ext_mod/HDFLibMacros.cmake | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index bb0d238..b7aa77d 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -8,7 +8,9 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (ZLIB_URL ${ZLIB_GIT_URL} CACHE STRING "Path to zlib git repository") + set (ZLIB_BRANCH ${ZLIB_GIT_BRANCH}) set (SZIP_URL ${SZIP_GIT_URL} CACHE STRING "Path to szip git repository") + set (SZIP_BRANCH ${SZIP_GIT_BRANCH}) elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") set (ZLIB_URL ${ZLIB_SVN_URL} CACHE STRING "Path to zlib Subversion repository") set (SZIP_URL ${SZIP_SVN_URL} CACHE STRING "Path to szip Subversion repository") diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 3f91405..2145a3d 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -22,6 +22,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (JPEG GIT_REPOSITORY ${JPEG_URL} + GIT_TAG ${JPEG_BRANCH} INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -82,9 +83,9 @@ macro (PACKAGE_JPEG_LIBRARY compress_type) COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" ) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h) - if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (JPEG-GenHeader-Copy JPEG) - endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") endmacro (PACKAGE_JPEG_LIBRARY) #------------------------------------------------------------------------------- @@ -109,7 +110,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (SZIP GIT_REPOSITORY ${SZIP_URL} - # [SVN_REVISION rev] + GIT_TAG ${SZIP_BRANCH} INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -172,9 +173,9 @@ macro (PACKAGE_SZIP_LIBRARY compress_type) COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" ) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h) - if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (SZIP-GenHeader-Copy SZIP) - endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") endmacro (PACKAGE_SZIP_LIBRARY) #------------------------------------------------------------------------------- @@ -198,7 +199,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (ZLIB GIT_REPOSITORY ${ZLIB_URL} - # [SVN_REVISION rev] + GIT_TAG ${ZLIB_BRANCH} INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -264,7 +265,7 @@ macro (PACKAGE_ZLIB_LIBRARY compress_type) COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" ) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) - if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (ZLIB-GenHeader-Copy ZLIB) - endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") endmacro (PACKAGE_ZLIB_LIBRARY) -- cgit v0.12 From aee8233f162529abac7302649e7146c587605392 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 5 Oct 2016 15:49:26 -0500 Subject: Correct how include is used when located inside project --- config/cmake/UseJava.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 3ec2ddb..379dc7e 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -403,7 +403,7 @@ # Sets the directory where the header files will be generated. Same behavior as option # '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory. -include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) +include(CMakeParseArguments) function (__java_copy_file src dest comment) add_custom_command( -- cgit v0.12 From 7d6bea96abcc33e69b3735abfebeee4dec9c4093 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 5 Oct 2016 16:17:39 -0500 Subject: Fix cyclic depends due to typo --- hl/tools/gif2h5/CMakeTests.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 1dda0f5..8a52f50 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -26,17 +26,16 @@ add_test ( image.gif image24.gif ) -set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) -set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) +set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) -set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) +set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") -set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) +set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects) #add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") -- cgit v0.12 From d817b63020310b6f275a569529075551dd2b756e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 6 Oct 2016 13:52:55 -0500 Subject: Fix copyright to point to cmake --- config/cmake/FindJNI.cmake | 3 +-- config/cmake/UseJava.cmake | 3 +-- config/cmake/UseJavaClassFilelist.cmake | 3 +-- config/cmake/UseJavaSymlinks.cmake | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake index 468b1304..9d755fc 100644 --- a/config/cmake/FindJNI.cmake +++ b/config/cmake/FindJNI.cmake @@ -1,5 +1,4 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. +# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. #.rst: # FindJNI diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 379dc7e..6391c63 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -1,5 +1,4 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. +# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. #.rst: # UseJava diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake index c2f9afa..4420550 100644 --- a/config/cmake/UseJavaClassFilelist.cmake +++ b/config/cmake/UseJavaClassFilelist.cmake @@ -1,5 +1,4 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. +# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. #.rst: # UseJavaClassFilelist diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake index 358b9ef..cd73348 100644 --- a/config/cmake/UseJavaSymlinks.cmake +++ b/config/cmake/UseJavaSymlinks.cmake @@ -1,5 +1,4 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. +# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. #.rst: # UseJavaSymlinks -- cgit v0.12 From c7fc321a6d4448c59cb621c46968a5245b080fa1 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 7 Oct 2016 09:58:40 -0500 Subject: Removed unused H5T_NATIVE_INTEGER_# variables due to NAG fixes. HDFFV-9973 Fortran library fails to compile and fails tests with NAG compiler --- fortran/src/H5f90global.F90 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index aef3e4d..b84f6c2 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -85,11 +85,7 @@ MODULE H5GLOBAL ! integer data types are added INTEGER, PARAMETER :: INTEGER_TYPES_LEN = 27 - INTEGER(HID_T) :: H5T_NATIVE_INTEGER_1, & - H5T_NATIVE_INTEGER_2, & - H5T_NATIVE_INTEGER_4, & - H5T_NATIVE_INTEGER_8, & - H5T_NATIVE_REAL_C_FLOAT, & + INTEGER(HID_T) :: H5T_NATIVE_REAL_C_FLOAT, & H5T_NATIVE_REAL_C_DOUBLE, & H5T_NATIVE_REAL_C_LONG_DOUBLE, & H5T_NATIVE_INTEGER, & -- cgit v0.12