diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-09-24 22:14:50 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-09-24 22:14:50 (GMT) |
commit | 426a3c1204fdcd1a999a966958a2edecc99b2d3b (patch) | |
tree | a786821d8e38f98f8977c30bf91c14b6d3267fd9 /tools/h5diff | |
parent | a2a61197aa18fcafef35ecc4aaef268b2e4731d5 (diff) | |
download | hdf5-426a3c1204fdcd1a999a966958a2edecc99b2d3b.zip hdf5-426a3c1204fdcd1a999a966958a2edecc99b2d3b.tar.gz hdf5-426a3c1204fdcd1a999a966958a2edecc99b2d3b.tar.bz2 |
[svn-r17522] Description:
Bring in the rest of Vailin's changes for testing fixed array chunk
indices, across the range of range of all the tools and the appropriate dataset
tests.
Tested on:
Mac OS X/32 10.5.8 (amazon) w/debug & production
(h5committest not required for this branch)
Diffstat (limited to 'tools/h5diff')
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 103 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_dset_idx1.h5 | bin | 0 -> 5974 bytes | |||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_dset_idx2.h5 | bin | 0 -> 2206 bytes | |||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_idx.txt | 19 | ||||
-rwxr-xr-x | tools/h5diff/testh5diff.sh | 11 |
5 files changed, 132 insertions, 1 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index cae79b6..1bfea17 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -43,6 +43,8 @@ #define FILE9 "h5diff_hyper1.h5" #define FILE10 "h5diff_hyper2.h5" #define FILE11 "h5diff_empty.h5" +#define FILE12 "h5diff_dset_idx1.h5" +#define FILE13 "h5diff_dset_idx2.h5" #define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */ #define STR_SIZE 3 #define GBLL ((unsigned long long) 1024 * 1024 *1024 ) @@ -87,6 +89,7 @@ static void gen_datareg(hid_t fid,int make_diffs); /* utilities */ static int write_attr(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf); static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf); +static int gen_dataset_idx(const char *file, int format); /*------------------------------------------------------------------------- @@ -118,8 +121,17 @@ int main(void) /* generate 2 files, the second call creates a similar file with differences */ test_hyperslab(FILE9,0); test_hyperslab(FILE10,1); - return 0; + /* + * Generate 2 files: FILE12 with old format; FILE13 with new format + * Create 2 datasets in each file: + * One dataset: chunked layout, w/o filters, fixed dimension + * One dataset: chunked layout, w/ filters, fixed dimension + */ + gen_dataset_idx(FILE12, 0); + gen_dataset_idx(FILE13, 1); + + return 0; } /*------------------------------------------------------------------------- @@ -893,6 +905,95 @@ int test_datasets(const char *file, } /*------------------------------------------------------------------------- +* Function: gen_dataset_idx +* +* Purpose: Create a file with either the new or old format +* Create two datasets in the file: +* one dataset: fixed dimension, chunked layout, w/o filters +* one dataset: fixed dimension, chunked layout, w/ filters +* +*------------------------------------------------------------------------- +*/ +static +int gen_dataset_idx(const char *file, int format) +{ + hid_t fid; /* file id */ + hid_t did, did2; /* dataset id */ + hid_t sid; /* space id */ + hid_t fapl; /* file access property id */ + hid_t dcpl; /* dataset creation property id */ + hsize_t dims[1] = {10}; /* dataset dimension */ + hsize_t c_dims[1] = {2}; /* chunk dimension */ + herr_t status; /* return status */ + int buf[10]; /* data buffer */ + int i; /* local index variable */ + + /* Get a copy of the file aaccess property */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + + /* Set the "use the latest format" bounds for creating objects in the file */ + if(format) { + status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + assert(status >= 0); + } + + /* Create a file */ + if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + return -1; + + /* Create data */ + for(i = 0; i < 10; i++) + buf[i] = i; + + /* Set chunk */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + status = H5Pset_chunk(dcpl, 1, c_dims); + assert(status >= 0); + + /* Create a 1D dataset */ + sid = H5Screate_simple(1, dims, NULL); + did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + + /* Write to the dataset */ + status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + assert(status >= 0); + +#if defined (H5_HAVE_FILTER_DEFLATE) + /* set deflate data */ + status = H5Pset_deflate(dcpl, 9); + assert(status >= 0); + + /* Create and write the dataset */ + did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + assert(status >= 0); + + /* Close the dataset */ + status = H5Dclose(did2); + assert(status >= 0); + +#endif + + /* closing: dataspace, dataset, file */ + status = H5Sclose(sid); + assert(status >= 0); + + status = H5Dclose(did); + assert(status >= 0); + + status = H5Fclose(fid); + assert(status >= 0); + + status = H5Pclose(dcpl); + assert(status >= 0); + + status = H5Pclose(fapl); + assert(status >= 0); + + return status; +} + +/*------------------------------------------------------------------------- * Function: write_attr_in * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) diff --git a/tools/h5diff/testfiles/h5diff_dset_idx1.h5 b/tools/h5diff/testfiles/h5diff_dset_idx1.h5 Binary files differnew file mode 100644 index 0000000..684925d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_dset_idx1.h5 diff --git a/tools/h5diff/testfiles/h5diff_dset_idx2.h5 b/tools/h5diff/testfiles/h5diff_dset_idx2.h5 Binary files differnew file mode 100644 index 0000000..ea721d1 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_dset_idx2.h5 diff --git a/tools/h5diff/testfiles/h5diff_idx.txt b/tools/h5diff/testfiles/h5diff_idx.txt new file mode 100644 index 0000000..3b37720 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_idx.txt @@ -0,0 +1,19 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset + x x /dset_filter + +group : </> and </> +0 differences found +dataset: </dset> and </dset> +Not comparable: </dset> or </dset> is an empty dataset +0 differences found +dataset: </dset_filter> and </dset_filter> +Not comparable: </dset_filter> or </dset_filter> is an empty dataset +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index b8e743d..22c6f3f 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -42,6 +42,8 @@ SRCFILE8=h5diff_dset2.h5 SRCFILE9=h5diff_hyper1.h5 SRCFILE10=h5diff_hyper2.h5 SRCFILE11=h5diff_empty.h5 +SRCFILE12=h5diff_dset_idx1.h5 +SRCFILE13=h5diff_dset_idx2.h5 FILE1="$INDIR/$SRCFILE1" FILE2="$INDIR/$SRCFILE2" @@ -54,6 +56,8 @@ FILE8="$INDIR/$SRCFILE8" FILE9="$INDIR/$SRCFILE9" FILE10="$INDIR/$SRCFILE10" FILE11="$INDIR/$SRCFILE11" +FILE12="$INDIR/$SRCFILE12" +FILE13="$INDIR/$SRCFILE13" H5DIFF=h5diff # The tool name @@ -615,6 +619,13 @@ TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset8 g2/dset9 TOOLTEST h5diff_207.txt -c $FILE2 $FILE2 g2/dset8 g2/dset9 +# ############################################################################## +# 12. The comparision for the two datasets between the 2 files should be the same +# SRCFILE12: B-tree indexing is used for the datasets +# SRCFILE13: Fixed Array indexing is used for the datasets +# ############################################################################## +TESTING $H5DIFF -v $SRCFILE12 $SRCFILE13 +TOOLTEST h5diff_idx.txt -v $FILE12 $FILE13 # ############################################################################## |