From f4492a33c1bc1f794e5887fc76f3dc365d56d181 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Thu, 10 Jun 2004 11:20:29 -0500 Subject: [svn-r8643] Purpose: h5dump new features Description: added the code for print strings with new line and display the path of references (new source files h5tools_ref.c and .h ) added a test suite in testh5dump.sh.in for ( note : to create testh5dump.sh , one must redo ./configure; this detects the availability of filters and generates testh5dump.sh accordingly) 1) storage layout 2) fill value 3) print reference with path 4) print strings with new lines 5) filters Solution: Platforms tested: linux solaris AIX Misc. update: --- MANIFEST | 21 ++ configure | 20 +- tools/h5dump/h5dump.c | 469 +++++----------------------------------- tools/h5dump/h5dumpgentest.c | 60 ++++- tools/h5dump/testh5dump.sh.in | 73 +++++++ tools/h5ls/h5ls.c | 5 + tools/lib/Makefile.in | 2 +- tools/lib/h5tools.h | 5 + tools/lib/h5tools_ref.c | 389 +++++++++++++++++++++++++++++++++ tools/lib/h5tools_ref.h | 48 ++++ tools/lib/h5tools_str.c | 17 ++ tools/lib/h5tools_utils.c | 2 +- tools/testfiles/tchunked.ddl | 18 ++ tools/testfiles/tcompact.ddl | 18 ++ tools/testfiles/tcontiguos.ddl | 8 + tools/testfiles/tdeflate.ddl | 20 ++ tools/testfiles/texternal.ddl | 18 ++ tools/testfiles/tfillearly.ddl | 17 ++ tools/testfiles/tfillifset.ddl | 17 ++ tools/testfiles/tfillnever.ddl | 17 ++ tools/testfiles/tfletcher32.ddl | 20 ++ tools/testfiles/treference.ddl | 14 ++ tools/testfiles/tshuffle.ddl | 20 ++ tools/testfiles/tstring.ddl | 20 ++ tools/testfiles/tszip.ddl | 8 + tools/testfiles/tuserfilter.ddl | 9 + 26 files changed, 895 insertions(+), 440 deletions(-) create mode 100644 tools/lib/h5tools_ref.c create mode 100644 tools/lib/h5tools_ref.h create mode 100644 tools/testfiles/tchunked.ddl create mode 100644 tools/testfiles/tcompact.ddl create mode 100644 tools/testfiles/tcontiguos.ddl create mode 100644 tools/testfiles/tdeflate.ddl create mode 100644 tools/testfiles/texternal.ddl create mode 100644 tools/testfiles/tfillearly.ddl create mode 100644 tools/testfiles/tfillifset.ddl create mode 100644 tools/testfiles/tfillnever.ddl create mode 100644 tools/testfiles/tfletcher32.ddl create mode 100644 tools/testfiles/treference.ddl create mode 100644 tools/testfiles/tshuffle.ddl create mode 100644 tools/testfiles/tstring.ddl create mode 100644 tools/testfiles/tszip.ddl create mode 100644 tools/testfiles/tuserfilter.ddl diff --git a/MANIFEST b/MANIFEST index a78a0a7..033567f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1197,6 +1197,8 @@ ./tools/lib/h5tools_str.h ./tools/lib/h5tools_utils.c ./tools/lib/h5tools_utils.h +./tools/lib/h5tools_ref.h +./tools/lib/h5tools_ref.c ./tools/lib/talign.c ./tools/lib/h5diff_attr.c ./tools/lib/h5diff.h @@ -1342,6 +1344,21 @@ ./tools/testfiles/tboot.ddl ./tools/testfiles/tcontents.ddl ./tools/testfiles/tfilters.h5 +./tools/testfiles/tchunked.ddl +./tools/testfiles/tcompact.ddl +./tools/testfiles/tcontiguos.ddl +./tools/testfiles/tdeflate.ddl +./tools/testfiles/texternal.ddl +./tools/testfiles/tfillearly.ddl +./tools/testfiles/tfillifset.ddl +./tools/testfiles/tfillnever.ddl +./tools/testfiles/tfletcher32.ddl +./tools/testfiles/treference.ddl +./tools/testfiles/tshuffle.ddl +./tools/testfiles/tstring.ddl +./tools/testfiles/tuserfilter.ddl +./tools/testfiles/tszip.ddl + # Expected output from h5ls tests ./tools/testfiles/help-1.ls @@ -1440,6 +1457,8 @@ ./tools/testfiles/file4.h5 ./tools/testfiles/file5.h5 ./tools/testfiles/file6.h5 +./tools/testfiles/file7.h5 +./tools/testfiles/file8.h5 ./tools/testfiles/h5diff_10.txt ./tools/testfiles/h5diff_11.txt ./tools/testfiles/h5diff_12.txt @@ -1503,6 +1522,8 @@ ./tools/testfiles/h5diff_627.txt ./tools/testfiles/h5diff_628.txt ./tools/testfiles/h5diff_629.txt +./tools/testfiles/h5diff_70.txt +./tools/testfiles/h5diff_80.txt ./tools/testfiles/test1.h5 ./tools/testfiles/test3.h5 ./tools/testfiles/test4.h5 diff --git a/configure b/configure index 4367698..2e885e2 100755 --- a/configure +++ b/configure @@ -1102,7 +1102,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -1485,6 +1485,8 @@ build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +test -z "$build_alias" && + build_alias=$ac_cv_build echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 @@ -1507,6 +1509,8 @@ host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +test -z "$host_alias" && + host_alias=$ac_cv_host @@ -4152,7 +4156,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 4155 "configure"' > conftest.$ac_ext + echo '#line 4159 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4693,7 +4697,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:4696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:4700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -6500,7 +6504,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <do_lf=display_lf; + status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth); H5Tclose(f_type); @@ -2053,16 +2040,22 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id) void *buf=NULL; int nelmts=1; h5dump_t *outputformat = &dataformat; + herr_t ret; + hid_t n_type; memset(&ctx, 0, sizeof(ctx)); ctx.indent_level=2; size = H5Tget_size(type_id); buf = malloc(size); - H5Pget_fill_value(dcpl, type_id, buf); + n_type = H5Tget_native_type(type_id,H5T_DIR_DEFAULT); + + ret=H5Pget_fill_value(dcpl, n_type, buf); h5tools_dump_simple_data(stdout, outputformat, obj_id, &ctx, - START_OF_DATA | END_OF_DATA, nelmts, type_id, buf); + START_OF_DATA | END_OF_DATA, nelmts, n_type, buf); + + H5Tclose(n_type); if (buf) free (buf); @@ -2125,11 +2118,11 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) /*start indent */ indent += COL; indentation(indent + COL); - printf("SIZE %d ", storage_size); + HDfprintf(stdout, "SIZE %Hu ", storage_size); rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); - printf("%s %d", dump_header_format->dataspacedimbegin, chsize[0]); + HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]); for ( i=1; idataspacedimend); /*end indent */ indent -= COL; @@ -2142,7 +2135,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) /*start indent */ indent += COL; indentation(indent + COL); - printf("SIZE %d\n", storage_size); + HDfprintf(stdout, "SIZE %Hu\n", storage_size); /*end indent */ indent -= COL; indentation(indent + COL); @@ -2163,7 +2156,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) for ( i=0; i", indent + 4, ""); } -/* - * XML support - */ - -/* - * XML needs a table to look up a path name for an object - * reference. - * - * This table stores mappings of reference -> path - * for all objects in the file that may be the target of - * an object reference. - * - * The 'path' is an absolute path by which the object - * can be accessed. When an object has > 1 such path, - * only one will be used in the table, with no particular - * method of selecting which one. - */ - - -struct ref_path_table_entry_t *ref_path_table = NULL; /* the table */ -int npte = 0; /* number of entries in the table */ - -/*------------------------------------------------------------------------- - * Function: ref_path_table_lookup - * - * Purpose: Looks up a table entry given a path name. - * Used during construction of the table. - * - * Return: The table entre (pte) or NULL if not in the - * table. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static struct ref_path_table_entry_t * -ref_path_table_lookup(const char *thepath) -{ - int i; - hobj_ref_t *ref; - herr_t status; - struct ref_path_table_entry_t *pte = ref_path_table; - - if (ref_path_table == NULL) - return NULL; - - ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t)); - - if (ref == NULL) { - /* fatal error ? */ - return NULL; - } - - status = H5Rcreate(ref, thefile, thepath, H5R_OBJECT, -1); - - if (status < 0) { - /* fatal error ? */ - return NULL; - } - - for (i = 0; i < npte; i++) { - if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) { - return pte; - } - - pte = pte->next; - } - - return NULL; -} - -/*------------------------------------------------------------------------- - * Function: ref_path_table_put - * - * Purpose: Enter the 'obj' with 'path' in the table if - * not already there. - * Create an object reference, pte, and store them - * in the table. - * - * Return: The object reference for the object. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static hobj_ref_t * -ref_path_table_put(hid_t obj, const char *path) -{ - hobj_ref_t *ref; - H5G_stat_t *sb; - herr_t status; - struct ref_path_table_entry_t *pte; - - /* look up 'obj'. If already in table, return */ - pte = ref_path_table_lookup(path); - if (pte != NULL) - return pte->obj_ref; - - /* if not found, then make new entry */ - - pte = (struct ref_path_table_entry_t *) - malloc(sizeof(struct ref_path_table_entry_t)); - if (pte == NULL) { - /* fatal error? */ - return NULL; - } - - pte->obj = obj; - ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t)); - if (ref == NULL) { - /* fatal error? */ - free(pte); - return NULL; - } - - status = H5Rcreate(ref, thefile, path, H5R_OBJECT, -1); - if (status < 0) { - /* fatal error? */ - free(ref); - free(pte); - return NULL; - } - - pte->obj_ref = ref; - - pte->apath = HDstrdup(path); - - sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t)); - if (sb == NULL) { - /* fatal error? */ - free(pte); - return NULL; - } - H5Gget_objinfo(thefile, path, TRUE, sb); - - memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t)); - - pte->next = ref_path_table; - ref_path_table = pte; - - npte++; - - return ref; -} - -/* - * counter used to disambiguate multiple instances of same object. - */ -static int xid = 1; - -static int get_next_xid() { - return xid++; -} - -/* - * This counter is used to create fake object ID's - * The idea is to set it to the largest possible offest, which - * minimizes the chance of collision with a real object id. - * - */ -haddr_t fake_xid = HADDR_MAX; -static haddr_t -get_fake_xid () { - return (fake_xid--); -} - -/* - * for an object that does not have an object id (e.g., soft link), - * create a table entry with a fake object id as the key. - */ - -static struct ref_path_table_entry_t * -ref_path_table_gen_fake(const char *path) -{ - union { - hobj_ref_t rr; - char cc[16]; - unsigned long ll[2]; - } uu; - hobj_ref_t *ref; - H5G_stat_t *sb; - struct ref_path_table_entry_t *pte; - - /* look up 'obj'. If already in table, return */ - pte = ref_path_table_lookup(path); - if (pte != NULL) { - return pte; - } - - /* if not found, then make new entry */ - - pte = (struct ref_path_table_entry_t *) - malloc(sizeof(struct ref_path_table_entry_t)); - if (pte == NULL) { - /* fatal error? */ - return NULL; - } - - pte->obj = (hid_t)-1; - - sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t)); - if (sb == NULL) { - /* fatal error? */ - free(pte); - return NULL; - } - sb->objno[0] = (unsigned long)get_fake_xid(); - sb->objno[1] = (unsigned long)get_fake_xid(); - - memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t)); - - ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t)); - if (ref == NULL) { - free(pte); - return NULL; - } - - uu.ll[0] = sb->objno[0]; - uu.ll[1] = sb->objno[1]; - - memcpy((char *)ref,(char *)&uu.rr,sizeof(ref)); - - pte->obj_ref = ref; - - pte->apath = HDstrdup(path); - - pte->next = ref_path_table; - ref_path_table = pte; - - npte++; - - return pte; -} - -/*------------------------------------------------------------------------- - * Function: lookup_ref_path - * - * Purpose: Lookup the path to the object with refernce 'ref'. - * - * Return: Return a path to the object, or NULL if not found. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static char * -lookup_ref_path(hobj_ref_t * ref) -{ - int i; - struct ref_path_table_entry_t *pte = NULL; - - if (ref_path_table == NULL) - return NULL; - - pte = ref_path_table; - if (pte == NULL) { - /* fatal -- not initialized? */ - return NULL; - } - for (i = 0; i < npte; i++) { - if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) { - return pte->apath; - } - pte = pte->next; - } - return NULL; -} - -/*------------------------------------------------------------------------- - * Function: fill_ref_path_table - * - * Purpose: Called by interator to create references for - * all objects and enter them in the table. - * - * Return: Error status. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) -{ - hid_t obj; - char *tmp; - H5G_stat_t statbuf; - struct ref_path_table_entry_t *pte; - char *thepath; - - H5Gget_objinfo(group, name, FALSE, &statbuf); - tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2); - - if (tmp == NULL) - return FAIL; - - thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2); - - if (thepath == NULL) { - free(tmp); - return FAIL; - } - - strcpy(tmp, prefix); - - strcpy(thepath, prefix); - strcat(thepath, "/"); - strcat(thepath, name); - - switch (statbuf.type) { - case H5G_DATASET: - if ((obj = H5Dopen(group, name)) >= 0) { - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - } - H5Dclose(obj); - } else { - error_msg(progname, "unable to get dataset \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - case H5G_GROUP: - if ((obj = H5Gopen(group, name)) >= 0) { - strcat(strcat(prefix, "/"), name); - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - H5Giterate(obj, ".", NULL, fill_ref_path_table, NULL); - strcpy(prefix, tmp); - } - H5Gclose(obj); - } else { - error_msg(progname, "unable to dump group \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - case H5G_TYPE: - if ((obj = H5Topen(group, name)) >= 0) { - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - } - H5Tclose(obj); - } else { - error_msg(progname, "unable to get dataset \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - default: - break; - } - - free(tmp); - free(thepath); - return 0; -} /* * create a string suitable for and XML NCNAME. Uses the diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 96f3aff..f9fcdd7 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -1,4 +1,4 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * @@ -4452,19 +4452,24 @@ static void gent_filters() hid_t sid1; /* dataspace ID */ hid_t tid; /* datatype ID */ hid_t did; /* dataset ID */ +#if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=4; +#endif hsize_t dims1[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf1[DIM1][DIM2]; hsize_t dims2[1]={2}; hvl_t buf2[2]; hsize_t dims3[1]={1}; - /*char buf3[]={"this is a string\n with a newline"};*/ - char buf3[]={"string\n new"}; + char buf3[]={"this is\n a string with three\n newline\n escape characters"}; hsize_t dims4[1]={6}; char buf4[6]={"abcdef"}; - int i, j, n, ret, fillval, val; + hobj_ref_t buf5[5]; + hsize_t dims5[1]={5}; + int i, j, n, ret, val; + int fillval = -99; + typedef enum { @@ -4489,6 +4494,10 @@ static void gent_filters() /* create a dataset creation property list; the same DCPL is used for all dsets */ dcpl = H5Pcreate(H5P_DATASET_CREATE); + ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); + assert(ret>=0); + + /*------------------------------------------------------------------------- * create a compact and contiguous storage layout dataset * add a comment to the datasets @@ -4512,6 +4521,18 @@ static void gent_filters() ret=H5Gset_comment(fid,"contiguous", "This is a dataset with contiguous storage"); assert(ret>=0); + ret=H5Pset_layout(dcpl, H5D_CHUNKED); + assert(ret>=0); + + ret=H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + assert(ret>=0); + + ret=make_dset(fid,"chunked",sid,dcpl,buf1); + assert(ret>=0); + + ret=H5Gset_comment(fid,"chunked", "This is a dataset with chunked storage"); + assert(ret>=0); + /*------------------------------------------------------------------------- * make several dataset with filters *------------------------------------------------------------------------- @@ -4659,12 +4680,11 @@ static void gent_filters() */ make_external(fid); -/*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * make datasets with fill value combinations *------------------------------------------------------------------------- */ - fillval = -99; ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); assert(ret>=0); @@ -4675,31 +4695,32 @@ static void gent_filters() ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); assert(ret>=0); - ret=make_dset(fid,"fill early",sid,dcpl,buf1); + ret=make_dset(fid,"fill_early",sid,dcpl,buf1); assert(ret>=0); ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); assert(ret>=0); - ret=make_dset(fid,"fill never",sid,dcpl,buf1); + ret=make_dset(fid,"fill_never",sid,dcpl,buf1); assert(ret>=0); ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); assert(ret>=0); - ret=make_dset(fid,"fill ifset",sid,dcpl,buf1); + ret=make_dset(fid,"fill_ifset",sid,dcpl,buf1); assert(ret>=0); + /*------------------------------------------------------------------------- * commit a H5G_TYPE type with a comment *------------------------------------------------------------------------- */ tid=H5Tcopy(H5T_STD_B8LE); - ret=H5Tcommit(fid, "my type", tid); + ret=H5Tcommit(fid, "mytype", tid); assert(ret>=0); - ret=H5Gset_comment(fid,"my type", "This is a commited datatype"); + ret=H5Gset_comment(fid,"mytype", "This is a commited datatype"); assert(ret>=0); ret=H5Tclose(tid); @@ -4768,6 +4789,23 @@ static void gent_filters() *------------------------------------------------------------------------- */ write_dset(fid,1,dims4,"char",H5T_NATIVE_CHAR,buf4); + +/*------------------------------------------------------------------------- + * reference + *------------------------------------------------------------------------- + */ + ret=H5Rcreate(&buf5[0],fid,"compact",H5R_OBJECT,-1); + assert(ret>=0); + ret=H5Rcreate(&buf5[1],fid,"myvlen",H5R_OBJECT,-1); + assert(ret>=0); + ret=H5Rcreate(&buf5[2],fid,"compact",H5R_OBJECT,-1); + assert(ret>=0); + ret=H5Rcreate(&buf5[3],fid,"myvlen",H5R_OBJECT,-1); + assert(ret>=0); + ret=H5Rcreate(&buf5[4],fid,"contiguous",H5R_OBJECT,-1); + assert(ret>=0); + write_dset(fid,1,dims5,"reference",H5T_STD_REF_OBJ,buf5); + /*------------------------------------------------------------------------- * close diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index ee45788..064923f 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -89,6 +89,15 @@ TOOLTEST() { fi } + + +# Print a "SKIP" message +SKIP() { + TESTING $DUMPER $@ + echo " -SKIP-" +} + + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -208,6 +217,70 @@ TOOLTEST tboot.ddl -H -B -d compact tfilters.h5 # test for file contents TOOLTEST tcontents.ddl -n tfilters.h5 +# tests for storage layout +# compact +TOOLTEST tcompact.ddl -H -p -d compact tfilters.h5 +# contiguous +TOOLTEST tcontiguos.ddl -H -p -d contiguos tfilters.h5 +# chunked +TOOLTEST tchunked.ddl -H -p -d chunked tfilters.h5 +# external +TOOLTEST texternal.ddl -H -p -d external tfilters.h5 + +# Fill values +TOOLTEST tfillearly.ddl -H -p -d fill_early tfilters.h5 +TOOLTEST tfillnever.ddl -H -p -d fill_never tfilters.h5 +TOOLTEST tfillifset.ddl -H -p -d fill_ifset tfilters.h5 + +# references , print path +TOOLTEST treference.ddl -d reference tfilters.h5 + +# string , print new lines +TOOLTEST tstring.ddl -e -d string tfilters.h5 + + +# tests for filters +# SZIP +option="-H -p -d szip tfilters.h5" +if test $USE_FILTER_SZIP != "yes"; then + SKIP $option +else + TOOLTEST tszip.ddl $option +fi +# deflate +option="-H -p -d deflate tfilters.h5" +if test $USE_FILTER_DEFLATE != "yes"; then + SKIP $option +else + TOOLTEST tdeflate.ddl $option +fi +# shuffle +option="-H -p -d shuffle tfilters.h5" +if test $USE_FILTER_SHUFFLE != "yes"; then + SKIP $option +else + TOOLTEST tshuffle.ddl $option +fi +# fletcher32 +option="-H -p -d fletcher32 tfilters.h5" +if test $USE_FILTER_FLETCHER32 != "yes"; then + SKIP $option +else + TOOLTEST tfletcher32.ddl $option +fi +# user defined +TOOLTEST tuserfilter.ddl -H -d myfilter tfilters.h5 + + + + + + + + + + + if test $nerrors -eq 0 ; then echo "All $DUMPER tests passed." diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 58fb782..6fdb7ef 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -78,6 +78,11 @@ static herr_t list (hid_t group, const char *name, void *cd); static void display_type(hid_t type, int ind); static char *fix_name(const char *path, const char *base); +hid_t thefile; +char *prefix; +char *progname; +int d_status; + /*------------------------------------------------------------------------- * Function: usage diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 070bdcc..2fff656 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -41,7 +41,7 @@ PROGS=$(PUB_PROGS) $(TEST_PROGS) ## Source and object files for the library; do not install ## -LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c h5tools_filters.c +LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c h5tools_filters.c h5tools_ref.c LIB_OBJ=$(LIB_SRC:.c=.lo) PUB_LIB= AUX_LIB=$(LIB) diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 5e47f10..ad85e3c 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -323,6 +323,9 @@ typedef struct h5dump_t { /*print array indices in output matrix */ int pindex; + /*interpret CR/LF information */ + int do_lf; + } h5dump_t; typedef struct dump_header{ @@ -509,4 +512,6 @@ extern void h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid extern int h5tools_canreadf(const char* name, hid_t dcpl_id); + + #endif /* H5TOOLS_H__ */ diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c new file mode 100644 index 0000000..4506994 --- /dev/null +++ b/tools/lib/h5tools_ref.c @@ -0,0 +1,389 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +#include +#include "h5tools_ref.h" +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" + + +/* + * Table to look up a path name for an object + * reference. + * + * This table stores mappings of reference -> path + * for all objects in the file that may be the target of + * an object reference. + * + * The 'path' is an absolute path by which the object + * can be accessed. When an object has > 1 such path, + * only one will be used in the table, with no particular + * method of selecting which one. + */ + + +extern hid_t thefile; +extern char *prefix; +extern char *progname; +extern int d_status; + + +struct ref_path_table_entry_t *ref_path_table = NULL; /* the table */ +int npte = 0; /* number of entries in the table */ + +/*------------------------------------------------------------------------- + * Function: ref_path_table_lookup + * + * Purpose: Looks up a table entry given a path name. + * Used during construction of the table. + * + * Return: The table entre (pte) or NULL if not in the + * table. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +struct ref_path_table_entry_t * +ref_path_table_lookup(const char *thepath) +{ + int i; + hobj_ref_t *ref; + herr_t status; + struct ref_path_table_entry_t *pte = ref_path_table; + + if (ref_path_table == NULL) + return NULL; + + ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t)); + + if (ref == NULL) { + /* fatal error ? */ + return NULL; + } + + status = H5Rcreate(ref, thefile, thepath, H5R_OBJECT, -1); + + if (status < 0) { + /* fatal error ? */ + return NULL; + } + + for (i = 0; i < npte; i++) { + if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) { + return pte; + } + + pte = pte->next; + } + + return NULL; +} + +/*------------------------------------------------------------------------- + * Function: ref_path_table_put + * + * Purpose: Enter the 'obj' with 'path' in the table if + * not already there. + * Create an object reference, pte, and store them + * in the table. + * + * Return: The object reference for the object. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +hobj_ref_t * +ref_path_table_put(hid_t obj, const char *path) +{ + hobj_ref_t *ref; + H5G_stat_t *sb; + herr_t status; + struct ref_path_table_entry_t *pte; + + /* look up 'obj'. If already in table, return */ + pte = ref_path_table_lookup(path); + if (pte != NULL) + return pte->obj_ref; + + /* if not found, then make new entry */ + + pte = (struct ref_path_table_entry_t *) + malloc(sizeof(struct ref_path_table_entry_t)); + if (pte == NULL) { + /* fatal error? */ + return NULL; + } + + pte->obj = obj; + ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t)); + if (ref == NULL) { + /* fatal error? */ + free(pte); + return NULL; + } + + status = H5Rcreate(ref, thefile, path, H5R_OBJECT, -1); + if (status < 0) { + /* fatal error? */ + free(ref); + free(pte); + return NULL; + } + + pte->obj_ref = ref; + + pte->apath = HDstrdup(path); + + sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t)); + if (sb == NULL) { + /* fatal error? */ + free(pte); + return NULL; + } + H5Gget_objinfo(thefile, path, TRUE, sb); + + memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t)); + + pte->next = ref_path_table; + ref_path_table = pte; + + npte++; + + return ref; +} + +/* + * counter used to disambiguate multiple instances of same object. + */ +int xid = 1; + +int get_next_xid() { + return xid++; +} + +/* + * This counter is used to create fake object ID's + * The idea is to set it to the largest possible offest, which + * minimizes the chance of collision with a real object id. + * + */ +haddr_t fake_xid = HADDR_MAX; +haddr_t +get_fake_xid () { + return (fake_xid--); +} + +/* + * for an object that does not have an object id (e.g., soft link), + * create a table entry with a fake object id as the key. + */ + +struct ref_path_table_entry_t * +ref_path_table_gen_fake(const char *path) +{ + union { + hobj_ref_t rr; + char cc[16]; + unsigned long ll[2]; + } uu; + hobj_ref_t *ref; + H5G_stat_t *sb; + struct ref_path_table_entry_t *pte; + + /* look up 'obj'. If already in table, return */ + pte = ref_path_table_lookup(path); + if (pte != NULL) { + return pte; + } + + /* if not found, then make new entry */ + + pte = (struct ref_path_table_entry_t *) + malloc(sizeof(struct ref_path_table_entry_t)); + if (pte == NULL) { + /* fatal error? */ + return NULL; + } + + pte->obj = (hid_t)-1; + + sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t)); + if (sb == NULL) { + /* fatal error? */ + free(pte); + return NULL; + } + sb->objno[0] = (unsigned long)get_fake_xid(); + sb->objno[1] = (unsigned long)get_fake_xid(); + + memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t)); + + ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t)); + if (ref == NULL) { + free(pte); + return NULL; + } + + uu.ll[0] = sb->objno[0]; + uu.ll[1] = sb->objno[1]; + + memcpy((char *)ref,(char *)&uu.rr,sizeof(ref)); + + pte->obj_ref = ref; + + pte->apath = HDstrdup(path); + + pte->next = ref_path_table; + ref_path_table = pte; + + npte++; + + return pte; +} + +/*------------------------------------------------------------------------- + * Function: lookup_ref_path + * + * Purpose: Lookup the path to the object with refernce 'ref'. + * + * Return: Return a path to the object, or NULL if not found. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +char* +lookup_ref_path(hobj_ref_t * ref) +{ + int i; + struct ref_path_table_entry_t *pte = NULL; + + if (ref_path_table == NULL) + return NULL; + + pte = ref_path_table; + if (pte == NULL) { + /* fatal -- not initialized? */ + return NULL; + } + for (i = 0; i < npte; i++) { + if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) { + return pte->apath; + } + pte = pte->next; + } + return NULL; +} + +/*------------------------------------------------------------------------- + * Function: fill_ref_path_table + * + * Purpose: Called by interator to create references for + * all objects and enter them in the table. + * + * Return: Error status. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) +{ + hid_t obj; + char *tmp; + H5G_stat_t statbuf; + struct ref_path_table_entry_t *pte; + char *thepath; + + H5Gget_objinfo(group, name, FALSE, &statbuf); + tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2); + + if (tmp == NULL) + return FAIL; + + thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2); + + if (thepath == NULL) { + free(tmp); + return FAIL; + } + + strcpy(tmp, prefix); + + strcpy(thepath, prefix); + strcat(thepath, "/"); + strcat(thepath, name); + + switch (statbuf.type) { + case H5G_DATASET: + if ((obj = H5Dopen(group, name)) >= 0) { + pte = ref_path_table_lookup(thepath); + if (pte == NULL) { + ref_path_table_put(obj, thepath); + } + H5Dclose(obj); + } else { + error_msg(progname, "unable to get dataset \"%s\"\n", name); + d_status = EXIT_FAILURE; + } + break; + case H5G_GROUP: + if ((obj = H5Gopen(group, name)) >= 0) { + strcat(strcat(prefix, "/"), name); + pte = ref_path_table_lookup(thepath); + if (pte == NULL) { + ref_path_table_put(obj, thepath); + H5Giterate(obj, ".", NULL, fill_ref_path_table, NULL); + strcpy(prefix, tmp); + } + H5Gclose(obj); + } else { + error_msg(progname, "unable to dump group \"%s\"\n", name); + d_status = EXIT_FAILURE; + } + break; + case H5G_TYPE: + if ((obj = H5Topen(group, name)) >= 0) { + pte = ref_path_table_lookup(thepath); + if (pte == NULL) { + ref_path_table_put(obj, thepath); + } + H5Tclose(obj); + } else { + error_msg(progname, "unable to get dataset \"%s\"\n", name); + d_status = EXIT_FAILURE; + } + break; + default: + break; + } + + free(tmp); + free(thepath); + return 0; +} + diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h new file mode 100644 index 0000000..5df2d38 --- /dev/null +++ b/tools/lib/h5tools_ref.h @@ -0,0 +1,48 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5TOOLS_REF_H__ +#define H5TOOLS_REF_H__ + +#include "hdf5.h" + +typedef struct ref_path_table_entry_t { + hid_t obj; + hobj_ref_t *obj_ref; + char *apath; + H5G_stat_t statbuf; + struct ref_path_table_entry_t *next; +}ref_path_table_entry_t; + +#ifdef __cplusplus +extern "C" { +#endif + +char* lookup_ref_path(hobj_ref_t * ref); +herr_t fill_ref_path_table(hid_t, const char *, void *); +int get_next_xid(void); +haddr_t get_fake_xid (void); +struct ref_path_table_entry_t *ref_path_table_lookup(const char *); +hobj_ref_t *ref_path_table_put(hid_t, const char *); +struct ref_path_table_entry_t *ref_path_table_gen_fake(const char *); + +#ifdef __cplusplus +} +#endif + + + +#endif + + diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 80ad868..d774c9a 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -27,6 +27,9 @@ #include "h5tools.h" /*for h5dump_t structure */ #include "h5tools_str.h" /*function prototypes */ +extern char *lookup_ref_path(hobj_ref_t *); + + /* * If REPEAT_VERBOSE is defined then character strings will be printed so * that repeated character sequences like "AAAAAAAAAA" are displayed as @@ -452,6 +455,11 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch) h5tools_str_append(str, "\\f"); break; case '\n': + if (info->do_lf) { + h5tools_str_append(str, "\n"); + h5tools_str_append(str, " "); + } + else h5tools_str_append(str, "\\n"); break; case '\r': @@ -793,6 +801,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, if (h5tools_is_zero(vp, H5Tget_size(type))) { h5tools_str_append(str, "NULL"); } else { + char *path=NULL; otype = H5Rget_obj_type(container, H5R_OBJECT, vp); obj = H5Rdereference(container, H5R_OBJECT, vp); H5Gget_objinfo(obj, ".", FALSE, &sb); @@ -823,6 +832,14 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, h5tools_str_append(str, info->obj_format, sb.fileno[1], sb.fileno[0], sb.objno[1], sb.objno[0]); } + + /* Print name */ + path = lookup_ref_path(vp); + if (path) { + h5tools_str_append(str, " "); + h5tools_str_append(str, path); + h5tools_str_append(str, " "); + } } } else if (H5Tget_class(type) == H5T_ARRAY) { int k, ndims; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index a942c17..26f894f 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -246,7 +246,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } -/*------------------------------------------------------------------------- +/*---------------------/---------------------------------------------------- * Function: indentation * * Purpose: Print spaces for indentation diff --git a/tools/testfiles/tchunked.ddl b/tools/testfiles/tchunked.ddl new file mode 100644 index 0000000..5d4571b --- /dev/null +++ b/tools/testfiles/tchunked.ddl @@ -0,0 +1,18 @@ +############################# +Expected output for 'h5dump -H -p -d chunked tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "chunked" { +COMMENT "This is a dataset with chunked storage" + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 800 ( 10, 5 ) + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE -99 + } +} +} diff --git a/tools/testfiles/tcompact.ddl b/tools/testfiles/tcompact.ddl new file mode 100644 index 0000000..ae4f3e7 --- /dev/null +++ b/tools/testfiles/tcompact.ddl @@ -0,0 +1,18 @@ +############################# +Expected output for 'h5dump -H -p -d compact tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "compact" { +COMMENT "This is a dataset with compact storage" + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT COMPACT { + SIZE 800 + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME EARLY + VALUE -99 + } +} +} diff --git a/tools/testfiles/tcontiguos.ddl b/tools/testfiles/tcontiguos.ddl new file mode 100644 index 0000000..7c26099 --- /dev/null +++ b/tools/testfiles/tcontiguos.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d contiguos tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "contiguos" { + } +} +h5dump error: unable to open dataset "contiguos" diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl new file mode 100644 index 0000000..8cc5b3a --- /dev/null +++ b/tools/testfiles/tdeflate.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5dump -H -p -d deflate tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "deflate" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 385 ( 10, 5 ) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 9 } + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE -99 + } +} +} diff --git a/tools/testfiles/texternal.ddl b/tools/testfiles/texternal.ddl new file mode 100644 index 0000000..511bd4f --- /dev/null +++ b/tools/testfiles/texternal.ddl @@ -0,0 +1,18 @@ +############################# +Expected output for 'h5dump -H -p -d external tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "external" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 100 ) / ( 100 ) } + STORAGE_LAYOUT CONTIGUOUS EXTERNAL { + FILENAME ext1.bin SIZE 200 OFFSET 0 + FILENAME ext2.bin SIZE 200 OFFSET 0 + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME LATE + VALUE 0 + } +} +} diff --git a/tools/testfiles/tfillearly.ddl b/tools/testfiles/tfillearly.ddl new file mode 100644 index 0000000..b48d64f --- /dev/null +++ b/tools/testfiles/tfillearly.ddl @@ -0,0 +1,17 @@ +############################# +Expected output for 'h5dump -H -p -d fill_early tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fill_early" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 800 ( 10, 5 ) + } + FILLVALUE { + FILL_TIME ALLOC + ALLOC_TIME EARLY + VALUE -99 + } +} +} diff --git a/tools/testfiles/tfillifset.ddl b/tools/testfiles/tfillifset.ddl new file mode 100644 index 0000000..b67f5c7 --- /dev/null +++ b/tools/testfiles/tfillifset.ddl @@ -0,0 +1,17 @@ +############################# +Expected output for 'h5dump -H -p -d fill_ifset tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fill_ifset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 800 ( 10, 5 ) + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME EARLY + VALUE -99 + } +} +} diff --git a/tools/testfiles/tfillnever.ddl b/tools/testfiles/tfillnever.ddl new file mode 100644 index 0000000..92f19bc --- /dev/null +++ b/tools/testfiles/tfillnever.ddl @@ -0,0 +1,17 @@ +############################# +Expected output for 'h5dump -H -p -d fill_never tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fill_never" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 800 ( 10, 5 ) + } + FILLVALUE { + FILL_TIME NEVER + ALLOC_TIME EARLY + VALUE -99 + } +} +} diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl new file mode 100644 index 0000000..4e44439 --- /dev/null +++ b/tools/testfiles/tfletcher32.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5dump -H -p -d fletcher32 tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fletcher32" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 816 ( 10, 5 ) + } + FILTERS { + CHECKSUM FLETCHER32 + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE -99 + } +} +} diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl new file mode 100644 index 0000000..754a840 --- /dev/null +++ b/tools/testfiles/treference.ddl @@ -0,0 +1,14 @@ +############################# +Expected output for 'h5dump -d reference tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "reference" { + DATATYPE H5T_REFERENCE + DATASPACE SIMPLE { ( 5 ) / ( 5 ) } + DATA { + (0) DATASET 0:976 /compact , DATATYPE 0:15955 /myvlen , + (2) DATASET 0:976 /compact , DATATYPE 0:15955 /myvlen , + (4) DATASET 0:2376 /contiguous + } +} +} diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl new file mode 100644 index 0000000..c68668c --- /dev/null +++ b/tools/testfiles/tshuffle.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5dump -H -p -d shuffle tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "shuffle" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 800 ( 10, 5 ) + } + FILTERS { + PREPROCESSING SHUFFLE + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE -99 + } +} +} diff --git a/tools/testfiles/tstring.ddl b/tools/testfiles/tstring.ddl new file mode 100644 index 0000000..d6df34b --- /dev/null +++ b/tools/testfiles/tstring.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5dump -e -d string tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "string" { + DATATYPE H5T_STRING { + STRSIZE 57; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + (0) "this is + a string with three + newline + escape characters" + } +} +} diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl new file mode 100644 index 0000000..02a5fd3 --- /dev/null +++ b/tools/testfiles/tszip.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d szip tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "szip" { + } +} +h5dump error: unable to open dataset "szip" diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl new file mode 100644 index 0000000..c262fb6 --- /dev/null +++ b/tools/testfiles/tuserfilter.ddl @@ -0,0 +1,9 @@ +############################# +Expected output for 'h5dump -H -d myfilter tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "myfilter" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } +} +} -- cgit v0.12