summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-05-06 18:06:07 (GMT)
committerGitHub <noreply@github.com>2022-05-06 18:06:07 (GMT)
commit13985a7f529a3628fe215478f9d77f0d5b9b0fd1 (patch)
treed82bdd79c45f99b5237977e3371af5a689014c14 /tools
parentcdf837d0a16acd657e53057d19b4b21763eeca45 (diff)
downloadhdf5-13985a7f529a3628fe215478f9d77f0d5b9b0fd1.zip
hdf5-13985a7f529a3628fe215478f9d77f0d5b9b0fd1.tar.gz
hdf5-13985a7f529a3628fe215478f9d77f0d5b9b0fd1.tar.bz2
Fixes for S3 and HDFS VFDs with tools (#1740)
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5tools.c12
-rw-r--r--tools/libtest/h5tools_test_utils.c64
-rw-r--r--tools/src/h5dump/h5dump.c8
-rw-r--r--tools/src/h5ls/h5ls.c4
-rw-r--r--tools/src/h5stat/h5stat.c9
5 files changed, 38 insertions, 59 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 8768633..720d8c3 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -600,7 +600,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
done:
if (ret_value < 0) {
/* Clear error message unless asked for */
- if (enable_error_stack <= 1)
+ if ((H5tools_ERR_STACK_g >= 0) && (enable_error_stack <= 1))
H5Epop(H5tools_ERR_STACK_g, 1);
}
@@ -705,7 +705,7 @@ done:
H5TOOLS_ERROR(FAIL, "failed to decrement refcount on VOL connector ID");
/* Clear error message unless asked for */
- if (enable_error_stack <= 1)
+ if ((H5tools_ERR_STACK_g >= 0) && (enable_error_stack <= 1))
H5Epop(H5tools_ERR_STACK_g, 1);
}
@@ -762,7 +762,7 @@ done:
}
/* Clear error message unless asked for */
- if (enable_error_stack <= 1)
+ if ((H5tools_ERR_STACK_g >= 0) && (enable_error_stack <= 1))
H5Epop(H5tools_ERR_STACK_g, 1);
}
@@ -1033,8 +1033,10 @@ done:
H5Pclose(tmp_fapl_id);
/* Clear error message unless asked for */
- if (ret_value < 0 && enable_error_stack <= 1)
- H5Epop(H5tools_ERR_STACK_g, 1);
+ if (ret_value < 0) {
+ if ((H5tools_ERR_STACK_g >= 0) && (enable_error_stack <= 1))
+ H5Epop(H5tools_ERR_STACK_g, 1);
+ }
return ret_value;
}
diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c
index 072179b..e49a155 100644
--- a/tools/libtest/h5tools_test_utils.c
+++ b/tools/libtest/h5tools_test_utils.c
@@ -1029,52 +1029,38 @@ test_set_configured_fapl(void)
2048, /* stream buffer size */
};
#endif /* H5_HAVE_LIBHDFS */
- unsigned n_cases = 7; /* number of common testcases */
+ unsigned n_cases = 5; /* number of common testcases */
testcase cases[] = {
{
- "(common) should fail: no fapl id",
- 0,
- UTIL_TEST_NOFAPL,
- "",
- NULL,
- },
- {
- "(common) should fail: no fapl id (with struct)",
- 0,
- UTIL_TEST_NOFAPL,
- "",
- &wrong_fa,
- },
- {
"(common) H5P_DEFAULT with no struct should succeed",
1,
UTIL_TEST_DEFAULT,
- "",
+ "sec2",
NULL,
},
{
"(common) H5P_DEFAULT with (ignored) struct should succeed",
1,
UTIL_TEST_DEFAULT,
- "",
+ "sec2",
&wrong_fa,
},
{
"(common) provided fapl entry should not fail",
1,
UTIL_TEST_CREATE,
- "",
+ "sec2",
NULL,
},
{
"(common) provided fapl entry should not fail; ignores struct",
1,
UTIL_TEST_CREATE,
- "",
+ "sec2",
&wrong_fa,
},
{
- "(common) should fail: unrecoginzed vfd name",
+ "(common) should fail: unrecognized vfd name",
0,
UTIL_TEST_DEFAULT,
"unknown",
@@ -1092,13 +1078,6 @@ test_set_configured_fapl(void)
NULL,
},
{
- "(ROS3) should fail: no fapl id",
- 0,
- UTIL_TEST_NOFAPL,
- "ros3",
- &ros3_anon_fa,
- },
- {
"(ROS3) should fail: no struct",
0,
UTIL_TEST_CREATE,
@@ -1112,13 +1091,6 @@ test_set_configured_fapl(void)
"ros3",
&ros3_anon_fa,
},
- {
- "(ROS3) should fail: attempt to set DEFAULT fapl",
- 0,
- UTIL_TEST_DEFAULT,
- "ros3",
- &ros3_anon_fa,
- },
#endif /* H5_HAVE_ROS3_VFD */
#ifdef H5_HAVE_LIBHDFS
@@ -1132,13 +1104,6 @@ test_set_configured_fapl(void)
NULL,
},
{
- "(HDFS) should fail: no fapl id",
- 0,
- UTIL_TEST_NOFAPL,
- "hdfs",
- &hdfs_fa,
- },
- {
"(HDFS) should fail: no struct",
0,
UTIL_TEST_CREATE,
@@ -1152,24 +1117,17 @@ test_set_configured_fapl(void)
"hdfs",
&hdfs_fa,
},
- {
- "(HDFS) should fail: attempt to set DEFAULT fapl",
- 0,
- UTIL_TEST_DEFAULT,
- "hdfs",
- &hdfs_fa,
- },
#endif /* H5_HAVE_LIBHDFS */
}; /* testcases `cases` array */
unsigned int i;
#ifdef H5_HAVE_ROS3_VFD
- n_cases += 5;
+ n_cases += 3;
#endif /* H5_HAVE_ROS3_VFD */
#ifdef H5_HAVE_LIBHDFS
- n_cases += 5;
+ n_cases += 3;
#endif /* H5_HAVE_LIBHDFS */
TESTING("programmatic fapl set");
@@ -1205,10 +1163,12 @@ test_set_configured_fapl(void)
vfd_info.info = C.conf_fa;
vfd_info.u.name = C.vfdname;
result = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info);
- if (C.expected == 0)
+ if (C.expected == 0) {
JSVERIFY(result, H5I_INVALID_HID, C.message)
- else
+ }
+ else {
JSVERIFY_NOT(result, H5I_INVALID_HID, C.message)
+ }
#if UTIL_TEST_DEBUG
HDfprintf(stderr, "after test\n");
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index d82ea94..22b869c 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -25,8 +25,8 @@ static const char *xml_dtd_uri_g = NULL;
static hbool_t use_custom_vol_g = FALSE;
static hbool_t use_custom_vfd_g = FALSE;
-static h5tools_vol_info_t vol_info_g;
-static h5tools_vfd_info_t vfd_info_g;
+static h5tools_vol_info_t vol_info_g = {0};
+static h5tools_vfd_info_t vfd_info_g = {0};
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -1238,6 +1238,8 @@ end_collect:
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
+
+ vfd_info_g.info = &ros3_fa_g;
#else
error_msg("Read-Only S3 VFD not enabled.\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -1255,6 +1257,8 @@ end_collect:
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
+
+ vfd_info_g.info = &hdfs_fa_g;
#else
error_msg("HDFS VFD not enabled.\n");
h5tools_setstatus(EXIT_FAILURE);
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 228893a..b7ee380 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -2854,6 +2854,8 @@ main(int argc, char *argv[])
usage();
leave(EXIT_FAILURE);
}
+
+ vfd_info.info = &ros3_fa;
#else
HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n");
usage();
@@ -2875,6 +2877,8 @@ main(int argc, char *argv[])
usage();
leave(EXIT_FAILURE);
}
+
+ vfd_info.info = &hdfs_fa;
#else
HDfprintf(rawerrorstream, "Error: The HDFS VFD is not enabled\n\n");
usage();
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index e42af10..d5b9a1a 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -1711,6 +1711,15 @@ main(int argc, char *argv[])
vfd_info.info = NULL;
vfd_info.u.name = drivername;
+#ifdef H5_HAVE_ROS3_VFD
+ if (!HDstrcmp(drivername, drivernames[ROS3_VFD_IDX]))
+ vfd_info.info = &ros3_fa;
+#endif
+#ifdef H5_HAVE_LIBHDFS
+ if (!HDstrcmp(drivername, drivernames[HDFS_VFD_IDX]))
+ vfd_info.info = &hdfs_fa;
+#endif
+
if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) {
error_msg("Unable to create FAPL for file access\n");
goto done;