diff options
Diffstat (limited to 'test/h5test.c')
-rw-r--r-- | test/h5test.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/h5test.c b/test/h5test.c index fb5b83d..888fded 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1901,3 +1901,46 @@ error: return NULL; } /* h5_get_dummy_vfd_class */ + +/*------------------------------------------------------------------------- + * Function: h5_get_dummy_vol_class() + * + * Purpose: Returns a disposable, generally non-functional, + * VOL class struct. + * + * In some of the test code, we need a disposable VOL driver + * but we don't want to mess with the real VFDs and we also + * don't have access to the internals of the real VOL drivers + * (which use static globals and functions) to easily duplicate + * them (e.g.: for testing VOL driver ID handling). + * + * This API call will return a pointer to a VOL class that + * can be used to construct a test VOL using H5VLregister(). + * + * Return: Success: A pointer to a VOL class struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5VL_class_t * +h5_get_dummy_vol_class(void) +{ + H5VL_class_t *vol_class = NULL; /* Dummy VOL class that will be returned */ + + /* Create the class and initialize everything to zero/NULL */ + if(NULL == (vol_class = (H5VL_class_t *)HDcalloc((size_t)1, sizeof(H5VL_class_t)))) + TEST_ERROR; + + /* Fill in the minimum parameters to make a VOL driver class that + * can be registered. + */ + vol_class->name = "dummy"; + + return vol_class; + +error: + if(vol_class) + HDfree(vol_class); + return NULL; +} /* h5_get_dummy_vol_class */ + |