From 3c882637c2ca6b13337f3a32d92ea2bc9c068fde Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 5 Feb 2009 15:21:31 -0500 Subject: [svn-r16444] Description: Bring r16412:16440 from trunk into revise_chunks branch. Tested on: FreeBSD/32 6.3(duty) (h5committest not required on this branch) --- src/H5Goh.c | 6 +- src/H5O.c | 38 +++++++--- src/H5Oalloc.c | 139 +++++++++++++++++++++++++++++++++- src/H5Odbg.c | 17 ++++- test/h5test.h | 1 + test/ohdr.c | 101 +++++++++++++++++++++++- test/set_extent.c | 80 +++++++++++-------- test/tsohm.c | 4 +- tools/h5diff/h5diff_common.c | 2 +- tools/h5diff/testfiles/h5diff_10.txt | 2 +- tools/h5diff/testfiles/h5diff_600.txt | 2 +- tools/h5diff/testfiles/h5diff_603.txt | 2 +- tools/h5diff/testfiles/h5diff_604.txt | 2 +- tools/h5diff/testfiles/h5diff_605.txt | 2 +- tools/h5diff/testfiles/h5diff_606.txt | 2 +- tools/h5diff/testfiles/h5diff_612.txt | 2 +- tools/h5diff/testfiles/h5diff_613.txt | 2 +- tools/h5diff/testfiles/h5diff_614.txt | 2 +- tools/h5diff/testfiles/h5diff_615.txt | 2 +- tools/h5diff/testfiles/h5diff_621.txt | 2 +- tools/h5diff/testfiles/h5diff_622.txt | 2 +- tools/h5diff/testfiles/h5diff_623.txt | 2 +- tools/h5diff/testfiles/h5diff_624.txt | 2 +- windows/installhdf5lib.bat | 6 ++ 24 files changed, 349 insertions(+), 73 deletions(-) diff --git a/src/H5Goh.c b/src/H5Goh.c index aa0fbe6..d727cb7 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -110,9 +110,9 @@ H5O_group_isa(struct H5O_t *oh) /* Check for any of the messages that indicate a group */ if((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") if((linfo_exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") ret_value = (stab_exists > 0 || linfo_exists > 0); @@ -273,7 +273,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) /* Check for "new style" group info */ if((exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") if(exists > 0) { H5O_linfo_t linfo; /* Link info message */ diff --git a/src/H5O.c b/src/H5O.c index 5dfca1b..73c8e73 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1652,11 +1652,11 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) HGOTO_DONE(SUCCEED); /*nothing to do*/ /* Allocate space for the modification time message */ - if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now)) == UFAIL) + if(UFAIL == (idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message") /* Set the message's flags if appropriate */ - oh->mesg[idx].flags = mesg_flags; + oh->mesg[idx].flags = (uint8_t)mesg_flags; } /* end if */ /* Allocate 'native' space, if necessary */ @@ -1892,8 +1892,8 @@ done: * * Purpose: Retrieves the type of object pointed to by `loc'. * - * Return: Success: An object type defined in H5Gpublic.h - * Failure: H5G_UNKNOWN + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, November 4, 1998 @@ -1929,8 +1929,8 @@ done: * * Purpose: Returns the type of object pointed to by `oh'. * - * Return: Success: An object type defined in H5Opublic.h - * Failure: H5G_UNKNOWN + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Monday, November 21, 2005 @@ -2311,6 +2311,8 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o oinfo->btime = oh->btime; } /* end if */ else { + htri_t exists; /* Flag if header message of interest exists */ + /* No information for access & modification fields */ /* (we stopped updating the "modification time" header message for * raw data changes, so the "modification time" header message @@ -2321,13 +2323,25 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o oinfo->btime = 0; /* Might be information for modification time */ - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) { - H5E_clear_stack(NULL); - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) { - H5E_clear_stack(NULL); - oinfo->ctime = 0; - } /* end if */ + if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message") + if(exists > 0) { + /* Get "old style" modification time info */ + if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message") } /* end if */ + else { + /* Check for "new style" modification time info */ + if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message") + if(exists > 0) { + /* Get "new style" modification time info */ + if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message") + } /* end if */ + else + oinfo->ctime = 0; + } /* end else */ } /* end else */ /* Set the version for the object header */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 7c6cf9d..6d5d736 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -68,7 +68,8 @@ static htri_t H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, size_t size, unsigned * msg_idx); static unsigned H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size); -static htri_t H5O_move_msgs_forward(H5O_t *oh); +static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u, hid_t dxpl_id); +static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id); static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh, hid_t dxpl_id); static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id); static herr_t H5O_alloc_shrink_chunk(H5F_t *f, H5O_t *oh, hid_t dxpl_id, unsigned chunkno); @@ -1091,6 +1092,118 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_move_cont + * + * Purpose: Check and move message(s) forward into a continuation message + * + * Return: Success: non-negative (TRUE/FALSE) + * Failure: negative + * + * Programmer: Vailin Choi + * Feb. 2009 + * + *------------------------------------------------------------------------- + */ +static htri_t +H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u, hid_t dxpl_id) +{ + unsigned v; /* local index variable */ + H5O_mesg_t *cont_msg; /* pointer to the continuation message */ + H5O_mesg_t *nonnull_msg; /* pointer to the current message to operate on */ + H5O_mesg_t *null_msg; /* pointer to the current message to operate on */ + size_t total_size=0; /* total size of nonnull messages in the chunk pointed to by cont message */ + size_t move_size=0; /* size of the message to be moved */ + uint8_t *move_start, *move_end; /* pointers to area of messages to move */ + size_t gap_size; /* size of gap produced */ + unsigned deleted_chunkno; /* Chunk # to delete */ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5O_move_cont) + + /* Check arguments. */ + HDassert(f); + HDassert(oh); + + cont_msg = &oh->mesg[cont_u]; + H5O_LOAD_NATIVE(f, dxpl_id, 0, oh, cont_msg, FAIL) + deleted_chunkno = ((H5O_cont_t *)(cont_msg->native))->chunkno; + + /* proceed further only if continuation message is pointing to the last chunk */ + if(deleted_chunkno != (oh->nchunks - 1)) + HGOTO_DONE(FALSE) + + /* find size of all nonnull messages in the chunk pointed to by the continuation message */ + for(v = 0, nonnull_msg = &oh->mesg[0]; v < oh->nmesgs; v++, nonnull_msg++) + if(nonnull_msg->chunkno == deleted_chunkno && nonnull_msg->type->id != H5O_NULL_ID) { + HDassert(nonnull_msg->type->id != H5O_CONT_ID); + total_size += nonnull_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); + } + + /* check if messages can fit into the continuation message */ + if(total_size && total_size <= (cont_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh))) { + + /* convert continuation message into a null message */ + if(H5O_release_mesg(f, dxpl_id, oh, cont_msg, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") + + move_start = cont_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh); + move_end = cont_msg->raw + cont_msg->raw_size; + + /* move message(s) forward into continuation message */ + for(v = 0, nonnull_msg = &oh->mesg[0]; v < oh->nmesgs; v++, nonnull_msg++) + if(nonnull_msg->chunkno == deleted_chunkno && nonnull_msg->type->id != H5O_NULL_ID) { + move_size = nonnull_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); + HDmemcpy(move_start, nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size); + nonnull_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh); + nonnull_msg->chunkno = cont_msg->chunkno; + nonnull_msg->dirty = TRUE; + move_start += move_size; + } + + HDassert(move_start <= move_end); + + /* check if there is space remaining in the continuation message */ + /* the remaining space can be gap or a null message */ + gap_size = move_end - move_start; + if(gap_size >= (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) { + cont_msg->raw_size = gap_size - H5O_SIZEOF_MSGHDR_OH(oh); + cont_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh); + cont_msg->dirty = TRUE; + } else { + if(gap_size && (H5O_add_gap(oh, cont_msg->chunkno, cont_u, move_start, gap_size) < 0)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") + /* Release any information/memory for continuation message */ + H5O_msg_free_mesg(cont_msg); + if(cont_u < (oh->nmesgs - 1)) + HDmemmove(&oh->mesg[cont_u], &oh->mesg[cont_u + 1], ((oh->nmesgs - 1) - cont_u) * sizeof(H5O_mesg_t)); + oh->nmesgs--; + } + + /* remove all null messages in deleted chunk from list of messages */ + /* Note: unsigned v wrapping around at the end */ + for (v = oh->nmesgs - 1, null_msg = &oh->mesg[v]; v < oh->nmesgs; v--, null_msg--) + if(null_msg->type->id == H5O_NULL_ID && null_msg->chunkno == deleted_chunkno) { + + /* Release any information/memory for message */ + H5O_msg_free_mesg(null_msg); + + if(v < (oh->nmesgs - 1)) + HDmemmove(&oh->mesg[v], &oh->mesg[v + 1], ((oh->nmesgs - 1) - v) * sizeof(H5O_mesg_t)); + oh->nmesgs--; + } /* end if */ + + (void)H5FL_BLK_FREE(chunk_image, oh->chunk[deleted_chunkno].image); + + oh->nchunks--; + ret_value = TRUE; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5O_move_cont() */ + + +/*------------------------------------------------------------------------- * * Function: H5O_move_msgs_forward * @@ -1101,11 +1214,14 @@ done: * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Oct 17 2005 + * Modifications: + * Feb. 2009: Vailin Choi + * Add changes to move messages forward into "continuation" message * *------------------------------------------------------------------------- */ static htri_t -H5O_move_msgs_forward(H5O_t *oh) +H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id) { hbool_t packed_msg; /* Flag to indicate that messages were packed */ hbool_t did_packing = FALSE; /* Whether any messages were packed */ @@ -1182,7 +1298,17 @@ H5O_move_msgs_forward(H5O_t *oh) } /* end if */ else { H5O_mesg_t *null_msg; /* Pointer to current message to operate on */ - unsigned v; /* Local index variable */ + unsigned v; /* Local index variable */ + htri_t status; + + if(H5O_CONT_ID == curr_msg->type->id) { + if((status = H5O_move_cont(f, oh, u, dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message") + else if(status > 0) { /* message(s) got moved into "continuation" message */ + packed_msg = TRUE; + break; + } + } /* Loop over messages again, looking for large enough null message in earlier chunk */ for(v = 0, null_msg = &oh->mesg[0]; v < oh->nmesgs; v++, null_msg++) { @@ -1583,6 +1709,11 @@ done: * koziol@ncsa.uiuc.edu * Oct 4 2005 * + * Modifications: + * Feb. 2009: Vailin Choi + * Add 2 more parameters to H5O_move_msgs_forward() for moving + * messages forward into "continuation" message + * *------------------------------------------------------------------------- */ herr_t @@ -1603,7 +1734,7 @@ H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id) rescan_header = FALSE; /* Scan for messages that can be moved earlier in chunks */ - result = H5O_move_msgs_forward(oh); + result = H5O_move_msgs_forward(f, oh, dxpl_id); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward") if(result > 0) diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 8a8b783..cd041e0 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -270,12 +270,16 @@ done: * matzke@llnl.gov * Aug 6 1997 * + * Modifications: + * Feb. 2009: Vailin Choi + * Fixed bug in the accumulation of chunk_total + * Used the appropriate flag when printing creation order tracked/indexed *------------------------------------------------------------------------- */ herr_t H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth) { - size_t mesg_total = 0, chunk_total = 0; + size_t mesg_total = 0, chunk_total = 0, gap_total = 0; unsigned *sequence; unsigned i; /* Local index variable */ herr_t ret_value = SUCCEED; @@ -311,10 +315,10 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i /* Display object's status flags */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order tracked:", - (oh->flags & H5P_CRT_ORDER_TRACKED) ? "Yes" : "No"); + (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No"); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order indexed:", - (oh->flags & H5P_CRT_ORDER_INDEXED) ? "Yes" : "No"); + (oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No"); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute storage phase change values:", (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default"); @@ -392,6 +396,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i /* Accumulate chunk's size to total */ chunk_total += chunk_size; + gap_total += oh->chunk[i].gap; HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", @@ -412,6 +417,10 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i /* Accumulate message's size to total */ mesg_total += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; + /* For version 2 object header, add size of "OCHK" for continuation chunk */ + if (oh->mesg[i].type->id == H5O_CONT_ID) + mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); + HDfprintf(stream, "%*sMessage %d...\n", indent, "", i); /* check for bad message id */ @@ -501,7 +510,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i } /* end for */ sequence = (unsigned *)H5MM_xfree(sequence); - if(mesg_total != chunk_total) + if((mesg_total + gap_total) != chunk_total) HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: diff --git a/test/h5test.h b/test/h5test.h index dd3bb32..64d43cc 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -99,6 +99,7 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * the H5_FAILED() macro is invoked automatically when an API function fails. */ #define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} +#define TESTING2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);} #define PASSED() {puts(" PASSED");fflush(stdout);} #define H5_FAILED() {puts("*FAILED*");fflush(stdout);} #define H5_WARNING() {puts("*WARNING*");fflush(stdout);} diff --git a/test/ohdr.c b/test/ohdr.c index 2d4f057..905551d 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -43,6 +43,101 @@ const char *FILENAME[] = { */ #define FILE_BOGUS "tbogus.h5" +/* + * Verify that messages are moved forward into a "continuation message": + * Create an object header with several continuation chunks + * Remove a message in the last chunk + * The remaining message(s) in the last chunk should be moved forward into the continuation message + * The process will repeat when the continuation message is big enough to hold all the + * messages in the last chunk. + * Result: the number of chunks should be reduced + */ +static herr_t +test_cont(char *filename, hid_t fapl) +{ + hid_t file=-1; + H5F_t *f = NULL; + H5O_info_t oinfo; + H5O_loc_t oh_locA, oh_locB; + time_t time_new; + char *short_name = "T"; + char *long_name = "This is the message"; + size_t nchunks; + + TESTING("object header continuation block"); + + /* Create the file to operate on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + + HDmemset(&oh_locA, 0, sizeof(oh_locA)); + HDmemset(&oh_locB, 0, sizeof(oh_locB)); + + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) + FAIL_STACK_ERROR + + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0) + FAIL_STACK_ERROR + + time_new = 11111111; + + if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE) < 0) + FAIL_STACK_ERROR + + if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0) + FAIL_STACK_ERROR + nchunks = oinfo.hdr.nchunks; + + /* remove the 1st H5O_NAME_ID message */ + if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0) + FAIL_STACK_ERROR + + if (oinfo.hdr.nchunks >= nchunks) + TEST_ERROR + + if(H5O_close(&oh_locA) < 0) + FAIL_STACK_ERROR + if(H5O_close(&oh_locB) < 0) + FAIL_STACK_ERROR + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + return 0; + +error: + H5E_BEGIN_TRY { + H5O_close(&oh_locA); + H5O_close(&oh_locB); + H5Fclose (file); + } H5E_END_TRY; + return -1; +} /* test_cont() */ + /*------------------------------------------------------------------------- * Function: main @@ -84,12 +179,16 @@ main(void) /* Display info about testing */ if(b) HDputs("Using new file format:"); - else + else HDputs("Using default file format:"); /* Set the format to use for the file */ if (H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR + /* test on object continuation block */ + if (test_cont(filename, fapl) < 0) + FAIL_STACK_ERROR + /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR diff --git a/test/set_extent.c b/test/set_extent.c index e145cff..87ff91c 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -30,12 +30,16 @@ *------------------------------------------------------------------------- */ - -#define FILE_NAME1 "set_extent1.h5" -#define FILE_NAME2 "set_extent2.h5" -#define FILE_NAME3 "set_extent3.h5" -#define FILE_NAME4 "set_extent4.h5" -#define FILE_NAME5 "set_extent5.h5" +const char *FILENAME[] = { + "set_extent1", + "set_extent2", + "set_extent3", + "set_extent4", + "set_extent5", + NULL +}; + +#define NAME_BUF_SIZE 1024 #define EXT_FILE_NAME1 "ext1.bin" #define EXT_FILE_NAME2 "ext2.bin" @@ -102,7 +106,7 @@ int main( void ) /* Set the FAPL for the type of format */ if(new_format) { - puts("\nTesting with new file format:"); + puts("Testing with new file format:"); my_fapl = fapl2; } /* end if */ else { @@ -117,12 +121,9 @@ int main( void ) /* Close 2nd FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR + + h5_cleanup(FILENAME, fapl); - HDremove(FILE_NAME1); - HDremove(FILE_NAME2); - HDremove(FILE_NAME3); - HDremove(FILE_NAME4); - HDremove(FILE_NAME5); HDremove(EXT_FILE_NAME1); HDremove(EXT_FILE_NAME2); @@ -152,7 +153,7 @@ static int do_ranks( hid_t fapl ) hbool_t set_istore_k = 0; - TESTING("with fill value, no compression"); + TESTING2("with fill value, no compression"); do_fillvalue = 1; @@ -186,7 +187,7 @@ static int do_ranks( hid_t fapl ) PASSED(); - TESTING("no fill value, no compression"); + TESTING2("no fill value, no compression"); do_fillvalue = 0; @@ -207,7 +208,7 @@ static int do_ranks( hid_t fapl ) PASSED(); - TESTING("with fill value, with compression"); + TESTING2("with fill value, with compression"); #ifdef H5_HAVE_FILTER_DEFLATE @@ -245,7 +246,7 @@ static int do_ranks( hid_t fapl ) SKIPPED(); #endif - TESTING("no fill value, with compression"); + TESTING2("no fill value, with compression"); #ifdef H5_HAVE_FILTER_DEFLATE @@ -269,7 +270,7 @@ static int do_ranks( hid_t fapl ) SKIPPED(); #endif - TESTING("with non-default indexed storage B-tree"); + TESTING2("with non-default indexed storage B-tree"); do_fillvalue = 1; set_istore_k = 1; @@ -298,7 +299,7 @@ error: static int do_layouts( hid_t fapl ) { - TESTING("storage layout use"); + TESTING2("storage layout use"); if (test_layouts( H5D_COMPACT, fapl ) < 0) { @@ -348,6 +349,7 @@ static int test_rank1( hbool_t do_compress, int i; int fillvalue = 1; int comp_value; + char filename[NAME_BUF_SIZE]; if ( do_fill_value ) { @@ -381,7 +383,8 @@ static int test_rank1( hbool_t do_compress, } /* create a new file */ - if ((fid = H5Fcreate(FILE_NAME1, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { goto error; } @@ -602,7 +605,7 @@ static int test_rank1( hbool_t do_compress, goto error; } - if ((fid = H5Fopen( FILE_NAME1, H5F_ACC_RDWR, H5P_DEFAULT ))<0) + if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) { goto error; } @@ -882,6 +885,7 @@ static int test_rank2( hbool_t do_compress, int i, j; int fillvalue = 1; int comp_value; + char filename[NAME_BUF_SIZE]; if ( do_fill_value ) { @@ -916,17 +920,15 @@ static int test_rank2( hbool_t do_compress, } } + /* create a new file */ - if ((fid = H5Fcreate(FILE_NAME2, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { goto error; } - /* close property list */ - if(H5Pclose(fcpl) < 0) - { - goto error; - } + /* create the data space with unlimited dimensions. */ if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) @@ -1175,7 +1177,7 @@ static int test_rank2( hbool_t do_compress, goto error; } - if ((fid = H5Fopen( FILE_NAME2, H5F_ACC_RDWR, H5P_DEFAULT ))<0) + if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) { goto error; } @@ -1417,6 +1419,12 @@ static int test_rank2( hbool_t do_compress, goto error; } + /* close file creation property list */ + if(H5Pclose(fcpl) < 0) + { + goto error; + } + if (H5Fclose( fid ) < 0) { goto error; @@ -1474,6 +1482,7 @@ static int test_rank3( hbool_t do_compress, int i, j, k; int fillvalue = 1; int comp_value; + char filename[NAME_BUF_SIZE]; if ( do_fill_value ) { @@ -1512,7 +1521,8 @@ static int test_rank3( hbool_t do_compress, } /* create a new file */ - if ((fid = H5Fcreate(FILE_NAME3, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { goto error; } @@ -1752,7 +1762,7 @@ static int test_rank3( hbool_t do_compress, goto error; } - if ((fid = H5Fopen( FILE_NAME3, H5F_ACC_RDWR, H5P_DEFAULT ))<0) + if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) { goto error; } @@ -2051,6 +2061,7 @@ static int test_external( hid_t fapl ) int buf_ro[DIM0][DIM1]; /* original buffer for reading */ int i, j; int comp_value = 0; + char filename[NAME_BUF_SIZE]; hsize_t size; /* number of bytes reserved in the file for the data */ @@ -2069,10 +2080,11 @@ static int test_external( hid_t fapl ) } } - TESTING("external file use"); + TESTING2("external file use"); /* create a new file */ - if ((fid = H5Fcreate(FILE_NAME4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[3], fapl, filename, sizeof filename); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* modify dataset creation properties */ @@ -2383,7 +2395,8 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl ) hsize_t dims_r[RANK2]; /* read dimensions */ int buf_o[DIM0][DIM1]; int buf_r[DIM0][DIM1]; - int i, j; + int i, j; + char filename[NAME_BUF_SIZE]; for( i = 0; i < DIM0; i++ ) { @@ -2395,7 +2408,8 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl ) /* create a new file */ - if ((fid = H5Fcreate(FILE_NAME5, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[4], fapl, filename, sizeof filename); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { goto error; } diff --git a/test/tsohm.c b/test/tsohm.c index 47c087e..0516590 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -2348,8 +2348,10 @@ static void test_sohm_size2(int close_reopen) if((list_index_big.attrs1 - list_index_big.interleaved) >= (list_index_small.attrs1 - list_index_small.interleaved)) VERIFY(0, 1, "h5_get_file_size"); + + /* Give it some overhead (for checkin to move messages into continuation message) */ if((list_index_small.attrs1 - list_index_small.interleaved) > - (btree_index.attrs1 - btree_index.interleaved)) + ((btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED)) VERIFY(0, 1, "h5_get_file_size"); diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 3f2b8cf..547d910 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -372,7 +372,7 @@ void usage(void) printf(" The compare criteria is:\n"); printf(" 1) datasets: numerical array differences 2) groups: name string difference\n"); - printf(" 3) datatypes: the return value of H5Tequal 2) links: name string difference\n"); + printf(" 3) datatypes: the return value of H5Tequal 4) links: name string difference\n"); printf(" of the linked value\n"); printf("\n"); diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index 316f06c..38246d9 100644 --- a/tools/h5diff/testfiles/h5diff_10.txt +++ b/tools/h5diff/testfiles/h5diff_10.txt @@ -33,7 +33,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt index f6492cd..17af208 100644 --- a/tools/h5diff/testfiles/h5diff_600.txt +++ b/tools/h5diff/testfiles/h5diff_600.txt @@ -33,7 +33,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index b3a2d91..30fe246 100644 --- a/tools/h5diff/testfiles/h5diff_603.txt +++ b/tools/h5diff/testfiles/h5diff_603.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt index f76be67..9357b26 100644 --- a/tools/h5diff/testfiles/h5diff_604.txt +++ b/tools/h5diff/testfiles/h5diff_604.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt index 6a5d5cb..1c99713 100644 --- a/tools/h5diff/testfiles/h5diff_605.txt +++ b/tools/h5diff/testfiles/h5diff_605.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index 8338959..0567106 100644 --- a/tools/h5diff/testfiles/h5diff_606.txt +++ b/tools/h5diff/testfiles/h5diff_606.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index ae42501..505705b 100644 --- a/tools/h5diff/testfiles/h5diff_612.txt +++ b/tools/h5diff/testfiles/h5diff_612.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt index a5fbeff..1a89746 100644 --- a/tools/h5diff/testfiles/h5diff_613.txt +++ b/tools/h5diff/testfiles/h5diff_613.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt index d5716f6..ec12818 100644 --- a/tools/h5diff/testfiles/h5diff_614.txt +++ b/tools/h5diff/testfiles/h5diff_614.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index be344bb..8528c0e 100644 --- a/tools/h5diff/testfiles/h5diff_615.txt +++ b/tools/h5diff/testfiles/h5diff_615.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 082598e..96d6c3f 100644 --- a/tools/h5diff/testfiles/h5diff_621.txt +++ b/tools/h5diff/testfiles/h5diff_621.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 986b196..9dc3751 100644 --- a/tools/h5diff/testfiles/h5diff_622.txt +++ b/tools/h5diff/testfiles/h5diff_622.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index cba630e..a02f5ea 100644 --- a/tools/h5diff/testfiles/h5diff_623.txt +++ b/tools/h5diff/testfiles/h5diff_623.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index 3a5554f..396a007 100644 --- a/tools/h5diff/testfiles/h5diff_624.txt +++ b/tools/h5diff/testfiles/h5diff_624.txt @@ -34,7 +34,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] The compare criteria is: 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 2) links: name string difference + 3) datatypes: the return value of H5Tequal 4) links: name string difference of the linked value Return exit code: diff --git a/windows/installhdf5lib.bat b/windows/installhdf5lib.bat index 8ee5bb6..e10707b 100755 --- a/windows/installhdf5lib.bat +++ b/windows/installhdf5lib.bat @@ -78,14 +78,17 @@ rem Install C Libraries and Tools rem bin call :safe_copy hl\tools\gifconv\gif2h5\debug\gif2h5.exe hdf5lib\debug\bin call :safe_copy hl\tools\gifconv\h52gif\debug\h52gif.exe hdf5lib\debug\bin + call :safe_copy tools\h5copy\debug\h5copy.exe hdf5lib\debug\bin call :safe_copy tools\h5debug\debug\h5debug.exe hdf5lib\debug\bin call :safe_copy tools\h5diff\debug\h5diff.exe hdf5lib\debug\bin call :safe_copy tools\h5dump\debug\h5dump.exe hdf5lib\debug\bin call :safe_copy tools\h5import\debug\h5import.exe hdf5lib\debug\bin call :safe_copy tools\h5jam\debug\h5jam.exe hdf5lib\debug\bin call :safe_copy tools\h5ls\debug\h5ls.exe hdf5lib\debug\bin + call :safe_copy tools\h5mkgrp\debug\h5mkgrp.exe hdf5lib\debug\bin call :safe_copy tools\h5repack\debug\h5repack.exe hdf5lib\debug\bin call :safe_copy tools\h5repart\debug\h5repart.exe hdf5lib\debug\bin + call :safe_copy tools\h5stat\debug\h5stat.exe hdf5lib\debug\bin call :safe_copy tools\h5unjam\debug\h5unjam.exe hdf5lib\debug\bin rem bindll call :safe_copy hl\tools\gifconvdll\h52gifdll\debug\h52gifdll.exe hdf5lib\debug\bindll @@ -110,14 +113,17 @@ rem Install C Libraries and Tools rem bin call :safe_copy hl\tools\gifconv\gif2h5\release\gif2h5.exe hdf5lib\release\bin call :safe_copy hl\tools\gifconv\h52gif\release\h52gif.exe hdf5lib\release\bin + call :safe_copy tools\h5copy\release\h5copy.exe hdf5lib\release\bin call :safe_copy tools\h5debug\release\h5debug.exe hdf5lib\release\bin call :safe_copy tools\h5diff\release\h5diff.exe hdf5lib\release\bin call :safe_copy tools\h5dump\release\h5dump.exe hdf5lib\release\bin call :safe_copy tools\h5import\release\h5import.exe hdf5lib\release\bin call :safe_copy tools\h5jam\release\h5jam.exe hdf5lib\release\bin call :safe_copy tools\h5ls\release\h5ls.exe hdf5lib\release\bin + call :safe_copy tools\h5mkgrp\release\h5mkgrp.exe hdf5lib\release\bin call :safe_copy tools\h5repack\release\h5repack.exe hdf5lib\release\bin call :safe_copy tools\h5repart\release\h5repart.exe hdf5lib\release\bin + call :safe_copy tools\h5stat\release\h5stat.exe hdf5lib\release\bin call :safe_copy tools\h5unjam\release\h5unjam.exe hdf5lib\release\bin rem bindll call :safe_copy hl\tools\gifconvdll\h52gifdll\release\h52gifdll.exe hdf5lib\release\bindll -- cgit v0.12