summaryrefslogtreecommitdiffstats
path: root/tools/test/h5dump
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-04-15 12:59:01 (GMT)
committerGitHub <noreply@github.com>2021-04-15 12:59:01 (GMT)
commite21f7aaac4a4d34a8a5aa1330fb2ed6814532cfb (patch)
treed43ff3c2b940cfbf3f16a67360bbe2070f3ec983 /tools/test/h5dump
parent052eed29d8922b87d4aa2734e4366de461326dd0 (diff)
downloadhdf5-e21f7aaac4a4d34a8a5aa1330fb2ed6814532cfb.zip
hdf5-e21f7aaac4a4d34a8a5aa1330fb2ed6814532cfb.tar.gz
hdf5-e21f7aaac4a4d34a8a5aa1330fb2ed6814532cfb.tar.bz2
Tools long double updates (#522)
* 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 * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools/test/h5dump')
-rw-r--r--tools/test/h5dump/CMakeTests.cmake18
-rw-r--r--tools/test/h5dump/h5dumpgentest.c157
-rw-r--r--tools/test/h5dump/testh5dump.sh.in7
3 files changed, 172 insertions, 10 deletions
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index 1e6ccb2..a8984de 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -101,6 +101,8 @@
${HDF5_TOOLS_DIR}/testfiles/tfamily.ddl
${HDF5_TOOLS_DIR}/testfiles/tfill.ddl
${HDF5_TOOLS_DIR}/testfiles/tfletcher32.ddl
+ #${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.ddl #native
+ #${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.wddl #special for windows
${HDF5_TOOLS_DIR}/testfiles/tfpformat.ddl
${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ddl
${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ddl
@@ -127,8 +129,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 #special handling on windows
- #${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl #special handling on windows
+ ${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl
${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl
${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl
${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl
@@ -283,6 +285,7 @@
${HDF5_TOOLS_DIR}/testfiles/tfcontents1.h5
${HDF5_TOOLS_DIR}/testfiles/tfcontents2.h5
${HDF5_TOOLS_DIR}/testfiles/tfilters.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5
${HDF5_TOOLS_DIR}/testfiles/tfpformat.h5
${HDF5_TOOLS_DIR}/testfiles/tfvalues.h5
${HDF5_TOOLS_DIR}/testfiles/tgroup.h5
@@ -413,12 +416,10 @@
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")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tfloatsattrs.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")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tfloatsattrs.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})
@@ -1093,8 +1094,9 @@
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_scalar 0 -p --enable-error-stack tldouble_scalar.h5)
+ ADD_H5_TEST (tfloatsattrs 0 -p --enable-error-stack tfloatsattrs.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 1c2bf6f..29922e8 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -116,6 +116,7 @@
#define FILE86 "err_attr_dspace.h5"
#define FILE87 "tintsnodata.h5"
#define FILE88 "tldouble_scalar.h5"
+#define FILE89 "tfloatsattrs.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -396,6 +397,15 @@ typedef struct s1_t {
#define F83_RANK 1
#define F83_ARRAYDIM 3
+/* "FILE89" macros */
+#define F89_XDIM 8
+#define F89_DATASETF32 "DS32BITS"
+#define F89_YDIM32 32
+#define F89_DATASETF64 "DS64BITS"
+#define F89_YDIM64 64
+#define F89_DATASETF128 "DS128BITS"
+#define F89_YDIM128 128
+
static void
gent_group(void)
{
@@ -10209,6 +10219,152 @@ gent_intsattrs(void)
HDfree(asetdbl);
}
+/*-------------------------------------------------------------------------
+ * Function: gent_floatsattrs
+ *
+ * Purpose: Generate a file to be used in the h5dump tests.
+ * Three datasets of 4, 8 and 16 bytes of float types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_floatsattrs(void)
+{
+ hid_t fid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t aspace = H5I_INVALID_HID;
+ hsize_t dims[2], adims[1];
+
+ float ** dset32 = NULL;
+ double ** dset64 = NULL;
+ long double **dset128 = NULL;
+
+ float * aset32 = NULL;
+ double * aset64 = NULL;
+ long double *aset128 = NULL;
+
+ float val32bits;
+ double val64bits;
+ long double val128bits;
+
+ unsigned int i, j;
+
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, float, F89_XDIM, F89_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, double, F89_XDIM, F89_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset128, long double, F89_XDIM, F89_YDIM128);
+
+ aset32 = HDcalloc(F89_XDIM * F89_YDIM32, sizeof(float));
+ aset64 = HDcalloc(F89_XDIM * F89_YDIM64, sizeof(double));
+ aset128 = HDcalloc(F89_XDIM * F89_YDIM128, sizeof(long double));
+
+ fid = H5Fcreate(FILE89, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ goto error;
+
+ if (H5Tget_size(tid) == 0)
+ goto error;
+
+ /* Dataset of 32 bits float */
+ dims[0] = F89_XDIM;
+ dims[1] = F89_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F89_DATASETF32, H5T_IEEE_F32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (float)F89_YDIM32;
+ for (i = 0; i < dims[0]; i++) {
+ dset32[i][0] = val32bits;
+ aset32[i * dims[1]] = dset32[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = (float)(j * dims[0] + i) / (float)F89_YDIM32;
+ aset32[i * dims[1] + j] = dset32[i][j];
+ }
+ val32bits -= (float)1;
+ }
+
+ H5Dwrite(dataset, H5T_IEEE_F32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
+ /* Attribute of 32 bits float */
+ adims[0] = F89_XDIM * F89_YDIM32;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F89_DATASETF32, H5T_IEEE_F32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_IEEE_F32LE, aset32);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits double */
+ dims[0] = F89_XDIM;
+ dims[1] = F89_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F89_DATASETF64, H5T_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (double)F89_YDIM64;
+ for (i = 0; i < dims[0]; i++) {
+ dset64[i][0] = val64bits;
+ aset64[i * dims[1]] = dset64[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = (double)(j * dims[0] + i) / (double)F89_YDIM64;
+ aset64[i * dims[1] + j] = dset64[i][j];
+ }
+ val64bits -= (double)1;
+ }
+
+ H5Dwrite(dataset, H5T_IEEE_F64LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
+ /* Attribute of 64 bits double */
+ adims[0] = F89_XDIM * F89_YDIM64;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F89_DATASETF64, H5T_IEEE_F64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_IEEE_F64LE, aset64);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 128 bits long double */
+ dims[0] = F89_XDIM;
+ dims[1] = F89_YDIM128;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F89_DATASETF128, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val128bits = (long double)F89_YDIM128;
+ for (i = 0; i < dims[0]; i++) {
+ dset128[i][0] = val128bits;
+ aset128[i * dims[1]] = dset128[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset128[i][j] = (long double)(j * dims[0] + i) / (long double)F89_YDIM128;
+ aset128[i * dims[1] + j] = dset128[i][j];
+ }
+ val128bits -= (long double)1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset128[0]);
+ /* Attribute of 128 bits long double */
+ adims[0] = F89_XDIM * F89_YDIM128;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F89_DATASETF128, tid, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, aset128);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+error:
+ H5Fclose(fid);
+
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dset128);
+
+ HDfree(aset32);
+ HDfree(aset64);
+ HDfree(aset128);
+}
+
static void
gent_bitnopaquefields(void)
{
@@ -11162,6 +11318,7 @@ main(void)
gent_compound_ints();
gent_intattrscalars();
gent_intsattrs();
+ gent_floatsattrs();
gent_bitnopaquefields();
gent_nodata();
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index e2776ab..9464302 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -132,6 +132,7 @@ $SRC_H5DUMP_TESTFILES/tfamily00010.h5
$SRC_H5DUMP_TESTFILES/tfcontents1.h5
$SRC_H5DUMP_TESTFILES/tfcontents2.h5
$SRC_H5DUMP_TESTFILES/tfilters.h5
+$SRC_H5DUMP_TESTFILES/tfloatsattrs.h5
$SRC_H5DUMP_TESTFILES/tfpformat.h5
$SRC_H5DUMP_TESTFILES/tfvalues.h5
$SRC_H5DUMP_TESTFILES/tgroup.h5
@@ -265,6 +266,7 @@ $SRC_H5DUMP_TESTFILES/textlink.ddl
$SRC_H5DUMP_TESTFILES/tfamily.ddl
$SRC_H5DUMP_TESTFILES/tfill.ddl
$SRC_H5DUMP_TESTFILES/tfletcher32.ddl
+$SRC_H5DUMP_TESTFILES/tfloatsattrs.ddl
$SRC_H5DUMP_TESTFILES/tfpformat.ddl
$SRC_H5DUMP_TESTFILES/tgroup-1.ddl
$SRC_H5DUMP_TESTFILES/tgroup-2.ddl
@@ -1384,8 +1386,9 @@ 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_scalar.ddl -p --enable-error-stack tldouble_scalar.h5
+TOOLTEST tfloatsattrs.ddl -p --enable-error-stack tfloatsattrs.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