[svn-r22563] HDFFV-8095: index order of links wrong

Create setters for indexing options in h5trav.c to be set before the obj table is created. 
Revert h5trav_print to remove now duplicated parameters.
Added test and testfiles.

Tested: local linux with cmake
This commit is contained in:
Allen Byrne 2012-07-12 10:38:44 -05:00
parent 4bba12dbee
commit b54b3fcf29
7 changed files with 44 additions and 6 deletions

View File

@ -1475,6 +1475,8 @@
./tools/testfiles/tcontents.ddl
./tools/testfiles/tordercontents1.ddl
./tools/testfiles/tordercontents2.ddl
./tools/testfiles/torderlinks1.ddl
./tools/testfiles/torderlinks2.ddl
./tools/testfiles/tfilters.h5
./tools/testfiles/tchunked.ddl
./tools/testfiles/tcompact.ddl
@ -1539,6 +1541,8 @@
./tools/h5dump/errfiles/textlinksrc.err
./tools/h5dump/errfiles/tgroup-2.err
./tools/h5dump/errfiles/tnofilename-with-packed-bits.err
./tools/h5dump/errfiles/orderlinks1.err
./tools/h5dump/errfiles/orderlinks2.err
./tools/h5dump/errfiles/tpbitsCharLengthExceeded.err
./tools/h5dump/errfiles/tpbitsCharOffsetExceeded.err
./tools/h5dump/errfiles/tpbitsIncomplete.err

View File

@ -152,6 +152,8 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/torderattr4.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tordercontents1.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tordercontents2.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/torderlinks1.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/torderlinks2.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tperror.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/treference.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ddl
@ -289,6 +291,8 @@ IF (BUILD_TESTING)
${PROJECT_SOURCE_DIR}/errfiles/textlink.err
${PROJECT_SOURCE_DIR}/errfiles/textlinkfar.err
${PROJECT_SOURCE_DIR}/errfiles/textlinksrc.err
${PROJECT_SOURCE_DIR}/errfiles/torderlinks1.err
${PROJECT_SOURCE_DIR}/errfiles/torderlinks2.err
${PROJECT_SOURCE_DIR}/errfiles/tgroup-2.err
${PROJECT_SOURCE_DIR}/errfiles/tperror.err
${PROJECT_SOURCE_DIR}/errfiles/tslink-D.err
@ -1436,6 +1440,10 @@ IF (BUILD_TESTING)
ADD_H5_TEST (torderattr3 0 --enable-error-stack -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
ADD_H5_TEST (torderattr4 0 --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5)
# tests for link references and order
ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5)
ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5)
# tests for floating point user defined printf format
ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5)

View File

@ -1464,6 +1464,9 @@ main(int argc, const char *argv[])
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
while(opt_ind < argc) {
fname = HDstrdup(argv[opt_ind++]);

View File

@ -1294,7 +1294,7 @@ dump_fcontents(hid_t fid)
}
/* print objects in the files */
h5trav_print(fid, sort_by, sort_order);
h5trav_print(fid);
HDfprintf(rawoutstream, " %s\n",END);
}

View File

@ -277,6 +277,8 @@ $SRC_H5DUMP_TESTFILES/torderattr3.ddl
$SRC_H5DUMP_TESTFILES/torderattr4.ddl
$SRC_H5DUMP_TESTFILES/tordercontents1.ddl
$SRC_H5DUMP_TESTFILES/tordercontents2.ddl
$SRC_H5DUMP_TESTFILES/torderlinks1.ddl
$SRC_H5DUMP_TESTFILES/torderlinks2.ddl
$SRC_H5DUMP_TESTFILES/tperror.ddl
$SRC_H5DUMP_TESTFILES/treference.ddl
$SRC_H5DUMP_TESTFILES/tsaf.ddl
@ -326,6 +328,8 @@ ${SRC_H5DUMP_ERRORFILES}/textlink.err
${SRC_H5DUMP_ERRORFILES}/textlinkfar.err
${SRC_H5DUMP_ERRORFILES}/textlinksrc.err
${SRC_H5DUMP_ERRORFILES}/tgroup-2.err
${SRC_H5DUMP_ERRORFILES}/torderlinks1.err
${SRC_H5DUMP_ERRORFILES}/torderlinks2.err
${SRC_H5DUMP_ERRORFILES}/tperror.err
${SRC_H5DUMP_ERRORFILES}/tqmarkfile.err
${SRC_H5DUMP_ERRORFILES}/tslink-D.err
@ -989,6 +993,10 @@ TOOLTEST torderattr2.ddl --enable-error-stack -H --sort_by=name --sort_order=des
TOOLTEST torderattr3.ddl --enable-error-stack -H --sort_by=creation_order --sort_order=ascending torderattr.h5
TOOLTEST torderattr4.ddl --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5
# tests for link references and order
TOOLTEST4 torderlinks1.ddl --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5
TOOLTEST4 torderlinks2.ddl --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5
# tests for floating point user defined printf format
TOOLTEST tfpformat.ddl --enable-error-stack -m %.7f tfpformat.h5

View File

@ -67,6 +67,23 @@ static void trav_table_addlink(trav_table_t *table,
static H5_index_t trav_index_by = H5_INDEX_NAME;
static H5_iter_order_t trav_index_order = H5_ITER_INC;
/*-------------------------------------------------------------------------
* Function: h5trav_set_index
*
* Purpose: Set indexing properties for the objects & links in the file
*
* Return: none
*
*-------------------------------------------------------------------------
*/
void
h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order)
{
trav_index_by = print_index_by;
trav_index_order = print_index_order;
}
/*-------------------------------------------------------------------------
* "h5trav info" public functions. used in h5diff
*-------------------------------------------------------------------------
@ -955,14 +972,11 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
*/
int
h5trav_print(hid_t fid, H5_index_t print_index_by, H5_iter_order_t print_index_order)
h5trav_print(hid_t fid)
{
trav_print_udata_t print_udata; /* User data for traversal */
trav_visitor_t print_visitor; /* Visitor structure for printing objects */
trav_index_by = print_index_by;
trav_index_order = print_index_order;
/* Init user data for printing */
print_udata.fid = fid;

View File

@ -131,6 +131,7 @@ extern "C" {
* "h5trav general" public functions
*-------------------------------------------------------------------------
*/
H5TOOLS_DLL void h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order);
H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name,
hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj,
h5trav_lnk_func_t visit_lnk, void *udata);
@ -158,7 +159,7 @@ H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt);
* "h5trav print" public functions
*-------------------------------------------------------------------------
*/
H5TOOLS_DLL int h5trav_print(hid_t fid, H5_index_t print_index_by, H5_iter_order_t print_index_order);
H5TOOLS_DLL int h5trav_print(hid_t fid);
#ifdef __cplusplus
}