Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for #257 #268

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
56 changes: 56 additions & 0 deletions tests/integration/gepetto_example_adder/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# This shall be run on manylinux2014_x86_64 to create test data for gepetto_example_adder

# Stop at any error, show all commands
set -exuo pipefail

OUTPUT_DIR=$(dirname $0)

#mkdir /root/maketest
cd /root/maketest

# Install ninja
PY38_BIN=/opt/python/cp38-cp38/bin
$PY38_BIN/pip install ninja
ln -sf $PY38_BIN/ninja /usr/local/bin/
ln -sf $PY38_BIN/wheel /usr/local/bin/

# build boost
curl -fsSLO https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2
tar -xf boost_1_72_0.tar.bz2
pushd boost_1_72_0
./bootstrap.sh --prefix=/usr/local
sed -i 's/using python.*/python_config/g' project-config.jam
sed -i 's&python_config&python_config\n using python : 3.9 : /opt/python/cp39-cp39/bin/python : /opt/python/cp39-cp39/include/python3.9 : /opt/python/cp39-cp39/lib ;&g' project-config.jam
sed -i 's&python_config&python_config\n using python : 3.8 : /opt/python/cp38-cp38/bin/python : /opt/python/cp38-cp38/include/python3.8 : /opt/python/cp38-cp38/lib ;&g' project-config.jam
sed -i 's&python_config&python_config\n using python : 3.7 : /opt/python/cp37-cp37m/bin/python : /opt/python/cp37-cp37m/include/python3.7m : /opt/python/cp37-cp37m/lib ;&g' project-config.jam
sed -i 's&python_config&python_config\n using python : 3.6 : /opt/python/cp36-cp36m/bin/python : /opt/python/cp36-cp36m/include/python3.6m : /opt/python/cp36-cp36m/lib ;&g' project-config.jam
sed -i 's/python_config//g' project-config.jam

./b2 install link=shared python=3.6,3.7,3.8,3.9 --with-python --with-test -j"$(nproc)"
popd

# build example-adder
git clone --recursive https://github.com/Ozon2/example-adder.git
pushd example-adder
git checkout d319dae3849b9dc3161b2b6cbafa9e45204dcc14

for PYBIN in /opt/python/{cp36*,cp37*,cp38*,cp39*}/bin; do
rm -rf _skbuild/
"$PYBIN"/pip install --upgrade pip
"$PYBIN"/pip install scikit-build
"$PYBIN"/python setup.py bdist_wheel
done
popd

# strip/compress dependencies
for PYVER in 36 37 38 39; do
strip --strip-unneeded /usr/local/lib/libboost_python${PYVER}.so.1.72.0
xz -z -c -e /usr/local/lib/libboost_python${PYVER}.so.1.72.0 > ${OUTPUT_DIR}/libboost_python${PYVER}.so.1.72.0.xz
done
strip --strip-unneeded example-adder/_skbuild/linux-x86_64-3.9/cmake-build/libexample-adder.so.3.0.2-6-gd319
xz -z -c -e example-adder/_skbuild/linux-x86_64-3.9/cmake-build/libexample-adder.so.3.0.2-6-gd319 > ${OUTPUT_DIR}/libexample-adder.so.3.0.2-6-gd319.xz

# copy wheels
cp example-adder/dist/* ${OUTPUT_DIR}/
52 changes: 52 additions & 0 deletions tests/integration/test_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,3 +705,55 @@ def test_build_wheel_compat(target_policy, only_plat, any_manylinux_container,
['python', '-c',
'from sys import exit; from testsimple import run; exit(run())']
)


def test_rpath(any_manylinux_container, docker_python, io_folder):
policy, tag, manylinux_ctr = any_manylinux_container
if policy != 'manylinux_2_17_x86_64':
pytest.skip('This test can only run on manylinux_2_17_x86_64')
orig_wheel = f'gepetto_example_adder-3.0.2-{PYTHON_ABI}-linux_x86_64.whl'
# decompress dependencies
docker_exec(manylinux_ctr, [
'bash', '-c',
'xz -d -c /auditwheel_src/tests/integration/gepetto_example_adder/'
f'libboost_python{PYTHON_ABI_MAJ_MIN}.so.1.72.0.xz > '
f'/usr/local/lib/libboost_python{PYTHON_ABI_MAJ_MIN}.so.1.72.0'
])
docker_exec(manylinux_ctr, [
'bash', '-c',
'xz -d -c /auditwheel_src/tests/integration/gepetto_example_adder/'
'libexample-adder.so.3.0.2-6-gd319.xz > '
'/usr/local/lib/libexample-adder.so.3.0.2-6-gd319'
])

# check the original wheel is not compliant
output = docker_exec(manylinux_ctr, [
'auditwheel', 'show',
f'/auditwheel_src/tests/integration/gepetto_example_adder/{orig_wheel}'
])
assert (
f'{orig_wheel} is consistent with the following platform tag: '
f'"linux_{PLATFORM}"'
) in output.replace('\n', ' ')

# repair
docker_exec(manylinux_ctr, [
'auditwheel', '-v', 'repair', '-w', '/io',
f'/auditwheel_src/tests/integration/gepetto_example_adder/{orig_wheel}'
])
filenames = os.listdir(io_folder)
assert len(filenames) == 1
repaired_wheels = [fn for fn in filenames if policy in fn]
expected_wheel_name = \
f'gepetto_example_adder-3.0.2-{PYTHON_ABI}-{tag}.whl'
assert repaired_wheels == [expected_wheel_name]
repaired_wheel = repaired_wheels[0]
assert_show_output(manylinux_ctr, expected_wheel_name, policy, False)

docker_exec(docker_python, ['pip', 'install', f'/io/{repaired_wheel}'])
with pytest.raises(CalledProcessError):
docker_exec(docker_python, [
'python', '-c',
'import example_adder as exa; assert exa.add(4, 3) == 7'
])
pytest.xfail('Bad RPATH')