diff options
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tools/h5dump/CMakeTests.cmake | 20 | ||||
-rw-r--r-- | tools/h5dump/binread.c | 66 | ||||
-rw-r--r-- | tools/h5dump/h5dump_xml.c | 2 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 17 |
5 files changed, 52 insertions, 59 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 4559ae3..7658c04 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -15,7 +15,7 @@ add_executable (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) TARGET_NAMING (h5dump ${LIB_TYPE}) -TARGET_C_PROPERTIES (h5dump " " " ") +TARGET_C_PROPERTIES (h5dump ${LIB_TYPE} " " " ") target_link_libraries (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dump PROPERTIES FOLDER tools) @@ -27,8 +27,8 @@ if (BUILD_TESTING) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) add_executable (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - TARGET_NAMING (h5dumpgentest ${LIB_TYPE}) - TARGET_C_PROPERTIES (h5dumpgentest " " " ") + TARGET_NAMING (h5dumpgentest STATIC) + TARGET_C_PROPERTIES (h5dumpgentest STATIC " " " ") target_link_libraries (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index afb482e..00ec760 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -1340,30 +1340,14 @@ set (USE_FILTER_SZIP "true") endif (H5_HAVE_FILTER_SZIP) - if (H5_HAVE_FILTER_SHUFFLE) - set (USE_FILTER_SHUFFLE "true") - endif (H5_HAVE_FILTER_SHUFFLE) - - if (H5_HAVE_FILTER_FLETCHER32) - set (USE_FILTER_FLETCHER32 "true") - endif (H5_HAVE_FILTER_FLETCHER32) - - if (H5_HAVE_FILTER_NBIT) - set (USE_FILTER_NBIT "true") - endif (H5_HAVE_FILTER_NBIT) - - if (H5_HAVE_FILTER_SCALEOFFSET) - set (USE_FILTER_SCALEOFFSET "true") - endif (H5_HAVE_FILTER_SCALEOFFSET) - - if (USE_FILTER_DEFLATE AND USE_FILTER_SHUFFLE AND USE_FILTER_FLETCHER32 AND USE_FILTER_NBIT AND USE_FILTER_SCALEOFFSET) + if (USE_FILTER_DEFLATE) # data read internal filters ADD_H5_TEST (treadintfilter 0 --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5) if (HDF5_ENABLE_SZIP_SUPPORT) # data read all filters ADD_H5_TEST (treadfilter 0 --enable-error-stack -d all -d szip tfilters.h5) endif (HDF5_ENABLE_SZIP_SUPPORT) - endif (USE_FILTER_DEFLATE AND USE_FILTER_SHUFFLE AND USE_FILTER_FLETCHER32 AND USE_FILTER_NBIT AND USE_FILTER_SCALEOFFSET) + endif (USE_FILTER_DEFLATE) # test for displaying objects with very long names ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) diff --git a/tools/h5dump/binread.c b/tools/h5dump/binread.c index 5abb9af..74db92c 100644 --- a/tools/h5dump/binread.c +++ b/tools/h5dump/binread.c @@ -49,8 +49,7 @@ static void usage (void) { - fprintf(stderr, "\ - usage: binread FILE_NAME\n"); + fprintf(stderr, "usage: binread FILE_NAME\n"); } /*------------------------------------------------------------------------- @@ -64,38 +63,35 @@ usage (void) int main (int argc, const char *argv[]) { - FILE *stream; - int numread; - TYPE buf[NELMTS]; - size_t i, nelmts = NELMTS; - char *fname=NULL; - - if (argc != 2) - { - usage(); - exit(1); - } - - fname = strdup(argv[1]); - - if( (stream = fopen(fname, "rb" )) != NULL ) - { - numread = fread( buf, sizeof( TYPE ), nelmts, stream ); - printf( "Number of items read = %d\n", numread ); - - for (i = 0; i < nelmts; i++) - { - printf(FORMAT,buf[i]); - } - printf("\n"); - - fclose( stream ); - } - else - printf( "File %s could not be opened\n",fname ); - - free(fname); - - return 0; + FILE *stream; + size_t numread; + TYPE buf[NELMTS]; + size_t i, nelmts = NELMTS; + char *fname=NULL; + + if (argc != 2) { + usage(); + exit(1); + } + + fname = strdup(argv[1]); + + if((stream = fopen(fname, "rb")) != NULL) { + numread = fread(buf, sizeof( TYPE ), nelmts, stream); + printf("Number of items read = %llu\n", (unsigned long long)numread); + + for (i = 0; i < nelmts; i++) { + printf(FORMAT,buf[i]); + } + printf("\n"); + + fclose(stream); + } + else + printf("File %s could not be opened\n", fname); + + free(fname); + + return 0; } diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 64667cb..6ccbc8c 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -3563,7 +3563,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "\"%f\"", *(float *) buf); + h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 36f12a0..95f8091 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -436,8 +436,21 @@ TESTING() { # the actual output file is calculated by replacing the `.ddl' with # `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a # non-zero value. +# If $1 == ignorecase then do caseless CMP and DIFF. # ADD_H5_TEST TOOLTEST() { + # check if caseless compare and diff requested + if [ "$1" = ignorecase ]; then + caseless="-i" + # replace cmp with diff which runs much longer. + xCMP="$DIFF -i" + shift + else + caseless="" + # stick with faster cmp if ignorecase is not requested. + xCMP="$CMP" + fi + expect="$TESTDIR/$1" actual="$TESTDIR/`basename $1 .ddl`.out" actual_err="$TESTDIR/`basename $1 .ddl`.err" @@ -463,13 +476,13 @@ TOOLTEST() { # Create the expect file if it doesn't yet exist. echo " CREATED" cp $actual $expect - elif $CMP $expect $actual; then + elif $xCMP $expect $actual > /dev/null 2>&1 ; then echo " PASSED" else echo "*FAILED*" echo " Expected result (*.ddl) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' fi # Clean up output file |