Skip to content

Commit

Permalink
Add error stack suppressions to some hdf5 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF committed Sep 26, 2024
1 parent 049bcd1 commit a01650c
Show file tree
Hide file tree
Showing 27 changed files with 684 additions and 216 deletions.
2 changes: 1 addition & 1 deletion c++/test/h5cpputil.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using std::endl;

#define MESSAGE(V, A) \
do { \
if (HDGetTestVerbosity() > (V)) \
if (GetTestVerbosity() > (V)) \
printf A; \
} while (0)
#define SUBTEST(TEST) \
Expand Down
2 changes: 1 addition & 1 deletion test/cache_tagging.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define H5F_TESTING
#include "H5Fpkg.h"

#include "testhdf5.h"
#include "h5test.h"
#include "cache_common.h"

#include "H5CXprivate.h" /* API Contexts */
Expand Down
2 changes: 1 addition & 1 deletion test/chunk_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define H5D_TESTING /* to use H5D__ functions */
#include "H5Dpkg.h"

#include "testhdf5.h"
#include "h5test.h"
#ifdef H5_HAVE_FILTER_DEFLATE
#include "zlib.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion test/dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define H5Z_FRIEND /*suppress error about including H5Zpkg */

#include "testhdf5.h"
#include "h5test.h"
#include "H5srcdir.h"

#include "H5CXprivate.h" /* API Contexts */
Expand Down
5 changes: 3 additions & 2 deletions test/dtypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Purpose: Tests the datatype interface (H5T)
*/

#include "testhdf5.h"
#include "h5test.h"
#include "H5srcdir.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */

Expand Down Expand Up @@ -9956,7 +9956,8 @@ verify_version(hid_t dtype, H5F_libver_t low, unsigned *highest_version)

/* Get the base datatype of this array type */
base_dtype = H5Tget_super(dtype);
CHECK(base_dtype, FAIL, "H5Tget_super");
if (base_dtype == H5I_INVALID_HID)
TEST_ERROR;

/* Get the base type's internal structure for version */
base_dtypep = (H5T_t *)H5I_object(base_dtype);
Expand Down
3 changes: 0 additions & 3 deletions test/enc_dec_plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ main(void)
"Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string, high_string);
puts(msg);

if (VERBOSE_MED)
printf("Encode/Decode DCPLs\n");

/******* ENCODE/DECODE DCPLS *****/
TESTING("Default DCPL Encoding/Decoding");
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
Expand Down
3 changes: 0 additions & 3 deletions test/enc_dec_plist_cross_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ static int test_plists(const char *filename_prefix);
int
main(void)
{
if (VERBOSE_MED)
printf("Encode/Decode property list endianness\n");

/******* ENCODE/DECODE DCPLS *****/
TESTING("Default DCPL Encoding/Decoding");
if (test_plists("plist_files/def_dcpl_") < 0)
Expand Down
2 changes: 1 addition & 1 deletion test/flushrefresh.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* Includes */
/* ======== */

#include "testhdf5.h"
#include "h5test.h"
#include "H5FDpkg.h" /* File Drivers */

/* ======= */
Expand Down
43 changes: 0 additions & 43 deletions test/h5test.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,6 @@
#include "H5private.h"
#include "H5Eprivate.h"

/*
* Predefined test verbosity levels.
*
* Convention:
*
* The higher the verbosity value, the more information printed.
* So, output for higher verbosity also include output of all lower
* verbosity.
*
* Value Description
* 0 None: No informational message.
* 1 "All tests passed"
* 2 Header of overall test
* 3 Default: header and results of individual test
* 4
* 5 Low: Major category of tests.
* 6
* 7 Medium: Minor category of tests such as functions called.
* 8
* 9 High: Highest level. All information.
*/
#define VERBO_NONE 0 /* None */
#define VERBO_DEF 3 /* Default */
#define VERBO_LO 5 /* Low */
#define VERBO_MED 7 /* Medium */
#define VERBO_HI 9 /* High */

/*
* Verbose queries
* Only None needs an exact match. The rest are at least as much.
*/

/* A macro version of HDGetTestVerbosity(). */
/* Should be used internally by the libtest.a only. */
#define HDGetTestVerbosity() (TestVerbosity_g)

#define VERBOSE_NONE (HDGetTestVerbosity() == VERBO_NONE)
#define VERBOSE_DEF (HDGetTestVerbosity() >= VERBO_DEF)
#define VERBOSE_LO (HDGetTestVerbosity() >= VERBO_LO)
#define VERBOSE_MED (HDGetTestVerbosity() >= VERBO_MED)
#define VERBOSE_HI (HDGetTestVerbosity() >= VERBO_HI)

/*
* This contains the filename prefix specified as command line option for
* the parallel test files.
Expand Down Expand Up @@ -321,7 +279,6 @@ H5TEST_DLL char *getenv_all(MPI_Comm comm, int root, const char *name);
#endif

/* Extern global variables */
H5TEST_DLLVAR int TestVerbosity_g;
H5TEST_DLLVAR size_t n_tests_run_g;
H5TEST_DLLVAR size_t n_tests_passed_g;
H5TEST_DLLVAR size_t n_tests_failed_g;
Expand Down
18 changes: 9 additions & 9 deletions test/objcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Purpose: Test H5Ocopy().
*/

#include "testhdf5.h"
#include "h5test.h"
#include "H5srcdir.h"

#include "H5Iprivate.h"
Expand Down Expand Up @@ -10063,14 +10063,14 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
for (i = 0; i < DIM_SIZE_1; i++) {
buf[i].p = malloc((i + 1) * sizeof(hvl_t));
if (buf[i].p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i);
return 1;
} /* end if */
buf[i].len = i + 1;
for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
tvl->p = malloc((j + 1) * sizeof(unsigned int));
if (tvl->p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return 1;
} /* end if */
tvl->len = j + 1;
Expand Down Expand Up @@ -10260,14 +10260,14 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
for (i = 0; i < DIM_SIZE_1; i++) {
buf[i].p = malloc((i + 1) * sizeof(hvl_t));
if (buf[i].p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i);
TEST_ERROR;
} /* end if */
buf[i].len = i + 1;
for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
tvl->p = malloc((j + 1) * sizeof(unsigned int));
if (tvl->p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
TEST_ERROR;
} /* end if */
tvl->len = j + 1;
Expand Down Expand Up @@ -10452,14 +10452,14 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
for (i = 0; i < DIM_SIZE_1; i++) {
buf[i].p = malloc((i + 1) * sizeof(hvl_t));
if (buf[i].p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i);
TEST_ERROR;
} /* end if */
buf[i].len = i + 1;
for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
tvl->p = malloc((j + 1) * sizeof(unsigned int));
if (tvl->p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
TEST_ERROR;
} /* end if */
tvl->len = j + 1;
Expand Down Expand Up @@ -10693,14 +10693,14 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
for (i = 0; i < DIM_SIZE_1; i++) {
buf[i].p = malloc((i + 1) * sizeof(hvl_t));
if (buf[i].p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i);
TEST_ERROR;
} /* end if */
buf[i].len = i + 1;
for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
tvl->p = malloc((j + 1) * sizeof(unsigned int));
if (tvl->p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
TEST_ERROR;
} /* end if */
tvl->len = j + 1;
Expand Down
2 changes: 1 addition & 1 deletion test/objcopy_ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Purpose: Test H5Ocopy() for references.
*/

#include "testhdf5.h"
#include "h5test.h"

#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
Expand Down
2 changes: 1 addition & 1 deletion test/select_io_dset.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Purpose: Tests selection IO for the dataset interface (H5D)
*/

#include "testhdf5.h"
#include "h5test.h"
#include "H5srcdir.h"

const char *FILENAME[] = {"select_io", /* 0 */
Expand Down
11 changes: 10 additions & 1 deletion test/tattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4009,7 +4009,16 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 2;
snprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT);

if (vol_is_native && low != H5F_LIBVER_LATEST) {
H5E_BEGIN_TRY
{
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT);
}
H5E_END_TRY
}
else
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT);
if (low == H5F_LIBVER_LATEST) {
CHECK(attr, FAIL, "H5Acreate2");

Expand Down
Loading

0 comments on commit a01650c

Please sign in to comment.