swig: convert to new stand-alone test process (#37786)
This commit is contained in:
parent
52ee1967d6
commit
d739989ec8
@ -102,47 +102,41 @@ def determine_version(cls, exe):
|
|||||||
return match.group(1) if match else None
|
return match.group(1) if match else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _installed_exe(self):
|
def _swig(self):
|
||||||
return join_path(self.prefix, "bin", "swig")
|
return Executable(join_path(self.prefix, "bin", "swig"))
|
||||||
|
|
||||||
def _test_version(self):
|
@property
|
||||||
|
def _swiglib(self):
|
||||||
|
return self._swig("-swiglib", output=str).strip()
|
||||||
|
|
||||||
|
def test_version(self):
|
||||||
|
"""check swig version"""
|
||||||
version = str(self.version)
|
version = str(self.version)
|
||||||
if version.endswith("-fortran"):
|
if version.endswith("-fortran"):
|
||||||
version = version.replace("-", r"\+")
|
version = version.replace("-", r"+")
|
||||||
elif version in ("fortran", "master"):
|
elif version in ("fortran", "master"):
|
||||||
version = r".*"
|
version = ""
|
||||||
|
|
||||||
self.run_test(
|
out = self._swig("-version", output=str.split, error=str.split)
|
||||||
self._installed_exe,
|
expected = f"SWIG Version {version}"
|
||||||
"-version",
|
assert expected in out, f"Expected '{expected}' in output"
|
||||||
expected=[r"SWIG Version {0}".format(version)],
|
|
||||||
purpose="test: version",
|
|
||||||
)
|
|
||||||
|
|
||||||
def _test_swiglib(self):
|
def test_swiglib(self):
|
||||||
# Get SWIG's alleged path to library files
|
"""check that the lib dir exists"""
|
||||||
swig = Executable(self._installed_exe)
|
assert os.path.isdir(self._swiglib), f"SWIG library does not exist at '{swiglib}'"
|
||||||
swiglib = swig("-swiglib", output=str).strip()
|
|
||||||
|
|
||||||
# Check that the lib dir exists
|
def test_swig_swg(self):
|
||||||
if not os.path.isdir(swiglib):
|
"""check that swig.swg exists"""
|
||||||
msg = "SWIG library does not exist at '{0}'".format(swiglib)
|
swigfile = join_path(self._swiglib, "swig.swg")
|
||||||
self.test_failures.append([None, msg])
|
assert os.path.exists(swigfile), f"SWIG runtime does not exist at '{swigfile}'"
|
||||||
|
|
||||||
# Check for existence of other critical SWIG library files
|
def test_fortran_swg(self):
|
||||||
swigfile = join_path(swiglib, "swig.swg")
|
"""check that fortran.swg exists"""
|
||||||
if not os.path.exists(swigfile):
|
if "fortran" not in str(self.version):
|
||||||
msg = "SWIG runtime does not exist at '{0}'".format(swigfile)
|
raise SkipTest(f"Test does not work with version {self.version}")
|
||||||
self.test_failures.append([None, msg])
|
|
||||||
if "fortran" in str(self.version):
|
|
||||||
swigfile = join_path(swiglib, "fortran", "fortran.swg")
|
|
||||||
if not os.path.exists(swigfile):
|
|
||||||
msg = "SWIG+Fortran runtime does not exist at '{0}'".format(swigfile)
|
|
||||||
self.test_failures.append([None, msg])
|
|
||||||
|
|
||||||
def test(self):
|
swigfile = join_path(self._swiglib, "fortran", "fortran.swg")
|
||||||
self._test_version()
|
assert os.path.exists(swigfile), f"SWIG+Fortran runtime does not exist at '{swigfile}'"
|
||||||
self._test_swiglib()
|
|
||||||
|
|
||||||
|
|
||||||
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):
|
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):
|
||||||
|
Loading…
Reference in New Issue
Block a user