summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2022-03-15 13:22:30 -0500
committerGitHub <noreply@github.com>2022-03-15 12:22:30 -0600
commit1250fac46795edeaa677b4a1188f402ed41cac84 (patch)
tree07097da9212fb934f8aa32e2b5cd76bb9226148f /var
parent8c59736ff954d8501bb8adeb38ced5e5a588b5df (diff)
downloadspack-1250fac46795edeaa677b4a1188f402ed41cac84.tar.gz
spack-1250fac46795edeaa677b4a1188f402ed41cac84.tar.bz2
spack-1250fac46795edeaa677b4a1188f402ed41cac84.tar.xz
spack-1250fac46795edeaa677b4a1188f402ed41cac84.zip
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.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/hdf5/package.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py
index df8ccda37f..040ada7770 100644
--- a/var/spack/repos/builtin/packages/hdf5/package.py
+++ b/var/spack/repos/builtin/packages/hdf5/package.py
@@ -476,7 +476,25 @@ class Hdf5(CMakePackage):
print("Checking HDF5 installation...")
checkdir = "spack-check"
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 <assert.h>
#include <stdio.h>
@@ -492,6 +510,12 @@ int main(int argc, char **argv) {
expected = """\
HDF5 version {version} {version}
""".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:
f.write(source)
if '+mpi' in spec:
@@ -523,6 +547,10 @@ HDF5 version {version} {version}
def _test_check_versions(self):
"""Perform version checks on selected installed package binaries."""
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 = [
'h5copy', 'h5diff', 'h5dump', 'h5format_convert', 'h5ls',