summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-03-02 18:12:25 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-03-02 18:12:25 (GMT)
commit931efcb5ebd4099d18d93e7dcdaf296ea4991d73 (patch)
tree045fa2f9825fae4609e73d39b6831f1efa6a3c43
parent77d3875c5b0787d373165f6b7537081b46e0d031 (diff)
downloadhdf5-931efcb5ebd4099d18d93e7dcdaf296ea4991d73.zip
hdf5-931efcb5ebd4099d18d93e7dcdaf296ea4991d73.tar.gz
hdf5-931efcb5ebd4099d18d93e7dcdaf296ea4991d73.tar.bz2
[svn-r8229] Purpose:
1) new function for tools library 2) new test script for h5repack Description: 1) currently all the tools (h5dump, h5diff, etc) do not check if a filter is available for reading some dataset that might have a filter not available on the current configuration (the behaviour of the tools until now was to trigger a library error, saying that the dataset cannot be read due to the lack of the filter) Solution: 1) added a new function h5tools_canreadf that checks if a dataset can be read depending on the availability of filters. this function was added in calls for h5diff and h5repack. instead of triggering the library error, a message is printed, saying that the dataset cannot be read (the print is optional, it is on on verbose mode) 2) added a shell script that tests the commannd line tool behaviour of h5repack the script does a series of runs of h5repack with several options on the same file (this file test4.h5 was added to the testfiles dir). then, it runs the h5diff tool, with the input and output files , in each run. the goal of the test is also to check item 1) . the binary file was saved with filters that might not be available on other configurations Platforms tested: linux (all filters enabled) linux (some filters disabled) solaris (some filters disabled) AIX (some filters disabled) windows (all filters on and off ) Misc. update:
-rw-r--r--MANIFEST4
-rw-r--r--tools/h5repack/Makefile.in3
-rw-r--r--tools/h5repack/h5repack.c8
-rw-r--r--tools/h5repack/h5repack.h7
-rw-r--r--tools/h5repack/h5repack.sh108
-rw-r--r--tools/h5repack/h5repack_copy.c11
-rw-r--r--tools/h5repack/h5repack_filters.c4
-rw-r--r--tools/h5repack/h5repack_main.c5
-rw-r--r--tools/h5repack/h5repack_refs.c28
-rw-r--r--tools/h5repack/h5repack_verify.c3
-rw-r--r--tools/h5repack/testh5repack_filters.c11
-rw-r--r--tools/h5repack/testh5repack_main.c9
-rw-r--r--tools/lib/Makefile.in2
-rw-r--r--tools/lib/h5diff_dset.c39
-rw-r--r--tools/lib/h5tools.h3
-rw-r--r--tools/lib/h5tools_filters.c144
-rw-r--r--tools/testfiles/h5repack_info.txt1
-rw-r--r--tools/testfiles/test4.h5bin0 -> 35552 bytes
18 files changed, 342 insertions, 48 deletions
diff --git a/MANIFEST b/MANIFEST
index 4125295..57c02d7 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1170,6 +1170,7 @@
./tools/lib/h5trav_table.c
./tools/lib/h5trav.h
./tools/lib/h5diff.h
+./tools/lib/h5tools_filters.c
./tools/misc/Dependencies
./tools/misc/Makefile.in
@@ -1465,6 +1466,9 @@
./tools/testfiles/h5diff_70.txt
./tools/testfiles/h5diff_80.txt
+#test files for h5repack
+./tools/testfiles/test4.h5
+./tools/testfiles/h5repack_info.txt
./windows/all.zip
./windows/all_withf90.zip
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index 757771d..d9e2f92 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -28,7 +28,8 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \
## Test programs and scripts.
##
TEST_PROGS=h5repacktst
-TEST_SCRIPTS=
+TEST_SCRIPTS=$(srcdir)/h5repack.sh
+
## These are our main targets: library and tools.
##
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 8cca76d..3863846 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -408,10 +408,10 @@ void read_info(const char *filename,
break;
/*-------------------------------------------------------------------------
- * comp
+ * filter
*-------------------------------------------------------------------------
*/
- if (strcmp(stype,"-t") == 0) {
+ if (strcmp(stype,"-f") == 0) {
/* find begining of info */
i=0; c='0';
@@ -435,10 +435,10 @@ void read_info(const char *filename,
}
}
/*-------------------------------------------------------------------------
- * chunk
+ * layout
*-------------------------------------------------------------------------
*/
- else if (strcmp(stype,"-c") == 0) {
+ else if (strcmp(stype,"-l") == 0) {
/* find begining of info */
i=0; c='0';
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index fa1c4b4..5abaf13 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -18,6 +18,9 @@
#include "hdf5.h"
#include "h5trav.h"
+#include "h5diff.h"
+#include "h5tools.h"
+
#if 0
#define H5_REPACK_DEBUG
@@ -203,6 +206,10 @@ int check_szip(hid_t type_id, /* dataset datatype */
unsigned *szip_pixels_per_block /*IN,OUT*/,
pack_opt_t *options);
+int can_read(const char* name, /* object name from traverse list */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t *options); /* repack options */
+
/*-------------------------------------------------------------------------
* layout functions
diff --git a/tools/h5repack/h5repack.sh b/tools/h5repack/h5repack.sh
index e55e8aa..8b8f44a 100644
--- a/tools/h5repack/h5repack.sh
+++ b/tools/h5repack/h5repack.sh
@@ -14,6 +14,110 @@
#
# Tests for the h5repack tool
+H5REPACK=h5repack # The tool name
+H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary
-#run the h5repack test
-./h5repacktst
+H5DIFF=../h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+
+nerrors=0
+verbose=yes
+
+# The build (current) directory might be different than the source directory.
+#
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+test -d ../testfiles || mkdir ../testfiles
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Verifying".
+#
+VERIFY() {
+ SPACES=" "
+ echo "Testing h5diff output $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+
+# Call h5repack
+#
+TOOLTEST()
+{
+ # Run test.
+ # Tflops interprets "$@" as "" when no parameter is given (e.g., the
+ # case of missing file name). Changed it to use $@ till Tflops fixes it.
+ TESTING $H5REPACK $@
+ (
+ cd $srcdir/../testfiles
+ if [ "`uname -s`" = "TFLOPS O/S" ]; then
+ $RUNSERIAL $H5REPACK_BIN $@
+ else
+ $RUNSERIAL $H5REPACK_BIN "$@"
+ fi
+ )
+echo " PASSED"
+}
+
+# Call the h5diff tool
+#
+DIFFTEST()
+{
+ VERIFY $@
+ (
+ cd $srcdir/../testfiles
+ if [ "`uname -s`" = "TFLOPS O/S" ]; then
+ $RUNSERIAL $H5DIFF_BIN $@
+ else
+ $RUNSERIAL $H5DIFF_BIN "$@"
+ fi
+ )
+ echo " PASSED"
+}
+
+
+#
+#The tests
+#We use the file "test4.h5" generated by h5repacktst
+#Each run generates "file4.out.h5" and the tool h5diff is used to
+# compare the input and output files
+#
+TOOLTEST -i test4.h5 -o test4.out.h5
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -f "GZIP 1"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -f "SZIP 8"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -f "SHUF"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -f "FLET"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -f "dset1:SHUF" -f "dset1,dset2:GZIP 6"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -l "dset1:CHUNK 20x20" -f "dset1,dset2:SZIP 8"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -l "CHUNK 20x20"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -l "COMPA"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -l "CONTI"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -f "GZIP 1" -m 1024
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -f "NONE"
+DIFFTEST test4.h5 test4.out.h5
+TOOLTEST -i test4.h5 -o test4.out.h5 -e "h5repack_info.txt"
+DIFFTEST test4.h5 test4.out.h5
+
+
+
+
+exit $nerrors
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 5134891..c74f5a4 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -232,6 +232,15 @@ int do_copy_objects(hid_t fidin,
if (options->verbose)
print_filters(dcpl_id);
+/*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if (h5tools_canreadf((options->verbose?travt->objs[i].name:NULL),dcpl_id)==1)
+ {
/*-------------------------------------------------------------------------
* references are a special case
@@ -314,6 +323,8 @@ int do_copy_objects(hid_t fidin,
free(buf);
}/*H5T_STD_REF_OBJ*/
+ }/*can_read*/
+
/*-------------------------------------------------------------------------
* close
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index ab592a0..9aacdd3 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -110,9 +110,6 @@ int filter_this(const char* name, /* object name from traverse list */
*
*-------------------------------------------------------------------------
*/
-
-
-
int apply_filters(const char* name, /* object name from traverse list */
int rank, /* rank of dataset */
hsize_t *dims, /* dimensions of dataset */
@@ -260,7 +257,6 @@ out:
if (options->verbose)
printf("Warning: Filter could not be applied to <%s>\n",name);
return 0;
-
}
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index ef18dfa..71308d9 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -66,7 +66,6 @@ int main(int argc, char **argv)
}
else if (strcmp(argv[i], "-m") == 0) {
-
options.threshold = parse_number(argv[i+1]);
if (options.threshold==-1) {
printf("Error: Invalid treshold size <%s>\n",argv[i+1]);
@@ -115,7 +114,7 @@ int main(int argc, char **argv)
static
void usage(void)
{
- printf("h5repack -i input -o output [-h] [-v] [-t 'comp_info'] [-c 'chunk_info'][-m number] \n");
+ printf("h5repack -i input -o output [-h] [-v] [-f 'comp_info'] [-l 'chunk_info'][-m number][-e file] \n");
printf("\n");
printf("-i input Input HDF5 File\n");
printf("-o output Output HDF5 File\n");
@@ -147,7 +146,7 @@ void usage(void)
printf(" it is the chunk size of each dimension:\n");
printf(" <dim_1 x dim_2 x ... dim_n>\n");
printf("\n");
- printf("-e file File with the above informatuion info in it (instead of the two above options)\n");
+ printf("-e file File with the -f and -l options (only filter and layout flags)\n");
printf("-m number Do not apply the filter to objects which size in bytes is smaller than number.\n");
printf(" If no size is specified a minimum of 1024 bytes is assumed.\n");
printf("\n");
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index a39a5ae..5955a08 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -127,6 +127,16 @@ int do_copy_refobjs(hid_t fidin,
goto error;
/*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if (h5tools_canreadf((options->verbose?travt->objs[i].name:NULL),dcpl_id)==1)
+ {
+
+/*-------------------------------------------------------------------------
* test for a valid output dataset
*-------------------------------------------------------------------------
*/
@@ -311,7 +321,7 @@ int do_copy_refobjs(hid_t fidin,
*/
if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0)
goto error;
-
+
/*-------------------------------------------------------------------------
* check for hard links
@@ -319,14 +329,18 @@ int do_copy_refobjs(hid_t fidin,
*/
if (travt->objs[i].nlinks)
{
- for ( j=0; j<travt->objs[i].nlinks; j++)
- {
- H5Glink(fidout,
+ for ( j=0; j<travt->objs[i].nlinks; j++){
+ H5Glink(fidout,
H5G_LINK_HARD,
travt->objs[i].name,
travt->objs[i].links[j].new_name);
}
}
+
+ if (H5Dclose(dset_out)<0)
+ goto error;
+
+ }/*can_read*/
/*-------------------------------------------------------------------------
* close
@@ -343,9 +357,7 @@ int do_copy_refobjs(hid_t fidin,
goto error;
if (H5Dclose(dset_in)<0)
goto error;
- if (H5Dclose(dset_out)<0)
- goto error;
-
+
break;
/*-------------------------------------------------------------------------
@@ -359,11 +371,9 @@ int do_copy_refobjs(hid_t fidin,
if (H5Tclose(type_in)<0)
goto error;
-
break;
-
/*-------------------------------------------------------------------------
* H5G_LINK
*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 61529e3..cee2ab7 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -321,7 +321,8 @@ error:
H5Sclose(space_id);
H5Dclose(dset_id);
H5Fclose(fid);
- trav_table_free(travt);
+ if (travt)
+ trav_table_free(travt);
} H5E_END_TRY;
return -1;
}
diff --git a/tools/h5repack/testh5repack_filters.c b/tools/h5repack/testh5repack_filters.c
index 6c58764..7a2265c 100644
--- a/tools/h5repack/testh5repack_filters.c
+++ b/tools/h5repack/testh5repack_filters.c
@@ -75,7 +75,6 @@ int make_filters(hid_t loc_id)
buf[i][j]=n++;
}
}
-
/*-------------------------------------------------------------------------
* make several dataset with no filters
@@ -87,7 +86,6 @@ int make_filters(hid_t loc_id)
if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf)<0)
return -1;
}
-
/*-------------------------------------------------------------------------
* make several dataset with filters
@@ -104,6 +102,8 @@ int make_filters(hid_t loc_id)
if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
goto out;
+
+
/*-------------------------------------------------------------------------
* SZIP
*-------------------------------------------------------------------------
@@ -145,6 +145,7 @@ int make_filters(hid_t loc_id)
* checksum
*-------------------------------------------------------------------------
*/
+#if 0
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
@@ -153,9 +154,10 @@ int make_filters(hid_t loc_id)
goto out;
if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf)<0)
goto out;
+#endif
/*-------------------------------------------------------------------------
- * shuffle + checksum + SZIP
+ * shuffle + SZIP
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
@@ -164,9 +166,6 @@ int make_filters(hid_t loc_id)
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl)<0)
goto out;
- /* set the checksum filter */
- if (H5Pset_fletcher32(dcpl)<0)
- goto out;
/* set szip data */
if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
goto out;
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index 89f2a97..2bcee27 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -97,7 +97,8 @@ test_copy(void)
TEST_ERROR;
/*-------------------------------------------------------------------------
- * file with filters
+ * file with filters. we cannot compare with cmpdcpl, because the current
+ * configuration might not have saved datasets with deflate and SZIP filters
*-------------------------------------------------------------------------
*/
@@ -109,9 +110,7 @@ test_copy(void)
TEST_ERROR;
if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
TEST_ERROR;
- if (h5repack_cmpdcpl(FNAME4,FNAME4OUT)<=0)
- TEST_ERROR;
- if (h5repack_end (&pack_options)<0)
+ if (h5repack_end (&pack_options)<0)
TEST_ERROR;
/*-------------------------------------------------------------------------
* end
@@ -177,6 +176,7 @@ test_filter_none(void)
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_FILTER_DEFLATE
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset_gzip:NONE",&pack_options)<0)
@@ -191,6 +191,7 @@ test_filter_none(void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
+#endif
PASSED();
return 0;
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index a816a0f..070bdcc 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
+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_OBJ=$(LIB_SRC:.c=.lo)
PUB_LIB=
AUX_LIB=$(LIB)
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 767db68..8cd5b32 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -14,6 +14,7 @@
#include "h5diff.h"
#include "H5private.h"
+#include "h5tools.h"
#include <assert.h>
/*-------------------------------------------------------------------------
@@ -36,9 +37,12 @@ int diff_dataset( hid_t file1_id,
const char *obj2_name,
diff_opt_t *options )
{
- hid_t dset1_id =-1;
- hid_t dset2_id =-1;
- int gout=0, nfound;
+ hid_t dset1_id =-1;
+ hid_t dset2_id =-1;
+ hid_t dcpl1_id;
+ hid_t dcpl2_id;
+ int gout=0, nfound=0;
+
/* disable error reporting */
H5E_BEGIN_TRY {
@@ -64,23 +68,36 @@ int diff_dataset( hid_t file1_id,
if (gout)
goto out;
- nfound=diff_datasetid(dset1_id,
+ if ((dcpl1_id=H5Dget_create_plist(dset1_id))<0)
+ goto out;
+ if ((dcpl2_id=H5Dget_create_plist(dset2_id))<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if ((h5tools_canreadf((options->verbose?obj1_name:NULL),dcpl1_id)==1) &&
+ (h5tools_canreadf((options->verbose?obj2_name:NULL),dcpl2_id)==1))
+ {
+ nfound=diff_datasetid(dset1_id,
dset2_id,
obj1_name,
obj2_name,
options);
-
-
-
+ }
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
out:
-
/* disable error reporting */
H5E_BEGIN_TRY {
+ H5Pclose(dcpl1_id);
+ H5Pclose(dcpl2_id);
H5Dclose(dset1_id);
H5Dclose(dset2_id);
/* enable error reporting */
@@ -377,12 +394,8 @@ out:
} H5E_END_TRY;
return nfound;
-
}
-
-
-
/*-------------------------------------------------------------------------
* Function: diff_can_type
*
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 80349d5..143685f 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -479,4 +479,7 @@ extern int h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset
extern int h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
hid_t type, hid_t space, void *mem, int indentlevel);
+extern int h5tools_canreadf(const char* name,
+ hid_t dcpl_id);
+
#endif /* H5TOOLS_H__ */
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
new file mode 100644
index 0000000..f02ec83
--- /dev/null
+++ b/tools/lib/h5tools_filters.c
@@ -0,0 +1,144 @@
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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"
+
+/*-------------------------------------------------------------------------
+ * print a warning message
+ *-------------------------------------------------------------------------
+ */
+static void print_warning(const char *dname, const char *fname)
+{
+ printf("Warning: dataset <%s> cannot be read, %s filter is not available\n",
+ dname,fname);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5tools_canreadf
+ *
+ * Purpose: check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *
+ * Return: 1, can read, 0, cannot, -1 error
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: March 1, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+int h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
+ hid_t dcpl_id) /* dataset creation property list */
+{
+
+ int nfilters; /* number of filters */
+ H5Z_filter_t filtn; /* filter identification number */
+ int i; /* index */
+ int have_deflate=0; /* assume initially we do not have filters */
+ int have_szip=0;
+ int have_shuffle=0;
+ int have_fletcher=0;
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ have_deflate=1;
+#endif
+#ifdef H5_HAVE_FILTER_SZIP
+ have_szip=1;
+#endif
+#ifdef H5_HAVE_FILTER_SHUFFLE
+ have_shuffle=1;
+#endif
+#ifdef H5_HAVE_FILTER_FLETCHER32
+ have_fletcher=1;
+#endif
+
+ /* get information about filters */
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ return -1;
+
+ /* if we do not have filters, we can read the dataset safely */
+ if (!nfilters)
+ return 1;
+
+ /* check availability of filters */
+ for (i=0; i<nfilters; i++)
+ {
+ if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0))<0)
+ return -1;
+
+ switch (filtn)
+ {
+ default:
+ break;
+/*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE:
+ if (!have_deflate)
+ {
+ if (name)
+ print_warning(name,"deflate");
+ return 0;
+ }
+ break;
+/*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP:
+ if (!have_szip)
+ {
+ if (name)
+ print_warning(name,"SZIP");
+ return 0;
+ }
+ break;
+/*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SHUFFLE:
+ if (!have_szip)
+ {
+ if (name)
+ print_warning(name,"shuffle");
+ return 0;
+ }
+ break;
+/*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_FLETCHER32:
+ if (!have_fletcher)
+ {
+ if (name)
+ print_warning(name,"fletcher32");
+ return 0;
+ }
+ break;
+ }/*switch*/
+ }/*for*/
+
+ return 1;
+}
+
+
+
+
diff --git a/tools/testfiles/h5repack_info.txt b/tools/testfiles/h5repack_info.txt
new file mode 100644
index 0000000..4d6eef1
--- /dev/null
+++ b/tools/testfiles/h5repack_info.txt
@@ -0,0 +1 @@
+-l "dset1:CHUNK 20x20" -f "dset1,dset2:SZIP 8"
diff --git a/tools/testfiles/test4.h5 b/tools/testfiles/test4.h5
new file mode 100644
index 0000000..7743eb5
--- /dev/null
+++ b/tools/testfiles/test4.h5
Binary files differ