diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-07-06 19:16:07 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-07-06 19:16:07 (GMT) |
commit | 046f1d7b1fd29c3caea904d3aa403fa4e9cae4b8 (patch) | |
tree | b932e36d4f7f428eed97a5e8b57137050f27ebb6 /tools/h5dump | |
parent | 3fef275c89ef954eb44929ede39b3a3926d61292 (diff) | |
download | hdf5-046f1d7b1fd29c3caea904d3aa403fa4e9cae4b8.zip hdf5-046f1d7b1fd29c3caea904d3aa403fa4e9cae4b8.tar.gz hdf5-046f1d7b1fd29c3caea904d3aa403fa4e9cae4b8.tar.bz2 |
[svn-r22522] Merge trunk revision 22520 cmake files and h5dump/h5diff and configure to branch
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 30 | ||||
-rw-r--r-- | tools/h5dump/Makefile.am | 2 | ||||
-rw-r--r-- | tools/h5dump/Makefile.in | 12 | ||||
-rw-r--r-- | tools/h5dump/h5dump_xml.c | 6 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 926 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 244 | ||||
-rw-r--r-- | tools/h5dump/testh5dumppbits.sh.in | 495 | ||||
-rw-r--r-- | tools/h5dump/testh5dumpxml.sh.in | 171 |
8 files changed, 1594 insertions, 292 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index a6e452d..3bc481d 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -43,6 +43,7 @@ IF (BUILD_TESTING) # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- SET (HDF5_REFERENCE_FILES + charsets.ddl file_space.ddl filter_fail.ddl packedbits.ddl @@ -65,6 +66,7 @@ IF (BUILD_TESTING) tarray7.ddl tarray8.ddl tattr-1.ddl + tattrintsize.ddl tattr-2.ddl tattr-3.ddl tattr-4_be.ddl @@ -81,6 +83,8 @@ IF (BUILD_TESTING) tboot2.ddl tchar1.ddl tchunked.ddl + tcmpdattrintsize.ddl + tcmpdintsize.ddl tcomp-1.ddl tcomp-2.ddl tcomp-3.ddl @@ -239,6 +243,7 @@ IF (BUILD_TESTING) tvlstr.h5.xml ) SET (HDF5_REFERENCE_TEST_FILES + charsets.h5 file_space.h5 filter_fail.h5 packedbits.h5 @@ -256,10 +261,13 @@ IF (BUILD_TESTING) tattr.h5 tattr2.h5 tattr4_be.h5 + tattrintsize.h5 tattrreg.h5 tbigdims.h5 tbinary.h5 tchar.h5 + tcmpdattrintsize.h5 + tcmpdintsize.h5 tcompound.h5 tcompound_complex.h5 tdatareg.h5 @@ -676,6 +684,8 @@ IF (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} -E remove h5dump-help.out + charsets.out + charsets.out.err file_space.out file_space.out.err filter_fail.out @@ -726,6 +736,8 @@ IF (BUILD_TESTING) tattr-3.out.err tattr-4_be.out tattr-4_be.out.err + tattrintsize.out + tattrintsize.out.err tattrreg.out tattrreg.out.err tattrregR.out @@ -742,6 +754,10 @@ IF (BUILD_TESTING) tchar1.out.err tchunked.out tchunked.out.err + tcmpdattrintsize.out + tcmpdattrintsize.out.err + tcmpdintsize.out + tcmpdintsize.out.err tcomp-1.out tcomp-1.out.err tcomp-2.out @@ -931,6 +947,12 @@ IF (BUILD_TESTING) # test for signed/unsigned datasets ADD_H5_TEST (packedbits 0 --enable-error-stack packedbits.h5) + # test for compound signed/unsigned datasets + ADD_H5_TEST (tcmpdintsize 0 --enable-error-stack tcmpdintsize.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 displaying groups ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups @@ -1060,6 +1082,9 @@ IF (BUILD_TESTING) # test printing characters in ASCII instead of decimal ADD_H5_TEST (tchar1 0 --enable-error-stack -r tchar.h5) + # test datatypes in ASCII and UTF8 + ADD_H5_TEST (charsets 0 --enable-error-stack charsets.h5) + # rev. 2004 # tests for super block ADD_H5_TEST (tboot1 0 --enable-error-stack -H -B -d dset tfcontents1.h5) @@ -1750,11 +1775,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5dump ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5dump RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am index 97d81c2..38864f5 100644 --- a/tools/h5dump/Makefile.am +++ b/tools/h5dump/Makefile.am @@ -25,7 +25,7 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts TEST_PROG=h5dumpgentest -TEST_SCRIPT=testh5dump.sh testh5dumpxml.sh +TEST_SCRIPT=testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh check_PROGRAMS=$(TEST_PROG) binread check_SCRIPTS=$(TEST_SCRIPT) diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 9d46557..0c45a72 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -52,8 +52,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/testh5dump.sh.in $(srcdir)/testh5dumpxml.sh.in \ - $(top_srcdir)/config/commence.am \ + $(srcdir)/testh5dump.sh.in $(srcdir)/testh5dumppbits.sh.in \ + $(srcdir)/testh5dumpxml.sh.in $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am check_PROGRAMS = $(am__EXEEXT_1) binread$(EXEEXT) bin_PROGRAMS = h5dump$(EXEEXT) @@ -65,7 +65,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = testh5dump.sh testh5dumpxml.sh +CONFIG_CLEAN_FILES = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" am__EXEEXT_1 = h5dumpgentest$(EXEEXT) @@ -412,7 +412,7 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts TEST_PROG = h5dumpgentest -TEST_SCRIPT = testh5dump.sh testh5dumpxml.sh +TEST_SCRIPT = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5dump$(EXEEXT) @@ -424,7 +424,7 @@ LDADD = $(LIBH5TOOLS) $(LIBHDF5) # Source files for the program h5dump_SOURCES = h5dump.c h5dump_ddl.c h5dump_xml.c -DISTCLEANFILES = testh5dump.sh +DISTCLEANFILES = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -477,6 +477,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): testh5dump.sh: $(top_builddir)/config.status $(srcdir)/testh5dump.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +testh5dumppbits.sh: $(top_builddir)/config.status $(srcdir)/testh5dumppbits.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5dumpxml.sh: $(top_builddir)/config.status $(srcdir)/testh5dumpxml.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index e6f8043..1b247f1 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -1883,9 +1883,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU p_type = h5tools_get_native_type(type); /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; H5Tclose(type); @@ -2952,7 +2950,7 @@ xml_print_refs(hid_t did, int source) string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - for (i = 0; i < ssiz; i++) { + for (i = 0; i < (hsize_t)ssiz; i++) { const char *path = lookup_ref_path(*refbuf); ctx.indent_level++; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 4114a94..a37f908 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -97,10 +97,11 @@ #define FILE65 "file_space.h5" #define FILE66 "packedbits.h5" #define FILE67 "zerodim.h5" -#define FILE68 "tdset_idx.h5" - - - +#define FILE68a "tdset_idx.h5" +#define FILE68 "charsets.h5" +#define FILE69 "tattrintsize.h5" +#define FILE70 "tcmpdintsize.h5" +#define FILE71 "tcmpdattrintsize.h5" /*------------------------------------------------------------------------- * prototypes @@ -262,22 +263,22 @@ typedef struct s1_t { #define THRESHOLD10 10 /* Free space section threshold */ /* "FILE66" macros */ -#define F66_XDIM 8 +#define F66_XDIM 8 #define F66_DATASETU08 "DU08BITS" #define F66_DATASETS08 "DS08BITS" -#define F66_YDIM8 8 +#define F66_YDIM8 8 #define F66_DATASETU16 "DU16BITS" #define F66_DATASETS16 "DS16BITS" -#define F66_YDIM16 16 +#define F66_YDIM16 16 #define F66_DATASETU32 "DU32BITS" #define F66_DATASETS32 "DS32BITS" -#define F66_YDIM32 32 +#define F66_YDIM32 32 #define F66_DATASETU64 "DU64BITS" #define F66_DATASETS64 "DS64BITS" #define F66_YDIM64 64 -#define F66_DUMMYDBL "DummyDBL" +#define F66_DUMMYDBL "DummyDBL" -/* Declarations for gent_dataset_idx() for "FILE68" */ +/* Declarations for gent_dataset_idx() for "FILE68a" */ #define DSET_FIXED "dset_fixed" #define DSET_FIXED_FILTER "dset_filter" #define DSET_BTREE "dset_btree" @@ -287,6 +288,29 @@ typedef struct s1_t { #define DIM10 10 #define CHUNK 5 +/* "FILE70" macros and for FILE71 */ +/* Name of dataset to create in datafile */ +#define F70_DATASETNAME "CompoundIntSize" +#define F70_LENGTH 4 +#define F70_RANK 1 +#define F70_ARRAY_RANK 2 +#define F70_XDIM 8 +#define F70_DATASETU08 "DU08BITS" +#define F70_DATASETS08 "DS08BITS" +#define F70_YDIM8 8 +#define F70_DATASETU16 "DU16BITS" +#define F70_DATASETS16 "DS16BITS" +#define F70_YDIM16 16 +#define F70_DATASETU32 "DU32BITS" +#define F70_DATASETS32 "DS32BITS" +#define F70_YDIM32 32 +#define F70_DATASETU64 "DU64BITS" +#define F70_DATASETS64 "DS64BITS" +#define F70_YDIM64 64 +#define F70_DUMMYDBL "DummyDBL" +/* Name of dataset to create in datafile */ +#define F71_DATASETNAME "CompoundAttrIntSize" + static void gent_group(void) { @@ -586,7 +610,7 @@ static int gent_softlink2(void) */ /* Create a new dataset as sample object */ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset1 < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); @@ -607,7 +631,7 @@ static int gent_softlink2(void) */ /* Create a new dataset as sample object */ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset2 < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); @@ -3354,7 +3378,7 @@ static void gent_array8(void) hsize_t sdims[] = {F64_DIM0}; hsize_t tdims[] = {F64_DIM1}; int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */ - unsigned int i; + unsigned int i; /* * Initialize data. i is the element in the dataspace, j and k the @@ -6982,7 +7006,7 @@ gent_dataset_idx(void) ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); assert(ret >= 0); - fid = H5Fcreate(FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(FILE68a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); dcpl = H5Pcreate(H5P_DATASET_CREATE); dims[0] = CHUNK; @@ -7040,8 +7064,8 @@ gent_dataset_idx(void) * Function: gent_packedbits * * Purpose: Generate a file to be used in the h5dump packed bits tests. - * Three datasets of 1, 2 and 4 bytes of unsigned int types are created. - * Three more datasets of 1, 2 and 4 bytes of signed int types are created. + * 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. * A dummy dataset of double type is created for failure test. * Created: Albert Cheng, 2010/5/10. @@ -7073,11 +7097,11 @@ gent_packedbits(void) valu8bits = (uint8_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu8[i][0] = valu8bits; - for(j = 1; j < dims[1]; j++) { + dsetu8[i][0] = valu8bits; + for(j = 1; j < dims[1]; j++) { dsetu8[i][j] = dsetu8[i][j-1] << 1; - } - valu8bits <<= 1; + } + valu8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -7089,13 +7113,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu16bits = (uint16_t) ~0u; /* all 1s */ + valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu16[i][0] = valu16bits; - for(j = 1; j < dims[1]; j++) { + dsetu16[i][0] = valu16bits; + for(j = 1; j < dims[1]; j++) { dsetu16[i][j] = dsetu16[i][j-1] << 1; - } - valu16bits <<= 1; + } + valu16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -7107,13 +7131,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu32bits = (uint32_t) ~0u; /* all 1s */ + valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu32[i][0] = valu32bits; - for(j = 1; j < dims[1]; j++) { + dsetu32[i][0] = valu32bits; + for(j = 1; j < dims[1]; j++) { dsetu32[i][j] = dsetu32[i][j-1] << 1; - } - valu32bits <<= 1; + } + valu32bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); @@ -7127,11 +7151,11 @@ gent_packedbits(void) valu64bits = (uint64_t) ~0Lu; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu64[i][0] = valu64bits; - for(j = 1; j < dims[1]; j++) { + dsetu64[i][0] = valu64bits; + for(j = 1; j < dims[1]; j++) { dsetu64[i][j] = dsetu64[i][j-1] << 1; - } - valu64bits <<= 1; + } + valu64bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); @@ -7143,13 +7167,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val8bits = (int8_t) ~0; /* all 1s */ + val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset8[i][0] = val8bits; - for(j = 1; j < dims[1]; j++) { + dset8[i][0] = val8bits; + for(j = 1; j < dims[1]; j++) { dset8[i][j] = dset8[i][j-1] << 1; - } - val8bits <<= 1; + } + val8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -7161,13 +7185,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val16bits = (int16_t) ~0; /* all 1s */ + val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset16[i][0] = val16bits; - for(j = 1; j < dims[1]; j++) { + dset16[i][0] = val16bits; + for(j = 1; j < dims[1]; j++) { dset16[i][j] = dset16[i][j-1] << 1; - } - val16bits <<= 1; + } + val16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -7179,13 +7203,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val32bits = (int32_t) ~0; /* all 1s */ + val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset32[i][0] = val32bits; - for(j = 1; j < dims[1]; j++) { + dset32[i][0] = val32bits; + for(j = 1; j < dims[1]; j++) { dset32[i][j] = dset32[i][j-1] << 1; - } - val32bits <<= 1; + } + val32bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); @@ -7199,11 +7223,11 @@ gent_packedbits(void) val64bits = (int64_t) ~0L; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset64[i][0] = val64bits; - for(j = 1; j < dims[1]; j++) { + dset64[i][0] = val64bits; + for(j = 1; j < dims[1]; j++) { dset64[i][j] = dset64[i][j-1] << 1; - } - val64bits <<= 1; + } + val64bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); @@ -7227,6 +7251,798 @@ gent_packedbits(void) } /*------------------------------------------------------------------------- + * Function: gent_attr_packedbits + * + * Purpose: Generate a file to be used in the h5dump packed bits 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. + * A dummy dataset of double type is created for failure test. + * Use file to test Signed/Unsigned datatypes and keep in sync with gent_packedbits() + *------------------------------------------------------------------------- + */ +static void +gent_attr_intsize(void) +{ + hid_t fid, attr, space, root; + hsize_t dims[2]; + uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits; + uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits; + uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits; + uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits; + int8_t dset8[F66_XDIM][F66_YDIM8], val8bits; + int16_t dset16[F66_XDIM][F66_YDIM16], val16bits; + int32_t dset32[F66_XDIM][F66_YDIM32], val32bits; + int64_t dset64[F66_XDIM][F66_YDIM64], val64bits; + double dsetdbl[F66_XDIM][F66_YDIM8]; + unsigned int i, j; + + fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + root = H5Gopen2(fid, "/", H5P_DEFAULT); + + /* Attribute of 8 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM8; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT); + + valu8bits = (uint8_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu8[i][0] = valu8bits; + for(j = 1; j < dims[1]; j++) { + dsetu8[i][j] = dsetu8[i][j-1] << 1; + } + valu8bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8); + H5Sclose(space); + H5Aclose(attr); + + /* Attribute of 16 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM16; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT); + + valu16bits = (uint16_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu16[i][0] = valu16bits; + for(j = 1; j < dims[1]; j++) { + dsetu16[i][j] = dsetu16[i][j-1] << 1; + } + valu16bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16); + H5Sclose(space); + H5Aclose(attr); + + /* Attribute of 32 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM32; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT); + + valu32bits = (uint32_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu32[i][0] = valu32bits; + for(j = 1; j < dims[1]; j++) { + dsetu32[i][j] = dsetu32[i][j-1] << 1; + } + valu32bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32); + H5Sclose(space); + H5Aclose(attr); + + /* Attribute of 64 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM64; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT); + + valu64bits = (uint64_t) ~0Lu; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu64[i][0] = valu64bits; + for(j = 1; j < dims[1]; j++) { + dsetu64[i][j] = dsetu64[i][j-1] << 1; + } + valu64bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64); + H5Sclose(space); + H5Aclose(attr); + + /* Attribute of 8 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM8; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT); + + val8bits = (int8_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset8[i][0] = val8bits; + for(j = 1; j < dims[1]; j++) { + dset8[i][j] = dset8[i][j-1] << 1; + } + val8bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_INT8, dset8); + H5Sclose(space); + H5Aclose(attr); + + /* Attribute of 16 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM16; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT); + + val16bits = (int16_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset16[i][0] = val16bits; + for(j = 1; j < dims[1]; j++) { + dset16[i][j] = dset16[i][j-1] << 1; + } + val16bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_INT16, dset16); + H5Sclose(space); + H5Aclose(attr); + + /* Attribute of 32 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM32; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT); + + val32bits = (int32_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset32[i][0] = val32bits; + for(j = 1; j < dims[1]; j++) { + dset32[i][j] = dset32[i][j-1] << 1; + } + val32bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_INT32, dset32); + H5Sclose(space); + H5Aclose(attr); + + /* Attribute of 64 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM64; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT); + + val64bits = (int64_t) ~0L; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset64[i][0] = val64bits; + for(j = 1; j < dims[1]; j++) { + dset64[i][j] = dset64[i][j-1] << 1; + } + val64bits <<= 1; + } + + H5Awrite(attr, H5T_NATIVE_INT64, dset64); + H5Sclose(space); + H5Aclose(attr); + + /* Double Dummy set for failure tests */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM8; + space = H5Screate_simple(2, dims, NULL); + attr = H5Acreate2(root, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; i < dims[0]; i++) + for(j = 0; j < dims[1]; j++) + dsetdbl[i][j] = 0.0001 * j + i; + + H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl); + + H5Sclose(space); + H5Aclose(attr); + + H5Gclose(root); + H5Fclose(fid); +} + +/*------------------------------------------------------------------------- + * Function: gent_charsets + * + * Purpose: Generate a file to be used in the character set test + * Contains: + * 1) a ascii datatype + * 2) a utf8 datatype + * + *------------------------------------------------------------------------- + */ +static void +gent_charsets(void) +{ + hid_t fid, did, sid; + herr_t status; + hsize_t dim[] = {1}; /* Dataspace dimensions */ + typedef struct CharSetInfo { + const char *ascii_p_; + const char *utf8_p_; + } CharSetInfo; + + sid = H5Screate_simple( 1, dim, NULL ); + fid = H5Fcreate( FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); + + hid_t charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) ); + + hid_t ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); + status = H5Tset_cset( ascii_dtid, H5T_CSET_ASCII ); + H5Tinsert( charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_ ), ascii_dtid ); + + hid_t utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); + status = H5Tset_cset( utf8_dtid, H5T_CSET_UTF8 ); + H5Tinsert( charset_dtid, "utf8", HOFFSET( CharSetInfo, utf8_p_ ), utf8_dtid ); + + did = H5Dcreate2( fid, "CharSets", charset_dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT ); + + const char * writeData[] = { "ascii", "utf8", }; + status = H5Dwrite( did, charset_dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, writeData ); + + H5Tclose( charset_dtid ); + H5Tclose( ascii_dtid ); + H5Tclose( utf8_dtid ); + H5Sclose( sid ); + H5Dclose( did ); + H5Fclose( fid ); +} + +static void gent_compound_intsizes(void) { + hid_t fid, dataset, space, root; + hsize_t dims[2]; + hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */ + hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */ + hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */ + hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */ + hid_t arrayu8_tid; /* Array datatype handle */ + hid_t arrayu16_tid; /* Array datatype handle */ + hid_t arrayu32_tid; /* Array datatype handle */ + hid_t arrayu64_tid; /* Array datatype handle */ + hid_t array8_tid; /* Array datatype handle */ + hid_t array16_tid; /* Array datatype handle */ + hid_t array32_tid; /* Array datatype handle */ + hid_t array64_tid; /* Array datatype handle */ + hid_t arraydbl_tid; /* Array datatype handle */ + uint8_t valu8bits; + uint16_t valu16bits; + uint32_t valu32bits; + uint64_t valu64bits; + int8_t val8bits; + int16_t val16bits; + int32_t val32bits; + int64_t val64bits; + /* Structure and array for compound types */ + typedef struct Array1Struct { + uint8_t dsetu8[F70_XDIM][F70_YDIM8]; + uint16_t dsetu16[F70_XDIM][F70_YDIM16]; + uint32_t dsetu32[F70_XDIM][F70_YDIM32]; + uint64_t dsetu64[F70_XDIM][F70_YDIM64]; + int8_t dset8[F70_XDIM][F70_YDIM8]; + int16_t dset16[F70_XDIM][F70_YDIM16]; + int32_t dset32[F70_XDIM][F70_YDIM32]; + int64_t dset64[F70_XDIM][F70_YDIM64]; + double dsetdbl[F70_XDIM][F70_YDIM8]; + } Array1Struct; + Array1Struct Array1[F70_LENGTH]; + + hid_t Array1Structid; /* File datatype identifier */ + herr_t status; /* Error checking variable */ + hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */ + + int m, n, o; /* Array init loop vars */ + + /* Initialize the data in the arrays/datastructure */ + for (m = 0; m < F70_LENGTH; m++) { + + /* Array of 8 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM8; + + valu8bits = (uint8_t) ~0u; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu8[n][0] = valu8bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1; + } + valu8bits <<= 1; + } + + /* Array of 16 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM16; + + valu16bits = (uint16_t) ~0u; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu16[n][0] = valu16bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1; + } + valu16bits <<= 1; + } + + /* Array of 32 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM32; + + valu32bits = (uint32_t) ~0u; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu32[n][0] = valu32bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1; + } + valu32bits <<= 1; + } + + /* Array of 64 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM64; + + valu64bits = (uint64_t) ~0Lu; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu64[n][0] = valu64bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1; + } + valu64bits <<= 1; + } + + /* Array of 8 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM8; + + val8bits = (int8_t) ~0; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset8[n][0] = val8bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1; + } + val8bits <<= 1; + } + + /* Array of 16 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM16; + + val16bits = (int16_t) ~0; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset16[n][0] = val16bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1; + } + val16bits <<= 1; + } + + /* Array of 32 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM32; + + val32bits = (int32_t) ~0; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset32[n][0] = val32bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1; + } + val32bits <<= 1; + } + + /* Array of 64 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM64; + + val64bits = (int64_t) ~0L; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset64[n][0] = val64bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1; + } + val64bits <<= 1; + } + + /* Double Dummy set for failure tests */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM8; + + for(n = 0; n < dims[0]; n++) + for(o = 0; o < dims[1]; o++) + Array1[m].dsetdbl[n][o] = 0.0001 * o + n; + } + + /* Create the array data type for the 8 bits signed int array */ + array8_tid = H5Tarray_create2(H5T_NATIVE_SCHAR, F70_ARRAY_RANK, array_dim8); + HDassert(array8_tid >= 0); + + /* Create the array data type for the 16 bits signed int array */ + array16_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F70_ARRAY_RANK, array_dim16); + HDassert(array16_tid >= 0); + + /* Create the array data type for the 32 bits signed int array */ + array32_tid = H5Tarray_create2(H5T_NATIVE_INT, F70_ARRAY_RANK, array_dim32); + HDassert(array32_tid >= 0); + + /* Create the array data type for the 64 bits signed int array */ + array64_tid = H5Tarray_create2(H5T_NATIVE_LONG, F70_ARRAY_RANK, array_dim64); + HDassert(array64_tid >= 0); + + /* Create the array data type for the 8 bits signed int array */ + arrayu8_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, F70_ARRAY_RANK, array_dim8); + HDassert(arrayu8_tid >= 0); + + /* Create the array data type for the 16 bits signed int array */ + arrayu16_tid = H5Tarray_create2(H5T_NATIVE_USHORT, F70_ARRAY_RANK, array_dim16); + HDassert(arrayu16_tid >= 0); + + /* Create the array data type for the 32 bits signed int array */ + arrayu32_tid = H5Tarray_create2(H5T_NATIVE_UINT, F70_ARRAY_RANK, array_dim32); + HDassert(arrayu32_tid >= 0); + + /* Create the array data type for the 64 bits signed int array */ + arrayu64_tid = H5Tarray_create2(H5T_NATIVE_ULONG, F70_ARRAY_RANK, array_dim64); + HDassert(arrayu64_tid >= 0); + + /* Create the array data type for the 32 bits double array */ + arraydbl_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F70_ARRAY_RANK, array_dim8); + HDassert(arraydbl_tid >= 0); + + /* Create the dataspace */ + space = H5Screate_simple(F70_RANK, dim, NULL); + HDassert(space >= 0); + + /* Create the file */ + fid = H5Fcreate(FILE70, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid >= 0); + + /* Create the memory data type */ + Array1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Array1Struct)); + HDassert(Array1Structid >= 0); + + /* Insert the arrays and variables into the structure */ + status = H5Tinsert(Array1Structid, F70_DATASETU08, HOFFSET(Array1Struct, dsetu8), arrayu8_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETU16, HOFFSET(Array1Struct, dsetu16), arrayu16_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETU32, HOFFSET(Array1Struct, dsetu32), arrayu32_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETU64, HOFFSET(Array1Struct, dsetu64), arrayu64_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS08, HOFFSET(Array1Struct, dset8), array8_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS16, HOFFSET(Array1Struct, dset16), array16_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS32, HOFFSET(Array1Struct, dset32), array32_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS64, HOFFSET(Array1Struct, dset64), array64_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DUMMYDBL, HOFFSET(Array1Struct, dsetdbl), arraydbl_tid); + HDassert(status >= 0); + + /* Create the dataset */ + dataset = H5Dcreate2(fid, F70_DATASETNAME, Array1Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* Write data to the dataset */ + status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Array1); + HDassert(status >= 0); + + /* Release resources */ + status = H5Tclose(Array1Structid); + HDassert(status >= 0); + + status = H5Tclose(arrayu8_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu16_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu32_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu64_tid); + HDassert(status >= 0); + + status = H5Tclose(array8_tid); + HDassert(status >= 0); + + status = H5Tclose(array16_tid); + HDassert(status >= 0); + + status = H5Tclose(array32_tid); + HDassert(status >= 0); + + status = H5Tclose(array64_tid); + HDassert(status >= 0); + + status = H5Tclose(arraydbl_tid); + HDassert(status >= 0); + + status = H5Sclose(space); + HDassert(status >= 0); + + status = H5Dclose(dataset); + HDassert(status >= 0); + + status = H5Fclose(fid); + HDassert(status >= 0); +} + +static void gent_compound_attr_intsizes(void) { + hid_t fid, attr, space, root; + hsize_t dims[2]; + hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */ + hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */ + hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */ + hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */ + hid_t arrayu8_tid; /* Array datatype handle */ + hid_t arrayu16_tid; /* Array datatype handle */ + hid_t arrayu32_tid; /* Array datatype handle */ + hid_t arrayu64_tid; /* Array datatype handle */ + hid_t array8_tid; /* Array datatype handle */ + hid_t array16_tid; /* Array datatype handle */ + hid_t array32_tid; /* Array datatype handle */ + hid_t array64_tid; /* Array datatype handle */ + hid_t arraydbl_tid; /* Array datatype handle */ + uint8_t valu8bits; + uint16_t valu16bits; + uint32_t valu32bits; + uint64_t valu64bits; + int8_t val8bits; + int16_t val16bits; + int32_t val32bits; + int64_t val64bits; + /* Structure and array for compound types */ + typedef struct Array1Struct { + uint8_t dsetu8[F70_XDIM][F70_YDIM8]; + uint16_t dsetu16[F70_XDIM][F70_YDIM16]; + uint32_t dsetu32[F70_XDIM][F70_YDIM32]; + uint64_t dsetu64[F70_XDIM][F70_YDIM64]; + int8_t dset8[F70_XDIM][F70_YDIM8]; + int16_t dset16[F70_XDIM][F70_YDIM16]; + int32_t dset32[F70_XDIM][F70_YDIM32]; + int64_t dset64[F70_XDIM][F70_YDIM64]; + double dsetdbl[F70_XDIM][F70_YDIM8]; + } Array1Struct; + Array1Struct Array1[F70_LENGTH]; + + hid_t Array1Structid; /* File datatype identifier */ + herr_t status; /* Error checking variable */ + hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */ + + int m, n, o; /* Array init loop vars */ + + /* Initialize the data in the arrays/datastructure */ + for (m = 0; m < F70_LENGTH; m++) { + + /* Array of 8 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM8; + + valu8bits = (uint8_t) ~0u; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu8[n][0] = valu8bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1; + } + valu8bits <<= 1; + } + + /* Array of 16 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM16; + + valu16bits = (uint16_t) ~0u; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu16[n][0] = valu16bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1; + } + valu16bits <<= 1; + } + + /* Array of 32 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM32; + + valu32bits = (uint32_t) ~0u; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu32[n][0] = valu32bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1; + } + valu32bits <<= 1; + } + + /* Array of 64 bits unsigned int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM64; + + valu64bits = (uint64_t) ~0Lu; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dsetu64[n][0] = valu64bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1; + } + valu64bits <<= 1; + } + + /* Array of 8 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM8; + + val8bits = (int8_t) ~0; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset8[n][0] = val8bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1; + } + val8bits <<= 1; + } + + /* Array of 16 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM16; + + val16bits = (int16_t) ~0; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset16[n][0] = val16bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1; + } + val16bits <<= 1; + } + + /* Array of 32 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM32; + + val32bits = (int32_t) ~0; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset32[n][0] = val32bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1; + } + val32bits <<= 1; + } + + /* Array of 64 bits signed int */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM64; + + val64bits = (int64_t) ~0L; /* all 1s */ + for(n = 0; n < dims[0]; n++){ + Array1[m].dset64[n][0] = val64bits; + for(o = 1; o < dims[1]; o++) { + Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1; + } + val64bits <<= 1; + } + + /* Double Dummy set for failure tests */ + dims[0] = F70_XDIM; dims[1] = F70_YDIM8; + + for(n = 0; n < dims[0]; n++) + for(o = 0; o < dims[1]; o++) + Array1[m].dsetdbl[n][o] = 0.0001 * o + n; + } + + /* Create the array data type for the 8 bits signed int array */ + array8_tid = H5Tarray_create2(H5T_NATIVE_SCHAR, F70_ARRAY_RANK, array_dim8); + HDassert(array8_tid >= 0); + + /* Create the array data type for the 16 bits signed int array */ + array16_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F70_ARRAY_RANK, array_dim16); + HDassert(array16_tid >= 0); + + /* Create the array data type for the 32 bits signed int array */ + array32_tid = H5Tarray_create2(H5T_NATIVE_INT, F70_ARRAY_RANK, array_dim32); + HDassert(array32_tid >= 0); + + /* Create the array data type for the 64 bits signed int array */ + array64_tid = H5Tarray_create2(H5T_NATIVE_LONG, F70_ARRAY_RANK, array_dim64); + HDassert(array64_tid >= 0); + + /* Create the array data type for the 8 bits signed int array */ + arrayu8_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, F70_ARRAY_RANK, array_dim8); + HDassert(arrayu8_tid >= 0); + + /* Create the array data type for the 16 bits signed int array */ + arrayu16_tid = H5Tarray_create2(H5T_NATIVE_USHORT, F70_ARRAY_RANK, array_dim16); + HDassert(arrayu16_tid >= 0); + + /* Create the array data type for the 32 bits signed int array */ + arrayu32_tid = H5Tarray_create2(H5T_NATIVE_UINT, F70_ARRAY_RANK, array_dim32); + HDassert(arrayu32_tid >= 0); + + /* Create the array data type for the 64 bits signed int array */ + arrayu64_tid = H5Tarray_create2(H5T_NATIVE_ULONG, F70_ARRAY_RANK, array_dim64); + HDassert(arrayu64_tid >= 0); + + /* Create the array data type for the 32 bits double array */ + arraydbl_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F70_ARRAY_RANK, array_dim8); + HDassert(arraydbl_tid >= 0); + + /* Create the dataspace */ + space = H5Screate_simple(F70_RANK, dim, NULL); + HDassert(space >= 0); + + /* Create the file */ + fid = H5Fcreate(FILE71, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid >= 0); + + /* Create the memory data type */ + Array1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Array1Struct)); + HDassert(Array1Structid >= 0); + + /* Insert the arrays and variables into the structure */ + status = H5Tinsert(Array1Structid, F70_DATASETU08, HOFFSET(Array1Struct, dsetu8), arrayu8_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETU16, HOFFSET(Array1Struct, dsetu16), arrayu16_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETU32, HOFFSET(Array1Struct, dsetu32), arrayu32_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETU64, HOFFSET(Array1Struct, dsetu64), arrayu64_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS08, HOFFSET(Array1Struct, dset8), array8_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS16, HOFFSET(Array1Struct, dset16), array16_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS32, HOFFSET(Array1Struct, dset32), array32_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DATASETS64, HOFFSET(Array1Struct, dset64), array64_tid); + HDassert(status >= 0); + + status = H5Tinsert(Array1Structid, F70_DUMMYDBL, HOFFSET(Array1Struct, dsetdbl), arraydbl_tid); + HDassert(status >= 0); + + root = H5Gopen2(fid, "/", H5P_DEFAULT); + + /* Create the Attribute */ + attr = H5Acreate2(root, F71_DATASETNAME, Array1Structid, space, H5P_DEFAULT, H5P_DEFAULT); + + /* Write data to the attribute */ + status = H5Awrite(attr, Array1Structid, Array1); + HDassert(status >= 0); + + status = H5Tclose(arrayu8_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu16_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu32_tid); + HDassert(status >= 0); + + status = H5Tclose(arrayu64_tid); + HDassert(status >= 0); + + status = H5Tclose(array8_tid); + HDassert(status >= 0); + + status = H5Tclose(array16_tid); + HDassert(status >= 0); + + status = H5Tclose(array32_tid); + HDassert(status >= 0); + + status = H5Tclose(array64_tid); + HDassert(status >= 0); + + status = H5Tclose(arraydbl_tid); + HDassert(status >= 0); + + /* Release resources */ + status = H5Tclose(Array1Structid); + HDassert(status >= 0); + + status = H5Sclose(space); + HDassert(status >= 0); + + status = H5Aclose(attr); + HDassert(status >= 0); + + status = H5Fclose(fid); + HDassert(status >= 0); +} + + +/*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- @@ -7303,6 +8119,10 @@ int main(void) gent_fs_strategy_threshold(); gent_packedbits(); gent_dataset_idx(); + gent_attr_intsize(); + gent_charsets(); + gent_compound_intsizes(); + gent_compound_attr_intsizes(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 4db9d5b..3bd0dfd 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -75,6 +75,7 @@ test -d $TESTDIR || mkdir $TESTDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_HDF5_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/charsets.h5 $SRC_H5DUMP_TESTFILES/file_space.h5 $SRC_H5DUMP_TESTFILES/filter_fail.h5 $SRC_H5DUMP_TESTFILES/packedbits.h5 @@ -92,10 +93,13 @@ $SRC_H5DUMP_TESTFILES/tarray8.h5 $SRC_H5DUMP_TESTFILES/tattr.h5 $SRC_H5DUMP_TESTFILES/tattr2.h5 $SRC_H5DUMP_TESTFILES/tattr4_be.h5 +$SRC_H5DUMP_TESTFILES/tattrintsize.h5 $SRC_H5DUMP_TESTFILES/tattrreg.h5 $SRC_H5DUMP_TESTFILES/tbigdims.h5 $SRC_H5DUMP_TESTFILES/tbinary.h5 $SRC_H5DUMP_TESTFILES/tchar.h5 +$SRC_H5DUMP_TESTFILES/tcmpdattrintsize.h5 +$SRC_H5DUMP_TESTFILES/tcmpdintsize.h5 $SRC_H5DUMP_TESTFILES/tcompound.h5 $SRC_H5DUMP_TESTFILES/tcompound_complex.h5 $SRC_H5DUMP_TESTFILES/tdatareg.h5 @@ -161,6 +165,7 @@ $SRC_H5DUMP_TESTFILES/tvms.h5 " LIST_OTHER_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/charsets.ddl $SRC_H5DUMP_TESTFILES/file_space.ddl $SRC_H5DUMP_TESTFILES/filter_fail.ddl $SRC_H5DUMP_TESTFILES/packedbits.ddl @@ -186,6 +191,7 @@ $SRC_H5DUMP_TESTFILES/tattr-1.ddl $SRC_H5DUMP_TESTFILES/tattr-2.ddl $SRC_H5DUMP_TESTFILES/tattr-3.ddl $SRC_H5DUMP_TESTFILES/tattr-4_be.ddl +$SRC_H5DUMP_TESTFILES/tattrintsize.ddl $SRC_H5DUMP_TESTFILES/tattrreg.ddl $SRC_H5DUMP_TESTFILES/tattrregR.ddl $SRC_H5DUMP_TESTFILES/tbin1.ddl @@ -199,6 +205,8 @@ $SRC_H5DUMP_TESTFILES/tboot1.ddl $SRC_H5DUMP_TESTFILES/tboot2.ddl $SRC_H5DUMP_TESTFILES/tchar1.ddl $SRC_H5DUMP_TESTFILES/tchunked.ddl +$SRC_H5DUMP_TESTFILES/tcmpdattrintsize.ddl +$SRC_H5DUMP_TESTFILES/tcmpdintsize.ddl $SRC_H5DUMP_TESTFILES/tcomp-1.ddl $SRC_H5DUMP_TESTFILES/tcomp-2.ddl $SRC_H5DUMP_TESTFILES/tcomp-3.ddl @@ -290,152 +298,9 @@ $SRC_H5DUMP_TESTFILES/tvlstr.ddl $SRC_H5DUMP_TESTFILES/tvms.ddl $SRC_H5DUMP_TESTFILES/h5dump-help.txt $SRC_H5DUMP_TESTFILES/out3.h5import -$SRC_H5DUMP_TESTFILES/tnofilename-with-packed-bits.ddl -$SRC_H5DUMP_TESTFILES/tpbitsArray.ddl -$SRC_H5DUMP_TESTFILES/tpbitsCompound.ddl -$SRC_H5DUMP_TESTFILES/tpbitsIncomplete.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsCharLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsIntLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLongLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLengthPositive.ddl -$SRC_H5DUMP_TESTFILES/tpbitsMax.ddl -$SRC_H5DUMP_TESTFILES/tpbitsMaxExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsCharOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsIntOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLongOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsOffsetNegative.ddl -$SRC_H5DUMP_TESTFILES/tpbitsOverlapped.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSigned.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsigned.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedInt.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedIntWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedIntWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole1.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole1.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole63.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole63.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSigned4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsigned4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedInt8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLong16.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong16.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong32.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong32.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSigned2.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsigned2.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedInt4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLong8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong16.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong16.ddl $SRC_H5DUMP_TESTFILES/tbinregR.exp " -LIST_HDF5_TEST_FILES_XML=" -$SRC_H5DUMP_TESTFILES/tbitfields.h5 -$SRC_H5DUMP_TESTFILES/tcompound2.h5 -$SRC_H5DUMP_TESTFILES/tdset2.h5 -$SRC_H5DUMP_TESTFILES/tenum.h5 -$SRC_H5DUMP_TESTFILES/textlink.h5 -$SRC_H5DUMP_TESTFILES/tloop2.h5 -$SRC_H5DUMP_TESTFILES/tmany.h5 -$SRC_H5DUMP_TESTFILES/tname-amp.h5 -$SRC_H5DUMP_TESTFILES/tname-apos.h5 -$SRC_H5DUMP_TESTFILES/tname-gt.h5 -$SRC_H5DUMP_TESTFILES/tname-lt.h5 -$SRC_H5DUMP_TESTFILES/tname-quot.h5 -$SRC_H5DUMP_TESTFILES/tname-sp.h5 -$SRC_H5DUMP_TESTFILES/tnodata.h5 -$SRC_H5DUMP_TESTFILES/tobjref.h5 -$SRC_H5DUMP_TESTFILES/topaque.h5 -$SRC_H5DUMP_TESTFILES/tref.h5 -$SRC_H5DUMP_TESTFILES/tref-escapes.h5 -$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5 -$SRC_H5DUMP_TESTFILES/tstring.h5 -$SRC_H5DUMP_TESTFILES/tstring-at.h5 -" - -LIST_OTHER_TEST_FILES_XML=" -$SRC_H5DUMP_TESTFILES/tall.h5.xml -$SRC_H5DUMP_TESTFILES/tall-2A.h5.xml -$SRC_H5DUMP_TESTFILES/tarray1.h5.xml -$SRC_H5DUMP_TESTFILES/tarray2.h5.xml -$SRC_H5DUMP_TESTFILES/tarray3.h5.xml -$SRC_H5DUMP_TESTFILES/tarray6.h5.xml -$SRC_H5DUMP_TESTFILES/tarray7.h5.xml -$SRC_H5DUMP_TESTFILES/tattr.h5.xml -$SRC_H5DUMP_TESTFILES/tbitfields.h5.xml -$SRC_H5DUMP_TESTFILES/tcompound_complex.h5.xml -$SRC_H5DUMP_TESTFILES/tcompound.h5.xml -$SRC_H5DUMP_TESTFILES/tcompound2.h5.xml -$SRC_H5DUMP_TESTFILES/tdatareg.h5.xml -$SRC_H5DUMP_TESTFILES/tdset.h5.xml -$SRC_H5DUMP_TESTFILES/tdset2.h5.xml -$SRC_H5DUMP_TESTFILES/tempty.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-dtd.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-dtd-2.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-dtd-uri.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-nons.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-nons-2.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-nons-uri.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-ns.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-ns-2.h5.xml -$SRC_H5DUMP_TESTFILES/tenum.h5.xml -$SRC_H5DUMP_TESTFILES/textlink.h5.xml -$SRC_H5DUMP_TESTFILES/tfpformat.h5.xml -$SRC_H5DUMP_TESTFILES/tgroup.h5.xml -$SRC_H5DUMP_TESTFILES/thlink.h5.xml -$SRC_H5DUMP_TESTFILES/tloop.h5.xml -$SRC_H5DUMP_TESTFILES/tloop2.h5.xml -$SRC_H5DUMP_TESTFILES/tmany.h5.xml -$SRC_H5DUMP_TESTFILES/tname-amp.h5.xml -$SRC_H5DUMP_TESTFILES/tname-apos.h5.xml -$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5.xml -$SRC_H5DUMP_TESTFILES/tname-gt.h5.xml -$SRC_H5DUMP_TESTFILES/tname-lt.h5.xml -$SRC_H5DUMP_TESTFILES/tname-quot.h5.xml -$SRC_H5DUMP_TESTFILES/tname-sp.h5.xml -$SRC_H5DUMP_TESTFILES/tnestedcomp.h5.xml -$SRC_H5DUMP_TESTFILES/tnodata.h5.xml -$SRC_H5DUMP_TESTFILES/tobjref.h5.xml -$SRC_H5DUMP_TESTFILES/topaque.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr1.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr2.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr3.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr4.h5.xml -$SRC_H5DUMP_TESTFILES/tref.h5.xml -$SRC_H5DUMP_TESTFILES/tref-escapes.h5.xml -$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5.xml -$SRC_H5DUMP_TESTFILES/tsaf.h5.xml -$SRC_H5DUMP_TESTFILES/tslink.h5.xml -$SRC_H5DUMP_TESTFILES/tstr.h5.xml -$SRC_H5DUMP_TESTFILES/tstr2.h5.xml -$SRC_H5DUMP_TESTFILES/tstring.h5.xml -$SRC_H5DUMP_TESTFILES/tstring-at.h5.xml -$SRC_H5DUMP_TESTFILES/tudlink.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes1.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes2.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes3.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes4.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes5.h5.xml -$SRC_H5DUMP_TESTFILES/tvlstr.h5.xml -" - # # copy test files and expected output files from source dirs to test dir # @@ -709,6 +574,12 @@ COPY_TESTFILES_TO_TESTDIR # test for signed/unsigned datasets TOOLTEST packedbits.ddl --enable-error-stack packedbits.h5 +# test for compound signed/unsigned datasets +TOOLTEST tcmpdintsize.ddl --enable-error-stack tcmpdintsize.h5 +# test for signed/unsigned attributes +TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5 +# test for compound signed/unsigned attributes +TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5 # test for displaying groups TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5 # test for displaying the selected groups @@ -834,6 +705,9 @@ TOOLTEST tno-subset.ddl --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] # test printing characters in ASCII instead of decimal TOOLTEST tchar1.ddl --enable-error-stack -r tchar.h5 +# test datatypes in ASCII and UTF8 +TOOLTEST charsets.ddl --enable-error-stack charsets.h5 + # rev. 2004 # tests for super block @@ -1042,90 +916,6 @@ TOOLTEST3 filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes TOOLTEST tall-6.ddl --enable-error-stack -y -o data -d /g1/g1.1/dset1.1.1 tall.h5 -####### test for dataset packed bits ###### - -# test failure handling -# Missing file name -TOOLTEST tnofilename-with-packed-bits.ddl --enable-error-stack -# Limits: -# Maximum number of packed bits is 8 (for now). -# Maximum integer size is 64 (for now). -# Maximun Offset is 63 (Maximum size - 1). -# Maximum Offset+Length is 64 (Maximum size). -# Tests: -# Normal operation on both signed and unsigned int datasets. -# Sanity check -# Their rawdata output should be the same. -TOOLTEST tpbitsSignedWhole.ddl --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5 -TOOLTEST tpbitsUnsignedWhole.ddl --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5 -TOOLTEST tpbitsSignedIntWhole.ddl --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5 -TOOLTEST tpbitsUnsignedIntWhole.ddl --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5 -TOOLTEST tpbitsSignedLongWhole.ddl --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5 -TOOLTEST tpbitsUnsignedLongWhole.ddl --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole.ddl --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole.ddl --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole63.ddl --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole63.ddl --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole1.ddl --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole1.ddl --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5 -# Half sections -TOOLTEST tpbitsSigned4.ddl --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5 -TOOLTEST tpbitsUnsigned4.ddl --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5 -TOOLTEST tpbitsSignedInt8.ddl --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5 -TOOLTEST tpbitsUnsignedInt8.ddl --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5 -TOOLTEST tpbitsSignedLong16.ddl --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5 -TOOLTEST tpbitsUnsignedLong16.ddl --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5 -TOOLTEST tpbitsSignedLongLong32.ddl --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong32.ddl --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5 -# Quarter sections -TOOLTEST tpbitsSigned2.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 -TOOLTEST tpbitsUnsigned2.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 -TOOLTEST tpbitsSignedInt4.ddl --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 -TOOLTEST tpbitsUnsignedInt4.ddl --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 -TOOLTEST tpbitsSignedLong8.ddl --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 -TOOLTEST tpbitsUnsignedLong8.ddl --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 -TOOLTEST tpbitsSignedLongLong16.ddl --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong16.ddl --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 -# Begin and End -TOOLTEST tpbitsSigned.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5 -TOOLTEST tpbitsUnsigned.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5 -TOOLTEST tpbitsSignedInt.ddl --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5 -TOOLTEST tpbitsUnsignedInt.ddl --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5 -TOOLTEST tpbitsSignedLong.ddl --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5 -TOOLTEST tpbitsUnsignedLong.ddl --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5 -TOOLTEST tpbitsSignedLongLong.ddl --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong.ddl --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5 -# Overlapped packed bits. -TOOLTEST tpbitsOverlapped.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5 -# Maximum number of packed bits. -TOOLTEST tpbitsMax.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 -# Compound type. -TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5 -# Array type. -TOOLTEST tpbitsArray.ddl --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5 -# Test Error handling. -# Too many packed bits requested. Max is 8 for now. -TOOLTEST tpbitsMaxExceeded.ddl --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 -# Offset too large. Max is 7 (8-1) for now. -TOOLTEST tpbitsOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5 -TOOLTEST tpbitsCharOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5 -TOOLTEST tpbitsIntOffsetExceeded.ddl --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5 -TOOLTEST tpbitsLongOffsetExceeded.ddl --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5 -# Bad offset, must not be negative. -TOOLTEST tpbitsOffsetNegative.ddl --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5 -# Bad length, must not be positive. -TOOLTEST tpbitsLengthPositive.ddl --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5 -# Offset+Length is too large. Max is 8 for now. -TOOLTEST tpbitsLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5 -TOOLTEST tpbitsCharLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5 -TOOLTEST tpbitsIntLengthExceeded.ddl --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5 -TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5 -# Incomplete pair of packed bits request. -TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5 - - -# tests for Fixed Array chunk indices -TOOLTEST tdset_idx.ddl -p -H tdset_idx.h5 # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/tools/h5dump/testh5dumppbits.sh.in b/tools/h5dump/testh5dumppbits.sh.in new file mode 100644 index 0000000..393fcc1 --- /dev/null +++ b/tools/h5dump/testh5dumppbits.sh.in @@ -0,0 +1,495 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# Tests for the h5dump tool with packed bits type files + +# Determine which filters are available +USE_FILTER_SZIP="@USE_FILTER_SZIP@" +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" +USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@" +USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" +USE_FILTER_NBIT="@USE_FILTER_NBIT@" +USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" + +TESTNAME=h5dump +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +DUMPER=h5dump # The tool name +DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary + +H5DIFF=../h5diff/h5diff # The h5diff tool name +H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary + +H5IMPORT=../h5import/h5import # The h5import tool name +H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary + + +CMP='cmp -s' +DIFF='diff -c' +CP='cp' + +nerrors=0 +verbose=yes + +# The build (current) directory might be different than the source directory. +if test -z "$srcdir"; then + srcdir=. +fi +# source dirs +SRC_TOOLS="$srcdir/../" + +SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" +# testfiles source dirs for tools +SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles" +SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles" +SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" +SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles" +SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles" +SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles" + +TESTDIR=./testfiles +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/packedbits.h5 +" + +LIST_OTHER_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/tnofilename-with-packed-bits.ddl +$SRC_H5DUMP_TESTFILES/tpbitsArray.ddl +$SRC_H5DUMP_TESTFILES/tpbitsCompound.ddl +$SRC_H5DUMP_TESTFILES/tpbitsIncomplete.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsCharLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsIntLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLongLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLengthPositive.ddl +$SRC_H5DUMP_TESTFILES/tpbitsMax.ddl +$SRC_H5DUMP_TESTFILES/tpbitsMaxExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsCharOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsIntOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLongOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsOffsetNegative.ddl +$SRC_H5DUMP_TESTFILES/tpbitsOverlapped.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSigned.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsigned.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedInt.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedIntWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedIntWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole1.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole1.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole63.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole63.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSigned4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsigned4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedInt8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLong16.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong16.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong32.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong32.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSigned2.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsigned2.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedInt4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLong8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong16.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong16.ddl +" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + if [ -a $tstfile ]; then + $CP -f $tstfile $TESTDIR + else + echo "Error: FAILED to copy $tstfile" + echo " $tstfile doesn't exist!" + exit $EXIT_FAILURE + fi + fi + done +} + + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Source in the output filter function definitions. +. $srcdir/../../bin/output_filter.sh + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output is given as the first argument to this function and +# 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. +# +TOOLTEST() { + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; 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/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + fi + +} + + +# same as TOOLTEST1 but compares generated file to expected output +# and compares the generated data file to the expected data file +# used for the binary tests that expect a full path in -o without -b +TOOLTEST2() { + + expectdata="$TESTDIR/$1" + expect="$TESTDIR/`basename $1 .exp`.ddl" + actualdata="$TESTDIR/`basename $1 .exp`.txt" + actual="$TESTDIR/`basename $1 .exp`.out" + actual_err="$TESTDIR/`basename $1 .exp`.err" + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + elif $CMP $expectdata $actualdata; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + fi + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actualdata $actual_err + fi + +} + +# same as TOOLTEST but filters error stack outp +# Extract file name, line number, version and thread IDs because they may be different +TOOLTEST3() { + + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_ext="$TESTDIR/`basename $1 .ddl`.ext" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + + # Extract file name, line number, version and thread IDs because they may be different + sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ + -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ + $actual_err > $actual_ext + cat $actual_ext >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; 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/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav + fi + +} + +# Print a "SKIP" message +SKIP() { + TESTING $DUMPER $@ + echo " -SKIP-" +} + +# Print a line-line message left justified in a field of 70 characters +# +PRINT_H5DIFF() { + SPACES=" " + echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' +} + + +# Call the h5diff tool +# +DIFFTEST() +{ + PRINT_H5DIFF $@ + ( + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN "$@" -q + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Verifying". +# +PRINT_H5IMPORT() { + SPACES=" " + echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Call the h5import tool +# +IMPORTTEST() +{ + # remove the output hdf5 file if it exists + hdf5_file="$TESTDIR/$5" + if [ -f $hdf5_file ]; then + rm -f $hdf5_file + fi + + PRINT_H5IMPORT $@ + ( + cd $TESTDIR + $RUNSERIAL $H5IMPORT_BIN "$@" + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + +} + + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## +# prepare for test +COPY_TESTFILES_TO_TESTDIR + +####### test for dataset packed bits ###### + +# test failure handling +# Missing file name +TOOLTEST tnofilename-with-packed-bits.ddl --enable-error-stack +# Limits: +# Maximum number of packed bits is 8 (for now). +# Maximum integer size is 64 (for now). +# Maximun Offset is 63 (Maximum size - 1). +# Maximum Offset+Length is 64 (Maximum size). +# Tests: +# Normal operation on both signed and unsigned int datasets. +# Sanity check +# Their rawdata output should be the same. +TOOLTEST tpbitsSignedWhole.ddl --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5 +TOOLTEST tpbitsUnsignedWhole.ddl --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5 +TOOLTEST tpbitsSignedIntWhole.ddl --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5 +TOOLTEST tpbitsUnsignedIntWhole.ddl --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5 +TOOLTEST tpbitsSignedLongWhole.ddl --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5 +TOOLTEST tpbitsUnsignedLongWhole.ddl --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole.ddl --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole.ddl --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole63.ddl --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole63.ddl --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole1.ddl --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole1.ddl --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5 +# Half sections +TOOLTEST tpbitsSigned4.ddl --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5 +TOOLTEST tpbitsUnsigned4.ddl --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5 +TOOLTEST tpbitsSignedInt8.ddl --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5 +TOOLTEST tpbitsUnsignedInt8.ddl --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5 +TOOLTEST tpbitsSignedLong16.ddl --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5 +TOOLTEST tpbitsUnsignedLong16.ddl --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5 +TOOLTEST tpbitsSignedLongLong32.ddl --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong32.ddl --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5 +# Quarter sections +TOOLTEST tpbitsSigned2.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 +TOOLTEST tpbitsUnsigned2.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 +TOOLTEST tpbitsSignedInt4.ddl --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 +TOOLTEST tpbitsUnsignedInt4.ddl --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 +TOOLTEST tpbitsSignedLong8.ddl --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 +TOOLTEST tpbitsUnsignedLong8.ddl --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 +TOOLTEST tpbitsSignedLongLong16.ddl --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong16.ddl --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 +# Begin and End +TOOLTEST tpbitsSigned.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5 +TOOLTEST tpbitsUnsigned.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5 +TOOLTEST tpbitsSignedInt.ddl --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5 +TOOLTEST tpbitsUnsignedInt.ddl --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5 +TOOLTEST tpbitsSignedLong.ddl --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5 +TOOLTEST tpbitsUnsignedLong.ddl --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5 +TOOLTEST tpbitsSignedLongLong.ddl --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong.ddl --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5 +# Overlapped packed bits. +TOOLTEST tpbitsOverlapped.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5 +# Maximum number of packed bits. +TOOLTEST tpbitsMax.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 +# Compound type. +TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5 +# Array type. +TOOLTEST tpbitsArray.ddl --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5 +# Test Error handling. +# Too many packed bits requested. Max is 8 for now. +TOOLTEST tpbitsMaxExceeded.ddl --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 +# Offset too large. Max is 7 (8-1) for now. +TOOLTEST tpbitsOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5 +TOOLTEST tpbitsCharOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5 +TOOLTEST tpbitsIntOffsetExceeded.ddl --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5 +TOOLTEST tpbitsLongOffsetExceeded.ddl --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5 +# Bad offset, must not be negative. +TOOLTEST tpbitsOffsetNegative.ddl --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5 +# Bad length, must not be positive. +TOOLTEST tpbitsLengthPositive.ddl --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5 +# Offset+Length is too large. Max is 8 for now. +TOOLTEST tpbitsLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5 +TOOLTEST tpbitsCharLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5 +TOOLTEST tpbitsIntLengthExceeded.ddl --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5 +TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5 +# Incomplete pair of packed bits request. +TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5 + + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 1bbf232..4e6081b 100644 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -26,6 +26,7 @@ DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary CMP='cmp -s' DIFF='diff -c' +CP='cp' nerrors=0 verbose=yes @@ -34,8 +35,176 @@ verbose=yes if test -z "$srcdir"; then srcdir=. fi +# source dirs +SRC_TOOLS="$srcdir/../" -test -d ../testfiles || mkdir ../testfiles +SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" +# testfiles source dirs for tools +SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles" +SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles" +SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" +SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles" +SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles" +SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles" + +TESTDIR=./testfiles +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES_XML=" +$SRC_H5DUMP_TESTFILES/tall.h5 +$SRC_H5DUMP_TESTFILES/tarray1.h5 +$SRC_H5DUMP_TESTFILES/tarray2.h5 +$SRC_H5DUMP_TESTFILES/tarray3.h5 +$SRC_H5DUMP_TESTFILES/tarray6.h5 +$SRC_H5DUMP_TESTFILES/tarray7.h5 +$SRC_H5DUMP_TESTFILES/tattr.h5 +$SRC_H5DUMP_TESTFILES/tbitfields.h5 +$SRC_H5DUMP_TESTFILES/tcompound.h5 +$SRC_H5DUMP_TESTFILES/tcompound2.h5 +$SRC_H5DUMP_TESTFILES/tcompound_complex.h5 +$SRC_H5DUMP_TESTFILES/tdatareg.h5 +$SRC_H5DUMP_TESTFILES/tdset.h5 +$SRC_H5DUMP_TESTFILES/tdset2.h5 +$SRC_H5DUMP_TESTFILES/tempty.h5 +$SRC_H5DUMP_TESTFILES/tenum.h5 +$SRC_H5DUMP_TESTFILES/textlink.h5 +$SRC_H5DUMP_TESTFILES/tfpformat.h5 +$SRC_H5DUMP_TESTFILES/tgroup.h5 +$SRC_H5DUMP_TESTFILES/thlink.h5 +$SRC_H5DUMP_TESTFILES/tloop.h5 +$SRC_H5DUMP_TESTFILES/tloop2.h5 +$SRC_H5DUMP_TESTFILES/tmany.h5 +$SRC_H5DUMP_TESTFILES/tname-amp.h5 +$SRC_H5DUMP_TESTFILES/tname-apos.h5 +$SRC_H5DUMP_TESTFILES/tname-gt.h5 +$SRC_H5DUMP_TESTFILES/tname-lt.h5 +$SRC_H5DUMP_TESTFILES/tname-quot.h5 +$SRC_H5DUMP_TESTFILES/tname-sp.h5 +$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5 +$SRC_H5DUMP_TESTFILES/tnestedcomp.h5 +$SRC_H5DUMP_TESTFILES/tnodata.h5 +$SRC_H5DUMP_TESTFILES/tobjref.h5 +$SRC_H5DUMP_TESTFILES/topaque.h5 +$SRC_H5DUMP_TESTFILES/torderattr.h5 +$SRC_H5DUMP_TESTFILES/tref.h5 +$SRC_H5DUMP_TESTFILES/tref-escapes.h5 +$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5 +$SRC_H5DUMP_TESTFILES/tsaf.h5 +$SRC_H5DUMP_TESTFILES/tslink.h5 +$SRC_H5DUMP_TESTFILES/tstring.h5 +$SRC_H5DUMP_TESTFILES/tstring-at.h5 +$SRC_H5DUMP_TESTFILES/tstr.h5 +$SRC_H5DUMP_TESTFILES/tstr2.h5 +$SRC_H5DUMP_TESTFILES/tudlink.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes1.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes2.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes3.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes4.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes5.h5 +$SRC_H5DUMP_TESTFILES/tvlstr.h5 +" + +LIST_OTHER_TEST_FILES_XML=" +$SRC_H5DUMP_TESTFILES/tall.h5.xml +$SRC_H5DUMP_TESTFILES/tall-2A.h5.xml +$SRC_H5DUMP_TESTFILES/tarray1.h5.xml +$SRC_H5DUMP_TESTFILES/tarray2.h5.xml +$SRC_H5DUMP_TESTFILES/tarray3.h5.xml +$SRC_H5DUMP_TESTFILES/tarray6.h5.xml +$SRC_H5DUMP_TESTFILES/tarray7.h5.xml +$SRC_H5DUMP_TESTFILES/tattr.h5.xml +$SRC_H5DUMP_TESTFILES/tbitfields.h5.xml +$SRC_H5DUMP_TESTFILES/tcompound_complex.h5.xml +$SRC_H5DUMP_TESTFILES/tcompound.h5.xml +$SRC_H5DUMP_TESTFILES/tcompound2.h5.xml +$SRC_H5DUMP_TESTFILES/tdatareg.h5.xml +$SRC_H5DUMP_TESTFILES/tdset.h5.xml +$SRC_H5DUMP_TESTFILES/tdset2.h5.xml +$SRC_H5DUMP_TESTFILES/tempty.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-dtd.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-dtd-2.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-dtd-uri.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-nons.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-nons-2.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-nons-uri.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-ns.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-ns-2.h5.xml +$SRC_H5DUMP_TESTFILES/tenum.h5.xml +$SRC_H5DUMP_TESTFILES/textlink.h5.xml +$SRC_H5DUMP_TESTFILES/tfpformat.h5.xml +$SRC_H5DUMP_TESTFILES/tgroup.h5.xml +$SRC_H5DUMP_TESTFILES/thlink.h5.xml +$SRC_H5DUMP_TESTFILES/tloop.h5.xml +$SRC_H5DUMP_TESTFILES/tloop2.h5.xml +$SRC_H5DUMP_TESTFILES/tmany.h5.xml +$SRC_H5DUMP_TESTFILES/tname-amp.h5.xml +$SRC_H5DUMP_TESTFILES/tname-apos.h5.xml +$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5.xml +$SRC_H5DUMP_TESTFILES/tname-gt.h5.xml +$SRC_H5DUMP_TESTFILES/tname-lt.h5.xml +$SRC_H5DUMP_TESTFILES/tname-quot.h5.xml +$SRC_H5DUMP_TESTFILES/tname-sp.h5.xml +$SRC_H5DUMP_TESTFILES/tnestedcomp.h5.xml +$SRC_H5DUMP_TESTFILES/tnodata.h5.xml +$SRC_H5DUMP_TESTFILES/tobjref.h5.xml +$SRC_H5DUMP_TESTFILES/topaque.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr1.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr2.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr3.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr4.h5.xml +$SRC_H5DUMP_TESTFILES/tref.h5.xml +$SRC_H5DUMP_TESTFILES/tref-escapes.h5.xml +$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5.xml +$SRC_H5DUMP_TESTFILES/tsaf.h5.xml +$SRC_H5DUMP_TESTFILES/tslink.h5.xml +$SRC_H5DUMP_TESTFILES/tstr.h5.xml +$SRC_H5DUMP_TESTFILES/tstr2.h5.xml +$SRC_H5DUMP_TESTFILES/tstring.h5.xml +$SRC_H5DUMP_TESTFILES/tstring-at.h5.xml +$SRC_H5DUMP_TESTFILES/tudlink.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes1.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes2.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes3.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes4.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes5.h5.xml +$SRC_H5DUMP_TESTFILES/tvlstr.h5.xml +" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + if [ -a $tstfile ]; then + $CP -f $tstfile $TESTDIR + else + echo "Error: FAILED to copy $tstfile" + echo " $tstfile doesn't exist!" + exit $EXIT_FAILURE + fi + fi + done +} # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". |