diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/cache_common.c | 67 | ||||
-rw-r--r-- | test/cache_tagging.c | 3 | ||||
-rw-r--r-- | test/dsets.c | 32 | ||||
-rw-r--r-- | test/dtypes.c | 2 | ||||
-rw-r--r-- | test/mf.c | 8 | ||||
-rw-r--r-- | test/page_buffer.c | 23 | ||||
-rw-r--r-- | test/swmr_common.c | 24 | ||||
-rw-r--r-- | test/tfile.c | 9 | ||||
-rw-r--r-- | test/tmisc.c | 10 | ||||
-rw-r--r-- | test/trefer.c | 6 | ||||
-rw-r--r-- | test/tselect.c | 3 | ||||
-rw-r--r-- | test/use_common.c | 38 | ||||
-rw-r--r-- | test/use_disable_mdc_flushes.c | 21 | ||||
-rw-r--r-- | test/vds_swmr.h | 24 | ||||
-rw-r--r-- | test/vds_swmr_gen.c | 6 | ||||
-rw-r--r-- | test/vds_swmr_reader.c | 6 |
16 files changed, 144 insertions, 138 deletions
diff --git a/test/cache_common.c b/test/cache_common.c index f977c3c..038a0ed 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -17,6 +17,7 @@ * This file contains common code for tests of the cache * implemented in H5C.c */ +#include "H5private.h" #include "H5CXprivate.h" /* API Contexts */ #include "H5MMprivate.h" @@ -553,7 +554,7 @@ addr_to_type_and_index(haddr_t addr, *------------------------------------------------------------------------- */ static herr_t -get_initial_load_size(void *udata, size_t *image_length, int32_t entry_type) +get_initial_load_size(void *udata, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -663,7 +664,7 @@ notify_get_initial_load_size(void *udata, size_t *image_length) */ static herr_t get_final_load_size(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED image_len, - void *udata, size_t *actual_len, int32_t entry_type) + void *udata, size_t *actual_len, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -723,7 +724,8 @@ variable_get_final_load_size(const void *image, size_t image_len, */ static htri_t -verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata, int32_t entry_type) +verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata, + int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -776,8 +778,8 @@ variable_verify_chksum(const void *image, size_t len, void *udata) *------------------------------------------------------------------------- */ static void * -deserialize(const void *image, size_t len, void *udata, hbool_t *dirty, - int32_t entry_type) +deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *udata, hbool_t *dirty, + int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -933,12 +935,10 @@ notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty) *------------------------------------------------------------------------- */ herr_t -image_len(const void *thing, size_t *image_length, int32_t entry_type) +image_len(const void *thing, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { const test_entry_t *entry; - test_entry_t *base_addr; int32_t type; - int32_t idx; HDassert(thing); HDassert(image_length); @@ -948,14 +948,12 @@ image_len(const void *thing, size_t *image_length, int32_t entry_type) HDassert(entry->self == entry); type = entry->type; - idx = entry->index; HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES)); HDassert(type == entry_type); - HDassert((idx >= 0) && (idx <= max_indices[type])); + HDassert((entry->index >= 0) && (entry->index <= max_indices[type])); - base_addr = entries[type]; - HDassert(entry == &(base_addr[idx])); + HDassert(entry == &(entries[type][entry->index])); if(type != VARIABLE_ENTRY_TYPE) HDassert(entry->size == entry_sizes[type]); @@ -1055,18 +1053,15 @@ notify_image_len(const void *thing, size_t *image_length) *------------------------------------------------------------------------- */ herr_t -pre_serialize(H5F_t *f, +pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *thing, - haddr_t addr, - size_t len, + haddr_t H5_ATTR_NDEBUG_UNUSED addr, + size_t H5_ATTR_NDEBUG_UNUSED len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr) { test_entry_t *entry; - test_entry_t *base_addr; - int32_t type; - int32_t idx; int32_t i; HDassert(f); @@ -1086,16 +1081,9 @@ pre_serialize(H5F_t *f, /* shouldn't serialize the entry unless it is dirty */ HDassert(entry->is_dirty); - - type = entry->type; - idx = entry->index; - - HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES)); - HDassert((idx >= 0) && (idx <= max_indices[type])); - - base_addr = entries[type]; - - HDassert(entry == &(base_addr[idx])); + HDassert((entry->type >= 0) && (entry->type < NUMBER_OF_ENTRY_TYPES)); + HDassert((entry->index >= 0) && (entry->index <= max_indices[entry->type])); + HDassert(entry == &(entries[entry->type][entry->index])); HDassert(entry->num_flush_ops >= 0); HDassert(entry->num_flush_ops < MAX_FLUSH_OPS); @@ -1307,9 +1295,7 @@ herr_t serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing) { test_entry_t *entry; - test_entry_t *base_addr; int32_t type; - int32_t idx; HDassert(image_ptr); HDassert(thing); @@ -1323,14 +1309,11 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin HDassert(entry->is_dirty); type = entry->type; - idx = entry->index; HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES)); - HDassert((idx >= 0) && (idx <= max_indices[type])); + HDassert((entry->index >= 0) && (entry->index <= max_indices[type])); - base_addr = entries[type]; - - HDassert(entry == &(base_addr[idx])); + HDassert(entry == &(entries[type][entry->index])); HDassert(entry->num_flush_ops >= 0); HDassert(entry->num_flush_ops < MAX_FLUSH_OPS); @@ -1461,21 +1444,19 @@ notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, *------------------------------------------------------------------------- */ static herr_t -notify(H5C_notify_action_t action, void *thing, int32_t entry_type) +notify(H5C_notify_action_t action, void *thing, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; - test_entry_t *base_addr; HDassert(thing); entry = (test_entry_t *)thing; - base_addr = entries[entry->type]; HDassert(entry->index >= 0); HDassert(entry->index <= max_indices[entry->type]); HDassert((entry->type >= 0) && (entry->type < NUMBER_OF_ENTRY_TYPES)); HDassert(entry->type == entry_type); - HDassert(entry == &(base_addr[entry->index])); + HDassert(entry == &(entries[entry->type][entry->index])); HDassert(entry == entry->self); if(!(action == H5C_NOTIFY_ACTION_ENTRY_DIRTIED && entry->action == TEST_ENTRY_ACTION_MOVE)) HDassert(entry->header.addr == entry->addr); @@ -1540,18 +1521,14 @@ notify_notify(H5C_notify_action_t action, void *thing) *------------------------------------------------------------------------- */ herr_t -free_icr(test_entry_t *entry, int32_t entry_type) +free_icr(test_entry_t *entry, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { - test_entry_t *base_addr; - HDassert(entry); - base_addr = entries[entry->type]; - HDassert(entry->type == entry_type); HDassert(entry->index >= 0); HDassert(entry->index <= max_indices[entry->type]); - HDassert(entry == &(base_addr[entry->index])); + HDassert(entry == &(entries[entry->type][entry->index])); HDassert(entry == entry->self); HDassert(entry->cache_ptr != NULL); HDassert(entry->cache_ptr->magic == H5C__H5C_T_MAGIC); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 564e5bc..cf0cd8d 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3900,9 +3900,10 @@ check_invalid_tag_application(void) #if H5C_DO_TAGGING_SANITY_CHECKS error: if(api_ctx_pushed) H5CX_pop(); -#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 1; +#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ + } /* check_invalid_tag_application */ diff --git a/test/dsets.c b/test/dsets.c index 82766bf..8f89d82 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -7165,8 +7165,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i=0; i<NPOINTS; i++){ - chunk_row = (int)(ofs / cols); - chunk_col = (int)(ofs % cols); + H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long); + H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7286,14 +7286,14 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) for(j = 0; j < nsize[1] / csize[1]; j++) check2[i][j] = 0; - rows = (long)(nsize[0] / csize[0]); - cols = (long)(nsize[1] / csize[1]); + H5_CHECKED_ASSIGN(rows, int, nsize[0] / csize[0], long); + H5_CHECKED_ASSIGN(cols, int, nsize[1] / csize[1], long); make_random_offset_and_increment(rows * cols, &ofs, &inc); /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = (int)(ofs / cols); - chunk_col = (int)(ofs % cols); + H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long); + H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7402,8 +7402,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = (int)(ofs / cols); - chunk_col = (int)(ofs % cols); + H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long); + H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7551,10 +7551,10 @@ static herr_t test_deprec(hid_t file) { hid_t dataset, space, small_space, create_parms, dcpl; - hsize_t dims[2], small_dims[2]; - hsize_t deprec_size; - herr_t status; - hsize_t csize[2]; + hsize_t dims[2], small_dims[2]; + hsize_t deprec_size; + herr_t H5_ATTR_NDEBUG_UNUSED status; + hsize_t csize[2]; TESTING("deprecated API routines"); @@ -9524,8 +9524,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS; i++){ - chunk_row = (int)(ofs / cols); - chunk_col = (int)(ofs % cols); + H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long); + H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks[chunk_row][chunk_col]); @@ -9653,8 +9653,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS_BIG; i++){ - chunk_row = (int)(ofs / cols); - chunk_col = (int)(ofs % cols); + H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long); + H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks_big[chunk_row][chunk_col]); diff --git a/test/dtypes.c b/test/dtypes.c index b88e5b7..4805b0b 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6732,7 +6732,7 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl, hid_t my_fapl; /* Copy of file access property list ID */ hid_t dcpl; /* Dataset creation property list ID */ unsigned use_at_least_v18;/* Whether to use old or new format */ - herr_t status; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic return value */ /* Make copy of FAPL */ my_fapl = H5Pcopy(fapl); @@ -7528,7 +7528,7 @@ error: *------------------------------------------------------------------------- */ static int -set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) +set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t is_multi_or_split) { H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl_arr[H5FD_MEM_NTYPES]; @@ -7537,7 +7537,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) hbool_t relax; H5FD_mem_t mt; - HDassert(multi || split); + HDassert(is_multi_or_split); HDmemset(memb_name, 0, sizeof memb_name); @@ -7545,7 +7545,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0) TEST_ERROR - if(split) { + if(is_multi_or_split) { /* Set memb_addr aligned */ memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + pagesize - 1) / pagesize) * pagesize; memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; @@ -7614,7 +7614,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR if(multi || split) - if(set_multi_split(fapl_new, 4096, multi, split) < 0) + if(set_multi_split(fapl_new, 4096, split) < 0) TEST_ERROR; /* Test with TRUE or FALSE for persisting free-space */ diff --git a/test/page_buffer.c b/test/page_buffer.c index 5313c9b..21ffbf5 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -38,23 +38,25 @@ #define FILENAME_LEN 1024 + +/* test routines */ +#ifdef H5_HAVE_PARALLEL +static unsigned verify_page_buffering_disabled(hid_t orig_fapl, + const char *env_h5_drvr); +#else #define NUM_DSETS 5 #define NX 100 #define NY 50 -/* helper routines */ -static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); -static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size); - -/* test routines */ static unsigned test_args(hid_t fapl, const char *env_h5_drvr); static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr); static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr); static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr); static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr); -#ifdef H5_HAVE_PARALLEL -static unsigned verify_page_buffering_disabled(hid_t orig_fapl, - const char *env_h5_drvr); + +/* helper routines */ +static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); +static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size); #endif /* H5_HAVE_PARALLEL */ const char *FILENAME[] = { @@ -62,6 +64,7 @@ const char *FILENAME[] = { NULL }; +#ifndef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: create_file() @@ -296,6 +299,7 @@ error: } H5E_END_TRY; return 1; } +#endif /* H5_HAVE_PARALLEL */ /* * @@ -357,6 +361,7 @@ error: } /* set_multi_split() */ +#ifndef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: test_args() @@ -379,6 +384,7 @@ error: * *------------------------------------------------------------------------- */ + static unsigned test_args(hid_t orig_fapl, const char *env_h5_drvr) { @@ -2002,6 +2008,7 @@ error: return 1; } /* test_stats_collection */ +#endif /* #ifndef H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- diff --git a/test/swmr_common.c b/test/swmr_common.c index b323769..925dc33 100644 --- a/test/swmr_common.c +++ b/test/swmr_common.c @@ -26,7 +26,8 @@ #include "h5test.h" #include "swmr_common.h" - +#include "vds_swmr.h" + /*******************/ /* Local Variables */ /*******************/ @@ -73,6 +74,27 @@ unsigned symbol_count[NLEVELS] = {100, 200, 400, 800, 1600}; /* Array of dataset information entries (1 per dataset) */ symbol_info_t *symbol_info[NLEVELS]; +hsize_t PLANES[N_SOURCES][RANK] = { + {1, SM_HEIGHT, WIDTH}, + {1, LG_HEIGHT, WIDTH}, + {1, SM_HEIGHT, WIDTH}, + {1, LG_HEIGHT, WIDTH}, + {1, SM_HEIGHT, WIDTH}, + {1, LG_HEIGHT, WIDTH} +}; + +char FILE_NAMES[N_SOURCES][NAME_LEN] = { + {"vds_swmr_src_a.h5"}, + {"vds_swmr_src_b.h5"}, + {"vds_swmr_src_c.h5"}, + {"vds_swmr_src_d.h5"}, + {"vds_swmr_src_e.h5"}, + {"vds_swmr_src_f.h5"} +}; + +char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; +char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; +char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /*------------------------------------------------------------------------- * Function: choose_dataset diff --git a/test/tfile.c b/test/tfile.c index 2752282..663556c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -25,6 +25,7 @@ #include "H5Iprivate.h" #include "H5Pprivate.h" #include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5private.h" /* * This file needs to access private information from the H5F package. @@ -4208,7 +4209,7 @@ test_filespace_info(const char *env_h5_drvr) ** *****************************************************************/ static int -set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) +set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t split) { H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl_arr[H5FD_MEM_NTYPES]; @@ -4217,7 +4218,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) hbool_t relax; H5FD_mem_t mt; - HDassert(split || multi); + HDassert(split); HDmemset(memb_name, 0, sizeof memb_name); @@ -4308,7 +4309,7 @@ test_file_freespace(const char *env_h5_drvr) my_fapl = new_fapl; if(multi_vfd || split_vfd) { - ret = set_multi_split(new_fapl, FSP_SIZE_DEF, multi_vfd, split_vfd); + ret = set_multi_split(new_fapl, FSP_SIZE_DEF, split_vfd); CHECK(ret, FAIL, "set_multi_split"); } @@ -4474,7 +4475,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) /* Set up paged aligned address space for multi/split driver */ if(multi_vfd || split_vfd) { - ret = set_multi_split(fapl, FSP_SIZE_DEF, multi_vfd, split_vfd); + ret = set_multi_split(fapl, FSP_SIZE_DEF, split_vfd); CHECK(ret, FAIL, "set_multi_split"); } diff --git a/test/tmisc.c b/test/tmisc.c index 7b7f5ba..0ea9c4c 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -128,15 +128,19 @@ typedef struct /* Definitions for misc. test #8 */ #define MISC8_FILE "tmisc8.h5" #define MISC8_DSETNAME1 "Dataset1" -#define MISC8_DSETNAME2 "Dataset2" -#define MISC8_DSETNAME3 "Dataset3" #define MISC8_DSETNAME4 "Dataset4" #define MISC8_DSETNAME5 "Dataset5" +#define MISC8_DSETNAME8 "Dataset8" + +#ifndef H5_HAVE_PARALLEL +#define MISC8_DSETNAME2 "Dataset2" +#define MISC8_DSETNAME3 "Dataset3" #define MISC8_DSETNAME6 "Dataset6" #define MISC8_DSETNAME7 "Dataset7" -#define MISC8_DSETNAME8 "Dataset8" #define MISC8_DSETNAME9 "Dataset9" #define MISC8_DSETNAME10 "Dataset10" +#endif + #define MISC8_RANK 2 #define MISC8_DIM0 50 #define MISC8_DIM1 50 diff --git a/test/trefer.c b/test/trefer.c index 441b7aa..fe237d7 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -566,8 +566,8 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t *coords; /* Coordinate buffer */ hsize_t low[SPACE2_RANK]; /* Selection bounds */ hsize_t high[SPACE2_RANK]; /* Selection bounds */ - H5R_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ + H5R_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ @@ -580,7 +580,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hid_t dset_NA; /* Dataset id for undefined reference */ hid_t space_NA; /* Dataspace id for undefined reference */ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ - H5R_ref_t rdata_NA[1]; /* Read buffer */ + H5R_ref_t rdata_NA[1]; /* Read buffer */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataset Region Reference Functions\n")); diff --git a/test/tselect.c b/test/tselect.c index 27bc36b..390f61f 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -25,7 +25,6 @@ #define H5S_TESTING #include "testhdf5.h" -#include "hdf5.h" #include "H5Spkg.h" /* Dataspaces */ #define FILENAME "tselect.h5" @@ -1613,7 +1612,7 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) ****************************************************************/ static void verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, - size_t cube_size, unsigned edge_size, unsigned cube_rank) + size_t H5_ATTR_NDEBUG_UNUSED cube_size, unsigned edge_size, unsigned cube_rank) { const uint16_t *cube_ptr; /* Pointer into the cube buffer */ uint16_t expected_value; /* Expected value in dataset */ diff --git a/test/use_common.c b/test/use_common.c index 9effa06..4111b24 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -343,44 +343,45 @@ int write_uc_file(hbool_t tosend, hid_t fid) count[1]=dims[1]; count[2]=dims[2]; for (i=0; i<UC_opts.nplanes; i++){ - /* fill buffer with value i+1 */ - bufptr = buffer; - for (j=0; j<dims[1]; j++) - for (k=0; k<dims[2]; k++) - *bufptr++ = (UC_CTYPE)i; + /* fill buffer with value i+1 */ + bufptr = buffer; + for (j=0; j<dims[1]; j++) + for (k=0; k<dims[2]; k++) + *bufptr++ = (UC_CTYPE)i; /* Cork the dataset's metadata in the cache, if SWMR is enabled */ - if(UC_opts.use_swmr) + if(UC_opts.use_swmr) { if(H5Odisable_mdc_flushes(dsid) < 0) { HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n"); return -1; } + } - /* extend the dataset by one for new plane */ - dims[0]=i+1; + /* extend the dataset by one for new plane */ + dims[0]=i+1; if(H5Dset_extent(dsid, dims) < 0){ HDfprintf(stderr, "H5Dset_extent failed\n"); return -1; - } + } /* Get the dataset's dataspace */ if((f_sid = H5Dget_space(dsid)) < 0){ HDfprintf(stderr, "H5Dset_extent failed\n"); return -1; - } + } - start[0]=i; + start[0]=i; /* Choose the next plane to write */ if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){ HDfprintf(stderr, "Failed H5Sselect_hyperslab\n"); return -1; - } + } /* Write plane to the dataset */ if(H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){ HDfprintf(stderr, "Failed H5Dwrite\n"); return -1; - } + } /* Uncork the dataset's metadata from the cache, if SWMR is enabled */ if(UC_opts.use_swmr) @@ -389,12 +390,11 @@ int write_uc_file(hbool_t tosend, hid_t fid) return -1; } - /* flush file to make the just written plane available. */ - if(H5Dflush(dsid) < 0) - { - HDfprintf(stderr, "Failed to H5Fflush file\n"); - return -1; - } + /* flush file to make the just written plane available. */ + if(H5Dflush(dsid) < 0) { + HDfprintf(stderr, "Failed to H5Fflush file\n"); + return -1; + } } /* Done writing. Free/Close all resources including data file */ diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index 9cd202c..32a8244 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -108,7 +108,7 @@ parse_option(int argc, char * const argv[]) filename_g = optarg; break; case 'n': /* number of planes to write/read */ - if ((nplanes_g = HDatoi(optarg)) <= 0){ + if ((nplanes_g = (hsize_t)HDatoi(optarg)) <= 0){ HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); @@ -193,17 +193,17 @@ setup_parameters(int argc, char * const argv[]) return(-1); } /* set chunk dims */ - chunkdims_g[0] = chunkplanes_g; - chunkdims_g[1]= chunkdims_g[2] = chunksize_g; + chunkdims_g[0] = (hsize_t)chunkplanes_g; + chunkdims_g[1]= chunkdims_g[2] = (hsize_t)chunksize_g; /* set dataset initial and max dims */ dims_g[0] = 0; max_dims_g[0] = H5S_UNLIMITED; - dims_g[1] = dims_g[2] = max_dims_g[1] = max_dims_g[2] = chunksize_g; + dims_g[1] = dims_g[2] = max_dims_g[1] = max_dims_g[2] = (hsize_t)chunksize_g; /* set nplanes */ if (nplanes_g == 0) - nplanes_g = chunksize_g; + nplanes_g = (hsize_t)chunksize_g; /* show parameters and return */ show_parameters(); @@ -299,7 +299,7 @@ write_file(void) hid_t dcpl; /* Dataset creation property list */ char *name; UC_CTYPE *buffer, *bufptr; /* data buffer */ - hsize_t cz=chunksize_g; /* Chunk size */ + hsize_t cz=(hsize_t)chunksize_g; /* Chunk size */ hid_t f_sid; /* dataset file space id */ hid_t m_sid; /* memory space id */ int rank; /* rank */ @@ -413,8 +413,13 @@ write_file(void) /* fill buffer with value i+1 */ bufptr = buffer; for (j=0; j<dims[1]; j++) - for (k=0; k<dims[2]; k++) - *bufptr++ = i; + for (k=0; k<dims[2]; k++) { + if(i > SHRT_MAX) { + HDfprintf(stderr, "rank(%d) of dataset overflow\n", rank); + return -1; + } + *bufptr++ = (short)i; + } /* extend the dataset by one for new plane */ dims[0]=i+1; diff --git a/test/vds_swmr.h b/test/vds_swmr.h index eb2dcf4..edb01bc 100644 --- a/test/vds_swmr.h +++ b/test/vds_swmr.h @@ -84,31 +84,17 @@ #define N_PLANES_TO_WRITE 25 /* Planes */ -static hsize_t PLANES[N_SOURCES][RANK] = { - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH}, - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH}, - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH} -}; +H5TEST_DLLVAR hsize_t PLANES[N_SOURCES][RANK]; /* File names for source datasets */ -static char FILE_NAMES[N_SOURCES][NAME_LEN] = { - {"vds_swmr_src_a.h5"}, - {"vds_swmr_src_b.h5"}, - {"vds_swmr_src_c.h5"}, - {"vds_swmr_src_d.h5"}, - {"vds_swmr_src_e.h5"}, - {"vds_swmr_src_f.h5"} -}; +H5TEST_DLLVAR char FILE_NAMES[N_SOURCES][NAME_LEN]; /* VDS file name */ -static char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; +H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN]; /* Dataset names */ -static char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; -static char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; +H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN]; +H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN]; /* Fill values */ #endif /* VDS_SWMR_H */ diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c index 2589653..b14ecc2 100644 --- a/test/vds_swmr_gen.c +++ b/test/vds_swmr_gen.c @@ -145,11 +145,13 @@ main(void) if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, MAX_DIMS[i], NULL) < 0) TEST_ERROR - start[1] = map_start; + start[1] = (hsize_t)map_start; if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL, MAX_DIMS[i], NULL) < 0) TEST_ERROR - map_start += PLANES[i][1]; + if(PLANES[i][1] > INT_MAX) + TEST_ERROR + map_start += (int)PLANES[i][1]; /* Add VDS mapping */ if(H5Pset_virtual(vds_dcplid, vds_sid, FILE_NAMES[i], diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index eb9a82b..1ee65a0 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -45,8 +45,10 @@ main(void) TEST_ERROR /* Create the read buffer */ - n_elements = VDS_PLANE[1] * VDS_PLANE[2]; - size = n_elements * sizeof(int); + if(VDS_PLANE[1] * VDS_PLANE[2] > INT_MAX) + TEST_ERROR + n_elements = (int)(VDS_PLANE[1] * VDS_PLANE[2]); + size = (size_t)n_elements * sizeof(int); if(NULL == (buffer = (int *)HDmalloc(size))) TEST_ERROR |