diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-07-05 20:06:56 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-07-05 20:06:56 (GMT) |
commit | 434466e58ee41fc1cec5a184bc746ad88883e30a (patch) | |
tree | 15162a9edf1a44690cc107483accfb5aca4ebd6f /tools/h5dump | |
parent | 029ac0e3c8506de80b6fb86e6f1cc35f837e7b18 (diff) | |
download | hdf5-434466e58ee41fc1cec5a184bc746ad88883e30a.zip hdf5-434466e58ee41fc1cec5a184bc746ad88883e30a.tar.gz hdf5-434466e58ee41fc1cec5a184bc746ad88883e30a.tar.bz2 |
[svn-r22517] HDFFV-7782: h5import testfiles duplicated to match testname. (Consistent naming)
Tested: local linux using CMake
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 18 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 794 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 12 |
3 files changed, 812 insertions, 12 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 8ef2927..9fd35d5 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -65,6 +65,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 +82,8 @@ IF (BUILD_TESTING) tboot2.ddl tchar1.ddl tchunked.ddl + tcmpdattrintsize.ddl + tcmpdintsize.ddl tcomp-1.ddl tcomp-2.ddl tcomp-3.ddl @@ -256,10 +259,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 @@ -726,6 +732,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 +750,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 +943,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 diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 98700b0..dc8efa7 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -98,9 +98,9 @@ #define FILE66 "packedbits.h5" #define FILE67 "zerodim.h5" #define FILE68 "charsets.h5" - - - +#define FILE69 "tattrintsize.h5" +#define FILE70 "tcmpdintsize.h5" +#define FILE71 "tcmpdattrintsize.h5" /*------------------------------------------------------------------------- * prototypes @@ -252,21 +252,44 @@ typedef struct s1_t { #define F64_ARRAY_BUF_LEN (4*1024) #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) -/* "FILE66" macros */ -#define F66_XDIM 8 +/* "FILE66" macros and for FILE69 */ +#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" + +/* "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) @@ -6910,8 +6933,8 @@ gent_extlinks(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. @@ -6983,7 +7006,7 @@ gent_packedbits(void) 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); @@ -7097,6 +7120,198 @@ 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 @@ -7143,6 +7358,558 @@ gent_charsets(void) 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 @@ -7219,7 +7986,10 @@ int main(void) gent_fpformat(); gent_extlinks(); gent_packedbits(); + 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 9dcd5da..fe78693 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -92,10 +92,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 @@ -186,6 +189,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 +203,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 @@ -566,6 +572,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 |