summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-08-02 16:28:08 (GMT)
committerGitHub <noreply@github.com>2023-08-02 16:28:08 (GMT)
commit89b4afd4b317c5131cbc8607c99d21b369d050eb (patch)
treefb2e6c99d110a7c6e40e0671aa2f24d5e96a7060 /test
parentb78729638bf69dca9e0dd86eddd530d5fc1aef40 (diff)
downloadhdf5-89b4afd4b317c5131cbc8607c99d21b369d050eb.zip
hdf5-89b4afd4b317c5131cbc8607c99d21b369d050eb.tar.gz
hdf5-89b4afd4b317c5131cbc8607c99d21b369d050eb.tar.bz2
Fix loading plugin fails with missing directory GH issue #3248 (#3324)
Diffstat (limited to 'test')
-rw-r--r--test/filter_plugin.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/test/filter_plugin.c b/test/filter_plugin.c
index ea5c000..7ed8ced 100644
--- a/test/filter_plugin.c
+++ b/test/filter_plugin.c
@@ -438,9 +438,11 @@ static herr_t
test_dataset_write_with_filters(hid_t fid)
{
hid_t dcpl_id = -1; /* Dataset creation property list ID */
- unsigned int compress_level; /* Deflate compression level */
unsigned int filter1_data; /* Data used by filter 1 */
unsigned int libver_values[4]; /* Used w/ the filter that makes HDF5 calls */
+#ifdef H5_HAVE_FILTER_DEFLATE
+ unsigned int compress_level; /* Deflate compression level */
+#endif
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
@@ -847,7 +849,7 @@ test_creating_groups_using_plugins(hid_t fid)
for (i = 0; i < N_SUBGROUPS; i++) {
char *sp = subgroup_name;
- sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX);
+ sp += HDsnprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX);
HDsprintf(sp, "%d", i);
if ((sub_gid = H5Gcreate2(gid, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -906,7 +908,7 @@ test_opening_groups_using_plugins(hid_t fid)
for (i = 0; i < N_SUBGROUPS; i++) {
char *sp = subgroup_name;
- sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX);
+ sp += HDsnprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX);
HDsprintf(sp, "%d", i);
if ((sub_gid = H5Gopen2(gid, subgroup_name, H5P_DEFAULT)) < 0)
@@ -1025,7 +1027,7 @@ test_path_api_calls(void)
/* Add a bunch of paths to the path table */
for (u = 0; u < n_starting_paths; u++) {
- HDsprintf(path, "a_path_%u", u);
+ HDsnprintf(path, sizeof(path), "a_path_%u", u);
if (H5PLappend(path) < 0) {
HDfprintf(stderr, " at %u: %s\n", u, path);
TEST_ERROR;
@@ -1091,7 +1093,7 @@ test_path_api_calls(void)
/* Get path at the last index */
if ((path_len = H5PLget(n_starting_paths - 1, path, 256)) <= 0)
TEST_ERROR;
- HDsprintf(temp_name, "a_path_%u", n_starting_paths - 1);
+ HDsnprintf(temp_name, sizeof(temp_name), "a_path_%u", n_starting_paths - 1);
if (HDstrcmp(path, temp_name) != 0) {
HDfprintf(stderr, " get %u: %s\n", n_starting_paths - 1, path);
TEST_ERROR;
@@ -1145,7 +1147,7 @@ test_path_api_calls(void)
TESTING(" prepend");
/* Prepend one path */
- HDsprintf(path, "a_path_%d", n_starting_paths + 1);
+ HDsnprintf(path, sizeof(path), "a_path_%d", n_starting_paths + 1);
if (H5PLprepend(path) < 0) {
HDfprintf(stderr, " prepend %u: %s\n", n_starting_paths + 1, path);
TEST_ERROR;
@@ -1168,7 +1170,7 @@ test_path_api_calls(void)
/* Verify that the path was inserted at index zero */
if (H5PLget(0, path, 256) <= 0)
TEST_ERROR;
- HDsprintf(temp_name, "a_path_%d", n_starting_paths + 1);
+ HDsnprintf(temp_name, sizeof(temp_name), "a_path_%d", n_starting_paths + 1);
if (HDstrcmp(path, temp_name) != 0) {
HDfprintf(stderr, " get 0: %s\n", path);
TEST_ERROR;
@@ -1183,7 +1185,7 @@ test_path_api_calls(void)
TESTING(" replace");
/* Replace one path at index 1 */
- HDsprintf(path, "a_path_%u", n_starting_paths + 4);
+ HDsnprintf(path, sizeof(path), "a_path_%u", n_starting_paths + 4);
if (H5PLreplace(path, 1) < 0) {
HDfprintf(stderr, " replace 1: %s\n", path);
TEST_ERROR;
@@ -1202,7 +1204,7 @@ test_path_api_calls(void)
/* Check path at index 0 */
if (H5PLget(0, path, 256) <= 0)
TEST_ERROR;
- HDsprintf(temp_name, "a_path_%u", n_starting_paths + 1);
+ HDsnprintf(temp_name, sizeof(temp_name), "a_path_%u", n_starting_paths + 1);
if (HDstrcmp(path, temp_name) != 0) {
HDfprintf(stderr, " get 0: %s\n", path);
TEST_ERROR;
@@ -1250,7 +1252,7 @@ test_path_api_calls(void)
TESTING(" insert");
/* Insert one path at index 3*/
- HDsprintf(path, "a_path_%d", n_starting_paths + 5);
+ HDsnprintf(path, sizeof(path), "a_path_%d", n_starting_paths + 5);
if (H5PLinsert(path, 3) < 0) {
HDfprintf(stderr, " insert 3: %s\n", path);
TEST_ERROR;
@@ -1436,6 +1438,12 @@ main(void)
else
my_fapl_id = old_ff_fapl_id;
+ /* Add extra path to check for correct error process */
+ if (H5PLprepend("bogus") < 0) {
+ fprintf(stderr, "Could not prepend path:bogus\n");
+ TEST_ERROR;
+ }
+
/* Reopen the file for testing data reading */
if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, my_fapl_id)) < 0)
TEST_ERROR;