From af54fd532c470fa0bb76aa924dc695a86d3b0f9d Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 17 Mar 2021 10:27:21 -0500 Subject: [PATCH] Fix display of long double in tools (#469) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .gitattributes | 1 + MANIFEST | 4 ++++ config/cmake/hdf5-config-version.cmake.in | 2 +- release_docs/RELEASE.txt | 7 ++++++ tools/lib/h5diff_array.c | 6 ++--- tools/test/h5dump/CMakeTests.cmake | 11 +++++++-- tools/test/h5dump/h5dumpgentest.c | 1 + tools/test/h5dump/testh5dump.sh.in | 5 ++++- tools/testfiles/tldouble.wddl | 11 +++++++++ tools/testfiles/tldouble_scalar.ddl | 26 ++++++++++++++++++++++ tools/testfiles/tldouble_scalar.h5 | Bin 0 -> 2144 bytes tools/testfiles/tldouble_scalar.wddl | 26 ++++++++++++++++++++++ 12 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 tools/testfiles/tldouble.wddl create mode 100755 tools/testfiles/tldouble_scalar.ddl create mode 100644 tools/testfiles/tldouble_scalar.h5 create mode 100755 tools/testfiles/tldouble_scalar.wddl diff --git a/.gitattributes b/.gitattributes index f72b49c96b9..e01442aa84e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -785,6 +785,7 @@ tools/testfiles/tints4dimsStride2.ddl -text tools/testfiles/tintsattrs.h5 -text svneol=unset#application/x-hdf tools/testfiles/tlarge_objname.h5 -text tools/testfiles/tldouble.h5 -text +tools/testfiles/tldouble_scalar.h5 -text tools/testfiles/tlonglinks.h5 -text tools/testfiles/tloop.h5 -text tools/testfiles/tloop2.h5 -text diff --git a/MANIFEST b/MANIFEST index 6605812f823..b484ce5dd4d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2021,7 +2021,11 @@ ./tools/testfiles/tlarge_objname.ddl ./tools/testfiles/tlarge_objname.h5 ./tools/testfiles/tldouble.ddl +./tools/testfiles/tldouble.wddl ./tools/testfiles/tldouble.h5 +./tools/testfiles/tldouble_scalar.ddl +./tools/testfiles/tldouble_scalar.wddl +./tools/testfiles/tldouble_scalar.h5 ./tools/testfiles/tlonglinks.ddl ./tools/testfiles/tlonglinks.h5 ./tools/testfiles/tloop-1.ddl diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in index 8e93dc6dfe2..20ce630351a 100644 --- a/config/cmake/hdf5-config-version.cmake.in +++ b/config/cmake/hdf5-config-version.cmake.in @@ -33,7 +33,7 @@ else() endif() if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND - (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR)) + (PACKAGE_FIND_VERSION_MINOR STRLESS_EQUAL CVF_VERSION_MINOR)) set(PACKAGE_VERSION_COMPATIBLE TRUE) else() set(PACKAGE_VERSION_COMPATIBLE FALSE) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index bf4a2736843..054939423d6 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -877,6 +877,13 @@ Bug Fixes since HDF5-1.12.0 release Tools ----- + - Fixed tools display of long double. + + Long doubles were not being display correctly. Changed the printf + specifier from %Lf to %Lg. + + (ADB - 2021/03/12, HDFFV-11113) + - Fixed tools argument parsing. Tools parsing used the length of the option from the long array to match diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 41f47612983..77b6a5e36fa 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -27,7 +27,7 @@ #define F_FORMAT "%-15g %-15g %-15g\n" #if H5_SIZEOF_LONG_DOUBLE != 0 -#define LD_FORMAT "%-15Lf %-15Lf %-15Lf\n" +#define LD_FORMAT "%-15Lg %-15Lg %-15Lg\n" #endif #define I_FORMAT "%-15d %-15d %-15d\n" @@ -42,7 +42,7 @@ #define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n" #if H5_SIZEOF_LONG_DOUBLE != 0 -#define LD_FORMAT_P "%-15.10Lf %-15.10Lf %-15.10Lf %-14.10Lf\n" +#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n" #endif #define I_FORMAT_P "%-15d %-15d %-15d %-14f\n" @@ -59,7 +59,7 @@ #define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n" #if H5_SIZEOF_LONG_DOUBLE != 0 -#define LD_FORMAT_P_NOTCOMP "%-15.10Lf %-15.10Lf %-15.10Lf not comparable\n" +#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n" #endif #define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n" diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index f54da76ece2..4b61569ff2c 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -127,7 +127,8 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.ddl ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.ddl - ${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl + #${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl #special handling on windows + #${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl #special handling on windows ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl @@ -294,6 +295,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.h5 ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.h5 ${HDF5_TOOLS_DIR}/testfiles/tldouble.h5 + ${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.h5 ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.h5 ${HDF5_TOOLS_DIR}/testfiles/tloop.h5 ${HDF5_TOOLS_DIR}/testfiles/tmulti-b.h5 @@ -409,8 +411,12 @@ configure_file(${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp NEWLINE_STYLE CRLF) #file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) #file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble.ddl" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble_scalar.ddl" "h5dump_std_files") else () HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble.ddl" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble_scalar.ddl" "h5dump_std_files") endif () add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list}) @@ -1085,7 +1091,8 @@ ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) # test for long double (some systems do not have long double) -# ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) + ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) + ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5) # test for vms ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 35e1d6a0d54..1c2bf6fad37 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -11138,6 +11138,7 @@ main(void) gent_aindices(); gent_longlinks(); gent_ldouble(); + gent_ldouble_scalar(); gent_binary(); gent_bigdims(); gent_hyperslab(); diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 8f478b0d2e9..f985da5021e 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -143,6 +143,7 @@ $SRC_H5DUMP_TESTFILES/tintsattrs.h5 $SRC_H5DUMP_TESTFILES/tints4dims.h5 $SRC_H5DUMP_TESTFILES/tlarge_objname.h5 $SRC_H5DUMP_TESTFILES/tldouble.h5 +$SRC_H5DUMP_TESTFILES/tldouble_scalar.h5 $SRC_H5DUMP_TESTFILES/tlonglinks.h5 $SRC_H5DUMP_TESTFILES/tloop.h5 $SRC_H5DUMP_TESTFILES/tmulti-b.h5 @@ -288,6 +289,7 @@ $SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl $SRC_H5DUMP_TESTFILES/tldouble.ddl +$SRC_H5DUMP_TESTFILES/tldouble_scalar.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl $SRC_H5DUMP_TESTFILES/tloop-1.ddl $SRC_H5DUMP_TESTFILES/tmulti.ddl @@ -1351,7 +1353,8 @@ TOOLTEST tgrpnullspace.ddl -p --enable-error-stack tgrpnullspace.h5 TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 # test for long double (some systems do not have long double) -#TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 +TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 +TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5 # test for vms TOOLTEST tvms.ddl --enable-error-stack tvms.h5 diff --git a/tools/testfiles/tldouble.wddl b/tools/testfiles/tldouble.wddl new file mode 100644 index 00000000000..4793b4d1344 --- /dev/null +++ b/tools/testfiles/tldouble.wddl @@ -0,0 +1,11 @@ +HDF5 "tldouble.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE 128-bit little-endian floating-point + DATASPACE SIMPLE { ( 3 ) / ( 3 ) } + DATA { + (0): 1, 2, 3 + } + } +} +} diff --git a/tools/testfiles/tldouble_scalar.ddl b/tools/testfiles/tldouble_scalar.ddl new file mode 100755 index 00000000000..45f0b45ca72 --- /dev/null +++ b/tools/testfiles/tldouble_scalar.ddl @@ -0,0 +1,26 @@ +HDF5 "tldouble_scalar.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_ARRAY { [6] H5T_NATIVE_LDOUBLE } + DATASPACE SCALAR + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 96 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0): [ 0, 1, 2, 3, 4, 5 ] + } + } +} +} diff --git a/tools/testfiles/tldouble_scalar.h5 b/tools/testfiles/tldouble_scalar.h5 new file mode 100644 index 0000000000000000000000000000000000000000..0344ea0a0c3c67933a1fd790eac9a8e90f4d3a33 GIT binary patch literal 2144 zcmeD5aB<`1lHy_j0S*oZ76t(@6Gr@pf&>nT2#gPtPk=HQp>zk7Ucm%mFfxE31A_!q zTo7tLy1I}cS62q0N|^aD8mf)KfCa*WIs+y=N{^5b@Njhu0C_b6>R(tYJpoN;uwY0j zPAvhkVd>EWCP606$iN0M3u+)E10)5)%x7lM0LyCu%})SgkT@F*QRj9NJw0;3^7%MfS)l~qVtyMe(0#kvD%{02r;`2~y)xnK