Merge pull request #636 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop

* commit '3dcb1887085678f08c02b64f1a04a77cd607cc4c':
  HDFFV-10188 fix typo
  HDFFV-10188 add missing copy commands
  HDFFV-10188 Add tests and files
  HDFFV-10188 enable null space test
  HDFFV-10188 add release note
  HDFFV-10188 - Check for empty string first
  HDFFV-10188 error on NULL dataspace
This commit is contained in:
Allen Byrne 2017-08-22 15:29:35 -05:00
commit b901326501
16 changed files with 221 additions and 60 deletions

View File

@ -1712,6 +1712,9 @@
./tools/testfiles/tgrp_comments.ls
./tools/testfiles/tgrp_comments.ddl
./tools/testfiles/tgrp_comments.h5
./tools/testfiles/tgrpnullspace.h5
./tools/testfiles/tgrpnullspace.ddl
./tools/testfiles/tgrpnullspace.ls
./tools/testfiles/thlink-1.ddl
./tools/testfiles/thlink-2.ddl
./tools/testfiles/thlink-3.ddl
@ -1767,6 +1770,7 @@
./tools/testfiles/tno-subset.h5
./tools/testfiles/tno-subset.ddl
./tools/testfiles/tnullspace.h5
./tools/testfiles/tnullspace.h5.xml
./tools/testfiles/tnullspace.ddl
./tools/testfiles/tobjref.h5
./tools/testfiles/topaque.h5

View File

@ -147,6 +147,16 @@ Bug Fixes since HDF5-1.10.1 release
Tools
-----
- h5ls
h5ls generated error on stack when it encountered a H5S_NULL
dataspace.
Adding checks for H5S_NULL before calling H5Sis_simple (located
in the h5tools_dump_mem function) fixed the issue.
(ADB - 2017/08/17, HDFFV-10188)
- h5dump
h5dump segfaulted on output of XML file.

View File

@ -164,7 +164,8 @@ haddr_t
ref_path_table_lookup(const char *thepath)
{
H5O_info_t oi;
if((HDstrlen(thepath) == 0) || (thepath == NULL))
return HADDR_UNDEF;
/* Allow lookups on the root group, even though it doesn't have any link info */
if(HDstrcmp(thepath, "/")) {
H5L_info_t li;

View File

@ -1959,28 +1959,32 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
H5Tclose(type);
space = H5Aget_space(obj_id);
ndims = H5Sget_simple_extent_dims(space, size, NULL);
for (i = 0; i < ndims; i++)
nelmts *= size[i];
buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
HDassert(buf);
if (H5Aread(obj_id, p_type, buf) >= 0) {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
datactx.need_prefix = TRUE;
datactx.indent_level = ctx.indent_level;
datactx.cur_column = ctx.cur_column;
status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
if(space == H5S_NULL || space == H5S_NO_CLASS) {
status = SUCCEED;
}
/* Reclaim any VL memory, if necessary */
if (vl_data)
H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
else {
ndims = H5Sget_simple_extent_dims(space, size, NULL);
HDfree(buf);
for (i = 0; i < ndims; i++)
nelmts *= size[i];
buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
HDassert(buf);
if (H5Aread(obj_id, p_type, buf) >= 0) {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
datactx.need_prefix = TRUE;
datactx.indent_level = ctx.indent_level;
datactx.cur_column = ctx.cur_column;
status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
}
/* Reclaim any VL memory, if necessary */
if (vl_data)
H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
HDfree(buf);
}
H5Tclose(p_type);
H5Sclose(space);
H5Tclose(type);

View File

@ -1617,38 +1617,40 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
info = &outputformat;
if(hexdump_g)
p_type = H5Tcopy(type);
else
p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
if(space_type != H5S_NULL && space_type != H5S_NO_CLASS) {
if(hexdump_g)
p_type = H5Tcopy(type);
else
p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
if(p_type >= 0) {
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
if(p_type >= 0) {
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
/* Check if we have VL data in the dataset's datatype */
if (h5tools_detect_vlen(p_type) == TRUE)
vl_data = TRUE;
/* Check if we have VL data in the dataset's datatype */
if (h5tools_detect_vlen(p_type) == TRUE)
vl_data = TRUE;
temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
HDassert(temp_need == (hsize_t)((size_t)temp_need));
need = (size_t)temp_need;
buf = HDmalloc(need);
HDassert(buf);
if(H5Aread(attr, p_type, buf) >= 0) {
ctx.need_prefix = TRUE;
ctx.indent_level = 2;
ctx.cur_column = (size_t)curr_pos;
h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
}
temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
HDassert(temp_need == (hsize_t)((size_t)temp_need));
need = (size_t)temp_need;
buf = HDmalloc(need);
HDassert(buf);
if(H5Aread(attr, p_type, buf) >= 0) {
ctx.need_prefix = TRUE;
ctx.indent_level = 2;
ctx.cur_column = (size_t)curr_pos;
h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
}
/* Reclaim any VL memory, if necessary */
if (vl_data)
H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
/* Reclaim any VL memory, if necessary */
if (vl_data)
H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
HDfree(buf);
H5Tclose(p_type);
} /* end if */
HDfree(buf);
H5Tclose(p_type);
} /* end if */
}
H5Sclose(space);
H5Tclose(type);

View File

@ -104,6 +104,7 @@
${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ddl
${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ddl
${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.ddl
${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.ddl
${HDF5_TOOLS_DIR}/testfiles/thlink-1.ddl
${HDF5_TOOLS_DIR}/testfiles/thlink-2.ddl
${HDF5_TOOLS_DIR}/testfiles/thlink-3.ddl
@ -272,6 +273,7 @@
${HDF5_TOOLS_DIR}/testfiles/tfvalues.h5
${HDF5_TOOLS_DIR}/testfiles/tgroup.h5
${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.h5
${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.h5
${HDF5_TOOLS_DIR}/testfiles/thlink.h5
${HDF5_TOOLS_DIR}/testfiles/thyperslab.h5
${HDF5_TOOLS_DIR}/testfiles/tints4dims.h5
@ -887,6 +889,8 @@
tgroup-2.out.err
tgrp_comments.out
tgrp_comments.out.err
tgrpnullspace.out
tgrpnullspace.out.err
thlink-1.out
thlink-1.out.err
thlink-2.out
@ -1394,6 +1398,7 @@
# test for displaying dataset and attribute of null space
ADD_H5_TEST (tnullspace 0 --enable-error-stack tnullspace.h5)
ADD_H5_TEST (tgrpnullspace 0 -p --enable-error-stack tgrpnullspace.h5)
# test for displaying dataset and attribute of space with 0 dimension size
ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5)

View File

@ -53,6 +53,7 @@
${HDF5_TOOLS_DIR}/testfiles/test35.nc
${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5
${HDF5_TOOLS_DIR}/testfiles/tnodata.h5
${HDF5_TOOLS_DIR}/testfiles/tnullspace.h5
${HDF5_TOOLS_DIR}/testfiles/tobjref.h5
${HDF5_TOOLS_DIR}/testfiles/topaque.h5
${HDF5_TOOLS_DIR}/testfiles/torderattr.h5
@ -117,6 +118,7 @@
${HDF5_TOOLS_DIR}/testfiles/tname-sp.h5.xml
${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5.xml
${HDF5_TOOLS_DIR}/testfiles/tnodata.h5.xml
${HDF5_TOOLS_DIR}/testfiles/tnullspace.h5.xml
${HDF5_TOOLS_DIR}/testfiles/tobjref.h5.xml
${HDF5_TOOLS_DIR}/testfiles/topaque.h5.xml
${HDF5_TOOLS_DIR}/testfiles/torderattr1.h5.xml
@ -296,6 +298,8 @@
tnodata.h5.out.err
tnoname.h5.out
tnoname.h5.out.err
tnullspace.h5.out
tnullspace.h5.out.err
tobjref.h5.out
tobjref.h5.out.err
topaque.h5.out
@ -402,9 +406,7 @@
ADD_XML_H5_TEST (tsaf.h5 0 tsaf.h5)
ADD_XML_H5_TEST (tempty.h5 0 tempty.h5)
ADD_XML_H5_TEST (tnamed_dtype_attr.h5 0 tnamed_dtype_attr.h5)
##Test dataset and attribute of null space. Commented out:
## wait until the XML schema is updated for null space.
## ADD_XML_H5_TEST (tnullspace.h5 0 tnulspace.h5)
ADD_XML_H5_TEST (tnullspace.h5 0 tnullspace.h5)
## So is dataspace with 0 dimension size.
## ADD_XML_H5_TEST (zerodim.h5 0 zerodim.h5)

View File

@ -112,6 +112,7 @@
#define FILE82 "tcompound_complex2.h5"
#define FILE83 "tvlenstr_array.h5"
#define FILE84 "tudfilter.h5"
#define FILE85 "tgrpnullspace.h5"
/*-------------------------------------------------------------------------
* prototypes
@ -286,9 +287,9 @@ typedef struct s1_t {
#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
/* File 65 macros */
#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */
#define THRESHOLD10 10 /* Free-space section threshold */
#define FSPACE_PAGE_SIZE 8192 /* File space page size */
#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */
#define THRESHOLD10 10 /* Free-space section threshold */
#define FSPACE_PAGE_SIZE 8192 /* File space page size */
/* "FILE66" macros and for FILE69 */
#define F66_XDIM 8
@ -7041,8 +7042,8 @@ gent_extlinks(void)
* Function: gent_fs_strategy_threshold
*
* Purpose: Generate a file with non-default file space strategy,
* non-default free-space section threshold,
* non-default file space page size.
* non-default free-space section threshold,
* non-default file space page size.
*-------------------------------------------------------------------------
*/
static void
@ -9721,7 +9722,7 @@ static void gent_bitnopaquefields(void)
uint32_t c;
uint64_t d;
} s_t;
hid_t file, grp=-1, type=-1, space=-1, dset=-1;
size_t i;
hsize_t nelmts = F80_DIM32;
@ -10437,6 +10438,43 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
*-------------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------
* Function: gent_null_space_group
*
* Purpose: generates dataset and attribute of null dataspace in a group
*-------------------------------------------------------------------------
*/
static void gent_null_space_group(void)
{
hid_t fid, root, group, dataset, space, attr;
int dset_buf = 10;
int point = 4;
fid = H5Fcreate(FILE85, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* null space */
space = H5Screate(H5S_NULL);
/* dataset */
dataset = H5Dcreate2(group, "dset", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* nothing should be written */
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
/* attribute */
attr = H5Acreate2(group, "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */
H5Dclose(dataset);
H5Aclose(attr);
H5Gclose(group);
H5Gclose(root);
H5Sclose(space);
H5Fclose(fid);
}
int main(void)
{
gent_group();
@ -10526,6 +10564,7 @@ int main(void)
gent_bitnopaquefields();
gent_intsfourdims();
gent_null_space_group();
gent_udfilter();

View File

@ -132,6 +132,7 @@ $SRC_H5DUMP_TESTFILES/tfpformat.h5
$SRC_H5DUMP_TESTFILES/tfvalues.h5
$SRC_H5DUMP_TESTFILES/tgroup.h5
$SRC_H5DUMP_TESTFILES/tgrp_comments.h5
$SRC_H5DUMP_TESTFILES/tgrpnullspace.h5
$SRC_H5DUMP_TESTFILES/thlink.h5
$SRC_H5DUMP_TESTFILES/thyperslab.h5
$SRC_H5DUMP_TESTFILES/tintsattrs.h5
@ -260,6 +261,7 @@ $SRC_H5DUMP_TESTFILES/tfpformat.ddl
$SRC_H5DUMP_TESTFILES/tgroup-1.ddl
$SRC_H5DUMP_TESTFILES/tgroup-2.ddl
$SRC_H5DUMP_TESTFILES/tgrp_comments.ddl
$SRC_H5DUMP_TESTFILES/tgrpnullspace.ddl
$SRC_H5DUMP_TESTFILES/thlink-1.ddl
$SRC_H5DUMP_TESTFILES/thlink-2.ddl
$SRC_H5DUMP_TESTFILES/thlink-3.ddl
@ -1268,6 +1270,7 @@ TOOLTEST thyperslab.ddl --enable-error-stack thyperslab.h5
# test for displaying dataset and attribute of null space
TOOLTEST tnullspace.ddl --enable-error-stack tnullspace.h5
TOOLTEST tgrpnullspace.ddl -p --enable-error-stack tgrpnullspace.h5
# test for displaying dataset and attribute of space with 0 dimension size
TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5

View File

@ -97,6 +97,7 @@ $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/tnullspace.h5
$SRC_H5DUMP_TESTFILES/tobjref.h5
$SRC_H5DUMP_TESTFILES/topaque.h5
$SRC_H5DUMP_TESTFILES/torderattr.h5
@ -162,6 +163,7 @@ $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/tnullspace.h5.xml
$SRC_H5DUMP_TESTFILES/tobjref.h5.xml
$SRC_H5DUMP_TESTFILES/topaque.h5.xml
$SRC_H5DUMP_TESTFILES/torderattr1.h5.xml
@ -355,9 +357,7 @@ TOOLTEST tvlstr.h5.xml --xml tvlstr.h5
TOOLTEST tsaf.h5.xml --xml tsaf.h5
TOOLTEST tempty.h5.xml --xml tempty.h5
TOOLTEST tnamed_dtype_attr.h5.xml --xml tnamed_dtype_attr.h5
##Test dataset and attribute of null space. Commented out:
## wait until the XML schema is updated for null space.
##TOOLTEST tnullspace.h5.xml --xml tnulspace.h5
TOOLTEST tnullspace.h5.xml --xml tnullspace.h5
# other options for xml

View File

@ -33,6 +33,7 @@
${HDF5_TOOLS_DIR}/testfiles/textlinktar.h5
${HDF5_TOOLS_DIR}/testfiles/tgroup.h5
${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.h5
${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.h5
${HDF5_TOOLS_DIR}/testfiles/thlink.h5
${HDF5_TOOLS_DIR}/testfiles/tloop.h5
${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5
@ -89,6 +90,7 @@
${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ls
${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ls
${HDF5_TOOLS_DIR}/testfiles/tgroup-3.ls
${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.ls
${HDF5_TOOLS_DIR}/testfiles/thlink-1.ls
${HDF5_TOOLS_DIR}/testfiles/tloop-1.ls
${HDF5_TOOLS_DIR}/testfiles/tmultifile.ls
@ -241,6 +243,8 @@
textlinksrc-7-old.out.err
tgrp_comments.out
tgrp_comments.out.err
tgrpnullspace.out
tgrpnullspace.out.err
tsoftlinks-1.out
tsoftlinks-1.out.err
tsoftlinks-2.out
@ -415,6 +419,9 @@
# test for empty data
ADD_H5_TEST (tempty 0 -w80 -d tempty.h5)
# test for displaying dataset and attribute of null space
ADD_H5_TEST (tgrpnullspace 0 -w80 -v tgrpnullspace.h5)
# test for all dataset types written to attributes
# enable -S for avoiding printing NATIVE types
ADD_H5_TEST (tattr2 0 -w80 -v -S tattr2.h5)

View File

@ -80,6 +80,7 @@ $SRC_H5LS_TESTFILES/textlinksrc.h5
$SRC_H5LS_TESTFILES/textlinktar.h5
$SRC_H5LS_TESTFILES/tgroup.h5
$SRC_H5LS_TESTFILES/tgrp_comments.h5
$SRC_H5LS_TESTFILES/tgrpnullspace.h5
$SRC_H5LS_TESTFILES/thlink.h5
$SRC_H5LS_TESTFILES/tloop.h5
$SRC_H5LS_TESTFILES/tnestedcomp.h5
@ -135,6 +136,7 @@ $SRC_H5LS_TESTFILES/tgroup.ls
$SRC_H5LS_TESTFILES/tgroup-1.ls
$SRC_H5LS_TESTFILES/tgroup-2.ls
$SRC_H5LS_TESTFILES/tgroup-3.ls
$SRC_H5LS_TESTFILES/tgrpnullspace.ls
$SRC_H5LS_TESTFILES/thlink-1.ls
$SRC_H5LS_TESTFILES/tloop-1.ls
$SRC_H5LS_TESTFILES/tmultifile.ls
@ -392,6 +394,9 @@ TOOLTEST tarray1.ls 0 -w80 -r -d tarray1.h5
# test for empty data
TOOLTEST tempty.ls 0 -w80 -d tempty.h5
# test for displaying dataset and attribute of null space
TOOLTEST tgrpnullspace.ls 0 -w80 -v tgrpnullspace.h5
# test for all dataset types written to attributes
# enable -S for avoiding printing NATIVE types
TOOLTEST tattr2.ls 0 -w80 -v -S tattr2.h5

View File

@ -0,0 +1,33 @@
HDF5 "tgrpnullspace.h5" {
GROUP "/" {
GROUP "g1" {
ATTRIBUTE "attr" {
DATATYPE H5T_STD_U32LE
DATASPACE NULL
DATA {
}
}
DATASET "dset" {
DATATYPE H5T_STD_I32BE
DATASPACE NULL
STORAGE_LAYOUT {
CONTIGUOUS
SIZE 0
OFFSET 18446744073709551615
}
FILTERS {
NONE
}
FILLVALUE {
FILL_TIME H5D_FILL_TIME_IFSET
VALUE H5D_FILL_VALUE_DEFAULT
}
ALLOCATION_TIME {
H5D_ALLOC_TIME_LATE
}
DATA {
}
}
}
}
}

Binary file not shown.

View File

@ -0,0 +1,7 @@
Opened "tgrpnullspace.h5" with sec2 driver.
g1 Group
Attribute: attr null
Type: native unsigned int
Location: 1:800
Links: 1

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/HDF5/XML/schema/HDF5-File http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd">
<hdf5:RootGroup OBJ-XID="xid_928" H5Path="/">
<hdf5:Attribute Name="attr">
<hdf5:Dataspace>
<!-- unknown dataspace -->
</hdf5:Dataspace>
<hdf5:DataType>
<hdf5:AtomicType>
<hdf5:IntegerType ByteOrder="LE" Sign="false" Size="4" />
</hdf5:AtomicType>
</hdf5:DataType>
<hdf5:Data>
<hdf5:NoData/>
</hdf5:Data>
</hdf5:Attribute>
<hdf5:Dataset Name="dset" OBJ-XID="xid_976" H5Path= "/dset" Parents="xid_928" H5ParentPaths="/">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
<hdf5:FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
<hdf5:FillValue>
<hdf5:NoFill/>
</hdf5:FillValue>
</hdf5:FillValueInfo>
<hdf5:Dataspace>
<!-- unknown dataspace -->
</hdf5:Dataspace>
<hdf5:DataType>
<hdf5:AtomicType>
<hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
</hdf5:AtomicType>
</hdf5:DataType>
<hdf5:Data>
<hdf5:NoData/>
</hdf5:Data>
</hdf5:Dataset>
</hdf5:RootGroup>
</hdf5:HDF5-File>