summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5repack/Makefile.in5
-rw-r--r--tools/h5repack/h5repack.c29
-rw-r--r--tools/h5repack/h5repack.h24
-rwxr-xr-xtools/h5repack/h5repack.sh.in334
-rw-r--r--tools/h5repack/h5repack_copy.c43
-rw-r--r--tools/h5repack/h5repack_filters.c8
-rw-r--r--tools/h5repack/h5repack_list.c6
-rw-r--r--tools/h5repack/h5repack_parse.c2
-rw-r--r--tools/h5repack/h5repack_refs.c33
-rw-r--r--tools/h5repack/h5repack_verify.c8
-rw-r--r--tools/h5repack/testh5repack_attr.c2
-rw-r--r--tools/h5repack/testh5repack_filters.c170
-rw-r--r--tools/h5repack/testh5repack_layout.c108
-rw-r--r--tools/h5repack/testh5repack_main.c492
-rw-r--r--tools/h5repack/testh5repack_make.c508
-rw-r--r--tools/h5repack/testh5repack_util.c6
-rw-r--r--tools/lib/h5tools_filters.c9
-rw-r--r--tools/testfiles/h5repack_info.txt2
-rw-r--r--tools/testfiles/test1.h5bin34520 -> 33920 bytes
-rw-r--r--tools/testfiles/test3.h5bin6984 -> 6984 bytes
-rw-r--r--tools/testfiles/test4.h5bin57696 -> 29384 bytes
-rw-r--r--tools/testfiles/test5.h5bin0 -> 259464 bytes
-rw-r--r--tools/testfiles/test_all.h5bin0 -> 5925 bytes
-rw-r--r--tools/testfiles/test_deflate.h5bin0 -> 5954 bytes
-rw-r--r--tools/testfiles/test_fletcher32.h5bin0 -> 7880 bytes
-rw-r--r--tools/testfiles/test_shuffle.h5bin0 -> 7864 bytes
-rw-r--r--tools/testfiles/test_szip.h5bin0 -> 5588 bytes
27 files changed, 1080 insertions, 709 deletions
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index 6e7c61c..630a4e8 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -30,6 +30,7 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \
TEST_PROGS=h5repacktst
TEST_SCRIPTS=./h5repack.sh
+
## These are our main targets: library and tools.
##
LIBHDF5=$(top_builddir)/src/libhdf5.la
@@ -51,10 +52,10 @@ DISTCLEAN=h5repack.sh
## 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 testh5repack_layout.c testh5repack_util.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_main.c testh5repack_make.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 testh5repack_layout.lo testh5repack_util.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_main.lo testh5repack_make.lo testh5repack_util.lo
PRIVATE_HDR=
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index cd7a31b..cfd9363 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -55,7 +55,7 @@ static void aux_initglb_filter(pack_opt_t *options)
*
* Return: 0, ok, -1, fail
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: September, 22, 2003
*
@@ -223,7 +223,7 @@ int h5repack_addlayout(const char* str,
*
* Return: void, return -1 on error
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: September, 22, 2003
*
@@ -243,9 +243,9 @@ static int check_options(pack_opt_t *options)
if (options->verbose)
{
printf("\n");
- printf("Objects to modify are...\n");
+ printf("Objects to modify layout are...\n");
if (options->all_layout==1) {
- printf("\tApply layout to all\n ");
+ printf(" Apply layout to all\n ");
if (H5D_CHUNKED==options->layout_g) {
printf("with dimension [");
for ( j = 0; j < options->chunk_g.rank; j++)
@@ -262,7 +262,7 @@ static int check_options(pack_opt_t *options)
if (options->op_tbl->objs[i].chunk.rank>0)
{
if (options->verbose){
- printf("\t<%s> with chunk size ",name);
+ printf(" <%s> with chunk size ",name);
for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
printf("%d ",(int)options->op_tbl->objs[i].chunk.chunk_lengths[k]);
printf("\n");
@@ -272,7 +272,7 @@ static int check_options(pack_opt_t *options)
else if (options->op_tbl->objs[i].chunk.rank==-2)
{
if (options->verbose)
- printf("\t%s %s\n",name,"NONE");
+ printf(" <%s> %s\n",name,"NONE");
has_ck=1;
}
}
@@ -284,7 +284,7 @@ static int check_options(pack_opt_t *options)
}
/*-------------------------------------------------------------------------
- * objects to compress/uncompress
+ * objects to filter
*-------------------------------------------------------------------------
*/
@@ -297,10 +297,10 @@ static int check_options(pack_opt_t *options)
switch (filtn)
{
case H5Z_FILTER_NONE:
- printf("\tUncompress all %s\n",get_sfilter(filtn));
+ printf(" Uncompress all %s\n",get_sfilter(filtn));
break;
case H5Z_FILTER_SZIP:
- printf("\tCompress all with %s compression\n",get_sfilter(filtn));
+ printf(" Compress all with %s compression\n",get_sfilter(filtn));
break;
case H5Z_FILTER_DEFLATE:
printf("\tCompress all with %s compression, parameter %d\n",
@@ -314,15 +314,16 @@ static int check_options(pack_opt_t *options)
for ( i = 0; i < options->op_tbl->nelems; i++)
{
pack_info_t pack = options->op_tbl->objs[i];
- char* name = pack.path;
+ char* name = pack.path;
for ( j=0; j<pack.nfilters; j++)
{
if (options->verbose)
{
- printf("\t<%s> with %s filter",
+ printf(" <%s> with %s filter%s",
name,
- get_sfilter(pack.filter[j].filtn));
+ get_sfilter(pack.filter[j].filtn),
+ (i==options->op_tbl->nelems-1)? "" : "\n");
}
has_cp=1;
@@ -355,7 +356,7 @@ static int check_options(pack_opt_t *options)
options->op_tbl->objs[i].filter[j].filtn=-1;
options->op_tbl->objs[i].chunk.rank=-1;
- printf("\tObject <%s> cannot be filtered\n",name);
+ printf(" Object <%s> cannot be filtered\n",name);
}
@@ -380,7 +381,7 @@ static int check_options(pack_opt_t *options)
*
* Return: void, exit on error
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: September, 22, 2003
*
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index ef6dca6..eb05316 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -264,16 +264,26 @@ int parse_number(char *str);
*/
#define FNAME1 "test1.h5"
-#define FNAME1OUT "test1out.h5"
+#define FNAME1OUT "test1.out.h5"
#define FNAME2 "test2.h5"
-#define FNAME2OUT "test2out.h5"
+#define FNAME2OUT "test2.out.h5"
#define FNAME3 "test3.h5"
-#define FNAME3OUT "test3out.h5"
+#define FNAME3OUT "test3.out.h5"
#define FNAME4 "test4.h5"
-#define FNAME4OUT "test4out.h5"
+#define FNAME4OUT "test4.out.h5"
#define FNAME5 "test5.h5"
-#define FNAME5OUT "test5out.h5"
+#define FNAME5OUT "test5.out.h5"
#define FNAME6 "test6.h5"
+#define FNAME7 "test_szip.h5"
+#define FNAME8 "test_deflate.h5"
+#define FNAME9 "test_shuffle.h5"
+#define FNAME10 "test_fletcher32.h5"
+#define FNAME11 "test_all.h5"
+#define FNAME7OUT "test_szip.out.h5"
+#define FNAME8OUT "test_deflate.out.h5"
+#define FNAME9OUT "test_shuffle.out.h5"
+#define FNAME10OUT "test_fletcher32.out.h5"
+#define FNAME11OUT "test_all.out.h5"
int make_testfiles(void);
@@ -300,10 +310,6 @@ void write_dset_in(hid_t loc_id,
int make_diffs /* flag to modify data buffers */);
void write_null_dset(hid_t loc_id);
-int make_filters(hid_t loc_id);
-int make_layout(hid_t loc_id);
-
-
/*-------------------------------------------------------------------------
* tests utils
*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 17c6869..e4d65de 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -17,6 +17,10 @@
# Determine if SZIP has the encoder available
USE_FILTER_SZIP_ENCODER="@USE_FILTER_SZIP_ENCODER@"
USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@"
+USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@"
+
H5REPACK=h5repack # The tool name
H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary
@@ -64,20 +68,20 @@ DIFFTEST()
{
VERIFY $@
if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5DIFF_BIN $@
+ $RUNSERIAL $H5DIFF_BIN $@
else
- $RUNSERIAL $H5DIFF_BIN "$@"
+ $RUNSERIAL $H5DIFF_BIN "$@"
fi
RET=$?
if [ $RET != 0 ] ; then
- echo "*FAILED*"
+ echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
-
+
}
-
+
# Call h5repack
#
TOOLTEST()
@@ -91,18 +95,18 @@ TOOLTEST()
outfile=out.$1
shift
if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile $@
+ $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile $@
else
- $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@"
+ $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@"
fi
RET=$?
if [ $RET != 0 ] ; then
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
else
- echo " PASSED"
- DIFFTEST $infile $outfile
+ echo " PASSED"
+ DIFFTEST $infile $outfile
fi
rm -f $outfile
}
@@ -110,9 +114,11 @@ TOOLTEST()
#
# The tests
# We use the files generated by h5repacktst
-# Each run generates "file4.out.h5" and the tool h5diff is used to
+# Each run generates "<file>.out.h5" and the tool h5diff is used to
# compare the input and output files
#
+# the tests are the same as the program h5repacktst, but run from the CLI
+#
# See which filters are usable (and skip tests for filters we
# don't have). Do this by searching H5pubconf.h to see which
@@ -120,177 +126,233 @@ TOOLTEST()
# A filter value of 3 means the filter can read and write, 2
# is read-only, 1 is write-only, and 0 is not present.
-# copy files
+# copy files (these files have no filters; test2.h5 has copied references that h5diff detects)
TOOLTEST test1.h5
TOOLTEST test3.h5
+TOOLTEST test4.h5
+TOOLTEST test5.h5
+# use test4.h5 to write some filters (this file has no filters)
-arg="test4.h5"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
+# gzip with individual object
+arg="test4.h5 -f dset1:GZIP=1 -l dset1:CHUNK=20x10"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
TOOLTEST $arg
+fi
+
+# gzip for all
+arg="test4.h5 -f GZIP=1"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
else
- SKIP $arg
+ TOOLTEST $arg
fi
-#TOOLTEST test5.h5
-
-# remove all filters
-TOOLTEST test4.h5 -f NONE
-
-# remove one filter
-arg="test4.h5 -f dset_gzip:NONE"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
+# szip with individual object
+arg="test4.h5 -f dset2:SZIP=8 -l dset2:CHUNK=20x10"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
+else
TOOLTEST $arg
+fi
+
+# szip for all
+arg="test4.h5 -f SZIP=8"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
else
- SKIP $arg
+ TOOLTEST $arg
fi
-# gzip
-arg="test4.h5 -f dset1:GZIP=9"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
+# shuffle with individual object
+arg="test4.h5 -f dset2:SHUF -l dset2:CHUNK=20x10"
+if test $USE_FILTER_SHUFFLE != "yes" ; then
+ SKIP $arg
+else
TOOLTEST $arg
+fi
+
+
+# shuffle for all
+arg="test4.h5 -f SHUF"
+if test $USE_FILTER_SHUFFLE != "yes" ; then
+ SKIP $arg
else
- SKIP $arg
+ TOOLTEST $arg
fi
-TOOLTEST test4.h5 -f GZIP=1
-
-# szip
-arg1="test4.h5 -f dset1:SZIP=8"
-arg2="test4.h5 -f SZIP=8"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -a $USE_FILTER_SZIP = "yes" ; then
- TOOLTEST $arg1
- TOOLTEST $arg2
+
+# fletcher32 with individual object
+arg="test4.h5 -f dset2:FLET -l dset2:CHUNK=20x10"
+if test $USE_FILTER_FLETCHER32 != "yes" ; then
+ SKIP $arg
else
- SKIP $arg1
- SKIP $arg2
+ TOOLTEST $arg
fi
-# shuffle
-arg="test4.h5 -f dset1:SHUF"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
- TOOLTEST $arg
+# fletcher32 for all
+arg="test4.h5 -f FLET"
+if test $USE_FILTER_FLETCHER32 != "yes" ; then
+ SKIP $arg
else
- SKIP $arg
+ TOOLTEST $arg
fi
-TOOLTEST test4.h5 -f SHUF
-# fletcher
-arg="test4.h5 -f dset1:FLET"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
- TOOLTEST $arg
+# all filters
+arg="test4.h5 -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8 -f dset2:GZIP=1 -l dset2:CHUNK=20x10"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SHUFFLE != "yes" -o $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
else
- SKIP $arg
+ TOOLTEST $arg
fi
-TOOLTEST test4.h5 -f FLET
-
-#layout chunk
-arg1="test4.h5 -l dset1:CHUNK=20x10"
-arg2="test4.h5 -l CHUNK=20x10"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
- TOOLTEST $arg1
- TOOLTEST $arg2
+
+###########################################################
+# the following tests assume the input files have filters
+###########################################################
+
+# szip copy
+arg="test_szip.h5"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
else
- SKIP $arg1
- SKIP $arg2
+ TOOLTEST $arg
+fi
+
+# szip remove
+arg="test_szip.h5 -f dset_szip:NONE"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
+fi
+
+# deflate copy
+arg="test_deflate.h5"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
fi
-#layout compact
-arg1="test4.h5 -l dset1:COMPA"
-arg2="test4.h5 -l COMPA"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
- TOOLTEST $arg1
- TOOLTEST $arg2
+# deflate remove
+arg="test_deflate.h5 -f dset_deflate:NONE"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
else
- SKIP $arg1
- SKIP $arg2
+ TOOLTEST $arg
+fi
+
+# shuffle copy
+arg="test_shuffle.h5"
+if test $USE_FILTER_SHUFFLE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
fi
-#layout contiguous
-arg1="test4.h5 -l dset1:CONTI"
-arg2="test4.h5 -l CONTI"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
- TOOLTEST $arg1
- TOOLTEST $arg2
+# shuffle remove
+arg="test_shuffle.h5 -f dset_shuffle:NONE"
+if test $USE_FILTER_SHUFFLE != "yes" ; then
+ SKIP $arg
else
- SKIP $arg1
- SKIP $arg2
+ TOOLTEST $arg
fi
-#conversions
-arg1="test4.h5 -l dset_compact:CONTI"
-arg2="test4.h5 -l dset_compact:CHUNK=2x5"
-arg3="test4.h5 -l dset_compact:COMPA"
-arg4="test4.h5 -l dset_contiguous:COMPA"
-arg5="test4.h5 -l dset_contiguous:CHUNK=3x6"
-arg6="test4.h5 -l dset_contiguous:CONTI"
-arg7="test4.h5 -l dset_chunk:COMPA"
-arg8="test4.h5 -l dset_chunk:CONTI"
-arg9="test4.h5 -l dset_chunk:CHUNK=18x13"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -o $USE_FILTER_SZIP = "no" ; then
- TOOLTEST $arg1
- TOOLTEST $arg2
- TOOLTEST $arg3
- TOOLTEST $arg4
- TOOLTEST $arg5
- TOOLTEST $arg6
- TOOLTEST $arg7
- TOOLTEST $arg8
- TOOLTEST $arg9
+# fletcher32 copy
+arg="test_fletcher32.h5"
+if test $USE_FILTER_FLETCHER32 != "yes" ; then
+ SKIP $arg
else
- SKIP $arg1
- SKIP $arg2
- SKIP $arg3
- SKIP $arg4
- SKIP $arg5
- SKIP $arg6
- SKIP $arg7
- SKIP $arg8
- SKIP $arg9
+ TOOLTEST $arg
fi
-#filters
-arg1="test4.h5 -f dset1:SHUF -f dset1,dset2:GZIP=6"
-arg2="test4.h5 -l dset1:CHUNK=20x10 -f dset1,dset2:SZIP=8"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -a $USE_FILTER_SZIP = "yes"; then
- TOOLTEST $arg1
- TOOLTEST $arg2
-elif test $USE_FILTER_SZIP = "yes" ; then # SZIP has no encoder
- SKIP $arg1
- SKIP $arg2
-else # SZIP is absent
- TOOLTEST $arg1
- SKIP $arg2
+# fletcher32 remove
+arg="test_fletcher32.h5 -f dset_fletcher32:NONE"
+if test $USE_FILTER_FLETCHER32 != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
+fi
+
+# remove all filters
+arg="test_all.h5 -f NONE"
+if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SHUFFLE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
fi
#filter conversions
-arg1="test4.h5 -f dset_gzip:SZIP=8"
-arg2="test4.h5 -f dset_szip:GZIP=1"
-arg3="test4.h5 -f dset_all:GZIP=1"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -a $USE_FILTER_SZIP = "yes" ; then
- TOOLTEST $arg1
- TOOLTEST $arg2
- TOOLTEST $arg3
-elif test $USE_FILTER_SZIP = "yes" ; then # SZIP has no encoder
- SKIP $arg1
- SKIP $arg2
- SKIP $arg3
-else # SZIP is absent
- SKIP $arg1
- TOOLTEST $arg2
- TOOLTEST $arg3
+
+arg="test_deflate.h5 -f dset_deflate:SZIP=8"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
+fi
+
+arg="test_szip.h5 -f dset_szip:GZIP=1"
+if test $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
fi
+
#limit
-TOOLTEST test4.h5 -f GZIP=1 -m 1024
+arg="test4.h5 -f GZIP=1 -m 1024"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
+fi
#file
arg="test4.h5 -e ../testfiles/h5repack_info.txt"
-if test $USE_FILTER_SZIP_ENCODER = "yes" -a $USE_FILTER_SZIP = "yes" ; then
- TOOLTEST $arg
-else
+if test $USE_FILTER_DEFLATE != "yes" ; then
SKIP $arg
+else
+ TOOLTEST $arg
fi
+
+#########################################################
+# layout options (these files have no filters)
+#########################################################
+
+TOOLTEST test4.h5 -l dset2:CHUNK=20x10
+TOOLTEST test4.h5 -l CHUNK=20x10
+TOOLTEST test4.h5 -l dset2:CONTI
+TOOLTEST test4.h5 -l CONTI
+TOOLTEST test4.h5 -l dset2:COMPA
+TOOLTEST test4.h5 -l COMPA
+
+
+################################################################
+# layout conversions (file has no filters)
+###############################################################
+
+arg1="test4.h5 -l dset_compact:CONTI"
+arg2="test4.h5 -l dset_compact:CHUNK=2x5"
+arg3="test4.h5 -l dset_compact:COMPA"
+arg4="test4.h5 -l dset_contiguous:COMPA"
+arg5="test4.h5 -l dset_contiguous:CHUNK=3x6"
+arg6="test4.h5 -l dset_contiguous:CONTI"
+arg7="test4.h5 -l dset_chunk:COMPA"
+arg8="test4.h5 -l dset_chunk:CONTI"
+arg9="test4.h5 -l dset_chunk:CHUNK=18x13"
+TOOLTEST $arg1
+TOOLTEST $arg2
+TOOLTEST $arg3
+TOOLTEST $arg4
+TOOLTEST $arg5
+TOOLTEST $arg6
+TOOLTEST $arg7
+TOOLTEST $arg8
+TOOLTEST $arg9
+
+
if test $nerrors -eq 0 ; then
echo "All $H5REPACK tests passed."
fi
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 70d90da..e352b97 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -26,7 +26,7 @@
*
* Return: 0, ok, -1 no
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: October, 23, 2003
*
@@ -129,7 +129,7 @@ out:
*
* Return: 0, ok, -1 no
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: October, 23, 2003
*
@@ -141,22 +141,23 @@ int do_copy_objects(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in=-1; /* group ID */
- hid_t grp_out=-1; /* group ID */
- hid_t dset_in=-1; /* read dataset ID */
- hid_t dset_out=-1; /* write dataset ID */
- hid_t type_in=-1; /* named type ID */
- hid_t type_out=-1; /* named type ID */
- hid_t dcpl_id=-1; /* dataset creation property list ID */
- hid_t space_id=-1; /* space ID */
- hid_t ftype_id=-1; /* file data type ID */
- hid_t mtype_id=-1; /* memory data type ID */
+ hid_t grp_in; /* group ID */
+ hid_t grp_out; /* group ID */
+ hid_t dset_in; /* read dataset ID */
+ hid_t dset_out; /* write dataset ID */
+ hid_t type_in; /* named type ID */
+ hid_t type_out; /* named type ID */
+ hid_t dcpl_id; /* dataset creation property list ID */
+ hid_t space_id; /* space ID */
+ hid_t ftype_id; /* file data type ID */
+ hid_t mtype_id; /* memory data type ID */
size_t msize; /* memory size of memory type */
void *buf=NULL; /* data buffer */
hsize_t nelmts; /* number of elements in dataset */
int rank; /* rank of dataset */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
hsize_t dsize_in; /* input dataset size before filter */
+ int next; /* external files */
#ifdef LATER
hsize_t dsize_out; /* output dataset size after filter */
#endif /* LATER */
@@ -235,13 +236,24 @@ int do_copy_objects(hid_t fidin,
print_filters(dcpl_id);
/*-------------------------------------------------------------------------
+ * check for external files
+ *-------------------------------------------------------------------------
+ */
+ if ((next=H5Pget_external_count (dcpl_id))<0)
+ goto error;
+
+ if (next) {
+ fprintf(stderr,"Warning: <%s> has external files, ignoring read...\n",travt->objs[i].name );
+ }
+
+/*-------------------------------------------------------------------------
* 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)
+ if (next==0 && h5tools_canreadf((travt->objs[i].name),dcpl_id)==1)
{
/*-------------------------------------------------------------------------
@@ -476,7 +488,7 @@ error:
*
* Return: 0, ok, -1 no
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: October, 28, 2003
*
@@ -553,8 +565,6 @@ int copy_attr(hid_t loc_in,
*/
if ( ! H5Tequal(mtype_id, H5T_STD_REF_OBJ))
{
-
-
/*-------------------------------------------------------------------------
* read to memory
*-------------------------------------------------------------------------
@@ -582,7 +592,6 @@ int copy_attr(hid_t loc_in,
if (H5Aclose(attr_out)<0)
goto error;
-
if (buf)
free(buf);
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 18080c6..56ab189 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -42,7 +42,7 @@ static void aux_objinsert_filter(pack_info_t *obj,
*
* Return: 0 not found, 1 found
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 19, 2003
*
@@ -104,7 +104,7 @@ int filter_this(const char* name, /* object name from traverse list */
*
* Return: 0 success, -1 an error occured
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 19, 2003
*
@@ -267,7 +267,7 @@ out:
*
* Return: 0, ok, -1 no
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 19, 2003
*
@@ -343,7 +343,7 @@ int print_filters(hid_t dcpl_id)
* Return: 1=can apply the filter
* 0=cannot apply the filter
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 23, 2003
*
diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c
index 74e79a4..8c8acee 100644
--- a/tools/h5repack/h5repack_list.c
+++ b/tools/h5repack/h5repack_list.c
@@ -28,7 +28,7 @@
*
* Return: 0, ok, -1 no
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: September, 23, 2003
*
@@ -85,7 +85,7 @@ int check_objects(const char* fname,
{
char* name=options->op_tbl->objs[i].path;
if (options->verbose)
- printf(PFORMAT1,"","",name);
+ printf(" <%s>",name);
/* the input object names are present in the file and are valid */
if (h5trav_getindext(name,travt)<0)
@@ -120,7 +120,7 @@ out:
*
* Return: void
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: October 23, 2003
*
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 204adf3..9efeeb3 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -277,7 +277,7 @@ const char* get_sfilter(H5Z_filter_t filtn)
else if (filtn==H5Z_FILTER_SHUFFLE)
return "SHUFFLE";
else if (filtn==H5Z_FILTER_FLETCHER32)
- return "FLETCHERP";
+ return "FLETCHER32";
else {
printf("Input error in filter type\n");
exit(1);
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index e824493..ef7f298 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -52,19 +52,20 @@ int do_copy_refobjs(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in=-1; /* group ID */
- hid_t grp_out=-1; /* group ID */
- hid_t dset_in=-1; /* read dataset ID */
- hid_t dset_out=-1; /* write dataset ID */
- hid_t type_in=-1; /* named type ID */
- hid_t dcpl_id=-1; /* dataset creation property list ID */
- hid_t space_id=-1; /* space ID */
- hid_t ftype_id=-1; /* file data type ID */
- hid_t mtype_id=-1; /* memory data type ID */
- size_t msize; /* memory size of memory type */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
+ hid_t grp_in; /* read group ID */
+ hid_t grp_out; /* write group ID */
+ hid_t dset_in; /* read dataset ID */
+ hid_t dset_out; /* write dataset ID */
+ hid_t type_in; /* named type ID */
+ hid_t dcpl_id; /* dataset creation property list ID */
+ hid_t space_id; /* space ID */
+ hid_t ftype_id; /* file data type ID */
+ hid_t mtype_id; /* memory data type ID */
+ size_t msize; /* memory size of memory type */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ int next; /* external files */
int i, j;
/*-------------------------------------------------------------------------
@@ -127,13 +128,19 @@ int do_copy_refobjs(hid_t fidin,
goto error;
/*-------------------------------------------------------------------------
+ * check for external files
+ *-------------------------------------------------------------------------
+ */
+ if ((next=H5Pget_external_count (dcpl_id))<0)
+ 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)
+ if (next==0 && h5tools_canreadf((NULL),dcpl_id)==1)
{
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index d69465b..30d3c05 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -25,7 +25,7 @@
*
* Return: 1 has, 0 does not, -1 error
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 19, 2003
*
@@ -99,7 +99,7 @@ int has_filter(hid_t dcpl_id,
*
* Return: 1 has, 0 does not, -1 error
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 30, 2003
*
@@ -157,7 +157,7 @@ int has_layout(hid_t dcpl_id,
*
* Return: 1=filter present, 0=filter not present, -1=error
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 19, 2003
*
@@ -344,7 +344,7 @@ error:
*
* Return: 1=identical, 0=not identical, -1=error
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: December 31, 2003
*
diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c
index 135d15b..dc03415 100644
--- a/tools/h5repack/testh5repack_attr.c
+++ b/tools/h5repack/testh5repack_attr.c
@@ -21,7 +21,7 @@
*
* Purpose: write attributes in LOC_ID (dataset, group, named datatype)
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: November 12, 2003
*
diff --git a/tools/h5repack/testh5repack_filters.c b/tools/h5repack/testh5repack_filters.c
deleted file mode 100644
index 597381c..0000000
--- a/tools/h5repack/testh5repack_filters.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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"
-
-#define DIM1 40
-#define DIM2 20
-#define CDIM1 DIM1/2
-#define CDIM2 DIM2/2
-#define RANK 2
-
-/*-------------------------------------------------------------------------
- * Function: make_filters
- *
- * Purpose: make several datasets with filters in location LOC_ID
- *
- *-------------------------------------------------------------------------
- */
-int make_filters(hid_t loc_id)
-{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=8;
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- char name[5];
- 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 no filters
- *-------------------------------------------------------------------------
- */
- for (i=0; i<4; i++)
- {
- sprintf(name,"dset%d",i+1);
- if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf)<0)
- return -1;
- }
-
-/*-------------------------------------------------------------------------
- * make several dataset with filters
- *-------------------------------------------------------------------------
- */
- /* 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;
- /* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
- goto out;
-
-/*-------------------------------------------------------------------------
- * SZIP
- *-------------------------------------------------------------------------
- */
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
-
- /* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
- goto out;
- if (make_dset(loc_id,"dset_szip",sid,dcpl,buf)<0)
- goto out;
-
-#endif /* H5_HAVE_FILTER_SZIP && H5_SZIP_CAN_ENCODE */
-/*-------------------------------------------------------------------------
- * GZIP
- *-------------------------------------------------------------------------
- */
- /* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
- goto out;
- /* set deflate data */
- if(H5Pset_deflate(dcpl, 9)<0)
- goto out;
- if (make_dset(loc_id,"dset_gzip",sid,dcpl,buf)<0)
- goto out;
-
-
-/*-------------------------------------------------------------------------
- * shuffle
- *-------------------------------------------------------------------------
- */
- /* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
- goto out;
- /* set the shuffle filter */
- if (H5Pset_shuffle(dcpl)<0)
- goto out;
- if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf)<0)
- goto out;
-
-/*-------------------------------------------------------------------------
- * checksum
- *-------------------------------------------------------------------------
- */
-#if defined (H5_HAVE_FILTER_FLETCHER32)
- /* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
- goto out;
- /* set the checksum filter */
- if (H5Pset_fletcher32(dcpl)<0)
- goto out;
- if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf)<0)
- goto out;
-#endif
-
-/*-------------------------------------------------------------------------
- * shuffle + SZIP
- *-------------------------------------------------------------------------
- */
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
- /* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
- goto out;
- /* set the shuffle filter */
- if (H5Pset_shuffle(dcpl)<0)
- goto out;
- /* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
- goto out;
- if (make_dset(loc_id,"dset_all",sid,dcpl,buf)<0)
- goto out;
-#endif
-
-/*-------------------------------------------------------------------------
- * 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_layout.c b/tools/h5repack/testh5repack_layout.c
deleted file mode 100644
index 96e0ba6..0000000
--- a/tools/h5repack/testh5repack_layout.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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"
-
-#define DIM1 40
-#define DIM2 20
-#define CDIM1 20
-#define CDIM2 10
-
-#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 4c0a8c5..0c976f4 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -29,7 +29,7 @@
* Return: Success: zero
* Failure: non-zero
*
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
+ * Programmer: <pvn@ncsa.uiuc.edu>
* January, 6, 2004
*
*-------------------------------------------------------------------------
@@ -51,20 +51,19 @@ int main (void)
goto error;
/*-------------------------------------------------------------------------
- * Purpose:
+ * Format of the tests:
*
- * 1) make a copy with no filters
+ * 1) make a copy of the file with h5repack
* 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
*-------------------------------------------------------------------------
*/
+ TESTING(" copy of datasets");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME1,FNAME1OUT,&pack_options)<0)
@@ -77,14 +76,13 @@ int main (void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
PASSED();
- TESTING(" copy of attributes");
/*-------------------------------------------------------------------------
* file with attributes
*-------------------------------------------------------------------------
*/
+ TESTING(" copy of attributes");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME2,FNAME2OUT,&pack_options)<0)
@@ -97,14 +95,14 @@ int main (void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
PASSED();
- TESTING(" copy of hardlinks");
+
/*-------------------------------------------------------------------------
* file with hardlinks
*-------------------------------------------------------------------------
*/
+ TESTING(" copy of hardlinks");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME3,FNAME3OUT,&pack_options)<0)
@@ -118,33 +116,13 @@ int main (void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-/*-------------------------------------------------------------------------
- * file with filters. we cannot compare with cmpdcpl, because the current
- * configuration might not have saved datasets with deflate and SZIP filters
- *-------------------------------------------------------------------------
- */
PASSED();
- TESTING(" copy of datasets with all filters");
-
- if (h5repack_init (&pack_options, 0)<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(" copy of allocation early file");
/*-------------------------------------------------------------------------
* alloc early test
*-------------------------------------------------------------------------
*/
+ TESTING(" copy of allocation early file");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME5,FNAME5OUT,&pack_options)<0)
@@ -157,115 +135,10 @@ int main (void)
TEST_ERROR;
PASSED();
- TESTING(" removing all filters");
-
/*-------------------------------------------------------------------------
- * test the NONE global option
+ * deflate
*-------------------------------------------------------------------------
*/
-
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("NONE",&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(" removing deflate filter");
-
-#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("dset_gzip:NONE",&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();
-#else
- SKIPPED();
-#endif
-
- TESTING(" removing szip filter");
-
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
-
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("dset_szip:NONE",&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();
-#else
- SKIPPED();
-#endif
-
- TESTING(" removing shuffle filter");
-
-#ifdef H5_HAVE_FILTER_SHUFFLE
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("dset_shuffle:NONE",&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();
-#else
- SKIPPED();
-#endif
-
- TESTING(" removing fletcher filter");
-
-#ifdef H5_HAVE_FILTER_FLETCHER32
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("dset_fletcher32:NONE",&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();
-#else
- SKIPPED();
-#endif
-
-
-
TESTING(" adding deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -324,18 +197,19 @@ int main (void)
#endif
/*-------------------------------------------------------------------------
- * deflate
+ * SZIP
*-------------------------------------------------------------------------
*/
TESTING(" adding szip filter");
+#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+
/*-------------------------------------------------------------------------
* test an individual object option
*-------------------------------------------------------------------------
*/
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
-
+
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset2:SZIP=8",&pack_options)<0)
@@ -351,7 +225,7 @@ int main (void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
@@ -364,7 +238,6 @@ int main (void)
TESTING(" adding szip filter to all");
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
-
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("SZIP=8",&pack_options)<0)
@@ -378,8 +251,7 @@ TESTING(" adding szip filter to all");
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
-
+ PASSED();
#else
SKIPPED();
#endif
@@ -516,39 +388,28 @@ TESTING(" addding shuffle filter to all");
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
+
+#ifdef H5_HAVE_FILTER_SHUFFLE
if (h5repack_addfilter("dset1:SHUF",&pack_options)<0)
TEST_ERROR;
+#endif
+
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
- if (h5repack_addfilter("dset1:SZIP=8",&pack_options)<0)
- TEST_ERROR;
+ if (h5repack_addfilter("dset1:SZIP=8",&pack_options)<0)
+ TEST_ERROR;
#endif
+
+#ifdef H5_HAVE_FILTER_DEFLATE
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;
+#endif
- PASSED();
- TESTING(" filter conversion from deflate to szip");
-/*-------------------------------------------------------------------------
- * filter conversion from deflate to szip
- *-------------------------------------------------------------------------
- */
-#if defined(H5_HAVE_FILTER_DEFLATE) && defined(H5_HAVE_FILTER_SZIP) && defined(H5_SZIP_CAN_ENCODE)
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("dset_gzip:SZIP=8",&pack_options)<0)
- TEST_ERROR;
if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
TEST_ERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
@@ -557,60 +418,9 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
-#else
- SKIPPED();
-#endif
-
- TESTING(" filter conversion from szip to deflate");
-/*-------------------------------------------------------------------------
- * filter conversion from szip to deflate
- *-------------------------------------------------------------------------
- */
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
-
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("dset_szip: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;
PASSED();
-#else
- SKIPPED();
-#endif
-
- TESTING(" filter conversion from szip and shuffle to deflate");
-/*-------------------------------------------------------------------------
- * filter conversion from szip to deflate
- *-------------------------------------------------------------------------
- */
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
-
- if (h5repack_init (&pack_options, 0)<0)
- TEST_ERROR;
- if (h5repack_addfilter("dset_all: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;
- PASSED();
-#else
- SKIPPED();
-#endif
TESTING(" adding layout chunked");
@@ -677,7 +487,6 @@ TESTING(" addding shuffle filter to all");
TESTING(" adding layout contiguous to all");
-
/*-------------------------------------------------------------------------
* test all objects option
*-------------------------------------------------------------------------
@@ -918,6 +727,257 @@ TESTING(" addding shuffle filter to all");
PASSED();
+/*-------------------------------------------------------------------------
+ * the following tests assume the input files have filters
+ * FNAME7 "test_szip.h5"
+ * FNAME8 "test_deflate.h5"
+ * FNAME9 "test_shuffle.h5"
+ * FNAME10 "test_fletcher32.h5"
+ * FNAME11 "test_all.h5"
+ *-------------------------------------------------------------------------
+ */
+
+
+ TESTING(" copy of szip filter");
+
+#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME7,FNAME7OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME7OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" removing szip filter");
+
+#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset_szip:NONE",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME7,FNAME7OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME7OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+ TESTING(" copy of deflate filter");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME8,FNAME8OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME8OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+ TESTING(" removing deflate filter");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset_deflate:NONE",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME8,FNAME8OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME8OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+
+ TESTING(" copy of shuffle filter");
+
+#ifdef H5_HAVE_FILTER_SHUFFLE
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME9,FNAME9OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME9OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" removing shuffle filter");
+
+#ifdef H5_HAVE_FILTER_SHUFFLE
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset_shuffle:NONE",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME9,FNAME9OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME9OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" copy of fletcher filter");
+
+#ifdef H5_HAVE_FILTER_FLETCHER32
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME10,FNAME10OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME10OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" removing fletcher filter");
+
+#ifdef H5_HAVE_FILTER_FLETCHER32
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME10,FNAME10OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME10OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+
+/*-------------------------------------------------------------------------
+ * test the NONE global option
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" removing all filters");
+
+#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) \
+ && defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
+
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("NONE",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME11,FNAME11OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME11OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" filter conversion from deflate to szip");
+/*-------------------------------------------------------------------------
+ * filter conversion from deflate to szip
+ *-------------------------------------------------------------------------
+ */
+#if (defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)) && defined(H5_HAVE_FILTER_DEFLATE)
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset_deflate:SZIP=8",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME8,FNAME8OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME8OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" filter conversion from szip to deflate");
+/*-------------------------------------------------------------------------
+ * filter conversion from szip to deflate
+ *-------------------------------------------------------------------------
+ */
+#if (defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)) && defined(H5_HAVE_FILTER_DEFLATE)
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME7,FNAME7OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME7OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index 2ab1e00..249512c 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -16,12 +16,22 @@
#include "h5test.h"
#include "h5repack.h"
+#define DIM1 40
+#define DIM2 20
+#define CDIM1 DIM1/2
+#define CDIM2 DIM2/2
+#define RANK 2
int make_all_objects(hid_t loc_id);
int make_attributes(hid_t loc_id);
int make_special_objects(hid_t loc_id);
int make_early(void);
-
+int make_layout(hid_t loc_id);
+int make_szip(hid_t loc_id);
+int make_deflate(hid_t loc_id);
+int make_shuffle(hid_t loc_id);
+int make_fletcher32(hid_t loc_id);
+int make_all(hid_t loc_id);
/*-------------------------------------------------------------------------
@@ -70,13 +80,11 @@ int make_testfiles(void)
if(H5Fclose(loc_id)<0)
return -1;
/*-------------------------------------------------------------------------
- * create a file for the filters and layouts test
+ * create a file for 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;
if (make_layout(loc_id)<0)
goto out;
if(H5Fclose(loc_id)<0)
@@ -88,6 +96,61 @@ int make_testfiles(void)
*/
if (make_early()<0)
goto out;
+
+/*-------------------------------------------------------------------------
+ * create a file with the SZIP filter
+ *-------------------------------------------------------------------------
+ */
+ if((loc_id = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ return -1;
+ if (make_szip(loc_id)<0)
+ goto out;
+ if(H5Fclose(loc_id)<0)
+ return -1;
+
+/*-------------------------------------------------------------------------
+ * create a file with the deflate filter
+ *-------------------------------------------------------------------------
+ */
+ if((loc_id = H5Fcreate(FNAME8,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ return -1;
+ if (make_deflate(loc_id)<0)
+ goto out;
+ if(H5Fclose(loc_id)<0)
+ return -1;
+
+/*-------------------------------------------------------------------------
+ * create a file with the shuffle filter
+ *-------------------------------------------------------------------------
+ */
+ if((loc_id = H5Fcreate(FNAME9,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ return -1;
+ if (make_shuffle(loc_id)<0)
+ goto out;
+ if(H5Fclose(loc_id)<0)
+ return -1;
+
+/*-------------------------------------------------------------------------
+ * create a file with the fletcher32 filter
+ *-------------------------------------------------------------------------
+ */
+ if((loc_id = H5Fcreate(FNAME10,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ return -1;
+ if (make_fletcher32(loc_id)<0)
+ goto out;
+ if(H5Fclose(loc_id)<0)
+ return -1;
+
+/*-------------------------------------------------------------------------
+ * create a file with the all filters
+ *-------------------------------------------------------------------------
+ */
+ if((loc_id = H5Fcreate(FNAME11,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ return -1;
+ if (make_all(loc_id)<0)
+ goto out;
+ if(H5Fclose(loc_id)<0)
+ return -1;
PASSED();
@@ -164,7 +227,7 @@ int make_all_objects(hid_t loc_id)
write_dset_in(root_id,"dset_referenced",loc_id,0);
write_dset_in(group_id,"dset_referenced",loc_id,0);
- write_null_dset(root_id);
+
/* Close */
H5Dclose(dset_id);
@@ -216,7 +279,6 @@ int make_attributes(hid_t loc_id)
write_attr_in(dset_id,"dset",loc_id,0);
write_attr_in(group_id,"dset",loc_id,0);
write_attr_in(root_id,"dset",loc_id,0);
- write_null_attr(root_id);
/* Close */
H5Dclose(dset_id);
@@ -304,6 +366,344 @@ int make_special_objects(hid_t loc_id)
/*-------------------------------------------------------------------------
+ * Function: make_szip
+ *
+ * Purpose: make a dataset with the SZIP filter
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_szip(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block=8;
+ 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++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL))<0)
+ return -1;
+ /* create a dcpl */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
+ goto out;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
+ * SZIP
+ *-------------------------------------------------------------------------
+ */
+ /* Make sure encoding is enabled */
+#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)
+ /* set szip data */
+ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
+ goto out;
+ if (make_dset(loc_id,"dset_szip",sid,dcpl,buf)<0)
+ goto out;
+#endif
+
+ 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;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: make_deflate
+ *
+ * Purpose: make a dataset with the deflate filter
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_deflate(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++;
+ }
+ }
+
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL))<0)
+ return -1;
+ /* create a dcpl */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
+ goto out;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
+ goto out;
+/*-------------------------------------------------------------------------
+ * GZIP
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 9)<0)
+ goto out;
+ if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf)<0)
+ goto out;
+#endif
+
+/*-------------------------------------------------------------------------
+ * 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;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: make_shuffle
+ *
+ * Purpose: make a dataset with the shuffle filter
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_shuffle(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++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL))<0)
+ return -1;
+ /* create a dcpl */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
+ goto out;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
+ * shuffle
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5_HAVE_FILTER_SHUFFLE)
+ /* set the shuffle filter */
+ if (H5Pset_shuffle(dcpl)<0)
+ goto out;
+ if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf)<0)
+ goto out;
+#endif
+
+/*-------------------------------------------------------------------------
+ * 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;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: make_fletcher32
+ *
+ * Purpose: make a dataset with the fletcher32 filter
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_fletcher32(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++;
+ }
+ }
+ /* 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;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
+ goto out;
+
+
+/*-------------------------------------------------------------------------
+ * checksum
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5_HAVE_FILTER_FLETCHER32)
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ goto out;
+ /* set the checksum filter */
+ if (H5Pset_fletcher32(dcpl)<0)
+ goto out;
+ if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf)<0)
+ goto out;
+#endif
+
+/*-------------------------------------------------------------------------
+ * 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;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: make_all
+ *
+ * Purpose: make a dataset with the all filters
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_all(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block=8;
+ 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++;
+ }
+ }
+ /* 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;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
+ goto out;
+
+#if defined (H5_HAVE_FILTER_SHUFFLE)
+ /* set the shuffle filter */
+ if (H5Pset_shuffle(dcpl)<0)
+ goto out;
+#endif
+
+#if defined (H5_HAVE_FILTER_FLETCHER32)
+ /* set the checksum filter */
+ if (H5Pset_fletcher32(dcpl)<0)
+ goto out;
+#endif
+
+#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)
+ /* set szip data */
+ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
+ goto out;
+#endif
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 9)<0)
+ goto out;
+#endif
+
+ if (make_dset(loc_id,"dset_all",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;
+}
+
+
+
+/*-------------------------------------------------------------------------
* Function: make_early
*
* Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
@@ -399,3 +799,99 @@ out:
}
+
+/*-------------------------------------------------------------------------
+ * 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;
+ char name[5];
+
+
+ for (i=n=0; i<DIM1; i++){
+ for (j=0; j<DIM2; j++){
+ buf[i][j]=n++;
+ }
+ }
+
+/*-------------------------------------------------------------------------
+ * make several dataset with no filters
+ *-------------------------------------------------------------------------
+ */
+ for (i=0; i<4; i++)
+ {
+ sprintf(name,"dset%d",i+1);
+ if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf)<0)
+ return -1;
+ }
+
+
+/*-------------------------------------------------------------------------
+ * 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_util.c b/tools/h5repack/testh5repack_util.c
index f74b414..0f7253b 100644
--- a/tools/h5repack/testh5repack_util.c
+++ b/tools/h5repack/testh5repack_util.c
@@ -20,7 +20,7 @@
*
* Purpose: utility function to create and write a dataset in LOC_ID
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: November 12, 2003
*
@@ -60,7 +60,7 @@ int make_dset(hid_t loc_id,
*
* Purpose: utility function to create and write a dataset in LOC_ID
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: November 12, 2003
*
@@ -106,7 +106,7 @@ int write_dset( hid_t loc_id,
*
* Purpose: utility function to write an attribute in LOC_ID
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: pvn@ncsa.uiuc.edu
*
* Date: November 12, 2003
*
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 153c832..5315fd4 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -23,7 +23,7 @@
*/
static void print_warning(const char *dname, const char *fname)
{
- printf("Warning: dataset <%s> cannot be read, %s filter is not available\n",
+ fprintf(stderr,"Warning: dataset <%s> cannot be read, %s filter is not available\n",
dname,fname);
}
@@ -88,7 +88,14 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
switch (filtn)
{
+/*-------------------------------------------------------------------------
+ * user defined filter
+ *-------------------------------------------------------------------------
+ */
default:
+ if (name)
+ print_warning(name,"user defined");
+ return 0;
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_DEFLATE 1 , deflation like gzip
diff --git a/tools/testfiles/h5repack_info.txt b/tools/testfiles/h5repack_info.txt
index 20ed2f8..216948d 100644
--- a/tools/testfiles/h5repack_info.txt
+++ b/tools/testfiles/h5repack_info.txt
@@ -1 +1 @@
--l dset1:CHUNK=20x20 -f dset1,dset2:SZIP=8
+-l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
diff --git a/tools/testfiles/test1.h5 b/tools/testfiles/test1.h5
index 1edac90..fcf276d 100644
--- a/tools/testfiles/test1.h5
+++ b/tools/testfiles/test1.h5
Binary files differ
diff --git a/tools/testfiles/test3.h5 b/tools/testfiles/test3.h5
index 7072b02..2ab5c25 100644
--- a/tools/testfiles/test3.h5
+++ b/tools/testfiles/test3.h5
Binary files differ
diff --git a/tools/testfiles/test4.h5 b/tools/testfiles/test4.h5
index 6a04a34..223858d 100644
--- a/tools/testfiles/test4.h5
+++ b/tools/testfiles/test4.h5
Binary files differ
diff --git a/tools/testfiles/test5.h5 b/tools/testfiles/test5.h5
new file mode 100644
index 0000000..3ef3ad2
--- /dev/null
+++ b/tools/testfiles/test5.h5
Binary files differ
diff --git a/tools/testfiles/test_all.h5 b/tools/testfiles/test_all.h5
new file mode 100644
index 0000000..5a9d7fd
--- /dev/null
+++ b/tools/testfiles/test_all.h5
Binary files differ
diff --git a/tools/testfiles/test_deflate.h5 b/tools/testfiles/test_deflate.h5
new file mode 100644
index 0000000..840aee0
--- /dev/null
+++ b/tools/testfiles/test_deflate.h5
Binary files differ
diff --git a/tools/testfiles/test_fletcher32.h5 b/tools/testfiles/test_fletcher32.h5
new file mode 100644
index 0000000..36ca3f5
--- /dev/null
+++ b/tools/testfiles/test_fletcher32.h5
Binary files differ
diff --git a/tools/testfiles/test_shuffle.h5 b/tools/testfiles/test_shuffle.h5
new file mode 100644
index 0000000..f283612
--- /dev/null
+++ b/tools/testfiles/test_shuffle.h5
Binary files differ
diff --git a/tools/testfiles/test_szip.h5 b/tools/testfiles/test_szip.h5
new file mode 100644
index 0000000..7d0cb0b
--- /dev/null
+++ b/tools/testfiles/test_szip.h5
Binary files differ