summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-04-07 21:36:15 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-04-07 21:36:15 (GMT)
commit6f711ab4cb085936cb2a697d26747efad32ee0d6 (patch)
treeda94c27be5744d8168139a01589571ca9320228d /tools
parent42e2d9dd37a4a943d22f01179abc8eac776f0a9a (diff)
downloadhdf5-6f711ab4cb085936cb2a697d26747efad32ee0d6.zip
hdf5-6f711ab4cb085936cb2a697d26747efad32ee0d6.tar.gz
hdf5-6f711ab4cb085936cb2a697d26747efad32ee0d6.tar.bz2
[svn-r8318] Purpose:
new tests for h5repack Description: added tests that do layout type to layout type conversion in a matrix of 9 between compact, contiguous and chunking Solution: Platforms tested: linux afs has problems; I could not telnet to sol and copper, arabica is really slow (meaning waiting 1 minute for a typed character) and the writing of a file gave an error arabica 181% afs: failed to store file (145) afs: failed to store file (145) Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5repack/Makefile.in4
-rw-r--r--tools/h5repack/h5repack.h20
-rw-r--r--tools/h5repack/h5repack_verify.c9
-rw-r--r--tools/h5repack/testh5repack_attr.c97
-rw-r--r--tools/h5repack/testh5repack_dset.c45
-rw-r--r--tools/h5repack/testh5repack_filters.c29
-rw-r--r--tools/h5repack/testh5repack_layout.c119
-rw-r--r--tools/h5repack/testh5repack_main.c599
-rw-r--r--tools/h5repack/testh5repack_make.c9
-rw-r--r--tools/h5repack/testh5repack_util.c153
10 files changed, 546 insertions, 538 deletions
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index d9e2f92..98f1fea 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -51,10 +51,10 @@ MOSTLYCLEAN=*.h5
## Source and object files for programs...
##
-PROG_SRC=h5repack.c h5repack_copy.c h5repack_filters.c h5repack_refs.c h5repack_layout.c h5repack_list.c h5repack_main.c h5repack_opttable.c h5repack_parse.c h5repack_verify.c testh5repack_attr.c testh5repack_dset.c testh5repack_filters.c testh5repack_main.c testh5repack_make.c
+PROG_SRC=h5repack.c h5repack_copy.c h5repack_filters.c h5repack_refs.c h5repack_layout.c h5repack_list.c h5repack_main.c h5repack_opttable.c h5repack_parse.c h5repack_verify.c testh5repack_attr.c testh5repack_dset.c testh5repack_filters.c testh5repack_main.c testh5repack_make.c testh5repack_layout.c testh5repack_util.c
PROG_OBJ=$(PROG_SRC:.c=.lo)
OBJS=h5repack.lo h5repack_filters.lo h5repack_copy.lo h5repack_refs.lo h5repack_layout.lo h5repack_list.lo h5repack_main.lo h5repack_opttable.lo h5repack_parse.lo h5repack_verify.lo
-TEST_OBJS=h5repack.lo h5repack_filters.lo h5repack_copy.lo h5repack_refs.lo h5repack_layout.lo h5repack_list.lo h5repack_opttable.lo h5repack_parse.lo h5repack_verify.lo testh5repack_attr.lo testh5repack_dset.lo testh5repack_filters.lo testh5repack_main.lo testh5repack_make.lo
+TEST_OBJS=h5repack.lo h5repack_filters.lo h5repack_copy.lo h5repack_refs.lo h5repack_layout.lo h5repack_list.lo h5repack_opttable.lo h5repack_parse.lo h5repack_verify.lo testh5repack_attr.lo testh5repack_dset.lo testh5repack_filters.lo testh5repack_main.lo testh5repack_make.lo testh5repack_layout.lo testh5repack_util.lo
PRIVATE_HDR=
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 6ace654..6d67d69 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -274,7 +274,6 @@ int parse_number(char *str);
int make_testfiles(void);
-int make_attr(hid_t fid);
int write_dset( hid_t loc_id,
int rank,
hsize_t *dims,
@@ -297,6 +296,25 @@ void write_dset_in(hid_t loc_id,
int make_diffs /* flag to modify data buffers */);
int make_filters(hid_t loc_id);
+int make_layout(hid_t loc_id);
+
+
+/*-------------------------------------------------------------------------
+ * tests utils
+ *-------------------------------------------------------------------------
+ */
+int make_dset(hid_t loc_id,
+ const char *name,
+ hid_t sid,
+ hid_t dcpl,
+ void *buf);
+
+int make_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *attr_name,
+ hid_t type_id,
+ void *buf);
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index cee2ab7..e1c01eb 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -199,14 +199,11 @@ int h5repack_verify(const char *fname,
}
/*-------------------------------------------------------------------------
- * layout check; check only if a filter exists
+ * layout check
*-------------------------------------------------------------------------
*/
- if (obj->filter[j].filtn>H5Z_FILTER_NONE )
- {
- if (has_layout(dcpl_id,obj)==0)
- ret=0;
- }
+ if ((obj->layout!=-1) && (has_layout(dcpl_id,obj)==0))
+ ret=0;
/*-------------------------------------------------------------------------
* close
diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c
index ec77864..a1dad92 100644
--- a/tools/h5repack/testh5repack_attr.c
+++ b/tools/h5repack/testh5repack_attr.c
@@ -126,7 +126,7 @@ void write_attr_in(hid_t loc_id,
*/
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
- write_attr(loc_id,1,dims,"string",type_id,buf1);
+ make_attr(loc_id,1,dims,"string",type_id,buf1);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -152,7 +152,7 @@ void write_attr_in(hid_t loc_id,
*/
type_id = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,1,dims,"bitfield",type_id,buf2);
+ make_attr(loc_id,1,dims,"bitfield",type_id,buf2);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -174,7 +174,7 @@ void write_attr_in(hid_t loc_id,
type_id = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,1,dims,"opaque",type_id,buf2);
+ make_attr(loc_id,1,dims,"opaque",type_id,buf2);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -206,7 +206,7 @@ void write_attr_in(hid_t loc_id,
type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,1,dims,"compound",type_id,buf3);
+ make_attr(loc_id,1,dims,"compound",type_id,buf3);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -218,7 +218,7 @@ void write_attr_in(hid_t loc_id,
{
status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1);
status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1);
- write_attr(loc_id,1,dims,"reference to object",H5T_STD_REF_OBJ,buf4);
+ make_attr(loc_id,1,dims,"reference to object",H5T_STD_REF_OBJ,buf4);
}
@@ -246,7 +246,7 @@ void write_attr_in(hid_t loc_id,
type_id = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(type_id, "RED", (val = 0, &val));
H5Tenum_insert(type_id, "GREEN", (val = 1, &val));
- write_attr(loc_id,1,dims,"enum",type_id,buf45);
+ make_attr(loc_id,1,dims,"enum",type_id,buf45);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -319,7 +319,7 @@ position array of </g1> array of </g1> difference
[ 1 ] 6 0 6
*/
type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL);
- write_attr(loc_id,1,dims,"array",type_id,buf6);
+ make_attr(loc_id,1,dims,"array",type_id,buf6);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -349,8 +349,8 @@ position array of </g1> array of </g1> difference
[ 0 ] 1 0 1
[ 1 ] 2 0 2
*/
- write_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7);
- write_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8);
+ make_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7);
+ make_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8);
/*-------------------------------------------------------------------------
@@ -389,7 +389,7 @@ position array of </g1> array of </g1> difference
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
- write_attr(loc_id,2,dims2,"string2D",type_id,buf12);
+ make_attr(loc_id,2,dims2,"string2D",type_id,buf12);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -418,7 +418,7 @@ position array of </g1> array of </g1> difference
type_id = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,2,dims2,"bitfield2D",type_id,buf22);
+ make_attr(loc_id,2,dims2,"bitfield2D",type_id,buf22);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -441,7 +441,7 @@ position array of </g1> array of </g1> difference
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,2,dims2,"opaque2D",type_id,buf22);
+ make_attr(loc_id,2,dims2,"opaque2D",type_id,buf22);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -471,7 +471,7 @@ position array of </g1> array of </g1> difference
type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,2,dims2,"compound2D",type_id,buf32);
+ make_attr(loc_id,2,dims2,"compound2D",type_id,buf32);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -486,7 +486,7 @@ position array of </g1> array of </g1> difference
status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1);
}
}
- write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ make_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
}
/*-------------------------------------------------------------------------
@@ -514,7 +514,7 @@ position enum2D of </g1> enum2D of </g1> difference
type_id = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(type_id, "RED", (val = 0, &val));
H5Tenum_insert(type_id, "GREEN", (val = 1, &val));
- write_attr(loc_id,2,dims2,"enum2D",type_id,buf452);
+ make_attr(loc_id,2,dims2,"enum2D",type_id,buf452);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -598,7 +598,7 @@ position array2D of </g1> array2D of </g1> difference
[ 2 1 ] 18 0 18
*/
type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL);
- write_attr(loc_id,2,dims2,"array2D",type_id,buf62);
+ make_attr(loc_id,2,dims2,"array2D",type_id,buf62);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -633,8 +633,8 @@ position float2D of </g1> float2D of </g1> difference
[ 2 1 ] 6 0 6
*/
- write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72);
- write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82);
+ make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72);
+ make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82);
/*-------------------------------------------------------------------------
@@ -711,7 +711,7 @@ position string3D of </g1> string3D of </g1> difference
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
- write_attr(loc_id,3,dims3,"string3D",type_id,buf13);
+ make_attr(loc_id,3,dims3,"string3D",type_id,buf13);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -759,7 +759,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference
*/
type_id = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,3,dims3,"bitfield3D",type_id,buf23);
+ make_attr(loc_id,3,dims3,"bitfield3D",type_id,buf23);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -768,7 +768,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,3,dims3,"opaque3D",type_id,buf23);
+ make_attr(loc_id,3,dims3,"opaque3D",type_id,buf23);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -848,7 +848,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference
type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,3,dims3,"compound3D",type_id,buf33);
+ make_attr(loc_id,3,dims3,"compound3D",type_id,buf33);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -864,7 +864,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference
status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1);
}
}
- write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ make_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
}
/*-------------------------------------------------------------------------
@@ -913,7 +913,7 @@ position enum3D of </g1> enum3D of </g1> difference
type_id = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(type_id, "RED", (val = 0, &val));
H5Tenum_insert(type_id, "GREEN", (val = 1, &val));
- write_attr(loc_id,3,dims3,"enum3D",type_id,buf453);
+ make_attr(loc_id,3,dims3,"enum3D",type_id,buf453);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -986,7 +986,7 @@ etc
*/
type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL);
- write_attr(loc_id,3,dims3,"array3D",type_id,buf63);
+ make_attr(loc_id,3,dims3,"array3D",type_id,buf63);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
@@ -1024,52 +1024,9 @@ etc
[ 1 1 1 ] 10 0 10
etc
*/
- write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
- write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+ make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
+ make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
}
-
-
-
-/*-------------------------------------------------------------------------
- * Function: write_attr
- *
- * Purpose: utility function to write an attribute in LOC_ID
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 12, 2003
- *
- *-------------------------------------------------------------------------
- */
-
-
-int write_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *attr_name,
- hid_t type_id,
- void *buf)
-{
- hid_t attr_id;
- hid_t space_id;
- herr_t status;
-
- /* Create a buf space */
- space_id = H5Screate_simple(rank,dims,NULL);
-
- /* Create the attribute */
- attr_id = H5Acreate(loc_id,attr_name,type_id,space_id,H5P_DEFAULT);
-
- /* Write the buf */
- if ( buf )
- status = H5Awrite(attr_id,type_id,buf);
-
- /* Close */
- status = H5Aclose(attr_id);
- status = H5Sclose(space_id);
- return status;
-}
-
diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c
index 4d04da1..74ca97e 100644
--- a/tools/h5repack/testh5repack_dset.c
+++ b/tools/h5repack/testh5repack_dset.c
@@ -20,51 +20,6 @@ static void make_dset_reg_ref(hid_t loc_id);
static void read_dset_reg_ref(hid_t loc_id);
-/*-------------------------------------------------------------------------
- * Function: write_dset
- *
- * Purpose: utility function to create and write a dataset in LOC_ID
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 12, 2003
- *
- *-------------------------------------------------------------------------
- */
-
-int write_dset( hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *dset_name,
- hid_t type_id,
- void *buf )
-{
- hid_t dset_id;
- hid_t space_id;
-
- /* Create a buf space */
- if ((space_id = H5Screate_simple(rank,dims,NULL))<0)
- return -1;
-
- /* Create a dataset */
- if ((dset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT))<0)
- return -1;
-
- /* Write the buf */
- if ( buf )
- if (H5Dwrite(dset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
- return -1;
-
- /* Close */
- if (H5Dclose(dset_id)<0)
- return -1;
- if (H5Sclose(space_id)<0)
- return -1;
-
- return 0;
-
-}
-
/*-------------------------------------------------------------------------
* Function: write_dset_in
diff --git a/tools/h5repack/testh5repack_filters.c b/tools/h5repack/testh5repack_filters.c
index df2ba80..b285b28 100644
--- a/tools/h5repack/testh5repack_filters.c
+++ b/tools/h5repack/testh5repack_filters.c
@@ -23,35 +23,6 @@
#define RANK 2
/*-------------------------------------------------------------------------
- * Function: make_dset
- *
- * Purpose: utility function to create and write a dataset in LOC_ID
- *-------------------------------------------------------------------------
- */
-
-static
-int make_dset(hid_t loc_id,const char *name,hid_t sid, hid_t dcpl,void *buf)
-{
- hid_t dsid;
- /* create the dataset */
- if((dsid = H5Dcreate (loc_id,name,H5T_NATIVE_INT,sid,dcpl))<0)
- return -1;
- /* write */
- if(H5Dwrite(dsid,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
- goto out;
- /* close */
- if(H5Dclose(dsid)<0)
- return -1;
- return 0;
- out:
- H5E_BEGIN_TRY {
- H5Dclose(dsid);
- } H5E_END_TRY;
- return -1;
-
-}
-
-/*-------------------------------------------------------------------------
* Function: make_filters
*
* Purpose: make several datasets with filters in location LOC_ID
diff --git a/tools/h5repack/testh5repack_layout.c b/tools/h5repack/testh5repack_layout.c
new file mode 100644
index 0000000..5cf39be
--- /dev/null
+++ b/tools/h5repack/testh5repack_layout.c
@@ -0,0 +1,119 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "hdf5.h"
+#include "h5test.h"
+#include "h5repack.h"
+
+#if 0
+#define CHUNK_DEBUG
+#endif
+
+#if defined(CHUNK_DEBUG)
+#define DIM1 39
+#define DIM2 20
+#define CDIM1 19
+#define CDIM2 10
+#else
+#define DIM1 40
+#define DIM2 20
+#define CDIM1 20
+#define CDIM2 10
+#endif
+
+#define RANK 2
+
+
+/*-------------------------------------------------------------------------
+ * Function: make_layout
+ *
+ * Purpose: make several datasets with several layouts in location LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_layout(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+
+ for (i=n=0; i<DIM1; i++){
+ for (j=0; j<DIM2; j++){
+ buf[i][j]=n++;
+ }
+ }
+/*-------------------------------------------------------------------------
+ * make several dataset with several layout options
+ *-------------------------------------------------------------------------
+ */
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL))<0)
+ return -1;
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
+ * H5D_COMPACT
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pset_layout (dcpl,H5D_COMPACT)<0)
+ goto out;
+ if (make_dset(loc_id,"dset_compact",sid,dcpl,buf)<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
+ * H5D_COMPACT
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pset_layout (dcpl,H5D_CONTIGUOUS)<0)
+ goto out;
+ if (make_dset(loc_id,"dset_contiguous",sid,dcpl,buf)<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
+ * H5D_CHUNKED
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
+ goto out;
+ if (make_dset(loc_id,"dset_chunk",sid,dcpl,buf)<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if(H5Sclose(sid)<0)
+ goto out;
+ if(H5Pclose(dcpl)<0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+
+
+
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index 1e97a66..a008455 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -17,32 +17,49 @@
#include "h5repack.h"
#include "h5diff.h"
+#if 0
+#define PACK_DEBUG
+#endif
+
/*-------------------------------------------------------------------------
- * Function: test_copy
- *
- * Purpose:
+ * Function: main
*
- * 1) make a copy with no filters
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
+ * Purpose: Executes h5repack tests
*
* Return: Success: zero
- * Failure: 1
+ * Failure: non-zero
*
* Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * September, 19, 2003
+ * January, 6, 2004
*
*-------------------------------------------------------------------------
*/
-static int
-test_copy(void)
+
+
+int main (void)
{
pack_opt_t pack_options;
diff_opt_t diff_options;
memset(&diff_options, 0, sizeof (diff_opt_t));
+ memset(&pack_options, 0, sizeof (pack_opt_t));
+
+ /* run tests */
+ puts("Testing h5repack:");
+ /* make the test files */
+ if (make_testfiles()<0)
+ goto error;
- TESTING(" copy with no input filters");
+/*-------------------------------------------------------------------------
+ * Purpose:
+ *
+ * 1) make a copy with no filters
+ * 2) use the h5diff utility to compare the input and output file;
+ * it returns RET==0 if the objects have the same data
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" copy of datasets");
/*-------------------------------------------------------------------------
* file with all kinds of dataset datatypes
@@ -61,6 +78,9 @@ test_copy(void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
+ PASSED();
+
+ TESTING(" copy of attributes");
/*-------------------------------------------------------------------------
* file with attributes
*-------------------------------------------------------------------------
@@ -78,11 +98,13 @@ test_copy(void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
+ PASSED();
+ TESTING(" copy of hardlinks");
+
/*-------------------------------------------------------------------------
* file with hardlinks
*-------------------------------------------------------------------------
*/
-
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME3,FNAME3OUT,&pack_options)<0)
@@ -101,6 +123,8 @@ test_copy(void)
* configuration might not have saved datasets with deflate and SZIP filters
*-------------------------------------------------------------------------
*/
+ PASSED();
+ TESTING(" copy of datasets with filters");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -112,46 +136,10 @@ test_copy(void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-/*-------------------------------------------------------------------------
- * end
- *-------------------------------------------------------------------------
- */
- PASSED();
- return 0;
-
-error:
- return 1;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_filter_none
- *
- * Purpose:
- *
- * 1) remove filters form the filter pipeline
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the compression/chunking input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * September, 19, 2003
- *
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_filter_none(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
+ PASSED();
- TESTING(" removing filters");
+ TESTING(" removing all filters");
/*-------------------------------------------------------------------------
* test the NONE global option
@@ -171,6 +159,10 @@ test_filter_none(void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
+ PASSED();
+
+ TESTING(" removing one filter");
+
/*-------------------------------------------------------------------------
* test the NONE specific option; uncompress a dataset
*-------------------------------------------------------------------------
@@ -191,41 +183,12 @@ test_filter_none(void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-#endif
-
+
PASSED();
- return 0;
-
-error:
- return 1;
-}
+#else
+ SKIPPED();
+#endif
-/*-------------------------------------------------------------------------
- * Function: test_filter_deflate
- *
- * Purpose:
- *
- * 1) compress/chunk FILENAME with the DEFLATE filter
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the compression/chunking input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * September, 19, 2003
- *
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_filter_deflate(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
TESTING(" deflate filter");
@@ -288,45 +251,12 @@ test_filter_deflate(void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
PASSED();
#else
SKIPPED();
#endif
- return 0;
-
-#ifdef H5_HAVE_FILTER_DEFLATE
-error:
- return 1;
-#endif
-}
-/*-------------------------------------------------------------------------
- * Function: test_filter_szip
- *
- * Purpose:
- *
- * 1) compress/chunk FILENAME with the SZIP filter
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the compression/chunking input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * December, 19, 2003
- *
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_filter_szip(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
+
TESTING(" szip filter");
@@ -374,43 +304,7 @@ test_filter_szip(void)
#else
SKIPPED();
#endif
- return 0;
-
-#ifdef H5_HAVE_FILTER_SZIP
-error:
- return 1;
-#endif
-
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_filter_shuffle
- *
- * Purpose:
- *
- * 1) compress/chunk FILENAME with the shuffle filter
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the compression/chunking input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * September, 19, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_filter_shuffle(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
TESTING(" shuffle filter");
@@ -460,41 +354,9 @@ test_filter_shuffle(void)
#else
SKIPPED();
#endif
- return 0;
-
-#ifdef H5_HAVE_FILTER_SHUFFLE
-error:
- return 1;
-#endif
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_filter_checksum
- *
- * Purpose:
- *
- * 1) compress/chunk FILENAME with the checksum filter
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the compression/chunking input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * September, 19, 2003
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_filter_checksum(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
+
TESTING(" checksum filter");
#ifdef H5_HAVE_FILTER_FLETCHER32
@@ -543,42 +405,6 @@ test_filter_checksum(void)
#else
SKIPPED();
#endif
- return 0;
-
-#ifdef H5_HAVE_FILTER_FLETCHER32
-error:
- return 1;
-#endif
-
-
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: test_layout_chunked
- *
- * Purpose:
- *
- * 1) test the CHUNK layout options
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the layout input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * December 30, 2003
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_layout_chunked(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
TESTING(" layout chunked");
@@ -619,37 +445,6 @@ test_layout_chunked(void)
TEST_ERROR;
PASSED();
- return 0;
-
-error:
- return 1;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_layout_contiguous
- *
- * Purpose:
- *
- * 1) test the CONTI layout options
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the layout input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * December 30, 2003
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_layout_contiguous(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
TESTING(" layout contiguous");
@@ -674,7 +469,6 @@ test_layout_contiguous(void)
* test all objects option
*-------------------------------------------------------------------------
*/
-
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addlayout("CONTI",&pack_options)<0)
@@ -685,44 +479,10 @@ test_layout_contiguous(void)
TEST_ERROR;
if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
TEST_ERROR;
- if (h5repack_end (&pack_options)<0)
+ if (h5repack_end (&pack_options)<0)
TEST_ERROR;
PASSED();
- return 0;
-
-error:
- return 1;
-
-
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: test_layout_compact
- *
- * Purpose:
- *
- * 1) test the COMPA layout options
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the layout input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * December 30, 2003
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_layout_compact(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
TESTING(" layout compact");
@@ -763,59 +523,76 @@ test_layout_compact(void)
TEST_ERROR;
PASSED();
- return 0;
-
-error:
- return 1;
-}
+ TESTING(" layout compact to contiguous conversion");
+
/*-------------------------------------------------------------------------
- * Function: test_filterqueue
- *
- * Purpose:
- *
- * 1) test several filters
- * 2) use the h5diff utility to compare the input and output file;
- * it returns RET==0 if the objects have the same data
- * 3) use API functions to verify the input on the output file
- *
- * Return: Success: zero
- * Failure: 1
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * January 5, 2004
- *
+ * layout compact to contiguous conversion
*-------------------------------------------------------------------------
*/
-static int
-test_filterqueue(void)
-{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
- memset(&diff_options, 0, sizeof (diff_opt_t));
- memset(&pack_options, 0, sizeof (pack_opt_t));
-
- TESTING(" filter queue");
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_compact:CONTI",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
+
+ TESTING(" layout compact to chunk conversion");
/*-------------------------------------------------------------------------
- * add some filters
+ * layout compact to chunk conversion
*-------------------------------------------------------------------------
*/
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
+ TESTING(" layout compact to compact conversion");
+
+/*-------------------------------------------------------------------------
+ * layout compact to compact conversion
+ *-------------------------------------------------------------------------
+ */
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
- if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0)
+ if (h5repack_addlayout("dset_compact:COMPA",&pack_options)<0)
TEST_ERROR;
-#if defined (H5_HAVE_FILTER_FLETCHER32)
- if (h5repack_addfilter("dset1:FLET",&pack_options)<0)
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
TEST_ERROR;
-#endif
- if (h5repack_addfilter("dset1:SHUF",&pack_options)<0)
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
TEST_ERROR;
- if (h5repack_addfilter("dset1:SZIP=8",&pack_options)<0)
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
TEST_ERROR;
- if (h5repack_addfilter("dset1:GZIP=1",&pack_options)<0)
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
+
+ TESTING(" layout contiguous to compact conversion");
+/*-------------------------------------------------------------------------
+ * layout contiguous to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options)<0)
TEST_ERROR;
if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
TEST_ERROR;
@@ -825,74 +602,138 @@ test_filterqueue(void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
- PASSED();
- return 0;
-
-error:
- return 1;
-}
-
-
+ PASSED();
+
+ TESTING(" layout contiguous to chunk conversion");
/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Executes h5repack tests
- *
- * Return: Success: zero
- * Failure: non-zero
- *
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
- * January, 6, 2004
- *
+ * layout contiguous to chunk conversion
*-------------------------------------------------------------------------
*/
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
+ TESTING(" layout contiguous to contiguous conversion");
-int main (void)
-{
- int nerrors=0;
-
- /* run tests */
- puts("Testing h5repack:");
-
- /* make the test files */
- if (make_testfiles()<0)
- goto error;
+/*-------------------------------------------------------------------------
+ * layout contiguous to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
- /* test a copy with no filters */
- nerrors += test_copy();
+ TESTING(" layout chunked to compact conversion");
+/*-------------------------------------------------------------------------
+ * layout chunked to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_chunk:COMPA",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
- /* test a copy with the delete filters option */
- nerrors += test_filter_none();
+ TESTING(" layout chunked to contiguous conversion");
- /* test a copy with the deflate filter */
- nerrors += test_filter_deflate();
+/*-------------------------------------------------------------------------
+ * layout chunked to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_chunk:CONTI",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
- /* test a copy with the szip filter */
- nerrors += test_filter_szip();
+ TESTING(" layout chunked to chunk conversion");
+/*-------------------------------------------------------------------------
+ * layout chunked to chunked conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
- /* test a copy with the shuffle filter */
- nerrors += test_filter_shuffle();
- /* test a copy with the checksum filter */
- nerrors += test_filter_checksum();
+ TESTING(" filter queue");
- /* test a copy with layout CHUNK options */
- nerrors += test_layout_chunked();
+/*-------------------------------------------------------------------------
+ * add some filters
+ *-------------------------------------------------------------------------
+ */
- /* test a copy with layout CONTI options */
- nerrors += test_layout_contiguous();
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0)
+ TEST_ERROR;
+#if defined (H5_HAVE_FILTER_FLETCHER32)
+ if (h5repack_addfilter("dset1:FLET",&pack_options)<0)
+ TEST_ERROR;
+#endif
+ if (h5repack_addfilter("dset1:SHUF",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset1:SZIP=8",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset1:GZIP=1",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
- /* test a copy with layout COMPA options */
- nerrors += test_layout_compact();
-
- /* test a copy with all available filters */
- nerrors += test_filterqueue();
+ PASSED();
- /* check for errors */
- if (nerrors)
- goto error;
puts("All h5repack tests passed.");
return 0;
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index f625d2a..faacce4 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -44,7 +44,6 @@ int make_testfiles(void)
return -1;
if (make_all_objects(loc_id)<0)
goto out;
- /* close */
if(H5Fclose(loc_id)<0)
return -1;
@@ -56,7 +55,6 @@ int make_testfiles(void)
return -1;
if (make_attributes(loc_id)<0)
goto out;
- /* close */
if(H5Fclose(loc_id)<0)
return -1;
/*-------------------------------------------------------------------------
@@ -67,18 +65,18 @@ int make_testfiles(void)
return -1;
if (make_special_objects(loc_id)<0)
goto out;
- /* close */
if(H5Fclose(loc_id)<0)
return -1;
/*-------------------------------------------------------------------------
- * create a file for the filters test
+ * create a file for the filters and layouts test
*-------------------------------------------------------------------------
*/
if((loc_id = H5Fcreate(FNAME4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
return -1;
if (make_filters(loc_id)<0)
goto out;
- /* close */
+ if (make_layout(loc_id)<0)
+ goto out;
if(H5Fclose(loc_id)<0)
return -1;
@@ -120,7 +118,6 @@ int make_all_objects(hid_t loc_id)
* H5G_DATASET
*-------------------------------------------------------------------------
*/
-
space_id = H5Screate_simple(1,dims,NULL);
dset_id = H5Dcreate(loc_id,"dset_referenced",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
H5Sclose(space_id);
diff --git a/tools/h5repack/testh5repack_util.c b/tools/h5repack/testh5repack_util.c
new file mode 100644
index 0000000..f74b414
--- /dev/null
+++ b/tools/h5repack/testh5repack_util.c
@@ -0,0 +1,153 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "hdf5.h"
+#include "h5repack.h"
+
+/*-------------------------------------------------------------------------
+ * Function: make_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_dset(hid_t loc_id,
+ const char *name,
+ hid_t sid,
+ hid_t dcpl,
+ void *buf)
+{
+ hid_t dsid;
+
+ /* create the dataset */
+ if((dsid = H5Dcreate (loc_id,name,H5T_NATIVE_INT,sid,dcpl))<0)
+ return -1;
+
+ /* write */
+ if(H5Dwrite(dsid,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
+ goto out;
+
+ /* close */
+ if(H5Dclose(dsid)<0)
+ return -1;
+
+ return 0;
+ out:
+ H5E_BEGIN_TRY {
+ H5Dclose(dsid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: write_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int write_dset( hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *dset_name,
+ hid_t type_id,
+ void *buf )
+{
+ hid_t dset_id;
+ hid_t space_id;
+
+ /* Create a buf space */
+ if ((space_id = H5Screate_simple(rank,dims,NULL))<0)
+ return -1;
+
+ /* Create a dataset */
+ if ((dset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT))<0)
+ return -1;
+
+ /* Write the buf */
+ if ( buf )
+ if (H5Dwrite(dset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
+ return -1;
+
+ /* Close */
+ if (H5Dclose(dset_id)<0)
+ return -1;
+ if (H5Sclose(space_id)<0)
+ return -1;
+
+ return 0;
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: write_attr
+ *
+ * Purpose: utility function to write an attribute in LOC_ID
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int make_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *attr_name,
+ hid_t type_id,
+ void *buf)
+{
+ hid_t attr_id;
+ hid_t space_id;
+
+ /* create a space */
+ if ((space_id = H5Screate_simple(rank,dims,NULL))<0)
+ return -1;
+
+ /* create the attribute */
+ if ((attr_id = H5Acreate(loc_id,attr_name,type_id,space_id,H5P_DEFAULT))<0)
+ goto out;
+
+ /* write the buffer */
+ if ( buf )
+ {
+ if (H5Awrite(attr_id,type_id,buf)<0)
+ goto out;
+ }
+
+ /* close */
+ H5Aclose(attr_id);
+ H5Sclose(space_id);
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Aclose(attr_id);
+ H5Sclose(space_id);
+ } H5E_END_TRY;
+ return -1;
+}
+