Debian Codegraph @

tools/wheels/cibw_test_command.sh

raw
1 # This script is used by .github/workflows/wheels.yml to run the full test
2 # suite, and that the openblas version is correct.
3 set -xe
4
5 PROJECT_DIR="$1"
6
7 python -c "import numpy; numpy.show_config()"
8
9 if [[ $RUNNER_OS == "Windows" && $IS_32_BIT == true ]] ; then
10 # Avoid this in GHA: "ERROR: Found GNU link.exe instead of MSVC link.exe"
11 rm /c/Program\ Files/Git/usr/bin/link.EXE
12 fi
13
14 # Set available memory value to avoid OOM problems on aarch64 (see gh-22418)
15 export NPY_AVAILABLE_MEM="4 GB"
16
17 FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
18 if [[ $FREE_THREADED_BUILD == "True" ]]; then
19 # Manually check that importing NumPy does not re-enable the GIL.
20 # In principle the tests should catch this but it seems harmless to leave it
21 # here as a final sanity check before uploading broken wheels
22 if [[ $(python -c "import numpy" 2>&1) == *"The global interpreter lock (GIL) has been enabled"* ]]; then
23 echo "Error: Importing NumPy re-enables the GIL in the free-threaded build"
24 exit 1
25 fi
26 fi
27
28 # Run full tests with -n=auto. This makes pytest-xdist distribute tests across
29 # the available N CPU cores. Also print the durations for the 10 slowest tests
30 # to help with debugging slow or hanging tests
31 python -c "import sys; import numpy; sys.exit(not numpy.test(label='full', extra_argv=['-n=auto', '--durations=10']))"