summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/testh5repack_main.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-12-30 17:01:30 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-12-30 17:01:30 (GMT)
commit95da5842dfd4caaca02460a6ff1ffa22b8b9a312 (patch)
tree8c79bb560360fb52ff9de3e6ef5e27a3909d0f2e /tools/h5repack/testh5repack_main.c
parentbe59bde1f8b9c75aa04482ac46e31fa6fac3c250 (diff)
downloadhdf5-95da5842dfd4caaca02460a6ff1ffa22b8b9a312.zip
hdf5-95da5842dfd4caaca02460a6ff1ffa22b8b9a312.tar.gz
hdf5-95da5842dfd4caaca02460a6ff1ffa22b8b9a312.tar.bz2
[svn-r7996] Purpose:
h5repack new features Description: added support for shuffle and checksum filters Solution: Platforms tested: linux solaris AIX Misc. update:
Diffstat (limited to 'tools/h5repack/testh5repack_main.c')
-rw-r--r--tools/h5repack/testh5repack_main.c254
1 files changed, 248 insertions, 6 deletions
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index e46dd53..4385247 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -46,10 +46,12 @@ test_copy(void)
TEST_ERROR;
if (h5repack(FNAME1,FNAME1OUT,&pack_options)<0)
TEST_ERROR;
- if (h5repack_end (&pack_options)<0)
- TEST_ERROR;
if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) == 1)
TEST_ERROR;
+ if (h5repack_verify(FNAME1OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
PASSED();
TESTING(" copy of attributes");
@@ -57,10 +59,12 @@ test_copy(void)
TEST_ERROR;
if (h5repack(FNAME2,FNAME2OUT,&pack_options)<0)
TEST_ERROR;
- if (h5repack_end (&pack_options)<0)
- TEST_ERROR;
if (h5diff(FNAME2,FNAME2OUT,NULL,NULL,&diff_options) == 1)
TEST_ERROR;
+ if (h5repack_verify(FNAME2OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
PASSED();
TESTING(" copy of hardlinks");
@@ -68,10 +72,12 @@ test_copy(void)
TEST_ERROR;
if (h5repack(FNAME3,FNAME3OUT,&pack_options)<0)
TEST_ERROR;
- if (h5repack_end (&pack_options)<0)
- TEST_ERROR;
if (h5diff(FNAME3,FNAME3OUT,NULL,NULL,&diff_options) == 1)
TEST_ERROR;
+ if (h5repack_verify(FNAME3OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
PASSED();
return 0;
@@ -113,6 +119,28 @@ test_filter_deflate(void)
#ifdef H5_HAVE_FILTER_DEFLATE
+/*-------------------------------------------------------------------------
+ * test no object option (preserve old 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;
+
+
+/*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset1:GZIP 9",&pack_options)<0)
@@ -128,6 +156,11 @@ test_filter_deflate(void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
+/*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("GZIP 9",&pack_options)<0)
@@ -190,6 +223,11 @@ test_filter_szip(void)
#ifdef H5_HAVE_FILTER_SZIP
+/*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset2:SZIP 8",&pack_options)<0)
@@ -204,6 +242,30 @@ test_filter_szip(void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
+
+/*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
+
+#if 0
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("SZIP 8",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack_addchunk("20x10",&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();
#else
@@ -216,10 +278,184 @@ error:
return 1;
#endif
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_filter_shuffle
+ *
+ * Purpose:
+ *
+ * 1) compress/chunk FILENAME with the shuffle filter
+ * 2) use the h5diff utility to compare the input and output file;
+ * it returns RET==0 if the objects have the same data
+ * 3) use API functions to verify the compression/chunking input on the output file
+ *
+ * Return: Success: zero
+ * Failure: 1
+ *
+ * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
+ * September, 19, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_filter_shuffle(void)
+{
+ pack_opt_t pack_options;
+ diff_opt_t diff_options;
+ memset(&diff_options, 0, sizeof (diff_opt_t));
+ memset(&pack_options, 0, sizeof (pack_opt_t));
+
+ TESTING(" shuffle filter");
+
+#ifdef H5_HAVE_FILTER_SHUFFLE
+
+/*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset1:SHUF",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack_addchunk("dset1:20x10",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+/*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("SHUF",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack_addchunk("20x10",&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
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SHUFFLE
+error:
+ return 1;
+#endif
+
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_filter_checksum
+ *
+ * Purpose:
+ *
+ * 1) compress/chunk FILENAME with the checksum filter
+ * 2) use the h5diff utility to compare the input and output file;
+ * it returns RET==0 if the objects have the same data
+ * 3) use API functions to verify the compression/chunking input on the output file
+ *
+ * Return: Success: zero
+ * Failure: 1
+ *
+ * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
+ * September, 19, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_filter_checksum(void)
+{
+ pack_opt_t pack_options;
+ diff_opt_t diff_options;
+ memset(&diff_options, 0, sizeof (diff_opt_t));
+ memset(&pack_options, 0, sizeof (pack_opt_t));
+
+ TESTING(" checksum filter");
+
+#ifdef H5_HAVE_FILTER_FLETCHER32
+
+/*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("dset1:FLET",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack_addchunk("dset1:20x10",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+
+/*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack_addfilter("FLET",&pack_options)<0)
+ TEST_ERROR;
+ if (h5repack_addchunk("20x10",&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
+ return 0;
+
+#ifdef H5_HAVE_FILTER_FLETCHER32
+error:
+ return 1;
+#endif
+
}
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -256,6 +492,12 @@ int main (void)
/* test a copy with the szip filter */
nerrors += test_filter_szip();
+ /* test a copy with the shuffle filter */
+ nerrors += test_filter_shuffle();
+
+ /* test a copy with the checksum filter */
+ nerrors += test_filter_checksum();
+
/* check for errors */
if (nerrors)
goto error;