[Scipy-svn] r5023 - trunk/scipy/linalg/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Sat Nov 8 02:59:27 EST 2008
Author: cdavid
Date: 2008-11-08 01:59:17 -0600 (Sat, 08 Nov 2008)
New Revision: 5023
Added:
trunk/scipy/linalg/tests/test_build.py
Log:
Add fortran ABI mismatch test for scipy.linalg.
Added: trunk/scipy/linalg/tests/test_build.py
===================================================================
--- trunk/scipy/linalg/tests/test_build.py 2008-11-07 22:49:07 UTC (rev 5022)
+++ trunk/scipy/linalg/tests/test_build.py 2008-11-08 07:59:17 UTC (rev 5023)
@@ -0,0 +1,51 @@
+from subprocess import call, PIPE, Popen
+import sys
+import re
+
+import numpy as np
+from numpy.testing import TestCase, dec
+
+from scipy.linalg import flapack
+
+# XXX: this is copied from numpy trunk. Can be removed when we will depend on
+# numpy 1.3
+class FindDependenciesLdd:
+ def __init__(self):
+ self.cmd = ['ldd']
+
+ try:
+ st = call(self.cmd, stdout=PIPE, stderr=PIPE)
+ except OSError:
+ raise RuntimeError("command %s cannot be run" % self.cmd)
+
+ def get_dependencies(self, file):
+ p = Popen(self.cmd + [file], stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p.communicate()
+ if not (p.returncode == 0):
+ raise RuntimeError("Failed to check dependencies for %s" % libfile)
+
+ return stdout
+
+ def grep_dependencies(self, file, deps):
+ stdout = self.get_dependencies(file)
+
+ rdeps = dict([(dep, re.compile(dep)) for dep in deps])
+ founds = []
+ for l in stdout.splitlines():
+ for k, v in rdeps.items():
+ if v.search(l):
+ founds.append(k)
+
+ return founds
+
+class TestF77Mismatch(TestCase):
+ @dec.skipif(not(sys.platform[:5] == 'linux'),
+ "Skipping fortran compiler mismatch on non Linux platform")
+ def test_lapack(self):
+ f = FindDependenciesLdd()
+ deps = f.grep_dependencies(flapack.__file__,
+ ['libg2c', 'libgfortran'])
+ self.failIf(len(deps) > 1,
+"""Both g77 and gfortran runtimes linked in lapack_lite ! This is likely to
+cause random crashes and wrong results. See numpy INSTALL.txt for more
+information.""")
More information about the Scipy-svn
mailing list