summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-05-03 21:55:26 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-05-03 21:55:26 (GMT)
commit0ab5dd5e8ea2342ef039f0f79bd76e4ab187dddf (patch)
tree6900490d46d768f991e7cc91d45d4f8dc17985a4 /test
parentfca509b7d61b9dffae85be3406ca484c1bf28242 (diff)
downloadhdf5-0ab5dd5e8ea2342ef039f0f79bd76e4ab187dddf.zip
hdf5-0ab5dd5e8ea2342ef039f0f79bd76e4ab187dddf.tar.gz
hdf5-0ab5dd5e8ea2342ef039f0f79bd76e4ab187dddf.tar.bz2
Brings more develop code over, especially Doxygen
Diffstat (limited to 'test')
-rw-r--r--test/cache_logging.c22
-rw-r--r--test/hdfs.c154
-rw-r--r--test/testhdf5.c2
-rw-r--r--test/tfile.c12
-rw-r--r--test/tgenprop.c2
-rw-r--r--test/th5o.c2
-rw-r--r--test/th5s.c36
-rw-r--r--test/theap.c2
-rw-r--r--test/tid.c4
-rw-r--r--test/timer.c9
-rw-r--r--test/titerate.c23
-rw-r--r--test/tmisc.c39
12 files changed, 181 insertions, 126 deletions
diff --git a/test/cache_logging.c b/test/cache_logging.c
index 448e12b..12f3d96 100644
--- a/test/cache_logging.c
+++ b/test/cache_logging.c
@@ -16,7 +16,8 @@
#include "h5test.h"
#define LOG_LOCATION "cache_logging.out"
-#define FILE_NAME "cache_logging"
+
+const char *FILENAME[] = {"cache_logging", NULL};
#define N_GROUPS 100
@@ -50,7 +51,7 @@ test_logging_api(void)
TESTING("metadata cache log api calls");
fapl = h5_fileaccess();
- h5_fixname(FILE_NAME, fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Set up metadata cache logging */
is_enabled = TRUE;
@@ -58,6 +59,12 @@ test_logging_api(void)
if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
TEST_ERROR;
+ /* Ensure that setting the property twice doesn't cause problems
+ * (addresses a previous bug).
+ */
+ if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
+ TEST_ERROR;
+
/* Check to make sure that the property list getter returns the correct
* location string buffer size;
*/
@@ -84,8 +91,6 @@ test_logging_api(void)
TEST_ERROR;
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if (H5Pclose(fapl) < 0)
- TEST_ERROR;
/* Check to see if the logging flags were set correctly */
is_enabled = FALSE;
@@ -127,10 +132,19 @@ test_logging_api(void)
if (H5Fclose(fid) < 0)
TEST_ERROR;
+ HDremove(LOG_LOCATION);
+ h5_clean_files(FILENAME, fapl);
+
PASSED();
return 0;
error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl);
+ }
+ H5E_END_TRY
+
return 1;
} /* test_logging_api() */
diff --git a/test/hdfs.c b/test/hdfs.c
index 7a41b57..dfaa585 100644
--- a/test/hdfs.c
+++ b/test/hdfs.c
@@ -19,7 +19,7 @@
*
* Demonstrates basic use cases and fapl interaction.
*
- * Programmer: Jacob Smith <jake.smith@hdfgroup.org>
+ * Programmer: Jacob Smith
* 2018-04-23
*/
@@ -29,7 +29,6 @@
#ifdef H5_HAVE_LIBHDFS
#define HDFS_TEST_DEBUG 0
#define HDFS_TEST_MAX_BUF_SIZE 256
-#endif /* H5_HAVE_LIBHDFS */
/*****************************************************************************
*
@@ -231,9 +230,10 @@
*/
#define JSERR_STR(expected, actual, reason) \
{ \
+ const char *_reason = reason; \
JSFAILED_AT() \
- if ((reason) != NULL) { \
- HDprintf("%s\n", (reason)); \
+ if (_reason != NULL) { \
+ HDprintf("%s\n", _reason); \
} \
else { \
HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \
@@ -303,7 +303,7 @@
*----------------------------------------------------------------------------
*/
#define JSVERIFY_STR(expected, actual, reason) \
- if (strcmp((actual), (expected)) != 0) { \
+ if (HDstrcmp((actual), (expected)) != 0) { \
JSERR_STR((expected), (actual), (reason)); \
goto error; \
} /* JSVERIFY_STR */
@@ -348,7 +348,7 @@
*----------------------------------------------------------------------------
*/
#define JSVERIFY_STR(actual, expected, reason) \
- if (strcmp((actual), (expected)) != 0) { \
+ if (HDstrcmp((actual), (expected)) != 0) { \
JSERR_STR((expected), (actual), (reason)); \
goto error; \
} /* JSVERIFY_STR */
@@ -359,11 +359,8 @@
* OTHER MACROS AND DEFINITIONS *
********************************/
-/* copied from src/hdfs.c
- */
-#ifdef H5_HAVE_LIBHDFS
+/* copied from src/hdfs.c */
#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1)
-#endif /* H5_HAVE_LIBHDFS */
#define HDFS_NAMENODE_NAME_MAX_SIZE 128
@@ -371,12 +368,10 @@
* FILE-LOCAL GLOBAL VARIABLES *
*******************************/
-#ifdef H5_HAVE_LIBHDFS
static const char filename_missing[] = "/tmp/missing.txt";
static const char filename_bard[] = "/tmp/t8.shakespeare.txt";
static const char filename_raven[] = "/tmp/Poe_Raven.txt";
static const char filename_example_h5[] = "/tmp/t.h5";
-#endif /* H5_HAVE_LIBHDFS */
static H5FD_hdfs_fapl_t default_fa = {
1, /* fa version */
@@ -386,6 +381,7 @@ static H5FD_hdfs_fapl_t default_fa = {
"", /* kerberos path */
1024, /* buffer size */
};
+#endif /* H5_HAVE_LIBHDFS */
/******************
* TEST FUNCTIONS *
@@ -415,6 +411,14 @@ static H5FD_hdfs_fapl_t default_fa = {
static int
test_fapl_config_validation(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS fapl configuration validation");
+ SKIPPED();
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
+ return 0;
+
+#else
/*********************
* test-local macros *
*********************/
@@ -560,9 +564,10 @@ test_fapl_config_validation(void)
JSVERIFY(config.version, fa_fetch.version, "version number mismatch")
JSVERIFY(config.namenode_port, fa_fetch.namenode_port, "namenode port mismatch")
JSVERIFY(config.stream_buffer_size, fa_fetch.stream_buffer_size, "streambuffer size mismatch")
- JSVERIFY_STR(config.namenode_name, fa_fetch.namenode_name, NULL)
- JSVERIFY_STR(config.user_name, fa_fetch.user_name, NULL)
- JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache, NULL)
+ JSVERIFY_STR(config.namenode_name, fa_fetch.namenode_name, "node name mismatch")
+ JSVERIFY_STR(config.user_name, fa_fetch.user_name, "user name mismatch")
+ JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache,
+ "kerberos ticket cache mismatch")
}
/*-----------------------------
@@ -590,6 +595,7 @@ error:
H5E_END_TRY;
}
return 1;
+#endif /* H5_HAVE_LIBHDFS */
} /* end test_fapl_config_validation() */
@@ -615,14 +621,22 @@ error:
static int
test_hdfs_fapl(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS fapl ");
+ SKIPPED();
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
+ return 0;
+
+#else
/************************
* test-local variables *
************************/
- hid_t fapl_id = -1; /* file access property list ID */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- H5FD_hdfs_fapl_t hdfs_fa_0 = {
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ H5FD_hdfs_fapl_t hdfs_fa_0 = {
1, /* version*/
"", /* node name */
9000, /* node port */
@@ -667,6 +681,7 @@ error:
H5E_END_TRY;
return 1;
+#endif /* H5_HAVE_LIBHDFS */
} /* end test_hdfs_fapl() */
@@ -695,8 +710,8 @@ test_vfd_open(void)
#ifndef H5_HAVE_LIBHDFS
TESTING("HDFS VFD-level open");
SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
return 0;
#else
@@ -717,10 +732,10 @@ test_vfd_open(void)
struct test_condition {
const char *message;
const char *url;
- unsigned flags;
- int which_fapl;
- haddr_t maxaddr;
- hbool_t might_use_other_driver;
+ unsigned flags;
+ int which_fapl;
+ haddr_t maxaddr;
+ hbool_t might_use_other_driver;
};
/************************
@@ -809,11 +824,11 @@ test_vfd_open(void)
FALSE,
},
};
- unsigned i = 0;
+ unsigned i = 0;
unsigned failing_conditions_count = 10;
- H5FD_t * fd = NULL;
- hid_t fapl_hdfs = -1;
- hid_t fapl_unconfigured = -1;
+ H5FD_t *fd = NULL;
+ hid_t fapl_hdfs = -1;
+ hid_t fapl_unconfigured = -1;
TESTING("HDFS VFD-level open");
@@ -831,8 +846,8 @@ test_vfd_open(void)
/* all the test cases that will _not_ open
*/
for (i = 0; i < failing_conditions_count; i++) {
- struct test_condition T = failing_conditions[i];
- hid_t fapl_id = H5P_DEFAULT;
+ struct test_condition T = failing_conditions[i];
+ hid_t fapl_id = H5P_DEFAULT;
fd = NULL;
@@ -951,8 +966,8 @@ test_eof_eoa(void)
#ifndef H5_HAVE_LIBHDFS
TESTING("HDFS eof/eoa gets and sets");
SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
return 0;
#else
@@ -970,7 +985,7 @@ test_eof_eoa(void)
************************/
H5FD_t *fd_shakespeare = NULL;
- hid_t fapl_id = -1;
+ hid_t fapl_id = -1;
TESTING("HDFS eof/eoa gets and sets");
@@ -991,7 +1006,7 @@ test_eof_eoa(void)
/* verify as found
*/
- JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL)
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EOF mismatch")
JSVERIFY(H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
"mismatch between DEFAULT and RAW memory types")
JSVERIFY(0, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA should be unset by H5FDopen")
@@ -1064,16 +1079,16 @@ test_H5FDread_without_eoa_set_fails(void)
#ifndef H5_HAVE_LIBHDFS
TESTING("HDFS VFD read-eoa temporal coupling library limitation");
SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
return 0;
#else
- char buffer[HDFS_TEST_MAX_BUF_SIZE];
- unsigned int i = 0;
- H5FD_t * file_shakespeare = NULL;
- hid_t fapl_id = -1;
+ char buffer[HDFS_TEST_MAX_BUF_SIZE];
+ unsigned int i = 0;
+ H5FD_t *file_shakespeare = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS VFD read-eoa temporal coupling library limitation");
@@ -1166,8 +1181,8 @@ test_read(void)
#ifndef H5_HAVE_LIBHDFS
TESTING("HDFS VFD read/range-gets");
SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
return 0;
#else
@@ -1181,10 +1196,10 @@ test_read(void)
*************************/
struct testcase {
const char *message; /* purpose of test case */
- haddr_t eoa_set; /* set file EOA to this prior to read */
- size_t addr; /* offset of read in file */
- size_t len; /* length of read in file */
- herr_t success; /* expected return value of read function */
+ haddr_t eoa_set; /* set file EOA to this prior to read */
+ size_t addr; /* offset of read in file */
+ size_t len; /* length of read in file */
+ herr_t success; /* expected return value of read function */
const char *expected; /* expected contents of buffer; failure ignores */
};
@@ -1241,14 +1256,14 @@ test_read(void)
NULL,
},
};
- unsigned testcase_count = 6;
- unsigned test_i = 0;
+ unsigned testcase_count = 6;
+ unsigned test_i = 0;
struct testcase test;
- herr_t open_return = FAIL;
- char buffer[HDFS_TEST_MAX_BUF_SIZE];
- unsigned int i = 0;
- H5FD_t * file_raven = NULL;
- hid_t fapl_id = -1;
+ herr_t open_return = FAIL;
+ char buffer[HDFS_TEST_MAX_BUF_SIZE];
+ unsigned int i = 0;
+ H5FD_t *file_raven = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS VFD read/range-gets");
@@ -1273,7 +1288,7 @@ test_read(void)
HADDR_UNDEF); /* Demonstrate success with "automatic" value */
FAIL_IF(NULL == file_raven)
- JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL)
+ JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), "EOF mismatch")
/*********
* TESTS *
@@ -1285,7 +1300,7 @@ test_read(void)
* per-test setup *
* -------------- */
- test = cases[test_i];
+ test = cases[test_i];
open_return = FAIL;
FAIL_IF(HDFS_TEST_MAX_BUF_SIZE < test.len) /* buffer too small! */
@@ -1380,8 +1395,8 @@ test_noops_and_autofails(void)
#ifndef H5_HAVE_LIBHDFS
TESTING("HDFS VFD always-fail and no-op routines");
SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
return 0;
#else
@@ -1398,8 +1413,8 @@ test_noops_and_autofails(void)
* test-local variables *
************************/
- hid_t fapl_id = -1;
- H5FD_t * file = NULL;
+ hid_t fapl_id = -1;
+ H5FD_t *file = NULL;
const char data[36] = "The Force shall be with you, always";
TESTING("HDFS VFD always-fail and no-op routines");
@@ -1433,15 +1448,6 @@ test_noops_and_autofails(void)
H5E_BEGIN_TRY{
JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY;
- /* no-op calls to `lock()` and `unlock()`
- */
- JSVERIFY(SUCCEED, H5FDlock(file, TRUE), "lock always succeeds; has no effect")
- JSVERIFY(SUCCEED, H5FDlock(file, FALSE), NULL)
- JSVERIFY(SUCCEED, H5FDunlock(file), NULL)
- /* Lock/unlock with null file or similar error crashes tests.
- * HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()`
- */
-
/************
* TEARDOWN *
************/
@@ -1535,8 +1541,8 @@ test_H5F_integration(void)
#ifndef H5_HAVE_LIBHDFS
TESTING("HDFS file access through HD5F library (H5F API)");
SKIPPED();
- puts(" HDFS VFD is not enabled");
- fflush(stdout);
+ HDputs(" HDFS VFD is not enabled");
+ HDfflush(stdout);
return 0;
#else
@@ -1553,7 +1559,7 @@ test_H5F_integration(void)
* test-local variables *
************************/
- hid_t file = -1;
+ hid_t file = -1;
hid_t fapl_id = -1;
TESTING("HDFS file access through HD5F library (H5F API)");
@@ -1604,7 +1610,7 @@ error:
#if HDFS_TEST_DEBUG
HDprintf("\nerror!");
- fflush(stdout);
+ HDfflush(stdout);
#endif /* HDFS_TEST_DEBUG */
if (fapl_id >= 0) {
@@ -1647,6 +1653,7 @@ main(void)
* commence tests *
******************/
+#ifdef H5_HAVE_LIBHDFS
static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = "";
const char *hdfs_namenode_name_env = NULL;
@@ -1658,6 +1665,7 @@ main(void)
HDstrncpy(/* TODO: error-check? */
default_fa.namenode_name, hdfs_namenode_name_env, HDFS_NAMENODE_NAME_MAX_SIZE);
}
+#endif /* H5_HAVE_LIBHDFS */
h5_reset();
diff --git a/test/testhdf5.c b/test/testhdf5.c
index e5897b5..5e413f3 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
TestSummary();
/* Clean up test files, if allowed */
- if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
+ if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP"))
TestCleanup();
/* Release test infrastructure */
diff --git a/test/tfile.c b/test/tfile.c
index a56498b..e22e730 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -3955,7 +3955,7 @@ test_filespace_info(const char *env_h5_drvr)
MESSAGE(5, ("Testing file creation public routines: H5Pget/set_file_space_strategy & "
"H5Pget/set_file_space_page_size\n"));
- contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0);
fapl = h5_fileaccess();
h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
@@ -5312,7 +5312,12 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F
group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate");
+ //! [H5Oget_native_info_snip]
+
ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR);
+
+ //! [H5Oget_native_info_snip]
+
CHECK(ret, FAIL, "H5Oget_native)info");
VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info");
@@ -5333,10 +5338,15 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
+ //! [H5Oget_native_info_by_name_snip]
+
/*
* Make sure the root group still has the correct object header version
*/
ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+
+ //! [H5Oget_native_info_by_name_snip]
+
CHECK(ret, FAIL, "H5Oget_native_info_by_name");
VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name");
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 4e78739..7e805e2 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -2172,5 +2172,5 @@ test_genprop(void)
void
cleanup_genprop(void)
{
- remove(FILENAME);
+ HDremove(FILENAME);
}
diff --git a/test/th5o.c b/test/th5o.c
index b2d0357..ebb6c6e 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -1806,5 +1806,5 @@ test_h5o(void)
void
cleanup_h5o(void)
{
- remove(TEST_FILENAME);
+ HDremove(TEST_FILENAME);
}
diff --git a/test/th5s.c b/test/th5s.c
index d784dda..30c3396 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -1246,7 +1246,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
if (sbuf_size > 0) {
sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size);
- CHECK(sbuf, NULL, "HDcalloc");
+ CHECK_PTR(sbuf, "HDcalloc");
}
/* Try decoding bogus buffer */
@@ -1308,7 +1308,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
if (null_size > 0) {
null_sbuf = (unsigned char *)HDcalloc((size_t)1, null_size);
- CHECK(null_sbuf, NULL, "HDcalloc");
+ CHECK_PTR(null_sbuf, "HDcalloc");
}
/* Encode the null dataspace in the buffer */
@@ -1344,7 +1344,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
if (scalar_size > 0) {
scalar_buf = (unsigned char *)HDcalloc((size_t)1, scalar_size);
- CHECK(scalar_buf, NULL, "HDcalloc");
+ CHECK_PTR(scalar_buf, "HDcalloc");
}
/* Encode the scalar dataspace in the buffer */
@@ -1438,7 +1438,7 @@ test_h5s_encode1(void)
if (sbuf_size > 0) {
sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size);
- CHECK(sbuf, NULL, "HDcalloc");
+ CHECK_PTR(sbuf, "HDcalloc");
}
/* Try decoding bogus buffer */
@@ -1500,7 +1500,7 @@ test_h5s_encode1(void)
if (null_size > 0) {
null_sbuf = (unsigned char *)HDcalloc((size_t)1, null_size);
- CHECK(null_sbuf, NULL, "HDcalloc");
+ CHECK_PTR(null_sbuf, "HDcalloc");
}
/* Encode the null dataspace in the buffer */
@@ -1536,7 +1536,7 @@ test_h5s_encode1(void)
if (scalar_size > 0) {
scalar_buf = (unsigned char *)HDcalloc((size_t)1, scalar_size);
- CHECK(scalar_buf, NULL, "HDcalloc");
+ CHECK_PTR(scalar_buf, "HDcalloc");
}
/* Encode the scalar dataspace in the buffer */
@@ -1623,7 +1623,7 @@ test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, uint32_t expected_version,
/* Allocate the buffer for encoding */
buf = (char *)HDmalloc(buf_size);
- CHECK(buf, NULL, "H5Dmalloc");
+ CHECK_PTR(buf, "H5Dmalloc");
/* Encode according to the setting in in_fapl */
ret = H5Sencode2(in_sid, buf, &buf_size, in_fapl);
@@ -1984,7 +1984,7 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
break;
default:
- assert(0);
+ HDassert(0);
break;
}
@@ -2149,7 +2149,7 @@ test_h5s_encode_length(void)
/* Allocate the buffer */
if (sbuf_size > 0) {
sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size);
- CHECK(sbuf, NULL, "H5Sencode2");
+ CHECK_PTR(sbuf, "H5Sencode2");
}
/* Encode the dataspace */
@@ -2449,7 +2449,7 @@ test_h5s_compound_scalar_read(void)
ret = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct))) {
+ if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) {
HDprintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", space4_data.c1, rdata.c1);
HDprintf("scalar data different: space4_data.u=%u, read_data4.u=%u\n", space4_data.u, rdata.u);
HDprintf("scalar data different: space4_data.f=%f, read_data4.f=%f\n", (double)space4_data.f,
@@ -3304,7 +3304,7 @@ test_versionbounds(void)
/* Its version should be H5O_SDSPACE_VERSION_1 */
spacep = (H5S_t *)H5I_object(space);
- CHECK(spacep, NULL, "H5I_object");
+ CHECK_PTR(spacep, "H5I_object");
VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound");
/* Set high bound to V18 */
@@ -3325,7 +3325,7 @@ test_versionbounds(void)
dset_space = H5Dget_space(dset);
CHECK(dset_space, FAIL, "H5Dget_space");
spacep = (H5S_t *)H5I_object(dset_space);
- CHECK(spacep, NULL, "H5I_object");
+ CHECK_PTR(spacep, "H5I_object");
/* Dataspace version should remain as H5O_SDSPACE_VERSION_1 */
VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound");
@@ -3362,7 +3362,7 @@ test_versionbounds(void)
dset_space = H5Dget_space(dset);
CHECK(dset_space, FAIL, "H5Dget_space");
spacep = (H5S_t *)H5I_object(dset_space);
- CHECK(spacep, NULL, "H5I_object");
+ CHECK_PTR(spacep, "H5I_object");
/* Verify the dataspace version */
VERIFY(spacep->extent.version, H5O_sdspace_ver_bounds[low], "upgraded dataspace version");
@@ -3451,9 +3451,9 @@ test_h5s(void)
void
cleanup_h5s(void)
{
- remove(DATAFILE);
- remove(NULLFILE);
- remove(BASICFILE);
- remove(ZEROFILE);
- remove(VERBFNAME);
+ HDremove(DATAFILE);
+ HDremove(NULLFILE);
+ HDremove(BASICFILE);
+ HDremove(ZEROFILE);
+ HDremove(VERBFNAME);
}
diff --git a/test/theap.c b/test/theap.c
index f8a6e9b..9d5787b 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -1050,7 +1050,7 @@ test_heap_term(void)
HDfree(inc_sort_num);
if (dec_sort_num)
HDfree(dec_sort_num);
-} /* end test_tst_term() */
+} /* end test_heap_term() */
/****************************************************************
**
diff --git a/test/tid.c b/test/tid.c
index 490b536..0c7c4ab 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -20,7 +20,7 @@
#include "H5Ipkg.h"
static herr_t
-free_wrapper(void *p)
+free_wrapper(void *p, void H5_ATTR_UNUSED **_ctx)
{
HDfree(p);
return SUCCEED;
@@ -513,7 +513,7 @@ test_id_type_list(void)
/* Sanity check */
if ((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) {
/* Error condition, throw an error */
- CHECK(1, 1, "H5Iregister_type");
+ ERROR("H5Iregister_type");
goto out;
}
/* Create types up to H5I_MAX_NUM_TYPES */
diff --git a/test/timer.c b/test/timer.c
index e907655..24f3245 100644
--- a/test/timer.c
+++ b/test/timer.c
@@ -146,7 +146,7 @@ test_timer_system_user(void)
*/
if (timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) {
SKIPPED();
- printf("NOTE: No suitable way to get system/user times on this platform.\n");
+ HDprintf("NOTE: No suitable way to get system/user times on this platform.\n");
return 0;
}
@@ -383,7 +383,7 @@ main(void)
h5_reset();
- printf("Testing platform-independent timer functionality.\n");
+ HDprintf("Testing platform-independent timer functionality.\n");
nerrors += test_time_formatting() < 0 ? 1 : 0;
nerrors += test_timer_system_user() < 0 ? 1 : 0;
@@ -391,11 +391,12 @@ main(void)
nerrors += test_timer_functionality() < 0 ? 1 : 0;
if (nerrors) {
- printf("***** %d platform-independent timer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
+ HDprintf("***** %d platform-independent timer TEST%s FAILED! *****\n", nerrors,
+ nerrors > 1 ? "S" : "");
return 1;
}
else {
- printf("All platform-independent timer tests passed.\n");
+ HDprintf("All platform-independent timer tests passed.\n");
return 0;
}
}
diff --git a/test/titerate.c b/test/titerate.c
index e9ee5a7..10ed039 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -53,8 +53,8 @@ typedef struct {
#define CORRUPTED_ATNAMELEN_FILE "memleak_H5O_dtype_decode_helper_H5Odtype.h5"
#define DSET_NAME "image"
typedef struct searched_err_t {
- char message[256];
- bool found;
+ char message[256];
+ hbool_t found;
} searched_err_t;
/* Call back function for test_corrupted_attnamelen */
@@ -218,9 +218,14 @@ test_iter_group(hid_t fapl, hbool_t new_format)
dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
+ //! [H5Oget_info_by_idx3_snip]
+
ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx");
+
+ //! [H5Oget_info_by_idx3_snip]
+
} /* end for */
H5E_BEGIN_TRY
@@ -580,7 +585,7 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link
H5O_info2_t oinfo;
herr_t ret; /* Generic return value */
- if (HDstrcmp(name, test_info->name)) {
+ if (HDstrcmp(name, test_info->name) != 0) {
TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name);
return (H5_ITER_ERROR);
} /* end if */
@@ -947,7 +952,7 @@ test_links(hid_t fapl)
else if (!HDstrcmp(obj_name, "softlink"))
VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx");
else
- CHECK(0, 0, "unknown object name");
+ ERROR("unknown object name");
} /* end for */
ret = H5Gclose(gid);
@@ -981,8 +986,8 @@ find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_
return H5_ITER_ERROR;
/* If the searched error message is found, stop the iteration */
- if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) {
- searched_err->found = true;
+ if (err_desc->desc != NULL && HDstrcmp(err_desc->desc, searched_err->message) == 0) {
+ searched_err->found = TRUE;
status = H5_ITER_STOP;
}
@@ -1028,14 +1033,14 @@ test_corrupted_attnamelen(void)
if (err_status == -1) {
/* Initialize client data */
HDstrcpy(err_caught.message, err_message);
- err_caught.found = false;
+ err_caught.found = FALSE;
/* Look for the correct error message */
ret = H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, find_err_msg_cb, &err_caught);
CHECK(ret, FAIL, "H5Ewalk2");
/* Fail if the indicated message is not found */
- CHECK(err_caught.found, false, "test_corrupted_attnamelen: Expected error not found");
+ CHECK(err_caught.found, FALSE, "test_corrupted_attnamelen: Expected error not found");
}
/* Close the dataset and file */
@@ -1117,7 +1122,7 @@ test_links_deprec(hid_t fapl)
else if (!HDstrcmp(obj_name, "softlink"))
VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx");
else
- CHECK(0, 0, "unknown object name");
+ ERROR("unknown object name");
} /* end for */
ret = H5Gclose(gid);
diff --git a/test/tmisc.c b/test/tmisc.c
index cec4037..b078eed 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -129,7 +129,6 @@ typedef struct {
#ifndef H5_HAVE_PARALLEL
#define MISC8_DSETNAME2 "Dataset2"
#define MISC8_DSETNAME3 "Dataset3"
-#define MISC8_DSETNAME4 "Dataset4"
#define MISC8_DSETNAME6 "Dataset6"
#define MISC8_DSETNAME7 "Dataset7"
#define MISC8_DSETNAME9 "Dataset9"
@@ -518,7 +517,6 @@ test_misc2_write_attribute(void)
HDfree(string_att1);
HDfree(string_att2);
- return;
}
static void
@@ -564,8 +562,6 @@ test_misc2_read_attribute(const char *filename, const char *att_name)
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-
- return;
}
/****************************************************************
**
@@ -2093,11 +2089,11 @@ test_misc12(void)
CHECK(ret, FAIL, "H5Dread");
for (i = 0; i < MISC12_SPACE1_DIM1; i++)
- if (HDstrcmp(wdata[i], rdata[i]))
+ if (HDstrcmp(wdata[i], rdata[i]) != 0)
TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n", __LINE__, i, wdata[i], i,
rdata[i]);
for (; i < (MISC12_SPACE1_DIM1 + MISC12_APPEND_SIZE); i++)
- if (HDstrcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i]))
+ if (HDstrcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i]) != 0)
TestErrPrintf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n", __LINE__, i - MISC12_SPACE1_DIM1,
wdata1[i - MISC12_SPACE1_DIM1], i, rdata[i]);
@@ -2844,7 +2840,7 @@ test_misc16(void)
if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
TestErrPrintf(
"Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
+ (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
continue;
} /* end if */
if (HDstrcmp(wdata[i], rdata[i]) != 0) {
@@ -2929,7 +2925,7 @@ test_misc17(void)
if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
TestErrPrintf(
"Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
+ (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
continue;
} /* end if */
if (HDstrcmp(wdata[i], rdata[i]) != 0) {
@@ -3617,7 +3613,7 @@ test_misc19(void)
/* Get a VOL class to register */
vol_cls = h5_get_dummy_vol_class();
- CHECK(vol_cls, NULL, "h5_get_dummy_vol_class");
+ CHECK_PTR(vol_cls, "h5_get_dummy_vol_class");
/* Register a VOL connector */
volid = H5VLregister_connector(vol_cls, H5P_DEFAULT);
@@ -4092,9 +4088,31 @@ test_misc23(void)
H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gcreate1");
- tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0);
+ /* Make sure that size_hint values that can't fit into a 32-bit
+ * unsigned integer are rejected. Only necessary on systems where
+ * size_t is a 64-bit type.
+ */
+ if (SIZE_MAX > UINT32_MAX) {
+ H5E_BEGIN_TRY
+ {
+ tmp_id = H5Gcreate1(file_id, "/size_hint_too_large", SIZE_MAX);
+ }
+ H5E_END_TRY;
+ VERIFY(tmp_id, FAIL, "H5Gcreate1");
+ }
+
+ /* Make sure the largest size_hint value works */
+ H5E_BEGIN_TRY
+ {
+ tmp_id = H5Gcreate1(file_id, "/largest_size_hint", UINT32_MAX);
+ }
+ H5E_END_TRY;
CHECK(tmp_id, FAIL, "H5Gcreate1");
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+ tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0);
+ CHECK(tmp_id, FAIL, "H5Gcreate1");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
@@ -4107,7 +4125,6 @@ test_misc23(void)
tmp_id = H5Dcreate1(file_id, "/A/dset", type_id, space_id, create_id);
CHECK(tmp_id, FAIL, "H5Dcreate1");
-
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
#endif /* H5_NO_DEPRECATED_SYMBOLS */