diff options
-rw-r--r-- | .github/workflows/cygwin.yml | 5 | ||||
-rw-r--r-- | numpy/f2py/tests/util.py | 20 | ||||
-rwxr-xr-x | runtests.py | 11 | ||||
-rw-r--r-- | tools/list_installed_dll_dependencies_cygwin.sh | 10 | ||||
-rw-r--r-- | tools/rebase_installed_dlls_cygwin.sh | 4 |
5 files changed, 42 insertions, 8 deletions
diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index 04f21aab6..cc633ffe8 100644 --- a/.github/workflows/cygwin.yml +++ b/.github/workflows/cygwin.yml @@ -66,8 +66,9 @@ jobs: run: | dash "tools/rebase_installed_dlls_cygwin.sh" 3.9 - name: Run NumPy test suite - run: >- - dash -c "/usr/bin/python3.9 runtests.py -n" + shell: "C:\\tools\\cygwin\\bin\\bash.exe -o igncr -eo pipefail {0}" + run: | + /usr/bin/python3.9 runtests.py -n - name: Upload wheel if tests fail uses: actions/upload-artifact@v3 if: failure() diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py index 1534c4e7d..26fa7e49d 100644 --- a/numpy/f2py/tests/util.py +++ b/numpy/f2py/tests/util.py @@ -6,6 +6,7 @@ Utility functions for - determining paths to tests """ +import glob import os import sys import subprocess @@ -30,6 +31,10 @@ from importlib import import_module _module_dir = None _module_num = 5403 +if sys.platform == "cygwin": + NUMPY_INSTALL_ROOT = Path(__file__).parent.parent.parent + _module_list = list(NUMPY_INSTALL_ROOT.glob("**/*.dll")) + def _cleanup(): global _module_dir @@ -147,6 +152,21 @@ def build_module(source_files, options=[], skip=[], only=[], module_name=None): for fn in dst_sources: os.unlink(fn) + # Rebase (Cygwin-only) + if sys.platform == "cygwin": + # If someone starts deleting modules after import, this will + # need to change to record how big each module is, rather than + # relying on rebase being able to find that from the files. + _module_list.extend( + glob.glob(os.path.join(d, "{:s}*".format(module_name))) + ) + subprocess.check_call( + ["/usr/bin/rebase", "--database", "--oblivious", "--verbose"] + + _module_list + ) + + + # Import return import_module(module_name) diff --git a/runtests.py b/runtests.py index fea29a10d..8782f927d 100755 --- a/runtests.py +++ b/runtests.py @@ -545,6 +545,17 @@ def build_project(args): print("Build failed!") sys.exit(1) + # Rebase + if sys.platform == "cygwin": + from pathlib import path + testenv_root = Path(config_vars["platbase"]) + dll_list = testenv_root.glob("**/*.dll") + rebase_cmd = ["/usr/bin/rebase", "--database", "--oblivious"] + rebase_cmd.extend(dll_list) + if subprocess.run(rebase_cmd): + print("Rebase failed") + sys.exit(1) + return site_dir, site_dir_noarch def asv_compare_config(bench_path, args, h_commits): diff --git a/tools/list_installed_dll_dependencies_cygwin.sh b/tools/list_installed_dll_dependencies_cygwin.sh index ee06ae0d0..78436fe53 100644 --- a/tools/list_installed_dll_dependencies_cygwin.sh +++ b/tools/list_installed_dll_dependencies_cygwin.sh @@ -14,11 +14,11 @@ py_ver=${1} dll_list=`/bin/dash tools/list_numpy_dlls.sh ${py_ver}` echo "Checks for existence, permissions and file type" -ls -l ${dll_list} -file ${dll_list} +/usr/bin/timeout 10m /usr/bin/ls -l ${dll_list} +/usr/bin/timeout 10m /usr/bin/file ${dll_list} echo "Dependency checks" -ldd ${dll_list} | grep -F -e " => not found" && exit 1 -cygcheck ${dll_list} >cygcheck_dll_list 2>cygcheck_missing_deps +/usr/bin/timeout 10m /usr/bin/ldd ${dll_list} | grep -F -e " => not found" && exit 1 +/usr/bin/timeout 10m /usr/bin/cygcheck ${dll_list} >cygcheck_dll_list 2>cygcheck_missing_deps grep -F -e "cygcheck: track_down: could not find " cygcheck_missing_deps && exit 1 echo "Import tests" mkdir -p dist/ @@ -31,5 +31,5 @@ do -e "s/^\/+(home|usr).*?site-packages\/+//" \ -e "s/.cpython-3.m?-x86(_64)?-cygwin.dll$//" \ -e "s/\//./g"` - python${py_ver} -c "import ${ext_module}" + /usr/bin/timeout 2m /usr/bin/python${py_ver} -c "import ${ext_module}" done diff --git a/tools/rebase_installed_dlls_cygwin.sh b/tools/rebase_installed_dlls_cygwin.sh index f772879d9..58d4f0c0f 100644 --- a/tools/rebase_installed_dlls_cygwin.sh +++ b/tools/rebase_installed_dlls_cygwin.sh @@ -2,4 +2,6 @@ # Rebase the dlls installed by NumPy py_ver=${1} -/usr/bin/rebase --database --oblivious `/bin/dash tools/list_numpy_dlls.sh ${py_ver}` +numpy_dlls="`/bin/dash tools/list_numpy_dlls.sh ${py_ver}`" +/usr/bin/rebase --verbose --database --oblivious ${numpy_dlls} +/usr/bin/rebase --verbose --info ${numpy_dlls} |