diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-10 17:35:48 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-10 17:35:48 (GMT) |
commit | 78ca05e040c21cf79fe09da5269204f64bf6d967 (patch) | |
tree | 3f03841c935006d1d103b4e1063c6448a0456edc /tools/h5dump | |
parent | 29f91cd95d7ab067e46cad06d4cf48b03aabc834 (diff) | |
download | hdf5-78ca05e040c21cf79fe09da5269204f64bf6d967.zip hdf5-78ca05e040c21cf79fe09da5269204f64bf6d967.tar.gz hdf5-78ca05e040c21cf79fe09da5269204f64bf6d967.tar.bz2 |
[svn-r8644] 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:
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 78 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 411 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 66 |
3 files changed, 515 insertions, 40 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 550527b..b276e25 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -18,11 +18,12 @@ #include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" +#include "h5tools_ref.h" #include "h5trav.h" /* module-scoped variables */ -static const char *progname = "h5dump"; +const char *progname = "h5dump"; /* 3 private values: can't be set, but can be read. Note: these are defined in H5Zprivate, they are @@ -32,11 +33,11 @@ static const char *progname = "h5dump"; #define H5_SZIP_MSB_OPTION_MASK 16 #define H5_SZIP_RAW_OPTION_MASK 128 -static int d_status = EXIT_SUCCESS; +int d_status = EXIT_SUCCESS; static int unamedtype = 0; /* shared data type with no name */ static size_t prefix_len = 1024; static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; -static char *prefix; +char *prefix; static const char *driver = NULL; /* The driver to open the file with. */ static const dump_header *dump_header_format; @@ -52,15 +53,14 @@ static int display_bb = FALSE; /*superblock */ static int display_dcpl = FALSE; /*dcpl */ static int display_fi = FALSE; /*file index */ static int display_ai = TRUE; /*array index */ +static int display_lf = FALSE; /*do CR/LF */ + /** ** Added for XML ** **/ -/* fill_ref_path_table is called to inialize the object reference paths. */ -static herr_t fill_ref_path_table(hid_t, const char *, void *); - /* module-scoped variables for XML option */ #define DEFAULT_XSD "http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.xsd" #define DEFAULT_DTD "http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.dtd" @@ -69,13 +69,8 @@ static int doxml = 0; static int useschema = 1; static const char *xml_dtd_uri = NULL; static const char *xmlnsprefix="hdf5:"; -static hid_t thefile = -1; -typedef struct ref_path_table_entry { - hid_t obj; - char *apath; - H5G_stat_t statbuf; - struct ref_path_table_entry *next; -} ref_path_table_entry_t; +hid_t thefile = -1; + /** end XML **/ /* internal functions */ @@ -83,14 +78,12 @@ static hid_t h5_fileaccess(void); static void dump_oid(hid_t oid); static void print_enum(hid_t type); static herr_t dump_all(hid_t group, const char *name, void *op_data); -static char *lookup_ref_path(hobj_ref_t ); #ifdef LATER static void check_compression(hid_t); #endif /* LATER */ -static ref_path_table_entry_t *ref_path_table_lookup(const char *); static int xml_name_to_XID(const char *, char *, int , int ); -static int get_next_xid(void); -static haddr_t get_fake_xid (void); + + /* external functions */ extern int print_data(hid_t, hid_t, int); @@ -160,7 +153,8 @@ static h5dump_t dataformat = { "%s", /*dset_blockformat_pre */ "%s", /*dset_ptformat_pre */ "%s", /*dset_ptformat */ - 1 /*array indices */ + 1 , /*array indices */ + 1 /*interpret CR/LF information */ }; @@ -244,7 +238,8 @@ static h5dump_t xml_dataformat = { "%s", /*dset_blockformat_pre */ "%s", /*dset_ptformat_pre */ "%s", /*dset_ptformat */ - 0 /*array indices */ + 0 , /*array indices */ + 0 /*interpret CR/LF information */ }; /** XML **/ @@ -331,8 +326,6 @@ static void xml_print_datatype(hid_t, unsigned); static void xml_print_enum(hid_t); static int xml_print_refs(hid_t, int); static int xml_print_strs(hid_t, int); -static ref_path_table_entry_t *ref_path_table_put(hid_t, const char *); -static ref_path_table_entry_t *ref_path_table_gen_fake(const char *); static char *xml_escape_the_string(const char *, int); static char *xml_escape_the_name(const char *); @@ -352,7 +345,7 @@ struct handler_t { /* binary: not implemented yet */ static const char *s_opts = "hbBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A"; #else -static const char *s_opts = "hnpBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A"; +static const char *s_opts = "hnpeBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A"; #endif /* 0 */ static struct long_options l_opts[] = { { "help", no_arg, 'h' }, @@ -600,6 +593,7 @@ usage(const char *prog) fprintf(stdout, " -A Print the header and value of attributes; data of datasets is not displayed\n"); fprintf(stdout, " -i, --object-ids Print the object ids\n"); fprintf(stdout, " -r, --string Print 1-byte integer datasets as ASCII\n"); + fprintf(stdout, " -e, Interpret carriage return (\\n) as new line\n"); fprintf(stdout, " -V, --version Print version number and exit\n"); fprintf(stdout, " -a P, --attribute=P Print the specified attribute\n"); fprintf(stdout, " -d P, --dataset=P Print the specified dataset\n"); @@ -1966,6 +1960,9 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex) depth=0; } + /*interpret CR/LF information */ + outputformat->do_lf=display_lf; + status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth); H5Tclose(f_type); @@ -2086,18 +2083,24 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id) h5tools_context_t ctx; /*print context */ size_t size; void *buf=NULL; - hsize_t nelmts=1; + 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); @@ -2160,11 +2163,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 ", (int)storage_size); + HDfprintf(stdout, "SIZE %Hu ", storage_size); rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); - printf("%s %d", dump_header_format->dataspacedimbegin, (int)chsize[0]); + HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]); for ( i=1; i<rank; i++) - printf(", %d", (int)chsize[i]); + HDfprintf(stdout, ", %Hu", chsize[i]); printf(" %s\n", dump_header_format->dataspacedimend); /*end indent */ indent -= COL; @@ -2177,7 +2180,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", (int)storage_size); + HDfprintf(stdout, "SIZE %Hu\n", storage_size); /*end indent */ indent -= COL; indentation(indent + COL); @@ -2196,9 +2199,9 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indent += COL; for ( i=0; i<next; i++) { - H5Pget_external(dcpl_id,(unsigned)i,sizeof(name),name,&offset,&size); + H5Pget_external(dcpl_id,i,sizeof(name),name,&offset,&size); indentation(indent + COL); - printf("FILENAME %s SIZE %d OFFSET %d\n",name,(int)size,(int)offset); + HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset); } /*end indent */ indent -= COL; @@ -2212,7 +2215,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 OFFSET %d\n", (int)storage_size, (int)ioffset); + HDfprintf(stdout,"SIZE %Hu OFFSET %Hu\n", storage_size, ioffset); /*end indent */ indent -= COL; indentation(indent + COL); @@ -2340,8 +2343,6 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) H5Pget_fill_time(dcpl_id, &ft); switch ( ft ) { - default: - break; case H5D_FILL_TIME_ALLOC: printf("%s", "ALLOC\n"); break; @@ -3061,6 +3062,9 @@ parse_start: case 'p': display_dcpl = TRUE; break; + case 'e': + display_lf = TRUE; + break; case 'H': display_data = FALSE; display_attr_data = FALSE; @@ -3702,6 +3706,8 @@ print_enum(hid_t type) printf("\n%*s <empty>", indent + 4, ""); } +#if 0 + /* * XML support */ @@ -3879,7 +3885,7 @@ ref_path_table_gen_fake(const char *path) * *------------------------------------------------------------------------- */ -static char * +char * lookup_ref_path(hobj_ref_t ref) { ref_path_table_entry_t *pte = ref_path_table; @@ -3983,6 +3989,8 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) return 0; } +#endif + /* * create a string suitable for and XML NCNAME. Uses the * object reference to create the string. diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 9231b64..cd477da 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -4447,6 +4447,8 @@ make_external(hid_t fid) assert(ret>=0); } + +#if 0 /*------------------------------------------------------------------------- * Function: gent_filters * @@ -4473,10 +4475,11 @@ static void gent_filters(void) hsize_t dims2[1]={2}; hvl_t buf2[2]; hsize_t dims3[1]={1}; - 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"}; - hobj_ref_t buf5[2]; + hobj_ref_t buf5[5]; + hsize_t dims5[1]={5}; int i, j, n, ret, fillval, val; typedef enum @@ -4787,14 +4790,412 @@ static void gent_filters(void) * reference *------------------------------------------------------------------------- */ - ret=H5Rcreate(&buf5[0],fid,"char",H5R_OBJECT,-1); + 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 + *------------------------------------------------------------------------- + */ + + ret=H5Sclose(sid1); + assert(ret>=0); + + ret=H5Sclose(sid); + assert(ret>=0); + + ret=H5Pclose(dcpl); + assert(ret>=0); + + ret=H5Fclose(fid); + assert(ret>=0); +} + +#endif + + +/*------------------------------------------------------------------------- + * Function: gent_filters + * + * Purpose: make several datasets with filters, external dataset + * fill value + * + *------------------------------------------------------------------------- + */ +static void gent_filters() +{ + hid_t fid; /* file id */ + hid_t dcpl; /* dataset creation property list */ + hid_t sid; /* dataspace ID */ + 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\n a string with three\n newline\n escape characters"}; + hsize_t dims4[1]={6}; + char buf4[6]={"abcdef"}; + hobj_ref_t buf5[5]; + hsize_t dims5[1]={5}; + int i, j, n, ret, val; + int fillval = -99; + + + typedef enum + { + E_RED, + E_GREEN + } e_t; + + + for (i=n=0; i<DIM1; i++){ + for (j=0; j<DIM2; j++){ + buf1[i][j]=n++; + } + } + + /* create a file */ + fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid>=0); + + /* create a space */ + sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); + + /* 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 + *------------------------------------------------------------------------- + */ + ret=H5Pset_layout(dcpl, H5D_COMPACT); + assert(ret>=0); + + ret=make_dset(fid,"compact",sid,dcpl,buf1); + assert(ret>=0); + + ret=H5Gset_comment(fid,"compact", "This is a dataset with compact storage"); + assert(ret>=0); + + ret=H5Pset_layout(dcpl, H5D_CONTIGUOUS); + assert(ret>=0); + + ret=make_dset(fid,"contiguous",sid,dcpl,buf1); + assert(ret>=0); + + 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 + *------------------------------------------------------------------------- + */ + + /* set up chunk */ + ret=H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * SZIP + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_SZIP) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set szip data */ + ret=H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); + assert(ret>=0); + + ret=make_dset(fid,"szip",sid,dcpl,buf1); + assert(ret>=0); +#endif + +/*------------------------------------------------------------------------- + * GZIP + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_DEFLATE) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set deflate data */ + ret=H5Pset_deflate(dcpl, 9); assert(ret>=0); - ret=H5Rcreate(&buf5[1],fid,"string",H5R_OBJECT,-1); + + ret=make_dset(fid,"deflate",sid,dcpl,buf1); assert(ret>=0); - write_dset(fid,1,dims2,"reference",H5T_STD_REF_OBJ,buf5); +#endif +/*------------------------------------------------------------------------- + * shuffle + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_SHUFFLE) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set the shuffle filter */ + ret=H5Pset_shuffle(dcpl); + assert(ret>=0); + + ret=make_dset(fid,"shuffle",sid,dcpl,buf1); + assert(ret>=0); +#endif + + +/*------------------------------------------------------------------------- + * checksum + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_FLETCHER32) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set the checksum filter */ + ret=H5Pset_fletcher32(dcpl); + assert(ret>=0); + ret=make_dset(fid,"fletcher32",sid,dcpl,buf1); + assert(ret>=0); +#endif + +/*------------------------------------------------------------------------- + * all filters + *------------------------------------------------------------------------- + */ + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + +#if defined (H5_HAVE_FILTER_SHUFFLE) + /* set the shuffle filter */ + ret=H5Pset_shuffle(dcpl); + assert(ret>=0); +#endif + +#if defined (H5_HAVE_FILTER_SZIP) + szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK; + /* set szip data */ + ret=H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); + assert(ret>=0); +#endif + +#if defined (H5_HAVE_FILTER_DEFLATE) + /* set deflate data */ + ret=H5Pset_deflate(dcpl, 5); + assert(ret>=0); +#endif + +#if defined (H5_HAVE_FILTER_FLETCHER32) + /* set the checksum filter */ + ret=H5Pset_fletcher32(dcpl); + assert(ret>=0); +#endif + + ret=make_dset(fid,"all",sid,dcpl,buf1); + assert(ret>=0); + + +/*------------------------------------------------------------------------- + * user defined filter + *------------------------------------------------------------------------- + */ + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + +#ifdef H5_WANT_H5_V1_4_COMPAT + ret=H5Zregister (MYFILTER_ID, "myfilter", myfilter); +#else + ret=H5Zregister (H5Z_MYFILTER); +#endif + assert(ret>=0); + + H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL); + assert(ret>=0); + + ret=make_dset(fid,"myfilter",sid,dcpl,buf1); + assert(ret>=0); + + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * make an external dataset + *------------------------------------------------------------------------- + */ + make_external(fid); + + /*------------------------------------------------------------------------- + * make datasets with fill value combinations + *------------------------------------------------------------------------- + */ + + + ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); + assert(ret>=0); + + ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC); + assert(ret>=0); + + ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); + assert(ret>=0); + + 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); + assert(ret>=0); + + ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); + assert(ret>=0); + + 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, "mytype", tid); + assert(ret>=0); + + ret=H5Gset_comment(fid,"mytype", "This is a commited datatype"); + assert(ret>=0); + + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * enum type with nonprintable characters in the name + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED 3 \\n", (val = 0, &val)); + write_dset(fid,2,dims1,"enum",tid,0); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * vlen + *------------------------------------------------------------------------- + */ + + buf2[0].len = 1; + buf2[0].p = malloc( 1 * sizeof(int)); + ((int *)buf2[0].p)[0]=1; + buf2[1].len = 2; + buf2[1].p = malloc( 2 * sizeof(int)); + ((int *)buf2[1].p)[0]=2; + ((int *)buf2[1].p)[1]=3; + + sid1=H5Screate_simple(1,dims2,NULL); + tid=H5Tvlen_create(H5T_NATIVE_INT); + did=H5Dcreate(fid,"vlen",tid,sid1,H5P_DEFAULT); + ret=H5Dwrite(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2); + assert(ret>=0); + ret=H5Tcommit(fid,"myvlen",tid); + assert(ret>=0); + ret=H5Dvlen_reclaim(tid,sid1,H5P_DEFAULT,buf2); + assert(ret>=0); + ret=H5Dclose(did); + assert(ret>=0); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * bitfield + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_STD_B8LE); + write_dset(fid,1,dims3,"bitfield",tid,buf3); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * string + *------------------------------------------------------------------------- + */ + + tid=H5Tcopy(H5T_C_S1); + ret=H5Tset_size(tid, sizeof(buf3)); + assert(ret>=0); + write_dset(fid,1,dims3,"string",tid,buf3); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * char array + *------------------------------------------------------------------------- + */ + 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..067d0f0 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 ### @@ -209,6 +218,63 @@ TOOLTEST tboot.ddl -H -B -d compact tfilters.h5 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." fi |