summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeTests.cmake4
-rw-r--r--test/h5test.c15
-rw-r--r--test/tattr.c65
-rw-r--r--test/tvlstr.c4
4 files changed, 80 insertions, 8 deletions
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 3ad9de7..1c26def 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -843,6 +843,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=err_compat.txt"
-D "TEST_REFERENCE=err_compat_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
@@ -877,6 +878,7 @@ else ()
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=error_test.txt"
-D "TEST_REFERENCE=error_test_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
@@ -943,6 +945,7 @@ if (BUILD_SHARED_LIBS)
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=err_compat.txt"
-D "TEST_REFERENCE=err_compat_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
@@ -977,6 +980,7 @@ if (BUILD_SHARED_LIBS)
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=error_test.txt"
-D "TEST_REFERENCE=error_test_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
diff --git a/test/h5test.c b/test/h5test.c
index 0805f06..6aad76a 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -855,6 +855,7 @@ h5_get_vfd_fapl(hid_t fapl)
{
const char *env = NULL; /* HDF5_DRIVER environment variable */
const char *tok = NULL; /* strtok pointer */
+ char *lasts = NULL; /* Context pointer for strtok_r() call */
char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */
/* Get the environment variable, if it exists */
@@ -877,7 +878,7 @@ h5_get_vfd_fapl(hid_t fapl)
*/
HDstrncpy(buf, env, sizeof(buf));
buf[sizeof(buf) - 1] = '\0';
- if(NULL == (tok = HDstrtok(buf, " \t\n\r")))
+ if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
goto done;
if(!HDstrcmp(tok, "sec2")) {
@@ -936,7 +937,7 @@ h5_get_vfd_fapl(hid_t fapl)
hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */
/* Was a family size specified in the environment variable? */
- if((tok = HDstrtok(NULL, " \t\n\r")))
+ if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024);
if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0)
goto error;
@@ -945,7 +946,7 @@ h5_get_vfd_fapl(hid_t fapl)
unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC;
/* Were special log file flags specified in the environment variable? */
- if((tok = HDstrtok(NULL, " \t\n\r")))
+ if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
log_flags = (unsigned)HDstrtol(tok, NULL, 0);
if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
@@ -990,6 +991,7 @@ h5_get_libver_fapl(hid_t fapl)
{
const char *env = NULL; /* HDF5_DRIVER environment variable */
const char *tok = NULL; /* strtok pointer */
+ char *lasts = NULL; /* Context pointer for strtok_r() call */
char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */
/* Get the environment variable, if it exists */
@@ -1012,7 +1014,7 @@ h5_get_libver_fapl(hid_t fapl)
*/
HDstrncpy(buf, env, sizeof(buf));
buf[sizeof(buf) - 1] = '\0';
- if(NULL == (tok = HDstrtok(buf, " \t\n\r")))
+ if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
goto done;
if(!HDstrcmp(tok, "latest")) {
@@ -1053,6 +1055,7 @@ h5_get_vol_fapl(hid_t fapl)
{
const char *env = NULL;
const char *tok = NULL;
+ char *lasts = NULL; /* Context pointer for strtok_r() call */
htri_t connector_is_registered;
char buf[1024]; /* Buffer for tokenizing HDF5_VOL_CONNECTOR */
void *vol_info = NULL; /* VOL connector info */
@@ -1075,7 +1078,7 @@ h5_get_vol_fapl(hid_t fapl)
*/
HDstrncpy(buf, env, sizeof(buf));
buf[sizeof(buf) - 1] = '\0';
- if(NULL == (tok = HDstrtok(buf, " \t\n\r")))
+ if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
goto done;
/* First, check to see if the connector is already registered */
@@ -1105,7 +1108,7 @@ h5_get_vol_fapl(hid_t fapl)
} /* end else */
/* Was there any connector info specified in the environment variable? */
- if(NULL != (tok = HDstrtok(NULL, " \t\n\r")))
+ if(NULL != (tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
if(H5VLconnector_str_to_info(tok, connector_id, &vol_info) < 0)
goto error;
diff --git a/test/tattr.c b/test/tattr.c
index 3a7cf2c..63a0580 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -143,6 +143,10 @@ float attr_data5=-5.123F; /* Test data for 5th attribute */
#define DIM1 100
#define RANK 2
+/* Used by test_attr_info_null_info_pointer() */
+#define GET_INFO_NULL_POINTER_ATTR_NAME "NullInfoPointerAttr"
+
+
/* Attribute iteration struct */
typedef struct {
H5_iter_order_t order; /* Direction of iteration */
@@ -5875,6 +5879,65 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* test_attr_info_by_idx() */
+/***************************************************************
+**
+** test_attr_info_null_info_pointer(): A test to ensure that
+** passing a NULL attribute info pointer to H5Aget_info
+** (_by_name/_by_idx) doesn't cause bad behavior.
+**
+****************************************************************/
+static void
+test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl)
+{
+ herr_t err_ret = -1;
+ hid_t fid;
+ hid_t attr;
+ hid_t sid;
+
+ /* Create dataspace for dataset & attributes */
+ sid = H5Screate(H5S_SCALAR);
+ CHECK(sid, FAIL, "H5Screate");
+
+ /* Create file */
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create attribute */
+ attr = H5Acreate2(fid, GET_INFO_NULL_POINTER_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, FAIL, "H5Acreate2");
+
+ H5E_BEGIN_TRY {
+ err_ret = H5Aget_info(attr, NULL);
+ } H5E_END_TRY;
+
+ CHECK(err_ret, SUCCEED, "H5Aget_info");
+
+ H5E_BEGIN_TRY {
+ err_ret = H5Aget_info_by_name(fid, ".", GET_INFO_NULL_POINTER_ATTR_NAME, NULL, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ CHECK(err_ret, SUCCEED, "H5Aget_info_by_name");
+
+ H5E_BEGIN_TRY {
+ err_ret = H5Aget_info_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ CHECK(err_ret, SUCCEED, "H5Aget_info_by_idx");
+
+ /* Close dataspace */
+ err_ret = H5Sclose(sid);
+ CHECK(err_ret, FAIL, "H5Sclose");
+
+ /* Close attribute */
+ err_ret = H5Aclose(attr);
+ CHECK(err_ret, FAIL, "H5Aclose");
+
+ /* Close file */
+ err_ret = H5Fclose(fid);
+ CHECK(err_ret, FAIL, "H5Fclose");
+}
+
+
/****************************************************************
**
** test_attr_delete_by_idx(): Test basic H5A (attribute) code.
@@ -10875,6 +10938,7 @@ test_attr(void)
test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */
test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */
test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */
+ test_attr_info_null_info_pointer(my_fcpl, my_fapl); /* Test passing a NULL attribute info pointer to H5Aget_info(_by_name/_by_idx) */
/* Attribute creation order tests */
test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */
@@ -10919,6 +10983,7 @@ test_attr(void)
test_attr_null_space(fcpl, my_fapl); /* Test storing attribute with NULL dataspace */
test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */
test_attr_many(new_format, fcpl, my_fapl); /* Test storing lots of attributes */
+ test_attr_info_null_info_pointer(fcpl, my_fapl); /* Test passing a NULL attribute info pointer to H5Aget_info(_by_name/_by_idx) */
/* New attribute API routine tests, on old-format storage */
test_attr_info_by_idx(new_format, fcpl, my_fapl); /* Test querying attribute info by index */
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 68d1070..da6195c 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -880,7 +880,7 @@ static void test_write_same_element(void)
fspace = H5Screate_simple(SPACE1_RANK, fdim, NULL);
CHECK(fspace, FAIL, "H5Screate_simple");
- dataset1 = H5Dcreate(file1, DATASET, dtype, fspace, H5P_DEFAULT,
+ dataset1 = H5Dcreate2(file1, DATASET, dtype, fspace, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset1, FAIL, "H5Dcreate");
@@ -905,7 +905,7 @@ static void test_write_same_element(void)
file1 = H5Fopen(DATAFILE3, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(file1, FAIL, "H5Fopen");
- dataset1 = H5Dopen(file1, DATASET, H5P_DEFAULT);
+ dataset1 = H5Dopen2(file1, DATASET, H5P_DEFAULT);
CHECK(dataset1, FAIL, "H5Dopen");
fspace = H5Dget_space(dataset1);