diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-01-13 15:37:37 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-01-13 15:37:37 (GMT) |
commit | 050ded21d307de35b0394614aa0962e8bca2f850 (patch) | |
tree | b7c2cf2285664f0bd398fce943efc256d83b728e | |
parent | e5630f3351dd32cac2da76985d69c13658152a98 (diff) | |
download | hdf5-050ded21d307de35b0394614aa0962e8bca2f850.zip hdf5-050ded21d307de35b0394614aa0962e8bca2f850.tar.gz hdf5-050ded21d307de35b0394614aa0962e8bca2f850.tar.bz2 |
[svn-r16299] Print a message of
Storage: information not available
When displaying storage information for VL and dataset region types
Added 2 shell runs that display this information
#818
Tested: windows, linux
-rw-r--r-- | MANIFEST | 5 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 36 | ||||
-rwxr-xr-x | tools/h5ls/testh5ls.sh | 6 | ||||
-rw-r--r-- | tools/testfiles/tdatareg.ls | 14 | ||||
-rw-r--r-- | tools/testfiles/tvldtypes2.ls | 22 |
5 files changed, 74 insertions, 9 deletions
@@ -1307,8 +1307,6 @@ ./tools/testfiles/tfpformat.ddl ./tools/testfiles/tfpformat.h5 - - # Expected output from h5ls tests ./tools/testfiles/nosuchfile.ls ./tools/testfiles/help-1.ls @@ -1329,6 +1327,9 @@ ./tools/testfiles/tslink-1.ls ./tools/testfiles/tstr-1.ls ./tools/testfiles/tattr2.ls +./tools/testfiles/tdatareg.ls +./tools/testfiles/tvldtypes2.ls + #additional test input and output for h5dump XML ./tools/testfiles/tall.h5.xml diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index eec1fcd..d0af4bb 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1515,7 +1515,8 @@ dataset_list2(hid_t dset, const char UNUSED *name) int ndims; /* dimensionality */ int n, max_len; /* max extern file name length */ double utilization; /* percent utilization of storage */ - int i; + H5T_class_t tclass; /* datatype class identifier */ + int i; if(verbose_g > 0) { dcpl = H5Dget_create_plist(dset); @@ -1539,14 +1540,35 @@ dataset_list2(hid_t dset, const char UNUSED *name) /* Print total raw storage size */ total = H5Sget_simple_extent_npoints(space) * H5Tget_size(type); used = H5Dget_storage_size(dset); + tclass = H5Tget_class(type); printf(" %-10s ", "Storage:"); - printf("%lu logical byte%s, %lu allocated byte%s", - (unsigned long)total, 1==total?"":"s", - (unsigned long)used, 1==used?"":"s"); - if (used>0) { - utilization = (total*100.0)/used; - printf(", %1.2f%% utilization", utilization); + switch (tclass) + { + + case H5T_VLEN: + printf("information not available"); + break; + + case H5T_REFERENCE: + if ( H5Tequal(type, H5T_STD_REF_DSETREG)) + { + printf("information not available"); + } + break; + + default: + printf("%lu logical byte%s, %lu allocated byte%s", + (unsigned long)total, 1==total?"":"s", + (unsigned long)used, 1==used?"":"s"); + if (used>0) + { + utilization = (total*100.0)/used; + printf(", %1.2f%% utilization", utilization); + } + } + + putchar('\n'); /* Print information about external strorage */ diff --git a/tools/h5ls/testh5ls.sh b/tools/h5ls/testh5ls.sh index 0bae60b..8194bfb 100755 --- a/tools/h5ls/testh5ls.sh +++ b/tools/h5ls/testh5ls.sh @@ -173,6 +173,12 @@ TOOLTEST tattr2.ls 0 -w80 -v -S tattr2.h5 # test for non-existing file TOOLTEST nosuchfile.ls 0 nosuchfile.h5 +# test for variable length data types in verbose mode +TOOLTEST tvldtypes2.ls 0 -v tvldtypes1.h5 + +# test for dataset region references data types in verbose mode +TOOLTEST tdatareg.ls 0 -v tdatareg.h5 + if test $nerrors -eq 0 ; then echo "All h5ls tests passed." fi diff --git a/tools/testfiles/tdatareg.ls b/tools/testfiles/tdatareg.ls new file mode 100644 index 0000000..b07b274 --- /dev/null +++ b/tools/testfiles/tdatareg.ls @@ -0,0 +1,14 @@ +############################# + output for 'h5ls -v tdatareg.h5' +############################# +Opened "tdatareg.h5" with sec2 driver. +Dataset1 Dataset {4/4} + Location: 1:1284 + Links: 1 + Storage: information not available + Type: dataset region reference +Dataset2 Dataset {10/10, 10/10} + Location: 1:744 + Links: 1 + Storage: 100 logical bytes, 100 allocated bytes, 100.00% utilization + Type: 8-bit unsigned integer diff --git a/tools/testfiles/tvldtypes2.ls b/tools/testfiles/tvldtypes2.ls new file mode 100644 index 0000000..62dfa61 --- /dev/null +++ b/tools/testfiles/tvldtypes2.ls @@ -0,0 +1,22 @@ +############################# + output for 'h5ls -v tvldtypes1.h5' +############################# +Opened "tvldtypes1.h5" with sec2 driver. +Dataset1.0 Dataset {4/4} + Location: 1:976 + Links: 1 + Storage: information not available + Type: variable length of + native int +Dataset2.0 Dataset {4/4} + Location: 1:1576 + Links: 1 + Storage: information not available + Type: variable length of + native float +Dataset3.0 Dataset {SCALAR} + Location: 1:6272 + Links: 1 + Storage: information not available + Type: variable length of + native int |