2020
2121test_module=${1}
2222
23+ PYTEST_ARGS=()
24+
25+ FREE_THREADING=" "
26+ if python -c ' import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
27+ FREE_THREADING+=" -ft"
28+ PYTEST_ARGS+=(" --require-gil-disabled" " --threads" " ${FREE_THREADING_TEST_THREADS} " " --iterations" " ${FREE_THREADING_TEST_ITERATIONS} " )
29+ fi
30+
31+
2332# Unconditionally install pathfinder wheel
2433# (it is a direct dependency of bindings, and a transitive dependency of core)
2534pushd ./cuda_pathfinder
@@ -35,7 +44,7 @@ if [[ "${test_module}" == "pathfinder" ]]; then
3544 " LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \
3645 " FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS} "
3746 pwd
38- pytest -ra -s -v tests/ | & tee /tmp/pathfinder_test_log.txt
47+ pytest " ${PYTEST_ARGS[@]} " -ra -s -v tests/ | & tee /tmp/pathfinder_test_log.txt
3948 # Fail if no "INFO test_" lines are found; capture line count otherwise
4049 line_count=$( grep ' ^INFO test_' /tmp/pathfinder_test_log.txt | wc -l)
4150 echo " Number of \" INFO test_\" lines: $line_count "
@@ -55,9 +64,9 @@ elif [[ "${test_module}" == "bindings" ]]; then
5564 pushd ./cuda_bindings
5665 echo " Running bindinds tests"
5766 pwd
58- ${SANITIZER_CMD} pytest -rxXs -v tests/
67+ ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/
5968 if [[ " ${SKIP_CYTHON_TEST} " == 0 ]]; then
60- ${SANITIZER_CMD} pytest -rxXs -v tests/cython
69+ ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/cython
6170 fi
6271 popd
6372elif [[ " ${test_module} " == " core" ]]; then
@@ -81,11 +90,6 @@ elif [[ "${test_module}" == "core" ]]; then
8190 pwd
8291 ls
8392
84- FREE_THREADING=" "
85- if python -c ' import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
86- FREE_THREADING+=" -ft"
87- fi
88-
8993 if [[ " ${LOCAL_CTK} " == 1 ]]; then
9094 # We already installed cuda-bindings, and all CTK components exist locally,
9195 # so just install the test dependencies.
@@ -97,11 +101,11 @@ elif [[ "${test_module}" == "core" ]]; then
97101 pushd ./cuda_core
98102 echo " Running core tests"
99103 pwd
100- ${SANITIZER_CMD} pytest -rxXs -v tests/
104+ ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/
101105 # Currently our CI always installs the latest bindings (from either major version).
102106 # This is not compatible with the test requirements.
103107 if [[ " ${SKIP_CYTHON_TEST} " == 0 ]]; then
104- ${SANITIZER_CMD} pytest -rxXs -v tests/cython
108+ ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/cython
105109 fi
106110 popd
107111fi
0 commit comments