mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
Fix release check version logic (#1438)
This commit is contained in:
parent
758e97c1e5
commit
2db4c770f8
19
src/H5.c
19
src/H5.c
@ -70,9 +70,9 @@ static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *fla
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/* Library incompatible release versions */
|
||||
const unsigned VERS_RELEASE_EXCEPTIONS[] = {0};
|
||||
const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 0;
|
||||
/* Library incompatible release versions, develop releases are incompatible by design */
|
||||
const unsigned VERS_RELEASE_EXCEPTIONS[] = {0, 1};
|
||||
const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 2;
|
||||
|
||||
/* statically initialize block for pthread_once call used in initializing */
|
||||
/* the first global mutex */
|
||||
@ -954,6 +954,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
static int checked = 0; /* If we've already checked the version info */
|
||||
static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */
|
||||
static const char * version_mismatch_warning = VERSION_MISMATCH_WARNING;
|
||||
static const char * release_mismatch_warning = RELEASE_MISMATCH_WARNING;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API_NOINIT_NOERR_NOFS
|
||||
@ -974,10 +975,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
}
|
||||
|
||||
/* H5_VERS_MAJOR and H5_VERS_MINOR must match */
|
||||
/* Cast relnum to int to avoid warning for unsigned < 0 comparison
|
||||
* in first release versions */
|
||||
if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > (int)relnum) {
|
||||
|
||||
if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum) {
|
||||
switch (disable_version_check) {
|
||||
case 0:
|
||||
HDfprintf(stderr, "%s%s", version_mismatch_warning,
|
||||
@ -1012,9 +1010,10 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
} /* end if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > relnum) */
|
||||
} /* end if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum) */
|
||||
|
||||
/* H5_VERS_RELEASE should be compatible, we will only add checks for exceptions */
|
||||
/* Library develop release versions are incompatible by design */
|
||||
if (H5_VERS_RELEASE != relnum) {
|
||||
for (unsigned i = 0; i < VERS_RELEASE_EXCEPTIONS_SIZE; i++) {
|
||||
/* Check for incompatible headers or incompatible library */
|
||||
@ -1022,7 +1021,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
switch (disable_version_check) {
|
||||
case 0:
|
||||
HDfprintf(
|
||||
stderr, "%s%s", version_mismatch_warning,
|
||||
stderr, "%s%s", release_mismatch_warning,
|
||||
"You can, at your own risk, disable this warning by setting the environment\n"
|
||||
"variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n"
|
||||
"Setting it to 2 or higher will suppress the warning messages totally.\n");
|
||||
@ -1041,7 +1040,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
"%s'HDF5_DISABLE_VERSION_CHECK' "
|
||||
"environment variable is set to %d, application will\n"
|
||||
"continue at your own risk.\n",
|
||||
version_mismatch_warning, disable_version_check);
|
||||
release_mismatch_warning, disable_version_check);
|
||||
/* Mention the versions we are referring to */
|
||||
HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum,
|
||||
relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR,
|
||||
|
@ -649,10 +649,11 @@ set_tests_properties (H5TEST-tcheck_version-minor PROPERTIES
|
||||
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
|
||||
WILL_FAIL "true"
|
||||
)
|
||||
# release + 1 should pass
|
||||
# release + 1 should pass on non-develop branches
|
||||
add_test (NAME H5TEST-tcheck_version-release COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:tcheck_version> "-tr")
|
||||
set_tests_properties (H5TEST-tcheck_version-release PROPERTIES
|
||||
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
|
||||
WILL_FAIL "true"
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user