diff options
author | Seth R. Johnson <johnsonsr@ornl.gov> | 2021-05-20 20:00:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 17:00:20 -0700 |
commit | d2178fb47bd7be63d6cff89a360d8f52c9a204e8 (patch) | |
tree | e558e41541b1b9a604f4c5d187373fb5c9f3c3fa | |
parent | 3f184b5874ddb3bb00c8d71dbe09a6fa47127899 (diff) | |
download | spack-d2178fb47bd7be63d6cff89a360d8f52c9a204e8.tar.gz spack-d2178fb47bd7be63d6cff89a360d8f52c9a204e8.tar.bz2 spack-d2178fb47bd7be63d6cff89a360d8f52c9a204e8.tar.xz spack-d2178fb47bd7be63d6cff89a360d8f52c9a204e8.zip |
swig: add smoke tests (#23662)
-rw-r--r-- | var/spack/repos/builtin/packages/swig/package.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/swig/package.py b/var/spack/repos/builtin/packages/swig/package.py index ce47d71c80..4cf58e8bea 100644 --- a/var/spack/repos/builtin/packages/swig/package.py +++ b/var/spack/repos/builtin/packages/swig/package.py @@ -70,3 +70,45 @@ class Swig(AutotoolsPackage, SourceforgePackage): @when(_version) def autoreconf(self, spec, prefix): which('sh')('./autogen.sh') + + @property + def _installed_exe(self): + return join_path(self.prefix, 'bin', 'swig') + + def _test_version(self): + version = str(self.version) + if version.endswith('-fortran'): + version = version.replace('-', r'\+') + elif version in ('fortran', 'master'): + version = r'.*' + + self.run_test(self._installed_exe, + '-version', + expected=[r'SWIG Version {0}'.format(version)], + purpose="test: version") + + def _test_swiglib(self): + # Get SWIG's alleged path to library files + swig = Executable(self._installed_exe) + swiglib = swig('-swiglib', output=str).strip() + + # Check that the lib dir exists + if not os.path.isdir(swiglib): + msg = "SWIG library does not exist at '{0}'".format(swiglib) + self.test_failures.append([None, msg]) + + # Check for existence of other critical SWIG library files + swigfile = join_path(swiglib, 'swig.swg') + if not os.path.exists(swigfile): + msg = "SWIG runtime does not exist at '{0}'".format(swigfile) + 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): + self._test_version() + self._test_swiglib() |