Add changes to test functions for checking spack versions of hdf5 with (#29159)
develop in the version string. The versions from the HDF5 code were not matching because 'develop-' is not part of the HDF5 version. Also, the develop-x.x versions in spack omit the release version (third) number because the branch spans all of the release versions.
This commit is contained in:
parent
8c59736ff9
commit
1250fac467
@ -476,7 +476,25 @@ def _check_install(self):
|
|||||||
print("Checking HDF5 installation...")
|
print("Checking HDF5 installation...")
|
||||||
checkdir = "spack-check"
|
checkdir = "spack-check"
|
||||||
with working_dir(checkdir, create=True):
|
with working_dir(checkdir, create=True):
|
||||||
source = r"""
|
# Because the release number in a develop branch is not fixed,
|
||||||
|
# only the major and minor version numbers are compared.
|
||||||
|
# Otherwise all 3 numbers are checked.
|
||||||
|
if 'develop' in str(spec.version.up_to(3)):
|
||||||
|
source = r"""
|
||||||
|
#include <hdf5.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
unsigned majnum, minnum, relnum;
|
||||||
|
herr_t herr = H5get_libversion(&majnum, &minnum, &relnum);
|
||||||
|
assert(!herr);
|
||||||
|
printf("HDF5 version %d.%d %u.%u\n", H5_VERS_MAJOR, H5_VERS_MINOR,
|
||||||
|
majnum, minnum);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
source = r"""
|
||||||
#include <hdf5.h>
|
#include <hdf5.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -492,6 +510,12 @@ def _check_install(self):
|
|||||||
expected = """\
|
expected = """\
|
||||||
HDF5 version {version} {version}
|
HDF5 version {version} {version}
|
||||||
""".format(version=str(spec.version.up_to(3)))
|
""".format(version=str(spec.version.up_to(3)))
|
||||||
|
if 'develop' in expected:
|
||||||
|
# Remove 'develop-' from the version in spack for checking
|
||||||
|
# version against the version in the HDF5 code.
|
||||||
|
expected = """\
|
||||||
|
HDF5 version {version} {version}
|
||||||
|
""".format(version=str(spec.version.up_to(3)).partition("-")[2])
|
||||||
with open("check.c", 'w') as f:
|
with open("check.c", 'w') as f:
|
||||||
f.write(source)
|
f.write(source)
|
||||||
if '+mpi' in spec:
|
if '+mpi' in spec:
|
||||||
@ -523,6 +547,10 @@ def _check_install(self):
|
|||||||
def _test_check_versions(self):
|
def _test_check_versions(self):
|
||||||
"""Perform version checks on selected installed package binaries."""
|
"""Perform version checks on selected installed package binaries."""
|
||||||
spec_vers_str = 'Version {0}'.format(self.spec.version)
|
spec_vers_str = 'Version {0}'.format(self.spec.version)
|
||||||
|
if 'develop' in spec_vers_str:
|
||||||
|
# Remove 'develop-' from the version in spack for checking
|
||||||
|
# version against the version in the HDF5 code.
|
||||||
|
spec_vers_str = spec_vers_str.partition("-")[2]
|
||||||
|
|
||||||
exes = [
|
exes = [
|
||||||
'h5copy', 'h5diff', 'h5dump', 'h5format_convert', 'h5ls',
|
'h5copy', 'h5diff', 'h5dump', 'h5format_convert', 'h5ls',
|
||||||
|
Loading…
Reference in New Issue
Block a user