summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/CMakeLists.txt12
-rw-r--r--tools/h5dump/h5dumpgentest.c60
-rw-r--r--tools/h5dump/testh5dump.sh.in4
3 files changed, 69 insertions, 7 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 8766eb6..c3d3e1b 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -161,6 +161,7 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.ddl
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tscaleoffset.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tshuffle.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink-1.ddl
@@ -264,6 +265,7 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.h5
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-m.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-r.h5
@@ -1024,6 +1026,8 @@ IF (BUILD_TESTING)
tscalarintsize.out.err
tscalarattrintsize.out
tscalarattrintsize.out.err
+ tscalarstring.out
+ tscalarstring.out.err
tscaleoffset.out
tscaleoffset.out.err
tshuffle.out
@@ -1088,15 +1092,15 @@ IF (BUILD_TESTING)
# test for compound signed/unsigned datasets
ADD_H5_TEST (tcmpdintsize 0 --enable-error-stack tcmpdintsize.h5)
# test for signed/unsigned scalar datasets
- # TODO: failed on mac with intel compiler. (Allen will work on it)
- #ADD_H5_TEST (tscalarintsize 0 --enable-error-stack tscalarintsize.h5)
+ ADD_H5_TEST (tscalarintsize 0 --enable-error-stack tscalarintsize.h5)
# test for signed/unsigned attributes
ADD_H5_TEST (tattrintsize 0 --enable-error-stack tattrintsize.h5)
# test for compound signed/unsigned attributes
ADD_H5_TEST (tcmpdattrintsize 0 --enable-error-stack tcmpdattrintsize.h5)
# test for signed/unsigned scalar attributes
- # TODO: failed on mac with intel compiler. (Allen will work on it)
- #ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5)
+ ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5)
+ # test for string scalar dataset and attribute
+ ADD_H5_TEST (tscalarstring 0 --enable-error-stack tscalarstring.h5)
# test for displaying groups
ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5)
# test for displaying the selected groups
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 1bbb9f9..ffa6754 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -104,6 +104,7 @@
#define FILE72 "tnestedcmpddt.h5"
#define FILE73 "tscalarintsize.h5"
#define FILE74 "tscalarattrintsize.h5"
+#define FILE75 "tscalarstring.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -8118,7 +8119,7 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
/*-------------------------------------------------------------------------
* Function: gent_intscalars
*
- * Purpose: Generate a file to be used in the h5dump tests.
+ * Purpose: Generate a file to be used in the h5dump scalar tests.
* Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
* Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
* Fill them with raw data such that no bit will be all zero in a dataset.
@@ -8313,9 +8314,9 @@ gent_intscalars(void)
}
/*-------------------------------------------------------------------------
- * Function: gent_attr_packedbits
+ * Function: gent_attr_intscalars
*
- * Purpose: Generate a file to be used in the h5dump packed bits tests.
+ * Purpose: Generate a file to be used in the h5dump attribute scalar tests.
* Four attributes of 1, 2, 4 and 8 bytes of unsigned int types are created.
* Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
* Fill them with raw data such that no bit will be all zero in a dataset.
@@ -8514,6 +8515,58 @@ gent_attr_intscalars(void)
}
/*-------------------------------------------------------------------------
+ * Function: gent_string_scalars
+ *
+ * Purpose: Generate a file to be used in the h5dump string scalar tests.
+ * A dataset of string types are created.
+ * An attribute of string types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_string_scalars(void)
+{
+ hid_t fid, attr, dataset, space, tid, root;
+ hsize_t dims[2];
+ char string[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* string scalar */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid, F73_XDIM * F73_YDIM8);
+
+ memset(string, ' ', F73_XDIM * F73_YDIM8);
+ for(i = 0; i < dims[0]; i++) {
+ string[i][0] = 'A' + i;
+ for(j = 1; j < dims[1]; j++) {
+ string[i][j] = string[i][j-1] + 1;
+ }
+ }
+ string[i][j] = 0;
+
+ /* Dataset of string scalar */
+ dataset = H5Dcreate2(fid, "the_str", tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, string);
+ H5Dclose(dataset);
+
+ /* attribute of string scalar */
+ attr = H5Acreate2(root, "attr_str", tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, string);
+
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
* Function: main
*
*-------------------------------------------------------------------------
@@ -8597,6 +8650,7 @@ int main(void)
gent_nested_compound_dt();
gent_intscalars();
gent_attr_intscalars();
+ gent_string_scalars();
return 0;
}
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index c90c364..8a2483b 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -145,6 +145,7 @@ $SRC_H5DUMP_TESTFILES/tordergr.h5
$SRC_H5DUMP_TESTFILES/tsaf.h5
$SRC_H5DUMP_TESTFILES/tscalarintsize.h5
$SRC_H5DUMP_TESTFILES/tscalarattrintsize.h5
+$SRC_H5DUMP_TESTFILES/tscalarstring.h5
$SRC_H5DUMP_TESTFILES/tslink.h5
$SRC_H5DUMP_TESTFILES/tsplit_file-m.h5
$SRC_H5DUMP_TESTFILES/tsplit_file-r.h5
@@ -281,6 +282,7 @@ $SRC_H5DUMP_TESTFILES/treference.ddl
$SRC_H5DUMP_TESTFILES/tsaf.ddl
$SRC_H5DUMP_TESTFILES/tscalarintsize.ddl
$SRC_H5DUMP_TESTFILES/tscalarattrintsize.ddl
+$SRC_H5DUMP_TESTFILES/tscalarstring.ddl
$SRC_H5DUMP_TESTFILES/tscaleoffset.ddl
$SRC_H5DUMP_TESTFILES/tshuffle.ddl
$SRC_H5DUMP_TESTFILES/tslink-1.ddl
@@ -690,6 +692,8 @@ TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5
TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5
# test for signed/unsigned scalar attributes
TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5
+# test for string scalar dataset attribute
+TOOLTEST tscalarstring.ddl --enable-error-stack tscalarstring.h5
# test for displaying groups
TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5
# test for displaying the selected groups