summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.in28
-rw-r--r--test/dynlib1.c2
-rw-r--r--test/dynlib2.c2
-rw-r--r--test/plugin.c62
5 files changed, 84 insertions, 13 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 54bc4d2..ac5d169 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -81,9 +81,10 @@ if HAVE_SHARED_CONDITIONAL
# The libdynlib1 and libdynlib2 library for testing plugin module plugin.c.
# Build it as shared library if configure is enabled for shared library.
- lib_LTLIBRARIES=libdynlib1.la libdynlib2.la
+ lib_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la
libdynlib1_la_SOURCES=dynlib1.c
libdynlib2_la_SOURCES=dynlib2.c
+ libdynlib3_la_SOURCES=dynlib3.c
install-exec-hook:
$(RM) $(DESTDIR)$(libdir)/*dynlib*
diff --git a/test/Makefile.in b/test/Makefile.in
index f0817f5..65c0fca 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -139,6 +139,12 @@ am__libdynlib2_la_SOURCES_DIST = dynlib2.c
libdynlib2_la_OBJECTS = $(am_libdynlib2_la_OBJECTS)
@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlib2_la_rpath = -rpath \
@HAVE_SHARED_CONDITIONAL_TRUE@ $(libdir)
+libdynlib3_la_LIBADD =
+am__libdynlib3_la_SOURCES_DIST = dynlib3.c
+@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlib3_la_OBJECTS = dynlib3.lo
+libdynlib3_la_OBJECTS = $(am_libdynlib3_la_OBJECTS)
+@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlib3_la_rpath = -rpath \
+@HAVE_SHARED_CONDITIONAL_TRUE@ $(libdir)
libh5test_la_LIBADD =
am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo
libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS)
@@ -517,12 +523,13 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdynlib1_la_SOURCES) $(libdynlib2_la_SOURCES) \
- $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \
- btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \
- cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \
- earray.c efc.c enc_dec_plist.c enc_dec_plist_with_endianess.c \
- enum.c err_compat.c error_test.c extend.c external.c farray.c \
- fheap.c file_image.c fillval.c filter_fail.c flush1.c flush2.c \
+ $(libdynlib3_la_SOURCES) $(libh5test_la_SOURCES) accum.c \
+ app_ref.c big.c bittests.c btree2.c cache.c cache_api.c \
+ cache_tagging.c cmpd_dset.c cross_read.c dangle.c dsets.c \
+ dt_arith.c dtransform.c dtypes.c earray.c efc.c \
+ enc_dec_plist.c enc_dec_plist_with_endianess.c enum.c \
+ err_compat.c error_test.c extend.c external.c farray.c fheap.c \
+ file_image.c fillval.c filter_fail.c flush1.c flush2.c \
freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \
gen_deflate.c gen_file_image.c gen_filespace.c gen_filters.c \
gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \
@@ -534,7 +541,8 @@ SOURCES = $(libdynlib1_la_SOURCES) $(libdynlib2_la_SOURCES) \
tcheck_version.c $(testhdf5_SOURCES) testmeta.c \
$(ttsafe_SOURCES) unlink.c vfd.c
DIST_SOURCES = $(am__libdynlib1_la_SOURCES_DIST) \
- $(am__libdynlib2_la_SOURCES_DIST) $(libh5test_la_SOURCES) \
+ $(am__libdynlib2_la_SOURCES_DIST) \
+ $(am__libdynlib3_la_SOURCES_DIST) $(libh5test_la_SOURCES) \
accum.c app_ref.c big.c bittests.c btree2.c cache.c \
cache_api.c cache_tagging.c cmpd_dset.c cross_read.c dangle.c \
dsets.c dt_arith.c dtransform.c dtypes.c earray.c efc.c \
@@ -911,9 +919,10 @@ BUILD_ALL_PROGS = gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_n
@HAVE_SHARED_CONDITIONAL_FALSE@noinst_LTLIBRARIES = libh5test.la
@HAVE_SHARED_CONDITIONAL_TRUE@noinst_LTLIBRARIES = libh5test.la
-@HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlib1.la libdynlib2.la
+@HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlib1.la libdynlib2.la libdynlib3.la
@HAVE_SHARED_CONDITIONAL_TRUE@libdynlib1_la_SOURCES = dynlib1.c
@HAVE_SHARED_CONDITIONAL_TRUE@libdynlib2_la_SOURCES = dynlib2.c
+@HAVE_SHARED_CONDITIONAL_TRUE@libdynlib3_la_SOURCES = dynlib3.c
libh5test_la_SOURCES = h5test.c testframe.c cache_common.c
# Use libhd5test.la to compile all of the tests
@@ -1050,6 +1059,8 @@ libdynlib1.la: $(libdynlib1_la_OBJECTS) $(libdynlib1_la_DEPENDENCIES) $(EXTRA_li
$(AM_V_CCLD)$(LINK) $(am_libdynlib1_la_rpath) $(libdynlib1_la_OBJECTS) $(libdynlib1_la_LIBADD) $(LIBS)
libdynlib2.la: $(libdynlib2_la_OBJECTS) $(libdynlib2_la_DEPENDENCIES) $(EXTRA_libdynlib2_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(am_libdynlib2_la_rpath) $(libdynlib2_la_OBJECTS) $(libdynlib2_la_LIBADD) $(LIBS)
+libdynlib3.la: $(libdynlib3_la_OBJECTS) $(libdynlib3_la_DEPENDENCIES) $(EXTRA_libdynlib3_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libdynlib3_la_rpath) $(libdynlib3_la_OBJECTS) $(libdynlib3_la_LIBADD) $(LIBS)
libh5test.la: $(libh5test_la_OBJECTS) $(libh5test_la_DEPENDENCIES) $(EXTRA_libh5test_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(am_libh5test_la_rpath) $(libh5test_la_OBJECTS) $(libh5test_la_LIBADD) $(LIBS)
@@ -1320,6 +1331,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtypes.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib1.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib3.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist.Po@am__quote@
diff --git a/test/dynlib1.c b/test/dynlib1.c
index 2e0c593..e252623 100644
--- a/test/dynlib1.c
+++ b/test/dynlib1.c
@@ -24,6 +24,8 @@
#include <stdio.h>
#include <hdf5.h>
+#define H5Z_FILTER_DYNLIB1 257
+
static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
diff --git a/test/dynlib2.c b/test/dynlib2.c
index b1c1707..1ee6ed7 100644
--- a/test/dynlib2.c
+++ b/test/dynlib2.c
@@ -25,6 +25,8 @@
#include <math.h>
#include <hdf5.h>
+#define H5Z_FILTER_DYNLIB2 258
+
static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
diff --git a/test/plugin.c b/test/plugin.c
index 4fc8115..6f85dd4 100644
--- a/test/plugin.c
+++ b/test/plugin.c
@@ -34,6 +34,7 @@
/* Filters for HDF5 internal test */
#define H5Z_FILTER_DYNLIB1 257
#define H5Z_FILTER_DYNLIB2 258
+#define H5Z_FILTER_DYNLIB3 259
/* Bzip2 filter */
#define H5Z_FILTER_BZIP2 307
@@ -65,6 +66,8 @@ const char *FILENAME[] = {
/* Limit random number within 20000 */
#define RANDOM_LIMIT 20000
+#define ITER 100
+
int points_deflate[DSET_DIM1][DSET_DIM2],
points_dynlib1[DSET_DIM1][DSET_DIM2],
points_dynlib2[DSET_DIM1][DSET_DIM2],
@@ -329,7 +332,7 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_filters
+ * Function: test_filters_for_datasets
*
* Purpose: Tests creating datasets and writing data with dynamically
* loaded filters
@@ -343,7 +346,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_filters(hid_t file, hid_t fapl)
+test_filters_for_datasets(hid_t file, hid_t fapl)
{
hid_t dc; /* Dataset creation property list ID */
const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
@@ -529,6 +532,55 @@ error:
return -1;
}
+/*-------------------------------------------------------------------------
+ * Function: test_filters_for_groups
+ *
+ * Purpose: Tests creating group with dynamically loaded filters
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 1 April 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_filters_for_groups(hid_t file, hid_t fapl)
+{
+ hid_t gcpl, gid, group;
+ int i;
+ char name[256];
+
+ puts("Testing DYNLIB3 filter for group");
+
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error;
+
+ if(H5Pset_filter (gcpl, H5Z_FILTER_DYNLIB3, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) goto error;
+
+ /* Create a group using this filter */
+ if((gid = H5Gcreate2(file, "group1", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error;
+
+ for (i=0; i < ITER; i++) {
+ sprintf(name, "group_%d", i);
+ if((group = H5Gcreate (gid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if(H5Gclose(group) < 0) goto error;
+ }
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0) goto error;
+
+ /* Clean up objects used for this test */
+ if(H5Pclose (gcpl) < 0) goto error;
+
+ PASSED();
+
+ return 0;
+
+error:
+ return -1;
+}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -593,8 +645,10 @@ main(void)
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
TEST_ERROR
- /* Test dynamically loaded filters */
- nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
+ /* Test dynamically loaded filters for chunked dataset */
+ nerrors += (test_filters_for_datasets(file, my_fapl) < 0 ? 1 : 0);
+
+ nerrors += (test_filters_for_groups(file, my_fapl) < 0 ? 1 : 0);
if(H5Fclose(file) < 0)
TEST_ERROR