Commit d6bc94ef authored by Roman Yurchak's avatar Roman Yurchak

Refactor scipy tests

parent ba0e045b
......@@ -22,9 +22,6 @@ jobs:
sudo apt-get update
sudo apt-get install gfortran f2c
# Download BLAS/LAPACK
git clone https://github.com/rth/CLAPACK-WA.git CLAPACK-WA
- restore_cache:
keys:
- v1-emsdk-{{ checksum "emsdk/Makefile" }}-v11-
......
......@@ -26,7 +26,7 @@ source:
- patches/fix_mmap.patch
build:
cflags: -I../../../../CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration
cflags: -I../../../../CLAPACK/CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration
cxxflags:
requirements:
......@@ -36,6 +36,15 @@ requirements:
test:
imports:
- scipy
- scipy.cluster
- scipy.constants
- scipy.fftpack
- scipy.odr
- scipy.sparse
- scipy.interpolate
- scipy.integrate
- scipy.linalg
- scipy.misc
- scipy.ndimage
- scipy.spatial
- scipy.special
- scipy.sparse
commit eba70f7602827851012acd1b836b5a56a3e70e32
commit f03d85c00ae993c3c87a5a7b2ea0c1215f57ee04
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Mon Oct 8 10:53:11 2018 +0200
Partial fixes for BLAS/LAPACK
diff --git a/scipy/linalg/setup.py b/scipy/linalg/setup.py
index 2c9b9ba22..6a0c4fa65 100755
index 2c9b9ba22..e8c7336d5 100755
--- a/scipy/linalg/setup.py
+++ b/scipy/linalg/setup.py
@@ -14,7 +14,13 @@ def configuration(parent_package='', top_path=None):
......@@ -16,7 +16,7 @@ index 2c9b9ba22..6a0c4fa65 100755
+ lapack_opt = { # libraries will be auto-generated by pywasmcross
+ 'libraries': [],
+ 'include_dirs': [],
+ 'library_dirs': ['../../../../CLAPACK-WA/'],
+ 'library_dirs': ['../../../../CLAPACK/CLAPACK-WA/'],
+ 'language': 'f77',
+ 'define_macros': [('NO_ATLAS_INFO', 1),
+ ('HAVE_CBLAS', None)]}
......@@ -50,7 +50,7 @@ index 2c9b9ba22..6a0c4fa65 100755
# _calc_lwork:
config.add_extension('_calc_lwork',
diff --git a/scipy/sparse/linalg/eigen/arpack/setup.py b/scipy/sparse/linalg/eigen/arpack/setup.py
index a8175a9d5..0fafd82b3 100755
index a8175a9d5..88a717fe6 100755
--- a/scipy/sparse/linalg/eigen/arpack/setup.py
+++ b/scipy/sparse/linalg/eigen/arpack/setup.py
@@ -11,7 +11,13 @@ def configuration(parent_package='',top_path=None):
......@@ -61,7 +61,7 @@ index a8175a9d5..0fafd82b3 100755
+ lapack_opt = { # libraries will be auto-generated by pywasmcross
+ 'libraries': [],
+ 'include_dirs': [],
+ 'library_dirs': ['../../../../CLAPACK-WA/'],
+ 'library_dirs': ['../../../../CLAPACK/CLAPACK-WA/'],
+ 'language': 'f77',
+ 'define_macros': [('NO_ATLAS_INFO', 1),
+ ('HAVE_CBLAS', None)]}
......@@ -69,7 +69,7 @@ index a8175a9d5..0fafd82b3 100755
if not lapack_opt:
raise NotFoundError('no lapack/blas resources found')
diff --git a/scipy/sparse/linalg/isolve/setup.py b/scipy/sparse/linalg/isolve/setup.py
index becb9237a..c9d4379b1 100755
index becb9237a..707e3f49d 100755
--- a/scipy/sparse/linalg/isolve/setup.py
+++ b/scipy/sparse/linalg/isolve/setup.py
@@ -11,7 +11,13 @@ def configuration(parent_package='',top_path=None):
......@@ -80,7 +80,7 @@ index becb9237a..c9d4379b1 100755
+ lapack_opt = { # libraries will be auto-generated by pywasmcross
+ 'libraries': [],
+ 'include_dirs': [],
+ 'library_dirs': ['../../../../CLAPACK-WA/'],
+ 'library_dirs': ['../../../../CLAPACK/CLAPACK-WA/'],
+ 'language': 'f77',
+ 'define_macros': [('NO_ATLAS_INFO', 1),
+ ('HAVE_CBLAS', None)]}
......
......@@ -3,39 +3,13 @@ from textwrap import dedent
import pytest
def test_scipy_import(selenium_standalone, request):
from selenium.common.exceptions import JavascriptException
def test_scipy_linalg(selenium_standalone, request):
selenium = selenium_standalone
if selenium.browser == 'chrome':
request.applymarker(pytest.mark.xfail(
run=False, reason='chrome not supported'))
selenium.load_package("scipy")
selenium.run("""
import scipy
""")
# supported modules
for module in ['cluster', 'constants', 'fftpack', 'odr', 'sparse',
'interpolate', 'integrate',
'linalg',
'misc', 'ndimage', 'spatial', 'special'
]:
selenium.run(f"import scipy.{module}")
# not yet built modules
for module in []:
print(module)
with pytest.raises(JavascriptException) as err:
selenium.run(f"import scipy.{module}")
assert ('ModuleNotFoundError' in str(err.value)
or 'ImportError' in str(err.value))
print(selenium.logs)
def test_scipy_linalg(selenium_standalone):
selenium = selenium_standalone
selenium.load_package("scipy")
cmd = dedent(r"""
import numpy as np
......@@ -55,37 +29,3 @@ def test_scipy_linalg(selenium_standalone):
""")
selenium.run(cmd)
print(selenium.logs)
@pytest.mark.skip
def test_built_so(selenium_standalone):
selenium = selenium_standalone
selenium.load_package("numpy")
selenium.load_package("scipy")
cmd = dedent(r"""
import scipy as sp
import os
base_dir = os.path.dirname(sp.__file__)
out = []
for (dirpath, dirnames, filenames) in os.walk(base_dir):
for path in filenames:
if path.endswith('.so'):
rel_path = os.path.relpath(dirpath, base_dir)
out.append(os.path.join(rel_path, path))
print("\n".join(out))
out
""")
def _get_modules_name(modules):
return set([path.split('.')[0] for path in modules if path])
modules_target = selenium.run(cmd)
modules_target = _get_modules_name(modules_target)
print(f'Included modules: {len(modules_target)}')
print(f' {modules_target} ')
......@@ -23,7 +23,7 @@ def registered_packages_meta():
for name in packages}
UNSUPPORTED_PACKAGES = {'chrome': ['pandas'],
UNSUPPORTED_PACKAGES = {'chrome': ['pandas', 'scipy'],
'firefox': []}
......@@ -72,10 +72,15 @@ def test_import(name, selenium_standalone):
"""
) == baseline_pyc
loaded_packages = []
for import_name in meta.get('test', {}).get('imports', []):
if name not in loaded_packages:
selenium_standalone.load_package(name)
loaded_packages.append(name)
try:
selenium_standalone.run('import %s' % import_name)
except Exception as e:
except Exception:
print(selenium_standalone.logs)
raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment