Fixes for S3 and HDFS VFDs with tools (#1740)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
@@ -1091,13 +1077,6 @@ test_set_configured_fapl(void)
|
||||
"ros3",
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
"(ROS3) should fail: no fapl id",
|
||||
0,
|
||||
UTIL_TEST_NOFAPL,
|
||||
"ros3",
|
||||
&ros3_anon_fa,
|
||||
},
|
||||
{
|
||||
"(ROS3) should fail: no struct",
|
||||
0,
|
||||
@@ -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
|
||||
@@ -1131,13 +1103,6 @@ test_set_configured_fapl(void)
|
||||
"hdfs",
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
"(HDFS) should fail: no fapl id",
|
||||
0,
|
||||
UTIL_TEST_NOFAPL,
|
||||
"hdfs",
|
||||
&hdfs_fa,
|
||||
},
|
||||
{
|
||||
"(HDFS) should fail: no struct",
|
||||
0,
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user