Skip to content

Commit 6238f5b

Browse files
authored
feat: prepare run_tests.sh for manylinux_2_34 (#1682)
Prepare run_tests.sh for manylinux_2_34 This also allows other manylinux-like projects to run the same tests as manylinux without the same number of CPython installations.
1 parent ccf54a0 commit 6238f5b

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

tests/run_tests.sh

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@ set -exuo pipefail
66
# Get script directory
77
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
88

9-
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ]; then
10-
PACKAGE_MANAGER=yum
11-
elif [ "${AUDITWHEEL_POLICY:0:10}" == "musllinux_" ]; then
12-
PACKAGE_MANAGER=apk
13-
elif [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ]; then
14-
PACKAGE_MANAGER=dnf
15-
else
16-
echo "Unsupported policy: '${AUDITWHEEL_POLICY}'"
17-
exit 1
18-
fi
19-
209
if [ "${AUDITWHEEL_POLICY:0:10}" == "musllinux_" ]; then
2110
EXPECTED_PYTHON_COUNT=9
2211
EXPECTED_PYTHON_COUNT_ALL=9
@@ -32,6 +21,14 @@ else
3221
EXPECTED_PYTHON_COUNT_ALL=9
3322
fi
3423
fi
24+
25+
# the following environment variable allows other manylinux-like projects to run
26+
# the same tests as manylinux without the same number of CPython installations
27+
if [ "${ADJUST_CPYTHON_COUNT:-}" != "" ]; then
28+
EXPECTED_PYTHON_COUNT=$(( ${EXPECTED_PYTHON_COUNT} ${ADJUST_CPYTHON_COUNT} ))
29+
EXPECTED_PYTHON_COUNT_ALL=$(( ${EXPECTED_PYTHON_COUNT_ALL} ${ADJUST_CPYTHON_COUNT} ))
30+
fi
31+
3532
PYTHON_COUNT=$(manylinux-interpreters list --installed | wc -l)
3633
if [ ${EXPECTED_PYTHON_COUNT} -ne ${PYTHON_COUNT} ]; then
3734
echo "unexpected number of default python installations: ${PYTHON_COUNT}, expecting ${EXPECTED_PYTHON_COUNT}"
@@ -65,7 +62,7 @@ for PYTHON in /opt/python/*/bin/python; do
6562
if [ "${IMPLEMENTATION}" == "cpython" ]; then
6663
# Make sure sqlite3 module can be loaded properly and is the manylinux version one
6764
# c.f. https://github.com/pypa/manylinux/issues/1030
68-
$PYTHON -c 'import sqlite3; print(sqlite3.sqlite_version); assert sqlite3.sqlite_version_info[0:2] >= (3, 34)'
65+
$PYTHON -c 'import sqlite3; print(sqlite3.sqlite_version); assert sqlite3.sqlite_version_info[0:2] >= (3, 31)'
6966
# Make sure tkinter module can be loaded properly
7067
$PYTHON -c 'import tkinter; print(tkinter.TkVersion); assert tkinter.TkVersion >= 8.6'
7168
# cpython shall be available as python
@@ -129,35 +126,33 @@ patchelf --version
129126
git --version
130127
cmake --version
131128
swig -version
132-
sqlite3 --version
133129
pipx run nox --version
134130
pipx install --pip-args='--no-python-version-warning --no-input' nox
135131
nox --version
136132
tar --version | grep "GNU tar"
133+
# we stopped installing sqlite3 after manylinux_2_28 / musllinux_1_2
134+
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_1" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_2" ]; then
135+
sqlite3 --version
136+
fi
137137

138138
# check libcrypt.so.1 can be loaded by some system packages,
139139
# as LD_LIBRARY_PATH might not be enough.
140140
# c.f. https://github.com/pypa/manylinux/issues/1022
141-
if [ "${PACKAGE_MANAGER}" == "yum" ]; then
141+
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ]; then
142142
yum -y install openssh-clients
143-
elif [ "${PACKAGE_MANAGER}" == "apk" ]; then
144-
apk add --no-cache openssh-client
145-
elif [ "${PACKAGE_MANAGER}" == "dnf" ]; then
146-
dnf -y install --allowerasing openssh-clients
147-
else
148-
echo "Unsupported package manager: '${PACKAGE_MANAGER}'"
149-
exit 1
143+
eval "$(ssh-agent)"
144+
eval "$(ssh-agent -k)"
150145
fi
151-
eval "$(ssh-agent)"
152-
eval "$(ssh-agent -k)"
153146

154-
# compilation tests, intended to ensure appropriate headers, pkg_config, etc.
155-
# are available for downstream compile against installed tools
156-
source_dir="${MY_DIR}/ctest"
157-
build_dir="$(mktemp -d)"
158-
cmake -S "${source_dir}" -B "${build_dir}"
159-
cmake --build "${build_dir}"
160-
(cd "${build_dir}"; ctest --output-on-failure)
147+
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_1" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_2" ]; then
148+
# sqlite compilation tests, intended to ensure appropriate headers, pkg_config, etc.
149+
# are available for downstream compile against installed tools
150+
source_dir="${MY_DIR}/ctest"
151+
build_dir="$(mktemp -d)"
152+
cmake -S "${source_dir}" -B "${build_dir}"
153+
cmake --build "${build_dir}"
154+
(cd "${build_dir}"; ctest --output-on-failure)
155+
fi
161156

162157
# https://github.com/pypa/manylinux/issues/1060
163158
# wrong /usr/local/man symlink

0 commit comments

Comments
 (0)