Skip to content

Commit

Permalink
Brings recent changes from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins committed May 27, 2021
1 parent e88b939 commit d511582
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 43 deletions.
35 changes: 30 additions & 5 deletions src/H5E.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ static H5E_t * H5E__get_current_stack(void);
static herr_t H5E__set_current_stack(H5E_t *estack);
static herr_t H5E__close_stack(H5E_t *err_stack, void **request);
static ssize_t H5E__get_num(const H5E_t *err_stack);
static herr_t H5E__print2(hid_t err_stack, FILE *stream);
static herr_t H5E__append_stack(H5E_t *dst_estack, const H5E_t *src_stack);

/*********************/
Expand Down Expand Up @@ -326,10 +327,10 @@ H5E__set_default_auto(H5E_t *stk)
#endif /* H5_USE_16_API_DEFAULT */

stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1;
stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2;
stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5E__print2;
stk->auto_op.is_default = TRUE;
#else /* H5_NO_DEPRECATED_SYMBOLS */
stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2;
stk->auto_op.func2 = (H5E_auto2_t)H5E__print2;
#endif /* H5_NO_DEPRECATED_SYMBOLS */

stk->auto_data = NULL;
Expand Down Expand Up @@ -1447,13 +1448,37 @@ H5Eclear2(hid_t err_stack)
herr_t
H5Eprint2(hid_t err_stack, FILE *stream)
{
H5E_t *estack; /* Error stack to operate on */
herr_t ret_value = SUCCEED; /* Return value */

/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/

/* Print error stack */
if ((ret_value = H5E__print2(err_stack, stream)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")

done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eprint2() */

/*-------------------------------------------------------------------------
* Function: H5E__print2
*
* Purpose: Internal helper routine for H5Eprint2.
*
* Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
static herr_t
H5E__print2(hid_t err_stack, FILE *stream)
{
H5E_t *estack; /* Error stack to operate on */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_STATIC

/* Need to check for errors */
if (err_stack == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
Expand All @@ -1473,8 +1498,8 @@ H5Eprint2(hid_t err_stack, FILE *stream)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")

done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eprint2() */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__print2() */

/*-------------------------------------------------------------------------
* Function: H5Ewalk2
Expand Down
20 changes: 1 addition & 19 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,6 @@ set (ttsafe_SOURCES
${HDF5_TEST_SOURCE_DIR}/ttsafe_attr_vlen.c
)

set (event_set_SOURCES
${HDF5_TEST_SOURCE_DIR}/event_set.c
)

set (H5_TESTS
testhdf5 # multiple source
cache
Expand Down Expand Up @@ -357,7 +353,7 @@ set (H5_TESTS
vol
timer
cmpd_dtransform
event_set # multiple source
event_set
vfd_swmr
)

Expand Down Expand Up @@ -390,7 +386,6 @@ set (H5_TESTS_MULTIPLE
ttsafe
thread_id # special link
mirror_vfd
event_set
)
# Only build single source tests here
foreach (h5_test ${H5_TESTS})
Expand Down Expand Up @@ -554,19 +549,6 @@ if (HDF5_ENABLE_FORMATTERS)
clang_format (HDF5_TEST_mirror_vfd_FORMAT mirror_vfd)
endif ()

#-- Adding test for event_set
add_executable (event_set ${event_set_SOURCES})
target_compile_options(event_set PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_include_directories (event_set PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (event_set STATIC)
target_link_libraries (event_set PRIVATE ${HDF5_TEST_LIB_TARGET})
else ()
TARGET_C_PROPERTIES (event_set SHARED)
target_link_libraries (event_set PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
set_target_properties (event_set PROPERTIES FOLDER test)

#-----------------------------------------------------------------------------
# Add Target to clang-format
#-----------------------------------------------------------------------------
Expand Down
9 changes: 1 addition & 8 deletions test/CMakeTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,6 @@ set (test_CLEANFILES
tvlstr.h5
tvlstr2.h5
twriteorder.dat
flush.h5
flush-swmr.h5
noflush.h5
noflush-swmr.h5
flush_extend.h5
flush_extend-swmr.h5
noflush_extend.h5
noflush_extend-swmr.h5
enum1.h5
titerate.h5
ttsafe.h5
Expand Down Expand Up @@ -640,6 +632,7 @@ else ()
)
endif ()
set_tests_properties (H5TEST-flush2 PROPERTIES
FIXTURES_REQUIRED clear_flush
DEPENDS H5TEST-flush1
)

Expand Down
1 change: 0 additions & 1 deletion test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \
ttsafe_acreate.c ttsafe_attr_vlen.c
cache_image_SOURCES=cache_image.c genall5.c
mirror_vfd_SOURCES=mirror_vfd.c genall5.c
event_set_SOURCES=event_set.c

vfd_swmr_zoo_writer_SOURCES=vfd_swmr_zoo_writer.c genall5.c
vfd_swmr_zoo_reader_SOURCES=vfd_swmr_zoo_writer.c genall5.c
Expand Down
16 changes: 7 additions & 9 deletions test/err_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,14 @@ test_error_compat(void)
if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;

/* Use H5Eget_auto2 to query the default printing function. The library
*should indicate H5Eprint2 as the default. */
/* Use H5Eget_auto2 to query the default printing function. */
if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data) < 0)
TEST_ERROR;
if (old_data != NULL)
TEST_ERROR;
if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
if (old_func2 == NULL)
TEST_ERROR;

/* This function sets the default printing function to be H5Eprint2. */
if (H5Eset_auto2(H5E_DEFAULT, old_func2, old_data) < 0)
TEST_ERROR;

Expand Down Expand Up @@ -282,12 +280,12 @@ test_error_compat(void)
if (did >= 0)
TEST_ERROR;

/* This function changes the new-style printing function back to the default H5Eprint2. */
if (H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL) < 0)
/* This function changes the new-style printing function to the original. */
if (H5Eset_auto2(H5E_DEFAULT, old_func2, NULL) < 0)
TEST_ERROR;

/* This call should work because the H5Eset_auto2 above restored the default printing
* function H5Eprint2. It simply returns user_print1. */
/* This call should work because the H5Eset_auto2 above set the default printing
* function to H5Eprint2. It simply returns user_print1. */
if ((ret = H5Eget_auto1(&old_func1, &old_data)) < 0)
TEST_ERROR;
if (old_data != NULL)
Expand All @@ -305,7 +303,7 @@ test_error_compat(void)
TEST_ERROR;
if (old_data != NULL)
TEST_ERROR;
if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
if (old_func2 == NULL)
TEST_ERROR;

/* Try the printing function. Dataset creation should fail because the file
Expand Down
2 changes: 1 addition & 1 deletion test/error_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ test_error(hid_t file)
TEST_ERROR;
if (old_data != NULL)
TEST_ERROR;
if (old_func != (H5E_auto2_t)H5Eprint2)
if (old_func == NULL)
TEST_ERROR;

if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
Expand Down

0 comments on commit d511582

Please sign in to comment.