summaryrefslogtreecommitdiffstats
path: root/test/plugin.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2013-04-01 23:28:48 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2013-04-01 23:28:48 (GMT)
commit72e84fcd8253661a3cee60f4adcbb9c0b4999067 (patch)
tree81b07e01eb290a82e7c926014790128e44f86a2b /test/plugin.c
parente679eed61b59bd5e434b43ca749e6c885020afb2 (diff)
downloadhdf5-72e84fcd8253661a3cee60f4adcbb9c0b4999067.zip
hdf5-72e84fcd8253661a3cee60f4adcbb9c0b4999067.tar.gz
hdf5-72e84fcd8253661a3cee60f4adcbb9c0b4999067.tar.bz2
[svn-r23513] I added a test case in plugin.c for testing using filter for groups and created a dummy filter library for this test case.
Tested on jam and koala.
Diffstat (limited to 'test/plugin.c')
-rw-r--r--test/plugin.c62
1 files changed, 58 insertions, 4 deletions
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