From 7c561e2e113186d8977b262d7c203316bbd1d57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Tue, 18 Sep 2018 12:17:36 +0200 Subject: [PATCH 01/76] Initial example of the Flexible Metadata Format --- .fmf/version | 1 + main.fmf | 2 ++ smoke/venv.fmf | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 .fmf/version create mode 100644 main.fmf create mode 100644 smoke/venv.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/main.fmf b/main.fmf new file mode 100644 index 0000000..f448dea --- /dev/null +++ b/main.fmf @@ -0,0 +1,2 @@ +contact: Petr Šplíchal +component: [python] diff --git a/smoke/venv.fmf b/smoke/venv.fmf new file mode 100644 index 0000000..0547dd5 --- /dev/null +++ b/smoke/venv.fmf @@ -0,0 +1,37 @@ +summary: Basic smoke test for virtualenv +description: | + Check basic functionality of the virtualenv module. The + test supports different python versions & implementations + including pypy and jython. + + The following steps are performed: + + * Create virtual environment + * Activate virtual environment + * Install pip and Cython in it + * Create and test a simple module + * Check we can do extension modules + * Ensure we can test with the tox tool + + Use the following environment variables to adjust what + should be tested (default values listed first): + + * VERSION ... python version (3.7, 3.6, 2.7, 2.6) + * PYTHON ... implementation (python3.7, pypy, jython) + * METHOD ... virtualenv implementation (venv, virtualenv) + * TOX ... enable or disable the tox test (true, false) + +path: smoke +test: ./venv.sh + +tier: 1 +tags: [venv] + +environment: + VERSION: 3.7 + METHOD: venv + TOX: true +duration: 10m +component+: + - pypy + - jython From 3903c0b861324f73ecce95972909e2659664c967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Wed, 19 Sep 2018 10:21:05 +0200 Subject: [PATCH 02/76] Incorporate pull request feedback --- main.fmf | 4 +++- smoke/venv.fmf | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/main.fmf b/main.fmf index f448dea..5d4352f 100644 --- a/main.fmf +++ b/main.fmf @@ -1,2 +1,4 @@ -contact: Petr Šplíchal +contact: + - Petr Šplíchal + - Miro Hrončok component: [python] diff --git a/smoke/venv.fmf b/smoke/venv.fmf index 0547dd5..9e6f5ee 100644 --- a/smoke/venv.fmf +++ b/smoke/venv.fmf @@ -1,14 +1,14 @@ summary: Basic smoke test for virtualenv description: | - Check basic functionality of the virtualenv module. The - test supports different python versions & implementations - including pypy and jython. + Check basic functionality of Python virtual environments (venv + or virtualenv based). The test supports different python + versions & implementations including pypy and jython. The following steps are performed: * Create virtual environment * Activate virtual environment - * Install pip and Cython in it + * Install pip, pytest and Cython * Create and test a simple module * Check we can do extension modules * Ensure we can test with the tox tool @@ -17,8 +17,8 @@ description: | should be tested (default values listed first): * VERSION ... python version (3.7, 3.6, 2.7, 2.6) - * PYTHON ... implementation (python3.7, pypy, jython) - * METHOD ... virtualenv implementation (venv, virtualenv) + * PYTHON ... implementation (python${VERSION}, pypy, pypy3, jython) + * METHOD ... virtual environment creation method (venv, virtualenv) * TOX ... enable or disable the tox test (true, false) path: smoke From b3c9a16a9deabbae582a9e0ce9e163199dc886ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Wed, 19 Sep 2018 10:33:46 +0200 Subject: [PATCH 03/76] Update the list of components --- smoke/venv.fmf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/smoke/venv.fmf b/smoke/venv.fmf index 9e6f5ee..3595bc1 100644 --- a/smoke/venv.fmf +++ b/smoke/venv.fmf @@ -33,5 +33,16 @@ environment: TOX: true duration: 10m component+: + - python2 + - python26 + - python3 + - python34 + - python35 + - python36 - pypy + - pypy3 - jython + - python-pip + - python-wheel + - python-setuptools + - python-virtualenv From 9358fa66bcf5e30caad52caf17513f15cc257809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Wed, 19 Sep 2018 13:52:39 +0200 Subject: [PATCH 04/76] Add python-tox to the list of relevant components --- smoke/venv.fmf | 1 + 1 file changed, 1 insertion(+) diff --git a/smoke/venv.fmf b/smoke/venv.fmf index 3595bc1..91fee9d 100644 --- a/smoke/venv.fmf +++ b/smoke/venv.fmf @@ -46,3 +46,4 @@ component+: - python-wheel - python-setuptools - python-virtualenv + - python-tox From 8ddab88d434654381e2c4d4184edf199e43ea1e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Tue, 18 Sep 2018 12:17:36 +0200 Subject: [PATCH 05/76] Initial example of the Flexible Metadata Format --- .fmf/version | 1 + main.fmf | 4 ++++ smoke/venv.fmf | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 .fmf/version create mode 100644 main.fmf create mode 100644 smoke/venv.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/main.fmf b/main.fmf new file mode 100644 index 0000000..69f4373 --- /dev/null +++ b/main.fmf @@ -0,0 +1,4 @@ +contact: + - Petr Šplíchal + - Miro Hrončok +component: [python] diff --git a/smoke/venv.fmf b/smoke/venv.fmf new file mode 100644 index 0000000..91fee9d --- /dev/null +++ b/smoke/venv.fmf @@ -0,0 +1,49 @@ +summary: Basic smoke test for virtualenv +description: | + Check basic functionality of Python virtual environments (venv + or virtualenv based). The test supports different python + versions & implementations including pypy and jython. + + The following steps are performed: + + * Create virtual environment + * Activate virtual environment + * Install pip, pytest and Cython + * Create and test a simple module + * Check we can do extension modules + * Ensure we can test with the tox tool + + Use the following environment variables to adjust what + should be tested (default values listed first): + + * VERSION ... python version (3.7, 3.6, 2.7, 2.6) + * PYTHON ... implementation (python${VERSION}, pypy, pypy3, jython) + * METHOD ... virtual environment creation method (venv, virtualenv) + * TOX ... enable or disable the tox test (true, false) + +path: smoke +test: ./venv.sh + +tier: 1 +tags: [venv] + +environment: + VERSION: 3.7 + METHOD: venv + TOX: true +duration: 10m +component+: + - python2 + - python26 + - python3 + - python34 + - python35 + - python36 + - pypy + - pypy3 + - jython + - python-pip + - python-wheel + - python-setuptools + - python-virtualenv + - python-tox From 11bfd62cc191703bd05ae6561ec3408ad1c9a515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 18 Oct 2018 17:23:46 +0200 Subject: [PATCH 06/76] Add selftest suite (untested) --- selftest/findleaks.sh | 11 +++++++++++ selftest/parallel.sh | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 selftest/findleaks.sh create mode 100755 selftest/parallel.sh diff --git a/selftest/findleaks.sh b/selftest/findleaks.sh new file mode 100755 index 0000000..da94593 --- /dev/null +++ b/selftest/findleaks.sh @@ -0,0 +1,11 @@ +#!/bin/sh -eux + +# set python version +VERSION=${VERSION:-3.7} +PYTHON=${PYTHON:-python${VERSION}dm} + +# what to skip +# test_socket swaps and kills the machine https://bugs.python.org/issue34587 +X=${X:-"-x test_socket"} + +$PYTHON -m test --findleaks $X diff --git a/selftest/parallel.sh b/selftest/parallel.sh new file mode 100755 index 0000000..5997a30 --- /dev/null +++ b/selftest/parallel.sh @@ -0,0 +1,14 @@ +#!/bin/sh -eux + +# set python version +VERSION=${VERSION:-3.7} +PYTHON=${PYTHON:-python$VERSION} + +# what to skip +# test_socket swaps and kills the machine https://bugs.python.org/issue34587 +X=${X:-"-x test_socket"} + +# parallel jobs, 0 lets Python decide what's best +JOBS=${JOBS:-0} + +$PYTHON -m test -j$JOBS $X From 81d0de13aa3ec4f7c7c75befa2d05388c021e6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Thu, 22 Nov 2018 11:32:00 +0100 Subject: [PATCH 07/76] Enable smoke test in the tests namespace pipeline --- tests.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests.yml diff --git a/tests.yml b/tests.yml new file mode 100644 index 0000000..e51e55f --- /dev/null +++ b/tests.yml @@ -0,0 +1,35 @@ +--- +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - smoke27: + dir: smoke + run: VERSION=2.7 METHOD=virtualenv ./venv.sh + - smoke36: + dir: smoke + run: VERSION=3.6 METHOD=venv TOX=false ./venv.sh + - smoke37: + dir: smoke + run: VERSION=3.7 METHOD=venv ./venv.sh + - smokepypy: + dir: smoke + run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh + - smokepypy3: + dir: smoke + run: VERSION=3.5 METHOD=venv PYTHON=pypy3 ./venv.sh + required_packages: + - gcc + - /usr/bin/virtualenv + - python27 + - python36 + - python37 + - pypy + - pypy3 + - python2-devel + - python3-devel + - pypy-devel + - pypy3-devel + - python3-tox From 97db1f97bbd65a663479484b2d282a578e4c55da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 29 Nov 2018 15:22:23 +0100 Subject: [PATCH 08/76] Run Python 3.7 selftest tests in selftest tests of these tests --- selftest/findleaks.sh | 6 ++++++ selftest/parallel.sh | 6 ++++++ tests.yml | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/selftest/findleaks.sh b/selftest/findleaks.sh index da94593..44bba9f 100755 --- a/selftest/findleaks.sh +++ b/selftest/findleaks.sh @@ -8,4 +8,10 @@ PYTHON=${PYTHON:-python${VERSION}dm} # test_socket swaps and kills the machine https://bugs.python.org/issue34587 X=${X:-"-x test_socket"} +# Fedora sets TLSv1 as explicit minimum version. +# Python's test suite assumes that the minimum protocol version is set to +# a magic marker. We workaround the test problem by setting: +export OPENSSL_CONF=/non-existing-file +# https://bugzilla.redhat.com/show_bug.cgi?id=1618753 + $PYTHON -m test --findleaks $X diff --git a/selftest/parallel.sh b/selftest/parallel.sh index 5997a30..d050cf7 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -11,4 +11,10 @@ X=${X:-"-x test_socket"} # parallel jobs, 0 lets Python decide what's best JOBS=${JOBS:-0} +# Fedora sets TLSv1 as explicit minimum version. +# Python's test suite assumes that the minimum protocol version is set to +# a magic marker. We workaround the test problem by setting: +export OPENSSL_CONF=/non-existing-file +# https://bugzilla.redhat.com/show_bug.cgi?id=1618753 + $PYTHON -m test -j$JOBS $X diff --git a/tests.yml b/tests.yml index e51e55f..739e52c 100644 --- a/tests.yml +++ b/tests.yml @@ -20,6 +20,9 @@ - smokepypy3: dir: smoke run: VERSION=3.5 METHOD=venv PYTHON=pypy3 ./venv.sh + - selftest37: + dir: selftest + run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh required_packages: - gcc - /usr/bin/virtualenv @@ -33,3 +36,5 @@ - pypy-devel - pypy3-devel - python3-tox + - python3-tkinter + - python3-test From ead01d15f0a1d94c6185bdb35e5da1e454e899de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 30 Nov 2018 10:12:31 +0100 Subject: [PATCH 09/76] Find leaks! --- tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests.yml b/tests.yml index 739e52c..3d37712 100644 --- a/tests.yml +++ b/tests.yml @@ -23,6 +23,9 @@ - selftest37: dir: selftest run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh + - findleaks37: + dir: selftest + run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./findleaks.sh required_packages: - gcc - /usr/bin/virtualenv @@ -38,3 +41,4 @@ - python3-tox - python3-tkinter - python3-test + - python3-debug From 8dbc369a49b5053e97a60aac97c792475a5ba4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 20 Dec 2018 11:31:22 +0100 Subject: [PATCH 10/76] More test output --- selftest/findleaks.sh | 3 ++- selftest/parallel.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/selftest/findleaks.sh b/selftest/findleaks.sh index 44bba9f..d04b364 100755 --- a/selftest/findleaks.sh +++ b/selftest/findleaks.sh @@ -14,4 +14,5 @@ X=${X:-"-x test_socket"} export OPENSSL_CONF=/non-existing-file # https://bugzilla.redhat.com/show_bug.cgi?id=1618753 -$PYTHON -m test --findleaks $X +$PYTHON -m test.pythoninfo +$PYTHON -m test -wW --findleaks $X diff --git a/selftest/parallel.sh b/selftest/parallel.sh index d050cf7..5bc2c11 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -17,4 +17,5 @@ JOBS=${JOBS:-0} export OPENSSL_CONF=/non-existing-file # https://bugzilla.redhat.com/show_bug.cgi?id=1618753 -$PYTHON -m test -j$JOBS $X +$PYTHON -m test.pythoninfo +$PYTHON -m test -wW -j$JOBS $X From ca464dcb6096a1b73e607d2595a5ff27585b8b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 7 Feb 2019 08:36:39 +0100 Subject: [PATCH 11/76] Fix Cython installation for fresh CPythons We try to fetch a wheel only and if that fails, we disable compilation. Useful for fresh CPythons such as 3.8 now, where wheels are not yet ready, but Cython defaults to compiling (because it detects CPython). Note that --install-option="--no-cython-compile" makes pip use source package, hence we don't want to use it right away. We still prefer wheel over sdist. --- smoke/venv.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 9585acc..4281e5c 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -36,7 +36,9 @@ if [ "$VERSION" == "2.6" ]; then else python -m pip install pytest if [ "$PYTHON" != "jython" ]; then - python -m pip install Cython + # We try to fetch a wheel only and if that fails, we disable compilation + # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling + python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" fi fi From bb40c2a2a8f74615061305efb20bad62a15c6f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sat, 9 Feb 2019 11:55:22 +0100 Subject: [PATCH 12/76] Smoke test Python 3.8 --- tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests.yml b/tests.yml index 3d37712..b58ec77 100644 --- a/tests.yml +++ b/tests.yml @@ -14,6 +14,9 @@ - smoke37: dir: smoke run: VERSION=3.7 METHOD=venv ./venv.sh + - smoke38: + dir: smoke + run: VERSION=3.8 METHOD=venv ./venv.sh - smokepypy: dir: smoke run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh @@ -32,6 +35,7 @@ - python27 - python36 - python37 + - python38 - pypy - pypy3 - python2-devel From 0ae24258743ca5be50706cd60f50b32ff70a8895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 9 May 2019 13:54:40 +0200 Subject: [PATCH 13/76] Python 3.8: Install Cython from git master --- smoke/venv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 4281e5c..17528b4 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -35,7 +35,10 @@ if [ "$VERSION" == "2.6" ]; then pip install Cython --install-option="--no-cython-compile" else python -m pip install pytest - if [ "$PYTHON" != "jython" ]; then + if [ "$VERSION" == "3.8" ]; then + # Cython support for 3.8.0a4+ is not yet released + python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" + elif [ "$PYTHON" != "jython" ]; then # We try to fetch a wheel only and if that fails, we disable compilation # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" From bd3ec9505cd37d80fe47fbb8234928abcfc0c658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 9 May 2019 16:16:52 +0200 Subject: [PATCH 14/76] Workaround fedora-ci/general#31 https://pagure.io/fedora-ci/general/issue/31 --- tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.yml b/tests.yml index b58ec77..3579e44 100644 --- a/tests.yml +++ b/tests.yml @@ -31,7 +31,7 @@ run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./findleaks.sh required_packages: - gcc - - /usr/bin/virtualenv + - virtualenv - python27 - python36 - python37 From 8f563a8e110fb0692f32c7048f1a58ea46d5a336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 27 Jun 2019 11:40:06 +0200 Subject: [PATCH 15/76] Stop running findleaks tests, but run a test on debug Python See https://src.fedoraproject.org/rpms/python3/pull-request/113 We keep findleaks script in the repo, until eliminated elsewhere. --- tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests.yml b/tests.yml index 3579e44..16d8dbf 100644 --- a/tests.yml +++ b/tests.yml @@ -26,9 +26,9 @@ - selftest37: dir: selftest run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh - - findleaks37: + - debugtest37: dir: selftest - run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./findleaks.sh + run: VERSION=3.7 PYTHON="python3-debug" X="test_ssl" ./parallel.sh required_packages: - gcc - virtualenv From f5948a878cf5658ffe629f54f0a808b624e59a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 26 Jun 2019 18:18:13 +0200 Subject: [PATCH 16/76] Update the test image before running tests See https://pagure.io/fedora-ci/general/issue/20 --- tests.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests.yml b/tests.yml index 16d8dbf..bf0931d 100644 --- a/tests.yml +++ b/tests.yml @@ -1,4 +1,12 @@ --- +- hosts: localhost + tags: + - classic + tasks: + - dnf: + name: "*" + state: latest + - hosts: localhost roles: - role: standard-test-basic From d72c62fe79dab5e6489f4f1f16ed33a09d01f408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sun, 1 Sep 2019 09:03:39 +0200 Subject: [PATCH 17/76] It is no longer needed to fetch Cython from git master --- smoke/venv.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 17528b4..4281e5c 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -35,10 +35,7 @@ if [ "$VERSION" == "2.6" ]; then pip install Cython --install-option="--no-cython-compile" else python -m pip install pytest - if [ "$VERSION" == "3.8" ]; then - # Cython support for 3.8.0a4+ is not yet released - python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" - elif [ "$PYTHON" != "jython" ]; then + if [ "$PYTHON" != "jython" ]; then # We try to fetch a wheel only and if that fails, we disable compilation # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" From d37bcbfd9ac30e50a699f624da0281f431661a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 5 Sep 2019 11:49:37 +0200 Subject: [PATCH 18/76] Also enable testing virtualenv --no-download --- smoke/venv.sh | 2 ++ tests.yml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/smoke/venv.sh b/smoke/venv.sh index 4281e5c..b6c0d40 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -14,6 +14,8 @@ if [ "$METHOD" == "venv" ]; then $PYTHON -m venv venv elif [ "$METHOD" == "virtualenv" ]; then virtualenv --python=$PYTHON venv +elif [ "$METHOD" == "virtualenv-no-download" ]; then + virtualenv --no-download --python=$PYTHON venv else echo 'Unsupported $METHOD' $METHOD >&2 exit 1 diff --git a/tests.yml b/tests.yml index bf0931d..9978f6f 100644 --- a/tests.yml +++ b/tests.yml @@ -16,6 +16,9 @@ - smoke27: dir: smoke run: VERSION=2.7 METHOD=virtualenv ./venv.sh + - smoke34: + dir: smoke + run: VERSION=3.4 METHOD=virtualenv-no-download TOX=false ./venv.sh - smoke36: dir: smoke run: VERSION=3.6 METHOD=venv TOX=false ./venv.sh @@ -41,6 +44,7 @@ - gcc - virtualenv - python27 + - python34 - python36 - python37 - python38 From 30e8067df55185c933012a8b7f5817e07464a3fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 5 Sep 2019 11:50:33 +0200 Subject: [PATCH 19/76] Test debug tests with current rawhide python3-debug --- tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests.yml b/tests.yml index 9978f6f..acd77a3 100644 --- a/tests.yml +++ b/tests.yml @@ -37,9 +37,9 @@ - selftest37: dir: selftest run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh - - debugtest37: + - debugtest38: dir: selftest - run: VERSION=3.7 PYTHON="python3-debug" X="test_ssl" ./parallel.sh + run: VERSION=3.8 PYTHON="python3-debug" X="test_ssl" ./parallel.sh required_packages: - gcc - virtualenv From 11b7e874efb59f465a43305362e761023e098d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 5 Sep 2019 14:54:15 +0200 Subject: [PATCH 20/76] Test pypy3 tests with current pypy3, that is Python 3.6 --- tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.yml b/tests.yml index acd77a3..c5f4a49 100644 --- a/tests.yml +++ b/tests.yml @@ -33,7 +33,7 @@ run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh - smokepypy3: dir: smoke - run: VERSION=3.5 METHOD=venv PYTHON=pypy3 ./venv.sh + run: VERSION=3.6 METHOD=venv PYTHON=pypy3 ./venv.sh - selftest37: dir: selftest run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh From 96fbcc5c42d5fae406ea1bc6406db68d6f140fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 16 Oct 2019 15:44:09 +0200 Subject: [PATCH 21/76] Test that the debug build has the proper -O flags set Fixes https://src.fedoraproject.org/tests/python/issue/12 --- flags/assertflags.py | 40 ++++++++++++++++++++++++++++++++++++++++ tests.yml | 3 +++ 2 files changed, 43 insertions(+) create mode 100644 flags/assertflags.py diff --git a/flags/assertflags.py b/flags/assertflags.py new file mode 100644 index 0000000..3373275 --- /dev/null +++ b/flags/assertflags.py @@ -0,0 +1,40 @@ +""" +This script asserts that Python config vars with compiler options including +one or more -O flags have the last specified -O flag equal to the script's +first argument. + +We use it to check that the debug build (as well as extension modules) was +built with a desired optimization level (usually -Og or -O0). + +About -O flags: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html +"If you use multiple -O options, with or without level numbers, +the last such option is the one that is effective." +""" + +import sys +import sysconfig + +# The flags that currently don't have the -Og flag on the debug build +# and we consider it OK, because we don't know any better :) +WHITELIST = [ + 'CONFIGURE_CFLAGS', + 'CONFIGURE_CFLAGS_NODIST', + 'CONFIG_ARGS', + 'OPT', +] + +print('Expecting that {} is the last -O flag:\n'.format(sys.argv[1])) +ret = 0 + +for key, flags in sysconfig.get_config_vars().items(): + if key in WHITELIST: + continue + if isinstance(flags, str): + oflags = [f for f in flags.split(' ') if f.startswith('-O')] + if oflags and oflags[-1] != sys.argv[1]: + print('Problem in {} -O flags: {}'.format(key, ' '.join(oflags))) + ret = 1 + elif oflags: + print('{} are OK'.format(key)) + +sys.exit(ret) diff --git a/tests.yml b/tests.yml index c5f4a49..c55eca8 100644 --- a/tests.yml +++ b/tests.yml @@ -40,6 +40,9 @@ - debugtest38: dir: selftest run: VERSION=3.8 PYTHON="python3-debug" X="test_ssl" ./parallel.sh + - debugflags: + dir: flags + run: python3-debug ./assertflags.py -Og required_packages: - gcc - virtualenv From 754dc5a5734212af1f04e25e80c715028af69593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 26 Nov 2019 01:10:14 +0100 Subject: [PATCH 22/76] Python 3.9: Fetch Cython master --- smoke/venv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index b6c0d40..6744a3a 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -37,7 +37,10 @@ if [ "$VERSION" == "2.6" ]; then pip install Cython --install-option="--no-cython-compile" else python -m pip install pytest - if [ "$PYTHON" != "jython" ]; then + if [ "$VERSION" == "3.9" ]; then + # Cython support for 3.9.0a1+ is not yet released + python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" + elif [ "$PYTHON" != "jython" ]; then # We try to fetch a wheel only and if that fails, we disable compilation # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" From 606e77a1ba8fb48db2f83a69f1d194c27453448e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 2 Dec 2019 13:20:18 +0100 Subject: [PATCH 23/76] Expand the OPENSSL_CONF=/non-existing-file comment It's not just the minimum version now. --- selftest/findleaks.sh | 7 +++++-- selftest/parallel.sh | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/selftest/findleaks.sh b/selftest/findleaks.sh index d04b364..dde2ba8 100755 --- a/selftest/findleaks.sh +++ b/selftest/findleaks.sh @@ -8,11 +8,14 @@ PYTHON=${PYTHON:-python${VERSION}dm} # test_socket swaps and kills the machine https://bugs.python.org/issue34587 X=${X:-"-x test_socket"} -# Fedora sets TLSv1 as explicit minimum version. -# Python's test suite assumes that the minimum protocol version is set to +# Fedora sets explicit minimum/maximum TLS versions. +# Python's test suite assumes that the minimum/maximum version is set to # a magic marker. We workaround the test problem by setting: export OPENSSL_CONF=/non-existing-file # https://bugzilla.redhat.com/show_bug.cgi?id=1618753 +# https://bugzilla.redhat.com/show_bug.cgi?id=1778357 +# https://bugs.python.org/issue35045 +# https://bugs.python.org/issue38815 $PYTHON -m test.pythoninfo $PYTHON -m test -wW --findleaks $X diff --git a/selftest/parallel.sh b/selftest/parallel.sh index 5bc2c11..740607c 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -11,11 +11,14 @@ X=${X:-"-x test_socket"} # parallel jobs, 0 lets Python decide what's best JOBS=${JOBS:-0} -# Fedora sets TLSv1 as explicit minimum version. -# Python's test suite assumes that the minimum protocol version is set to +# Fedora sets explicit minimum/maximum TLS versions. +# Python's test suite assumes that the minimum/maximum version is set to # a magic marker. We workaround the test problem by setting: export OPENSSL_CONF=/non-existing-file # https://bugzilla.redhat.com/show_bug.cgi?id=1618753 +# https://bugzilla.redhat.com/show_bug.cgi?id=1778357 +# https://bugs.python.org/issue35045 +# https://bugs.python.org/issue38815 $PYTHON -m test.pythoninfo $PYTHON -m test -wW -j$JOBS $X From 74239cac5d975b5b805cbeba395dbc7a92882066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 6 Feb 2020 12:13:10 +0100 Subject: [PATCH 24/76] Assert that tox uses the appropriate Python version --- smoke/venv.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 6744a3a..725c948 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -86,6 +86,23 @@ set -u # use it with tox [[ "$TOX" != "true" ]] && exit 0 +if [[ $PYTHON == python* ]]; then + export TOXENV=py${VERSION/./} +else + export TOXENV=$PYTHON +fi + +cat > tox.ini << EOF +[tox] +skipsdist = True +[testenv] +commands = python -c 'import sys; print(sys.version)' +EOF + +# Tests that the Python version used in tox is really the Python version we want +tox | tee toxlog +grep "^$VERSION\.[0-9]" toxlog + cat > tox.ini << EOF [tox] skipsdist = True @@ -94,8 +111,5 @@ deps = pytest commands = python -m pytest -v test_foo.py EOF -if [[ $PYTHON == python* ]]; then - tox -e py${VERSION/./} -else - tox -e $PYTHON -fi +# A more complex example with pytest +tox From 38d9a441ce730c296880558e17960492e450b8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 6 Feb 2020 18:55:03 +0100 Subject: [PATCH 25/76] Test with Python 3.9 as well --- tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests.yml b/tests.yml index c55eca8..e308377 100644 --- a/tests.yml +++ b/tests.yml @@ -28,6 +28,9 @@ - smoke38: dir: smoke run: VERSION=3.8 METHOD=venv ./venv.sh + - smoke39: + dir: smoke + run: VERSION=3.9 METHOD=venv ./venv.sh - smokepypy: dir: smoke run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh @@ -51,6 +54,7 @@ - python36 - python37 - python38 + - python39 - pypy - pypy3 - python2-devel From 562c77a4830b977317c7376d12136a0a9dc12353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 12 Feb 2020 16:13:16 +0100 Subject: [PATCH 26/76] Smoke test self without Python 3.4 Python 3.4 is going to be removed in Fedora 33: https://fedoraproject.org/wiki/Changes/RetirePython34 --- tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests.yml b/tests.yml index e308377..79a2b24 100644 --- a/tests.yml +++ b/tests.yml @@ -16,9 +16,9 @@ - smoke27: dir: smoke run: VERSION=2.7 METHOD=virtualenv ./venv.sh - - smoke34: + - smoke35: dir: smoke - run: VERSION=3.4 METHOD=virtualenv-no-download TOX=false ./venv.sh + run: VERSION=3.5 METHOD=virtualenv-no-download ./venv.sh - smoke36: dir: smoke run: VERSION=3.6 METHOD=venv TOX=false ./venv.sh @@ -50,7 +50,7 @@ - gcc - virtualenv - python27 - - python34 + - python35 - python36 - python37 - python38 From 6a9ffe6cb20d6253088f0f046a93ea0522b6f6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 20 Apr 2020 14:52:33 +0200 Subject: [PATCH 27/76] Have a dynamic Python version by default if possible --- selftest/parallel.sh | 7 +++++-- smoke/venv.sh | 7 +++++-- tests.yml | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/selftest/parallel.sh b/selftest/parallel.sh index 740607c..49ec458 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -1,7 +1,10 @@ #!/bin/sh -eux -# set python version -VERSION=${VERSION:-3.7} +# set default version to %{python3_version} if available +VERSION=${VERSION:-$(rpm --eval '%{?python3_version}')} || true +# ...or 3.8 if that macro is not available or rpm fails for any reason +VERSION=${VERSION:-3.8} + PYTHON=${PYTHON:-python$VERSION} # what to skip diff --git a/smoke/venv.sh b/smoke/venv.sh index 725c948..f127e4a 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -1,7 +1,10 @@ #!/bin/sh -eux -# set python version -VERSION=${VERSION:-3.7} +# set default version to %{python3_version} if available +VERSION=${VERSION:-$(rpm --eval '%{?python3_version}')} || true +# ...or 3.8 if that macro is not available or rpm fails for any reason +VERSION=${VERSION:-3.8} + PYTHON=${PYTHON:-python$VERSION} METHOD=${METHOD:-venv} TOX=${TOX:-true} diff --git a/tests.yml b/tests.yml index 79a2b24..d9c3c04 100644 --- a/tests.yml +++ b/tests.yml @@ -13,6 +13,9 @@ tags: - classic tests: + - smoke_default: + dir: smoke + run: ./venv.sh - smoke27: dir: smoke run: VERSION=2.7 METHOD=virtualenv ./venv.sh @@ -65,3 +68,4 @@ - python3-tkinter - python3-test - python3-debug + - python3-rpm-macros From 450364614f9a8f58f0cf9b5da3ddd47411ce3352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 29 Apr 2020 01:17:58 +0200 Subject: [PATCH 28/76] Also test plain ensurepip in smoke tests --- smoke/venv.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index f127e4a..d85f7b7 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -10,7 +10,7 @@ METHOD=${METHOD:-venv} TOX=${TOX:-true} # clean from possible older runs -rm -rf venv .tox __pycache__ .pytest* test_*.py *.pyx *.c *.so || : +rm -rf venv .tox __pycache__ .pytest* test_*.py *.pyx *.c *.so ensurepiptestroot || : # check the we can create the venv if [ "$METHOD" == "venv" ]; then @@ -87,6 +87,10 @@ set +u deactivate set -u +# ensurepip test (when testing virtualenv, this was not covered) +# with the main Python, this will say "Requirement already satisfied", but that's OK +$PYTHON -m ensurepip --root ensurepiptestroot + # use it with tox [[ "$TOX" != "true" ]] && exit 0 if [[ $PYTHON == python* ]]; then From 0ec11f1f64cc3257b9ed17aa5c3634fb0bf6ec09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 3 Jun 2020 15:59:47 +0200 Subject: [PATCH 29/76] Require Python packages with dots --- tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests.yml b/tests.yml index d9c3c04..63a8b78 100644 --- a/tests.yml +++ b/tests.yml @@ -52,12 +52,12 @@ required_packages: - gcc - virtualenv - - python27 - - python35 - - python36 - - python37 - - python38 - - python39 + - python2.7 + - python3.5 + - python3.6 + - python3.7 + - python3.8 + - python3.9 - pypy - pypy3 - python2-devel From c26b64823bfc2c7724126f7194359aa6990b81d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 3 Jun 2020 16:10:27 +0200 Subject: [PATCH 30/76] Make it possible to run Python 3.4 tests optionally --- smoke/venv.sh | 9 +++++++++ tests.yml | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/smoke/venv.sh b/smoke/venv.sh index d85f7b7..2864540 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -8,10 +8,19 @@ VERSION=${VERSION:-3.8} PYTHON=${PYTHON:-python$VERSION} METHOD=${METHOD:-venv} TOX=${TOX:-true} +INSTALL_OR_SKIP=${INSTALL_OR_SKIP:-false} # clean from possible older runs rm -rf venv .tox __pycache__ .pytest* test_*.py *.pyx *.c *.so ensurepiptestroot || : +if [ "$INSTALL_OR_SKIP" == "true" ] && [ ! -f "/usr/bin/$PYTHON" ]; then + dnf -y install "/usr/bin/$PYTHON" || : + if [ ! -f "/usr/bin/$PYTHON" ]; then + echo "/usr/bin/$PYTHON not installable, skipping this test" + exit 0 + fi +fi + # check the we can create the venv if [ "$METHOD" == "venv" ]; then $PYTHON -m venv venv diff --git a/tests.yml b/tests.yml index 63a8b78..7633e84 100644 --- a/tests.yml +++ b/tests.yml @@ -34,6 +34,9 @@ - smoke39: dir: smoke run: VERSION=3.9 METHOD=venv ./venv.sh + - smoke34_optional: + dir: smoke + run: VERSION=3.4 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh - smokepypy: dir: smoke run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh @@ -50,6 +53,7 @@ dir: flags run: python3-debug ./assertflags.py -Og required_packages: + - dnf - gcc - virtualenv - python2.7 From 261dfe65e1af0ca1be793fc2fa9633796cefedd4 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 23 Jun 2020 13:35:27 +0200 Subject: [PATCH 31/76] Add method for virtualenv with --seeder pip --seeder pip uses pip (from wheel) to install seed packages (pip, setuptools and wheel) from our own system wheels. --- smoke/venv.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smoke/venv.sh b/smoke/venv.sh index 2864540..40c7e6b 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -28,6 +28,8 @@ elif [ "$METHOD" == "virtualenv" ]; then virtualenv --python=$PYTHON venv elif [ "$METHOD" == "virtualenv-no-download" ]; then virtualenv --no-download --python=$PYTHON venv +elif [ "$METHOD" == "virtualenv-seeder-pip" ]; then + virtualenv --seeder pip --python=$PYTHON venv else echo 'Unsupported $METHOD' $METHOD >&2 exit 1 From b4fd40e6ca5742858db8ec2d4e81ee2ea30bbfb5 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 23 Jun 2020 14:10:41 +0200 Subject: [PATCH 32/76] Test virtualenv with pip for Py 2.7 (bundled wheels in ensurepip) and Py 3.9 --- tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests.yml b/tests.yml index 7633e84..ee2bd4c 100644 --- a/tests.yml +++ b/tests.yml @@ -19,6 +19,9 @@ - smoke27: dir: smoke run: VERSION=2.7 METHOD=virtualenv ./venv.sh + - smoke27_seeder_pip: + dir: smoke + run: VERSION=2.7 METHOD=virtualenv-seeder-pip ./venv.sh - smoke35: dir: smoke run: VERSION=3.5 METHOD=virtualenv-no-download ./venv.sh @@ -34,6 +37,9 @@ - smoke39: dir: smoke run: VERSION=3.9 METHOD=venv ./venv.sh + - smoke39_seeder_pip: + dir: smoke + run: VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh - smoke34_optional: dir: smoke run: VERSION=3.4 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh From 86842acd1b2a99bc2842fa838136b526f567a9d7 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 29 Jul 2020 10:59:50 +0200 Subject: [PATCH 33/76] Add marshalparser to Python tests Marshalparser helps us to uniform byte-compiled Python files so it has to be able to also parse pyc files from the main python packages. Moreover, it has its own database of magic numbers so this test checks that the parser is compatible with the latest python before we ship it. --- .../test_marshalparser_compatibility.sh | 22 +++++++++++++++++++ tests.yml | 4 ++++ 2 files changed, 26 insertions(+) create mode 100755 marshalparser/test_marshalparser_compatibility.sh diff --git a/marshalparser/test_marshalparser_compatibility.sh b/marshalparser/test_marshalparser_compatibility.sh new file mode 100755 index 0000000..2c8d254 --- /dev/null +++ b/marshalparser/test_marshalparser_compatibility.sh @@ -0,0 +1,22 @@ +#!/bin/sh -eux + +# Marshalparser helps us to uniform byte-compiled Python files +# so it has to be able to also parse pyc files from +# the main python packages. +# Moreover, it has its own database of magic numbers so this test +# checks that the parser is compatible with the latest python before +# we ship it. + +# Test the latest version by default because that's the place +# where magic number incompatibility might happen with +# the largest probability +VERSION=${VERSION:-3.9} + +# How many randomly-selected pyc files to check? +SAMPLE=${SAMPLE:-50} + +path="/usr/lib*/python$VERSION/" + +for file in `find $path -name "*.pyc" | shuf | head -n $SAMPLE`; do + marshalparser $file || exit 1 +done diff --git a/tests.yml b/tests.yml index ee2bd4c..9d49567 100644 --- a/tests.yml +++ b/tests.yml @@ -58,6 +58,9 @@ - debugflags: dir: flags run: python3-debug ./assertflags.py -Og + - marshalparser_compatibility: + dir: marshalparser + run: SAMPLE=10 test_marshalparser_compatibility.sh required_packages: - dnf - gcc @@ -79,3 +82,4 @@ - python3-test - python3-debug - python3-rpm-macros + - marshalparser From 6cc91d52a715ab890dad1f1e3055493e5d591c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 12 Oct 2020 11:18:00 +0200 Subject: [PATCH 34/76] No longer install Cython from master on Python 3.9 It also is not (yet) necessary on Python 3.10. --- smoke/venv.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 40c7e6b..262ff13 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -51,10 +51,7 @@ if [ "$VERSION" == "2.6" ]; then pip install Cython --install-option="--no-cython-compile" else python -m pip install pytest - if [ "$VERSION" == "3.9" ]; then - # Cython support for 3.9.0a1+ is not yet released - python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" - elif [ "$PYTHON" != "jython" ]; then + if [ "$PYTHON" != "jython" ]; then # We try to fetch a wheel only and if that fails, we disable compilation # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" From 59f2079f68bed955e2cf6af48a8dea17cf6b27f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 13 Oct 2020 14:37:06 +0200 Subject: [PATCH 35/76] Support INSTALL_OR_SKIP for marshalparser test --- marshalparser/test_marshalparser_compatibility.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/marshalparser/test_marshalparser_compatibility.sh b/marshalparser/test_marshalparser_compatibility.sh index 2c8d254..2d32537 100755 --- a/marshalparser/test_marshalparser_compatibility.sh +++ b/marshalparser/test_marshalparser_compatibility.sh @@ -15,6 +15,16 @@ VERSION=${VERSION:-3.9} # How many randomly-selected pyc files to check? SAMPLE=${SAMPLE:-50} +# This allows us to test marshalparser optionally: on Fedora 33+ only +INSTALL_OR_SKIP=${INSTALL_OR_SKIP:-false} +if [ "$INSTALL_OR_SKIP" == "true" ] && [ ! -f "/usr/bin/marshalparser" ]; then + dnf -y install marshalparser || : + if [ ! -f "/usr/bin/marshalparser" ]; then + echo "marshalparser not installable, skipping this test" + exit 0 + fi +fi + path="/usr/lib*/python$VERSION/" for file in `find $path -name "*.pyc" | shuf | head -n $SAMPLE`; do From 1b6575d5a5d4e24d150e5db83984a056e509424c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 5 Nov 2020 13:32:26 +0100 Subject: [PATCH 36/76] Avoid variable names with negative conotations --- flags/assertflags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flags/assertflags.py b/flags/assertflags.py index 3373275..c7f0b08 100644 --- a/flags/assertflags.py +++ b/flags/assertflags.py @@ -16,7 +16,7 @@ import sysconfig # The flags that currently don't have the -Og flag on the debug build # and we consider it OK, because we don't know any better :) -WHITELIST = [ +SKIP = [ 'CONFIGURE_CFLAGS', 'CONFIGURE_CFLAGS_NODIST', 'CONFIG_ARGS', @@ -27,7 +27,7 @@ print('Expecting that {} is the last -O flag:\n'.format(sys.argv[1])) ret = 0 for key, flags in sysconfig.get_config_vars().items(): - if key in WHITELIST: + if key in SKIP: continue if isinstance(flags, str): oflags = [f for f in flags.split(' ') if f.startswith('-O')] From 98ad8d02320a76a16e65bac67a277be8252f76e1 Mon Sep 17 00:00:00 2001 From: Tomas Hrnciar Date: Wed, 5 May 2021 09:11:21 +0200 Subject: [PATCH 37/76] For debug build, assert -O0 instead of -Og Python change: https://src.fedoraproject.org/rpms/python3.9/c/1d2d05b30506c5758da94f1cd3860f3d58a87db0 Rationale: https://bugzilla.redhat.com/show_bug.cgi?id=1818857 --- tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.yml b/tests.yml index 9d49567..3c11dde 100644 --- a/tests.yml +++ b/tests.yml @@ -57,7 +57,7 @@ run: VERSION=3.8 PYTHON="python3-debug" X="test_ssl" ./parallel.sh - debugflags: dir: flags - run: python3-debug ./assertflags.py -Og + run: python3-debug ./assertflags.py -O0 - marshalparser_compatibility: dir: marshalparser run: SAMPLE=10 test_marshalparser_compatibility.sh From 853a1f50a36e0406307854673f7e4d93f3c7ecca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 10 Aug 2021 14:53:33 +0200 Subject: [PATCH 38/76] Correctly determine toxenv for versioned PyPy --- smoke/venv.sh | 2 ++ tests.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 262ff13..d5da8e2 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -103,6 +103,8 @@ $PYTHON -m ensurepip --root ensurepiptestroot [[ "$TOX" != "true" ]] && exit 0 if [[ $PYTHON == python* ]]; then export TOXENV=py${VERSION/./} +elif [[ $PYTHON == pypy* ]]; then + export TOXENV=pypy${VERSION/./} else export TOXENV=$PYTHON fi diff --git a/tests.yml b/tests.yml index 3c11dde..395e7ba 100644 --- a/tests.yml +++ b/tests.yml @@ -48,7 +48,7 @@ run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh - smokepypy3: dir: smoke - run: VERSION=3.6 METHOD=venv PYTHON=pypy3 ./venv.sh + run: VERSION=3.7 METHOD=venv PYTHON=pypy3.7 ./venv.sh - selftest37: dir: selftest run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh From 2fc6fc00bc2e65e0ea987ca301f3530394421c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 10 Aug 2021 15:23:00 +0200 Subject: [PATCH 39/76] Make python3.5 optional --- tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests.yml b/tests.yml index 395e7ba..97acbc2 100644 --- a/tests.yml +++ b/tests.yml @@ -24,7 +24,7 @@ run: VERSION=2.7 METHOD=virtualenv-seeder-pip ./venv.sh - smoke35: dir: smoke - run: VERSION=3.5 METHOD=virtualenv-no-download ./venv.sh + run: VERSION=3.5 METHOD=virtualenv-no-download INSTALL_OR_SKIP=true ./venv.sh - smoke36: dir: smoke run: VERSION=3.6 METHOD=venv TOX=false ./venv.sh @@ -66,7 +66,6 @@ - gcc - virtualenv - python2.7 - - python3.5 - python3.6 - python3.7 - python3.8 From 1adc399e3dbb9a80f30eb051e22dc19673a735e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 12 Oct 2021 12:10:15 +0200 Subject: [PATCH 40/76] Add Python 3.11 workarounds --- smoke/venv.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index d5da8e2..e6b5b3c 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -49,6 +49,10 @@ python -c 'import sys; print(sys.version)' | head -n1 | grep $VERSION if [ "$VERSION" == "2.6" ]; then pip install pytest pip install Cython --install-option="--no-cython-compile" +elif [ "$VERSION" == "3.11" ]; then + # https://github.com/pytest-dev/py/issues/273 + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PY=1.10.1 python -m pip install https://github.com/pytest-dev/py/archive/refs/heads/master.zip + python -m pip install pytest else python -m pip install pytest if [ "$PYTHON" != "jython" ]; then @@ -67,7 +71,8 @@ EOF python -m pytest -v test_foo.py # check that we can do extension modules -if [ "$PYTHON" != "jython" ]; then +# 3.11 problem: https://github.com/cython/cython/issues/4158 +if [ "$PYTHON" != "jython" ] && [ "$VERSION" != "3.11" ]; then cat > module.pyx << EOF cdef int add(int a, int b): return a + b @@ -128,5 +133,8 @@ deps = pytest commands = python -m pytest -v test_foo.py EOF -# A more complex example with pytest -tox +# A more complex example with pytest (which is broken on Python 3.11) +# https://github.com/pytest-dev/py/issues/273 +if [ "$VERSION" != "3.11" ]; then + tox +fi From beb705f0d0cf6472a4b34b6e1ed4927e6202d2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 29 Oct 2021 16:46:19 +0200 Subject: [PATCH 41/76] Enable Cython test for Python 3.11, using the git master --- smoke/venv.sh | 6 +++--- tests.yml | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index e6b5b3c..a7f13cc 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -53,6 +53,8 @@ elif [ "$VERSION" == "3.11" ]; then # https://github.com/pytest-dev/py/issues/273 SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PY=1.10.1 python -m pip install https://github.com/pytest-dev/py/archive/refs/heads/master.zip python -m pip install pytest + # Cython support for 3.11.0a1+ is not yet released + python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" else python -m pip install pytest if [ "$PYTHON" != "jython" ]; then @@ -70,9 +72,7 @@ EOF python -m pytest -v test_foo.py -# check that we can do extension modules -# 3.11 problem: https://github.com/cython/cython/issues/4158 -if [ "$PYTHON" != "jython" ] && [ "$VERSION" != "3.11" ]; then +if [ "$PYTHON" != "jython" ]; then cat > module.pyx << EOF cdef int add(int a, int b): return a + b diff --git a/tests.yml b/tests.yml index 97acbc2..0975d87 100644 --- a/tests.yml +++ b/tests.yml @@ -37,6 +37,9 @@ - smoke39: dir: smoke run: VERSION=3.9 METHOD=venv ./venv.sh + - smoke311: + dir: smoke + run: VERSION=3.11 METHOD=venv ./venv.sh - smoke39_seeder_pip: dir: smoke run: VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh @@ -70,6 +73,7 @@ - python3.7 - python3.8 - python3.9 + - python3.11 - pypy - pypy3 - python2-devel From c2466c2de546b33a62bd27fdfe8b15a95266432d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 4 Nov 2021 18:26:12 +0100 Subject: [PATCH 42/76] Undo Python 3.11 py workarounds, py 1.11.0 is out with the fix --- smoke/venv.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index a7f13cc..d82973e 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -50,8 +50,6 @@ if [ "$VERSION" == "2.6" ]; then pip install pytest pip install Cython --install-option="--no-cython-compile" elif [ "$VERSION" == "3.11" ]; then - # https://github.com/pytest-dev/py/issues/273 - SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PY=1.10.1 python -m pip install https://github.com/pytest-dev/py/archive/refs/heads/master.zip python -m pip install pytest # Cython support for 3.11.0a1+ is not yet released python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" @@ -133,8 +131,5 @@ deps = pytest commands = python -m pytest -v test_foo.py EOF -# A more complex example with pytest (which is broken on Python 3.11) -# https://github.com/pytest-dev/py/issues/273 -if [ "$VERSION" != "3.11" ]; then - tox -fi +# A more complex example with pytest +tox From bc948d6e50eb6675c7328a5c0a3681cbb7c688cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 8 Mar 2022 01:02:10 +0100 Subject: [PATCH 43/76] Fixup the pypy3 test example --- tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests.yml b/tests.yml index 0975d87..4803bf4 100644 --- a/tests.yml +++ b/tests.yml @@ -49,9 +49,9 @@ - smokepypy: dir: smoke run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh - - smokepypy3: + - smokepypy38: dir: smoke - run: VERSION=3.7 METHOD=venv PYTHON=pypy3.7 ./venv.sh + run: VERSION=3.8 METHOD=venv PYTHON=pypy3.8 ./venv.sh - selftest37: dir: selftest run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh @@ -75,11 +75,10 @@ - python3.9 - python3.11 - pypy - - pypy3 + - pypy3.8-devel - python2-devel - python3-devel - pypy-devel - - pypy3-devel - python3-tox - python3-tkinter - python3-test From 362f438cc677d154be6aa95aab4df3a434ee48c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 7 Mar 2022 21:17:09 +0100 Subject: [PATCH 44/76] Instead of checking for Jython, make it possible to opt-out from the Cython test - we don't have Jython any more and even if we had, we could explicitly opt out from it - we sometimes need to opt out from Cython test in the development versions of Python --- smoke/venv.sh | 9 ++++++--- tests.yml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index d82973e..578c130 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -8,6 +8,7 @@ VERSION=${VERSION:-3.8} PYTHON=${PYTHON:-python$VERSION} METHOD=${METHOD:-venv} TOX=${TOX:-true} +CYTHON=${CYTHON:-true} INSTALL_OR_SKIP=${INSTALL_OR_SKIP:-false} # clean from possible older runs @@ -52,10 +53,12 @@ if [ "$VERSION" == "2.6" ]; then elif [ "$VERSION" == "3.11" ]; then python -m pip install pytest # Cython support for 3.11.0a1+ is not yet released - python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" + if [ "$CYTHON" == "true" ]; then + python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" + fi else python -m pip install pytest - if [ "$PYTHON" != "jython" ]; then + if [ "$CYTHON" == "true" ]; then # We try to fetch a wheel only and if that fails, we disable compilation # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" @@ -70,7 +73,7 @@ EOF python -m pytest -v test_foo.py -if [ "$PYTHON" != "jython" ]; then +if [ "$CYTHON" == "true" ]; then cat > module.pyx << EOF cdef int add(int a, int b): return a + b diff --git a/tests.yml b/tests.yml index 4803bf4..ea20a28 100644 --- a/tests.yml +++ b/tests.yml @@ -39,7 +39,7 @@ run: VERSION=3.9 METHOD=venv ./venv.sh - smoke311: dir: smoke - run: VERSION=3.11 METHOD=venv ./venv.sh + run: VERSION=3.11 METHOD=venv CYTHON=false ./venv.sh - smoke39_seeder_pip: dir: smoke run: VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh From 19a49e86371fe627a3caccb4050af16461fb71d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 8 Mar 2022 01:07:00 +0100 Subject: [PATCH 45/76] Drop no longer relevant conditionals for Python 2.6 --- smoke/venv.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 578c130..8240a21 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -47,18 +47,12 @@ set -u python -c 'import sys; print(sys.version)' | head -n1 | grep $VERSION # install packages with pip -if [ "$VERSION" == "2.6" ]; then - pip install pytest - pip install Cython --install-option="--no-cython-compile" -elif [ "$VERSION" == "3.11" ]; then - python -m pip install pytest - # Cython support for 3.11.0a1+ is not yet released - if [ "$CYTHON" == "true" ]; then +python -m pip install pytest +if [ "$CYTHON" == "true" ]; then + if [ "$VERSION" == "3.11" ]; then + # Cython support for 3.11.0a1+ is not yet released python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" - fi -else - python -m pip install pytest - if [ "$CYTHON" == "true" ]; then + else # We try to fetch a wheel only and if that fails, we disable compilation # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" From db335e1e44d5d60ade988bc1d8605830dc6388f2 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Wed, 16 Mar 2022 17:52:34 +0100 Subject: [PATCH 46/76] Explicitly declare the usage of distutils from Python stdlib for tests setuptools 60+ bundles distutils which then have an impact on the test environment, causing test_with_pip to fail. --- selftest/parallel.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selftest/parallel.sh b/selftest/parallel.sh index 49ec458..14b6e95 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -23,5 +23,10 @@ export OPENSSL_CONF=/non-existing-file # https://bugs.python.org/issue35045 # https://bugs.python.org/issue38815 +# setuptools 60+ uses its own copy of distutils by default +# this setting must be overriden with the environment variable for +# Python tests to use the standard library's distutils +export SETUPTOOLS_USE_DISTUTILS=stdlib + $PYTHON -m test.pythoninfo $PYTHON -m test -wW -j$JOBS $X From fd113d4cf850f513c0932bd534d0d2b4a5366523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Mon, 9 May 2022 12:27:26 +0200 Subject: [PATCH 47/76] Add gcc-c++ dependency to run Python 3.11 test --- tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests.yml b/tests.yml index ea20a28..cc1ab6a 100644 --- a/tests.yml +++ b/tests.yml @@ -67,6 +67,7 @@ required_packages: - dnf - gcc + - gcc-c++ - virtualenv - python2.7 - python3.6 From 18de9ca2b3acd97cfd37149c452c94d2cb7e7c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 9 Jun 2022 11:43:20 +0200 Subject: [PATCH 48/76] Run tests as regular user For this to work, we run the smoke test from a temporary directory, on the CI /var/str/smoke is not writable by non-root. --- smoke/venv.sh | 9 +++++++-- tests.yml | 37 ++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 8240a21..e7bfea2 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -11,8 +11,9 @@ TOX=${TOX:-true} CYTHON=${CYTHON:-true} INSTALL_OR_SKIP=${INSTALL_OR_SKIP:-false} -# clean from possible older runs -rm -rf venv .tox __pycache__ .pytest* test_*.py *.pyx *.c *.so ensurepiptestroot || : +# Work from a custom directory +workdir="$(mktemp --directory)" +cd "$workdir" if [ "$INSTALL_OR_SKIP" == "true" ] && [ ! -f "/usr/bin/$PYTHON" ]; then dnf -y install "/usr/bin/$PYTHON" || : @@ -130,3 +131,7 @@ EOF # A more complex example with pytest tox + +# Clean up if everything else went well +cd - +rm -rf "$workdir" diff --git a/tests.yml b/tests.yml index cc1ab6a..da26cbd 100644 --- a/tests.yml +++ b/tests.yml @@ -6,6 +6,8 @@ - dnf: name: "*" state: latest + - ansible.builtin.user: + name: testuser - hosts: localhost roles: @@ -15,56 +17,57 @@ tests: - smoke_default: dir: smoke - run: ./venv.sh + run: runuser testuser -c './venv.sh' - smoke27: dir: smoke - run: VERSION=2.7 METHOD=virtualenv ./venv.sh + run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv ./venv.sh' - smoke27_seeder_pip: dir: smoke - run: VERSION=2.7 METHOD=virtualenv-seeder-pip ./venv.sh + run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv-seeder-pip ./venv.sh' - smoke35: dir: smoke - run: VERSION=3.5 METHOD=virtualenv-no-download INSTALL_OR_SKIP=true ./venv.sh + run: runuser testuser -c 'VERSION=3.5 METHOD=virtualenv-no-download INSTALL_OR_SKIP=true ./venv.sh' - smoke36: dir: smoke - run: VERSION=3.6 METHOD=venv TOX=false ./venv.sh + run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX=false ./venv.sh' - smoke37: dir: smoke - run: VERSION=3.7 METHOD=venv ./venv.sh + run: runuser testuser -c 'VERSION=3.7 METHOD=venv ./venv.sh' - smoke38: dir: smoke - run: VERSION=3.8 METHOD=venv ./venv.sh + run: runuser testuser -c 'VERSION=3.8 METHOD=venv ./venv.sh' - smoke39: dir: smoke - run: VERSION=3.9 METHOD=venv ./venv.sh + run: runuser testuser -c 'VERSION=3.9 METHOD=venv ./venv.sh' - smoke311: dir: smoke - run: VERSION=3.11 METHOD=venv CYTHON=false ./venv.sh + run: runuser testuser -c 'VERSION=3.11 METHOD=venv CYTHON=false ./venv.sh' - smoke39_seeder_pip: dir: smoke - run: VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh + run: runuser testuser -c 'VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh' - smoke34_optional: dir: smoke - run: VERSION=3.4 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh + run: runuser testuser -c 'VERSION=3.4 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh' - smokepypy: dir: smoke - run: VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh + run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh' - smokepypy38: dir: smoke - run: VERSION=3.8 METHOD=venv PYTHON=pypy3.8 ./venv.sh + run: runuser testuser -c 'VERSION=3.8 METHOD=venv PYTHON=pypy3.8 ./venv.sh' - selftest37: dir: selftest - run: VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh + run: runuser testuser -c 'VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh' - debugtest38: dir: selftest - run: VERSION=3.8 PYTHON="python3-debug" X="test_ssl" ./parallel.sh + run: runuser testuser -c 'VERSION=3.8 PYTHON="python3-debug" X="test_ssl" ./parallel.sh' - debugflags: dir: flags - run: python3-debug ./assertflags.py -O0 + run: runuser testuser -c 'python3-debug ./assertflags.py -O0' - marshalparser_compatibility: dir: marshalparser - run: SAMPLE=10 test_marshalparser_compatibility.sh + run: runuser testuser -c 'SAMPLE=10 test_marshalparser_compatibility.sh' required_packages: + - util-linux # for runuser - dnf - gcc - gcc-c++ From df6c0cef6e7de65f07d6527c22539c5d5b6db815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 16 Nov 2022 00:10:19 +0100 Subject: [PATCH 49/76] Don't set SETUPTOOLS_USE_DISTUTILS=stdlib when distutils does not exist Python 3.12.0a2 removed the standard library distutils module, so we can no longer use it. --- selftest/parallel.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selftest/parallel.sh b/selftest/parallel.sh index 14b6e95..b59ea7c 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -26,7 +26,8 @@ export OPENSSL_CONF=/non-existing-file # setuptools 60+ uses its own copy of distutils by default # this setting must be overriden with the environment variable for # Python tests to use the standard library's distutils -export SETUPTOOLS_USE_DISTUTILS=stdlib +# We only do this if stdlib distutils actually exists +$PYTHON -c 'import distutils' 2>/dev/null && export SETUPTOOLS_USE_DISTUTILS=stdlib || true $PYTHON -m test.pythoninfo $PYTHON -m test -wW -j$JOBS $X From 4c3ed6ec49413f86b3511daed5faedd895c59d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 25 Nov 2022 14:20:23 +0100 Subject: [PATCH 50/76] Try installing the devel package when INSTALL_OR_SKIP is set --- smoke/venv.sh | 5 +++-- tests.yml | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index e7bfea2..362aa33 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -15,8 +15,9 @@ INSTALL_OR_SKIP=${INSTALL_OR_SKIP:-false} workdir="$(mktemp --directory)" cd "$workdir" -if [ "$INSTALL_OR_SKIP" == "true" ] && [ ! -f "/usr/bin/$PYTHON" ]; then - dnf -y install "/usr/bin/$PYTHON" || : +if [ "$INSTALL_OR_SKIP" == "true" ]; then + [ ! -f "/usr/bin/$PYTHON" ] && dnf -y install "/usr/bin/$PYTHON" || : + dnf -y install "$PYTHON-devel" || : if [ ! -f "/usr/bin/$PYTHON" ]; then echo "/usr/bin/$PYTHON not installable, skipping this test" exit 0 diff --git a/tests.yml b/tests.yml index da26cbd..b5c0783 100644 --- a/tests.yml +++ b/tests.yml @@ -48,6 +48,9 @@ - smoke34_optional: dir: smoke run: runuser testuser -c 'VERSION=3.4 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh' + - smoke310_optional: + dir: smoke + run: runuser testuser -c 'VERSION=3.10 METHOD=venv TOX=false INSTALL_OR_SKIP=true ./venv.sh' - smokepypy: dir: smoke run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh' From 51c24d51d16aaa7c16e59ea3d1e8b362ac771554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sat, 26 Nov 2022 22:42:49 +0100 Subject: [PATCH 51/76] dnf install cannot be run as non-root --- tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests.yml b/tests.yml index b5c0783..3fae1fe 100644 --- a/tests.yml +++ b/tests.yml @@ -26,7 +26,7 @@ run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv-seeder-pip ./venv.sh' - smoke35: dir: smoke - run: runuser testuser -c 'VERSION=3.5 METHOD=virtualenv-no-download INSTALL_OR_SKIP=true ./venv.sh' + run: VERSION=3.5 METHOD=virtualenv-no-download INSTALL_OR_SKIP=true ./venv.sh - smoke36: dir: smoke run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX=false ./venv.sh' @@ -47,10 +47,10 @@ run: runuser testuser -c 'VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh' - smoke34_optional: dir: smoke - run: runuser testuser -c 'VERSION=3.4 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh' + run: VERSION=3.4 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh - smoke310_optional: dir: smoke - run: runuser testuser -c 'VERSION=3.10 METHOD=venv TOX=false INSTALL_OR_SKIP=true ./venv.sh' + run: VERSION=3.10 METHOD=venv TOX=false INSTALL_OR_SKIP=true ./venv.sh - smokepypy: dir: smoke run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh' From b9dc63ad158ebeb9e62dee7127e27701b9f05bba Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 10 Jan 2023 13:37:41 +0100 Subject: [PATCH 52/76] Do not use Cython from master branch for Py 3.11 --- smoke/venv.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 362aa33..45ce205 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -51,14 +51,9 @@ python -c 'import sys; print(sys.version)' | head -n1 | grep $VERSION # install packages with pip python -m pip install pytest if [ "$CYTHON" == "true" ]; then - if [ "$VERSION" == "3.11" ]; then - # Cython support for 3.11.0a1+ is not yet released - python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" - else - # We try to fetch a wheel only and if that fails, we disable compilation - # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling - python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" - fi + # We try to fetch a wheel only and if that fails, we disable compilation + # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling + python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" fi # run tests From f022884999fc2effda41887496aeb2632533c422 Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Tue, 17 Jan 2023 17:00:49 +0100 Subject: [PATCH 53/76] Convert selftest into tmt --- selftest/findleaks.fmf | 1 + selftest/main.fmf | 4 ++++ selftest/parallel.fmf | 1 + 3 files changed, 6 insertions(+) create mode 100644 selftest/findleaks.fmf create mode 100644 selftest/main.fmf create mode 100644 selftest/parallel.fmf diff --git a/selftest/findleaks.fmf b/selftest/findleaks.fmf new file mode 100644 index 0000000..4210b54 --- /dev/null +++ b/selftest/findleaks.fmf @@ -0,0 +1 @@ +test: ./findleaks.sh diff --git a/selftest/main.fmf b/selftest/main.fmf new file mode 100644 index 0000000..a5f418e --- /dev/null +++ b/selftest/main.fmf @@ -0,0 +1,4 @@ +require: +- python3-test +- python3-rpm-macros +- python3-tkinter diff --git a/selftest/parallel.fmf b/selftest/parallel.fmf new file mode 100644 index 0000000..5ee2ea3 --- /dev/null +++ b/selftest/parallel.fmf @@ -0,0 +1 @@ +test: ./parallel.sh From 6f4c0d0815d9a2031cfaaf8df685afbdc97ad5ae Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Tue, 17 Jan 2023 17:01:22 +0100 Subject: [PATCH 54/76] Make tmt lint pass for /smoke/venv --- smoke/venv.fmf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smoke/venv.fmf b/smoke/venv.fmf index 91fee9d..fbddbab 100644 --- a/smoke/venv.fmf +++ b/smoke/venv.fmf @@ -21,11 +21,11 @@ description: | * METHOD ... virtual environment creation method (venv, virtualenv) * TOX ... enable or disable the tox test (true, false) -path: smoke +path: /smoke test: ./venv.sh tier: 1 -tags: [venv] +tag: [venv] environment: VERSION: 3.7 From 9a183583999571751e9ebbd62d2fc6b8b22e7ad3 Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Fri, 27 Jan 2023 13:22:52 +0100 Subject: [PATCH 55/76] Extend duration of selftest/parallel E.g. component python3.11 (from C9S) runs whole test suite which can't finish within the default value of 5 minutes. --- selftest/parallel.fmf | 1 + 1 file changed, 1 insertion(+) diff --git a/selftest/parallel.fmf b/selftest/parallel.fmf index 5ee2ea3..b11068f 100644 --- a/selftest/parallel.fmf +++ b/selftest/parallel.fmf @@ -1 +1,2 @@ test: ./parallel.sh +duration: 30m From 6be8056917f0b3d612da5ed5f94fd139e5d1930b Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Tue, 31 Jan 2023 08:21:34 +0100 Subject: [PATCH 56/76] smoke/venv needs gcc Which is not installed by default --- smoke/venv.fmf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smoke/venv.fmf b/smoke/venv.fmf index fbddbab..496b693 100644 --- a/smoke/venv.fmf +++ b/smoke/venv.fmf @@ -27,6 +27,10 @@ test: ./venv.sh tier: 1 tag: [venv] +require+: +- gcc +- gcc-c++ + environment: VERSION: 3.7 METHOD: venv From dc4e662e568a7b1dc1fe5d1f6256c0a3cf405037 Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Thu, 9 Feb 2023 10:14:06 +0100 Subject: [PATCH 57/76] parallel might run test_dtrace Which obviously needs dtrace to be installed. Added recommend as it is better to fail the test not whole plan if it is not possible to install systemtap-sdt-devel by its /usr/bin/dtrace provide --- selftest/parallel.fmf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selftest/parallel.fmf b/selftest/parallel.fmf index b11068f..9794a27 100644 --- a/selftest/parallel.fmf +++ b/selftest/parallel.fmf @@ -1,2 +1,4 @@ test: ./parallel.sh duration: 30m +recommend: +- /usr/bin/dtrace From b9eebf1c79a2bfae9b31a8e00d8c6454c2550a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Thu, 9 Feb 2023 17:04:16 +0100 Subject: [PATCH 58/76] Enable Cython test for Python 3.12, using the git master --- smoke/venv.sh | 11 ++++++++--- tests.yml | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 45ce205..d52ce65 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -51,9 +51,14 @@ python -c 'import sys; print(sys.version)' | head -n1 | grep $VERSION # install packages with pip python -m pip install pytest if [ "$CYTHON" == "true" ]; then - # We try to fetch a wheel only and if that fails, we disable compilation - # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling - python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" + if [ "$VERSION" == "3.12" ]; then + # Cython support for 3.12.0a1+ is not yet released + python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" + else + # We try to fetch a wheel only and if that fails, we disable compilation + # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling + python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" + fi fi # run tests diff --git a/tests.yml b/tests.yml index 3fae1fe..4967277 100644 --- a/tests.yml +++ b/tests.yml @@ -42,6 +42,9 @@ - smoke311: dir: smoke run: runuser testuser -c 'VERSION=3.11 METHOD=venv CYTHON=false ./venv.sh' + - smoke312: + dir: smoke + run: runuser testuser -c 'VERSION=3.12 METHOD=venv ./venv.sh' - smoke39_seeder_pip: dir: smoke run: runuser testuser -c 'VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh' @@ -81,6 +84,7 @@ - python3.8 - python3.9 - python3.11 + - python3.12 - pypy - pypy3.8-devel - python2-devel From 3ff6bdd8ba4e5d72f20bf0384f754dd1d68f07d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 28 Apr 2023 13:16:42 +0200 Subject: [PATCH 59/76] Don't execute setup.py directly, always use pip Since Python 3.12, virtual environments don't have setuptools, instead, pip will install it to an isolated build environment. --- smoke/venv.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index d52ce65..8c0d4c9 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -50,16 +50,6 @@ python -c 'import sys; print(sys.version)' | head -n1 | grep $VERSION # install packages with pip python -m pip install pytest -if [ "$CYTHON" == "true" ]; then - if [ "$VERSION" == "3.12" ]; then - # Cython support for 3.12.0a1+ is not yet released - python -m pip install https://github.com/cython/cython/archive/master.tar.gz --install-option="--no-cython-compile" - else - # We try to fetch a wheel only and if that fails, we disable compilation - # Useful for fresh CPythons, where wheels are not yet ready, but Cython defaults to compiling - python -m pip install Cython --only-binary :all: || python -m pip install Cython --install-option="--no-cython-compile" - fi -fi # run tests cat > test_foo.py << EOF @@ -80,6 +70,12 @@ def two(): return add(a, b) EOF +cat > pyproject.toml << EOF +[build-system] +requires = ["setuptools", "cython"] +build-backend = "setuptools.build_meta" +EOF + cat > setup.py << EOF from setuptools import setup from Cython.Build import cythonize @@ -87,7 +83,7 @@ from Cython.Build import cythonize setup(ext_modules = cythonize('module.pyx')) EOF -python setup.py build_ext --inplace +python -m pip install . python -c 'import module; print(module.two())' | grep '^2$' fi From 548de9fc09d2da17831b6921cb17bf6fc6b9b29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 28 Apr 2023 16:32:49 +0200 Subject: [PATCH 60/76] Run the CI tests of this repo with pypy3.9 instead of retired pypy3.8 --- tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests.yml b/tests.yml index 4967277..b45e22b 100644 --- a/tests.yml +++ b/tests.yml @@ -57,9 +57,9 @@ - smokepypy: dir: smoke run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh' - - smokepypy38: + - smokepypy39: dir: smoke - run: runuser testuser -c 'VERSION=3.8 METHOD=venv PYTHON=pypy3.8 ./venv.sh' + run: runuser testuser -c 'VERSION=3.9 METHOD=venv PYTHON=pypy3.9 ./venv.sh' - selftest37: dir: selftest run: runuser testuser -c 'VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh' @@ -86,7 +86,7 @@ - python3.11 - python3.12 - pypy - - pypy3.8-devel + - pypy3.9-devel - python2-devel - python3-devel - pypy-devel From 6f4fdf29c42fd7272105b7ec00a6b4d12d0ea5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 4 Apr 2024 17:50:39 +0200 Subject: [PATCH 61/76] Allow testing virtualenv with --download --- smoke/venv.sh | 2 ++ tests.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/smoke/venv.sh b/smoke/venv.sh index 8c0d4c9..b6fb842 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -29,6 +29,8 @@ if [ "$METHOD" == "venv" ]; then $PYTHON -m venv venv elif [ "$METHOD" == "virtualenv" ]; then virtualenv --python=$PYTHON venv +elif [ "$METHOD" == "virtualenv-download" ]; then + virtualenv --download --python=$PYTHON venv elif [ "$METHOD" == "virtualenv-no-download" ]; then virtualenv --no-download --python=$PYTHON venv elif [ "$METHOD" == "virtualenv-seeder-pip" ]; then diff --git a/tests.yml b/tests.yml index b45e22b..137cf22 100644 --- a/tests.yml +++ b/tests.yml @@ -54,6 +54,9 @@ - smoke310_optional: dir: smoke run: VERSION=3.10 METHOD=venv TOX=false INSTALL_OR_SKIP=true ./venv.sh + - smoke311_virtualenv_download: + dir: smoke + run: VERSION=3.10 METHOD=virtualenv-download TOX=false ./venv.sh - smokepypy: dir: smoke run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh' From b8d9e52c94d585fd7a35228ea8eec84655facc2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 4 Apr 2024 18:55:22 +0200 Subject: [PATCH 62/76] Update the list of self-tested Pythons python3.7 was retired in f40+ python3.5 is retired everywhere I intentionally kept python3.4 so we have at least one test that is skipped. --- tests.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests.yml b/tests.yml index 137cf22..2e96f16 100644 --- a/tests.yml +++ b/tests.yml @@ -24,15 +24,12 @@ - smoke27_seeder_pip: dir: smoke run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv-seeder-pip ./venv.sh' - - smoke35: - dir: smoke - run: VERSION=3.5 METHOD=virtualenv-no-download INSTALL_OR_SKIP=true ./venv.sh - smoke36: dir: smoke run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX=false ./venv.sh' - smoke37: dir: smoke - run: runuser testuser -c 'VERSION=3.7 METHOD=venv ./venv.sh' + run: VERSION=3.7 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh - smoke38: dir: smoke run: runuser testuser -c 'VERSION=3.8 METHOD=venv ./venv.sh' @@ -63,12 +60,12 @@ - smokepypy39: dir: smoke run: runuser testuser -c 'VERSION=3.9 METHOD=venv PYTHON=pypy3.9 ./venv.sh' - - selftest37: + - selftest39: dir: selftest - run: runuser testuser -c 'VERSION=3.7 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh' - - debugtest38: + run: runuser testuser -c 'VERSION=3.9 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh' + - debugtest310: dir: selftest - run: runuser testuser -c 'VERSION=3.8 PYTHON="python3-debug" X="test_ssl" ./parallel.sh' + run: runuser testuser -c 'VERSION=3.10 PYTHON="python3.10d" X="test_ssl" ./parallel.sh' - debugflags: dir: flags run: runuser testuser -c 'python3-debug ./assertflags.py -O0' @@ -83,7 +80,6 @@ - virtualenv - python2.7 - python3.6 - - python3.7 - python3.8 - python3.9 - python3.11 @@ -97,5 +93,6 @@ - python3-tkinter - python3-test - python3-debug + - python3.10-debug - python3-rpm-macros - marshalparser From 800608da2ebbf1f5c2dd387a585c7764622aff69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 1 Aug 2024 14:57:45 +0200 Subject: [PATCH 63/76] Allow to check explicit flags in assertflags.py --- flags/assertflags.py | 6 +++++- tests.yml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/flags/assertflags.py b/flags/assertflags.py index c7f0b08..6b15d2c 100644 --- a/flags/assertflags.py +++ b/flags/assertflags.py @@ -14,6 +14,9 @@ the last such option is the one that is effective." import sys import sysconfig +# We will check all flags if none were requested +KEYS_TO_CHECK = sys.argv[2:] or list(sysconfig.get_config_vars().keys()) + # The flags that currently don't have the -Og flag on the debug build # and we consider it OK, because we don't know any better :) SKIP = [ @@ -26,9 +29,10 @@ SKIP = [ print('Expecting that {} is the last -O flag:\n'.format(sys.argv[1])) ret = 0 -for key, flags in sysconfig.get_config_vars().items(): +for key in KEYS_TO_CHECK: if key in SKIP: continue + flags = sysconfig.get_config_vars()[key] if isinstance(flags, str): oflags = [f for f in flags.split(' ') if f.startswith('-O')] if oflags and oflags[-1] != sys.argv[1]: diff --git a/tests.yml b/tests.yml index 2e96f16..c321f7e 100644 --- a/tests.yml +++ b/tests.yml @@ -69,6 +69,9 @@ - debugflags: dir: flags run: runuser testuser -c 'python3-debug ./assertflags.py -O0' + - debugflags_some: + dir: flags + run: runuser testuser -c 'python3-debug ./assertflags.py -O0 PY_STDMODULE_CFLAGS' - marshalparser_compatibility: dir: marshalparser run: runuser testuser -c 'SAMPLE=10 test_marshalparser_compatibility.sh' From a0a96e272169552db546a94e44151002c0af5dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 11 Sep 2024 19:57:24 +0200 Subject: [PATCH 64/76] Add --timeout to selftest/parallel.sh --- selftest/parallel.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/selftest/parallel.sh b/selftest/parallel.sh index b59ea7c..6471f33 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -11,6 +11,8 @@ PYTHON=${PYTHON:-python$VERSION} # test_socket swaps and kills the machine https://bugs.python.org/issue34587 X=${X:-"-x test_socket"} +TIMEOUT=${TIMEOUT:-1800} + # parallel jobs, 0 lets Python decide what's best JOBS=${JOBS:-0} @@ -30,4 +32,4 @@ export OPENSSL_CONF=/non-existing-file $PYTHON -c 'import distutils' 2>/dev/null && export SETUPTOOLS_USE_DISTUTILS=stdlib || true $PYTHON -m test.pythoninfo -$PYTHON -m test -wW -j$JOBS $X +$PYTHON -m test -wW -j$JOBS --timeout=$TIMEOUT $X From 1ad7f0cc253e8e7e69da69e71e12f2f21dd0e685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 11 Sep 2024 20:14:34 +0200 Subject: [PATCH 65/76] Skip Python 2.7 tests on rawhide --- tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests.yml b/tests.yml index c321f7e..ff5b7dc 100644 --- a/tests.yml +++ b/tests.yml @@ -20,10 +20,10 @@ run: runuser testuser -c './venv.sh' - smoke27: dir: smoke - run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv ./venv.sh' + run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv ./venv.sh - smoke27_seeder_pip: dir: smoke - run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv-seeder-pip ./venv.sh' + run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv-seeder-pip ./venv.sh - smoke36: dir: smoke run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX=false ./venv.sh' @@ -81,7 +81,6 @@ - gcc - gcc-c++ - virtualenv - - python2.7 - python3.6 - python3.8 - python3.9 @@ -89,7 +88,6 @@ - python3.12 - pypy - pypy3.9-devel - - python2-devel - python3-devel - pypy-devel - python3-tox From 5ffff08833c151f9a38660a30acfb0357829f8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 10 Sep 2024 17:58:27 +0200 Subject: [PATCH 66/76] Do not skip a flag without -O, if the flag is checked explicitly --- flags/assertflags.py | 8 ++++++-- tests.yml | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/flags/assertflags.py b/flags/assertflags.py index 6b15d2c..9262a58 100644 --- a/flags/assertflags.py +++ b/flags/assertflags.py @@ -16,6 +16,10 @@ import sysconfig # We will check all flags if none were requested KEYS_TO_CHECK = sys.argv[2:] or list(sysconfig.get_config_vars().keys()) +# For backwards compatibility, if no flags were provided, we assume flags without -O are to be skipped +# But when we provide explicit list of flags, we assert they get the options, +# so we can assert things like "CFLAGS has -O3" vs. "CFLAGS has no -O at all" +NO_FLAG_FAILS = bool(sys.argv[2:]) # The flags that currently don't have the -Og flag on the debug build # and we consider it OK, because we don't know any better :) @@ -35,8 +39,8 @@ for key in KEYS_TO_CHECK: flags = sysconfig.get_config_vars()[key] if isinstance(flags, str): oflags = [f for f in flags.split(' ') if f.startswith('-O')] - if oflags and oflags[-1] != sys.argv[1]: - print('Problem in {} -O flags: {}'.format(key, ' '.join(oflags))) + if (oflags and oflags[-1] != sys.argv[1]) or (not oflags and NO_FLAG_FAILS): + print('Problem in {} -O flags: {}'.format(key, ' '.join(oflags) or '')) ret = 1 elif oflags: print('{} are OK'.format(key)) diff --git a/tests.yml b/tests.yml index ff5b7dc..6f32fa9 100644 --- a/tests.yml +++ b/tests.yml @@ -72,6 +72,9 @@ - debugflags_some: dir: flags run: runuser testuser -c 'python3-debug ./assertflags.py -O0 PY_STDMODULE_CFLAGS' + - optflags_o3: + dir: flags + run: runuser testuser -c 'python3 ./assertflags.py -O3 CFLAGS' - marshalparser_compatibility: dir: marshalparser run: runuser testuser -c 'SAMPLE=10 test_marshalparser_compatibility.sh' From 5c46fa4679061b1861a18997250d2986c5f08b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 11 Nov 2024 16:59:01 +0100 Subject: [PATCH 67/76] Inject $TOX_REQUIRES to tox config E.g. use TOX_REQUIRES="virtualenv<20.22.0" to test tox provision for old Pythons. --- smoke/venv.fmf | 1 + smoke/venv.sh | 15 +++++++++++---- tests.yml | 6 +++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/smoke/venv.fmf b/smoke/venv.fmf index 496b693..805ca8b 100644 --- a/smoke/venv.fmf +++ b/smoke/venv.fmf @@ -35,6 +35,7 @@ environment: VERSION: 3.7 METHOD: venv TOX: true + TOX_REQUIRES: "" duration: 10m component+: - python2 diff --git a/smoke/venv.sh b/smoke/venv.sh index b6fb842..c7e7d20 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -8,6 +8,7 @@ VERSION=${VERSION:-3.8} PYTHON=${PYTHON:-python$VERSION} METHOD=${METHOD:-venv} TOX=${TOX:-true} +TOX_REQUIRES=${TOX_REQUIRES:-} CYTHON=${CYTHON:-true} INSTALL_OR_SKIP=${INSTALL_OR_SKIP:-false} @@ -109,8 +110,11 @@ else export TOXENV=$PYTHON fi -cat > tox.ini << EOF -[tox] +echo '[tox]' > tox.ini +if [ -n "$TOX_REQUIRES" ]; then + echo 'requires = '"$TOX_REQUIRES" >> tox.ini +fi +cat >> tox.ini << EOF skipsdist = True [testenv] commands = python -c 'import sys; print(sys.version)' @@ -120,8 +124,11 @@ EOF tox | tee toxlog grep "^$VERSION\.[0-9]" toxlog -cat > tox.ini << EOF -[tox] +echo '[tox]' > tox.ini +if [ -n "$TOX_REQUIRES" ]; then + echo 'requires = '"$TOX_REQUIRES" >> tox.ini +fi +cat >> tox.ini << EOF skipsdist = True [testenv] deps = pytest diff --git a/tests.yml b/tests.yml index 6f32fa9..172881b 100644 --- a/tests.yml +++ b/tests.yml @@ -20,13 +20,13 @@ run: runuser testuser -c './venv.sh' - smoke27: dir: smoke - run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv ./venv.sh + run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv TOX_REQUIRES="virtualenv<20.22.0" ./venv.sh - smoke27_seeder_pip: dir: smoke - run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv-seeder-pip ./venv.sh + run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv-seeder-pip TOX=false ./venv.sh - smoke36: dir: smoke - run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX=false ./venv.sh' + run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX_REQUIRES="virtualenv<20.22.0" ./venv.sh' - smoke37: dir: smoke run: VERSION=3.7 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh From 085416c781f6c1a139a49d66c521538c0c62c636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 13 May 2025 20:42:25 +0200 Subject: [PATCH 68/76] Make venv.sh work with versions like 3.13t --- smoke/venv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index c7e7d20..39d7186 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -49,7 +49,7 @@ source venv/bin/activate set -u # run python in it -python -c 'import sys; print(sys.version)' | head -n1 | grep $VERSION +python -c 'import sys; print(sys.version)' | head -n1 | grep ${VERSION/t} # install packages with pip python -m pip install pytest @@ -122,7 +122,7 @@ EOF # Tests that the Python version used in tox is really the Python version we want tox | tee toxlog -grep "^$VERSION\.[0-9]" toxlog +grep "^${VERSION/t}\.[0-9]" toxlog echo '[tox]' > tox.ini if [ -n "$TOX_REQUIRES" ]; then From 223296d711c2d6c2590b23bc2533d6bbe64fa0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 10 Jul 2025 11:41:39 +0200 Subject: [PATCH 69/76] Allow skipping virtual environment tests This is useful for tox end ensurepip tests for pypy 2.7. --- smoke/venv.sh | 16 +++++++++++----- tests.yml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 39d7186..56ffd1e 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -36,11 +36,20 @@ elif [ "$METHOD" == "virtualenv-no-download" ]; then virtualenv --no-download --python=$PYTHON venv elif [ "$METHOD" == "virtualenv-seeder-pip" ]; then virtualenv --seeder pip --python=$PYTHON venv +elif [ "$METHOD" == "none" ]; then + echo 'Skipping plain virtual environment tests' >&2 else echo 'Unsupported $METHOD' $METHOD >&2 exit 1 fi +# create tests +cat > test_foo.py << EOF +def test_foo(): + assert True +EOF + +if [ "$METHOD" != "none" ]; then # and activate it # unset variables on 3.5, it's known @@ -55,11 +64,6 @@ python -c 'import sys; print(sys.version)' | head -n1 | grep ${VERSION/t} python -m pip install pytest # run tests -cat > test_foo.py << EOF -def test_foo(): - assert True -EOF - python -m pytest -v test_foo.py if [ "$CYTHON" == "true" ]; then @@ -96,6 +100,8 @@ set +u deactivate set -u +fi # METHOD != none + # ensurepip test (when testing virtualenv, this was not covered) # with the main Python, this will say "Requirement already satisfied", but that's OK $PYTHON -m ensurepip --root ensurepiptestroot diff --git a/tests.yml b/tests.yml index 172881b..ec2599e 100644 --- a/tests.yml +++ b/tests.yml @@ -56,7 +56,7 @@ run: VERSION=3.10 METHOD=virtualenv-download TOX=false ./venv.sh - smokepypy: dir: smoke - run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh' + run: runuser testuser -c 'VERSION=2.7 METHOD=none PYTHON=pypy TOX_REQUIRES="virtualenv<20.22.0" ./venv.sh' - smokepypy39: dir: smoke run: runuser testuser -c 'VERSION=3.9 METHOD=venv PYTHON=pypy3.9 ./venv.sh' From 5a345b59d64fab58337d4b094925e13bcda626d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 10 Jul 2025 12:34:24 +0200 Subject: [PATCH 70/76] Adjust the test cases here for rawhide --- tests.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests.yml b/tests.yml index ec2599e..02a52fa 100644 --- a/tests.yml +++ b/tests.yml @@ -32,7 +32,7 @@ run: VERSION=3.7 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh - smoke38: dir: smoke - run: runuser testuser -c 'VERSION=3.8 METHOD=venv ./venv.sh' + run: VERSION=3.8 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh - smoke39: dir: smoke run: runuser testuser -c 'VERSION=3.9 METHOD=venv ./venv.sh' @@ -57,9 +57,9 @@ - smokepypy: dir: smoke run: runuser testuser -c 'VERSION=2.7 METHOD=none PYTHON=pypy TOX_REQUIRES="virtualenv<20.22.0" ./venv.sh' - - smokepypy39: + - smokepypy310: dir: smoke - run: runuser testuser -c 'VERSION=3.9 METHOD=venv PYTHON=pypy3.9 ./venv.sh' + run: runuser testuser -c 'VERSION=3.10 METHOD=venv PYTHON=pypy3.10 ./venv.sh' - selftest39: dir: selftest run: runuser testuser -c 'VERSION=3.9 X="-x test_socket -x test_asyncgen -x test_asyncio -x test_compile -x test_concurrent_futures -x test_itertools -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_shutil -x test_time -x test_multiprocessing_spawn -x test_threading -x test_wsgiref" ./parallel.sh' @@ -85,12 +85,11 @@ - gcc-c++ - virtualenv - python3.6 - - python3.8 - python3.9 - python3.11 - python3.12 - pypy - - pypy3.9-devel + - pypy3.10-devel - python3-devel - pypy-devel - python3-tox From 018063867cbba031e2e7329296804fc9f5598f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 24 Oct 2025 12:58:39 +0200 Subject: [PATCH 71/76] INSTALL_OR_SKIP: Support python3.X-freethreading-devel installation It assumed python3.Xt-devel package name and that is not correct, this way, we go for files and we don't care what package they are in. All our Pythons have the -config file, but not PyPys, so we keep that installation optional (unchecked) and we keep the original -devel installation as well. --- smoke/venv.sh | 1 + tests.yml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/smoke/venv.sh b/smoke/venv.sh index 56ffd1e..4088279 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -18,6 +18,7 @@ cd "$workdir" if [ "$INSTALL_OR_SKIP" == "true" ]; then [ ! -f "/usr/bin/$PYTHON" ] && dnf -y install "/usr/bin/$PYTHON" || : + [ ! -f "/usr/bin/${PYTHON}-config" ] && dnf -y install "/usr/bin/${PYTHON}-config" || : dnf -y install "$PYTHON-devel" || : if [ ! -f "/usr/bin/$PYTHON" ]; then echo "/usr/bin/$PYTHON not installable, skipping this test" diff --git a/tests.yml b/tests.yml index 02a52fa..fae8c2a 100644 --- a/tests.yml +++ b/tests.yml @@ -42,6 +42,9 @@ - smoke312: dir: smoke run: runuser testuser -c 'VERSION=3.12 METHOD=venv ./venv.sh' + - smoke314t_optional: + dir: smoke + run: VERSION=3.14t METHOD=venv INSTALL_OR_SKIP=true ./venv.sh - smoke39_seeder_pip: dir: smoke run: runuser testuser -c 'VERSION=3.9 METHOD=virtualenv-seeder-pip ./venv.sh' From dfd41a9acf82944785e4c6a50812c8d63c5f42ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 13 May 2026 17:02:07 +0200 Subject: [PATCH 72/76] When CPython tests fail, exit with 1 to signal failure (rather than error) --- selftest/parallel.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/selftest/parallel.sh b/selftest/parallel.sh index 6471f33..588255d 100755 --- a/selftest/parallel.sh +++ b/selftest/parallel.sh @@ -32,4 +32,10 @@ export OPENSSL_CONF=/non-existing-file $PYTHON -c 'import distutils' 2>/dev/null && export SETUPTOOLS_USE_DISTUTILS=stdlib || true $PYTHON -m test.pythoninfo -$PYTHON -m test -wW -j$JOBS --timeout=$TIMEOUT $X +$PYTHON -m test -wW -j$JOBS --timeout=$TIMEOUT $X && e=0 || e=$? +# https://tmt.readthedocs.io/en/stable/spec/tests.html#framework says only exit code 1 is failure, rest is error +# https://github.com/python/cpython/blob/v3.14.0/Lib/test/libregrtest/results.py#L18 says a bad test exits with 2 +if [ $e -eq 2 ]; then + exit 1 +fi +exit $e From b4af9ca880f132639f66279405874b2a6d94d6c8 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 24 Jun 2026 22:05:28 +0200 Subject: [PATCH 73/76] Add new test that monitors symbols required from dynamic compiled libs --- required-symbols/check.sh | 73 +++++++++++++++++++++++++++++ required-symbols/collect_symbols.py | 56 ++++++++++++++++++++++ required-symbols/compare_symbols.py | 41 ++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100755 required-symbols/check.sh create mode 100755 required-symbols/collect_symbols.py create mode 100755 required-symbols/compare_symbols.py diff --git a/required-symbols/check.sh b/required-symbols/check.sh new file mode 100755 index 0000000..afce753 --- /dev/null +++ b/required-symbols/check.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# Compare required external symbols of compiled Python extension modules between +# the PR build (pre-installed by Testing Farm) and the latest stable version +# available in the distribution repositories. +# +# The PR build is already installed before this test runs (via the Testing Farm +# artifact mechanism). We save its .so files, downgrade to the stable repo version, +# collect symbols from both, and compare. +# +# Output: +# + [module] symbol — PR build adds a new required symbol (potential issue possibly requiring update of Requires) +# - [module] symbol — PR build drops a previously required symbol (generally OK) +# +# Exit codes: +# 0 — no changes, or no stable version available to compare against (skipped) +# 1 — symbol differences detected between PR build and stable release +set -eo pipefail + +PYVER=${VERSION} +SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" + +# Directories containing compiled extension modules +SCAN_DIRS=() +for d in "/usr/lib64/python${PYVER}" "/usr/lib64/python${PYVER}t"; do + [ -d "$d" ] && SCAN_DIRS+=("$d") +done + +if [ ${#SCAN_DIRS[@]} -eq 0 ]; then + echo "ERROR: No Python extension directories found for python${PYVER}" >&2 + exit 1 +fi + +WORK_DIR=$(mktemp -d) +trap 'rm -rf "$WORK_DIR"' EXIT + +echo "=== Collecting PR build symbols ===" +python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_DIRS[@]}" > "$WORK_DIR/new.json" + +# Downgrade to the latest stable version in the distribution repos. +# If no older version is available, there is nothing to compare against → skip. +echo "" +echo "=== Available repos ===" +dnf repolist --all + +echo "" +echo "=== Downgrading to the latest stable version in repos ===" +# Discover packages dynamically from the installed source RPM so we don't need +# to hardcode subpackage names — works regardless of which subpackages were built. +readarray -t PKGS < <( + rpm -qa --qf '%{SOURCERPM} %{NAME}\n' | + awk -v src="python${PYVER}" '$1 ~ "^" src "-[0-9]" { print $2 }' | + sort -u +) +echo "Packages to downgrade: ${PKGS[*]}" + +if ! dnf downgrade -y "${PKGS[@]}" 2>&1; then + echo "INFO: dnf downgrade failed or no stable version available; skipping comparison." >&2 + exit 0 +fi + +echo "" +echo "=== Collecting stable version symbols ===" +python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_DIRS[@]}" > "$WORK_DIR/old.json" + +echo "" +echo "=== Comparing PR build against stable ===" +python${PYVER} "$SCRIPT_DIR/compare_symbols.py" "$WORK_DIR/old.json" "$WORK_DIR/new.json" || COMPARE_RC=$? + +echo "" +echo "=== Reverting package downgrade ===" +dnf history undo last -y 2>&1 + +exit ${COMPARE_RC:-0} diff --git a/required-symbols/collect_symbols.py b/required-symbols/collect_symbols.py new file mode 100755 index 0000000..9550a39 --- /dev/null +++ b/required-symbols/collect_symbols.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +""" +Collect undefined non-boring external symbols from compiled Python extension modules. + +Usage: collect_symbols.py [...] + +Scans all *.cpython-*.so files found recursively, unions symbols across all +variants of each module (regular/debug/freethreading), and prints JSON to stdout. +""" + +import json +import re +import subprocess +import sys +from pathlib import Path + +BORING = re.compile( + r"@GLIBC_" # glibc versioned symbols (stable by definition) + r"|@GCC_" # GCC built-ins + r"|^_?Py[A-Za-z_]" # Python C API (resolved from libpython at runtime) + r"|^__" # C runtime internals + r"|^_ITM_" # Intel transactional memory +) + + +def module_name(so: Path) -> str: + # Strip ABI tag (d=debug, t=freethreading, td=both) so variants of the same + # module merge together: _ssl.cpython-314td-x86_64-linux-gnu.so → _ssl + return re.sub(r"\.cpython-\d+[a-z]*-[^.]+\.so$", "", so.name) + + +def external_symbols(so: Path) -> list[str]: + result = subprocess.run(["nm", "-D", str(so)], capture_output=True, text=True) + return sorted( + parts[-1] + for line in result.stdout.splitlines() + if len(parts := line.split()) >= 2 + and parts[-2] == "U" + and not BORING.search(parts[-1]) + ) + + +modules: dict[str, set[str]] = {} +for path_arg in sys.argv[1:]: + print(f"Scanning: {path_arg}", file=sys.stderr) + for so in sorted(Path(path_arg).rglob("*.cpython-*.so")): + if so.is_symlink(): + continue + if syms := external_symbols(so): + modules.setdefault(module_name(so), set()).update(syms) + +total_symbols = sum(len(v) for v in modules.values()) +print(f"Found {len(modules)} modules, {total_symbols} tracked symbols", file=sys.stderr) + +json.dump({k: sorted(v) for k, v in sorted(modules.items())}, sys.stdout, indent=2) +print() diff --git a/required-symbols/compare_symbols.py b/required-symbols/compare_symbols.py new file mode 100755 index 0000000..2692993 --- /dev/null +++ b/required-symbols/compare_symbols.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +""" +Compare two symbol JSON files produced by collect_symbols.py. + +Usage: compare_symbols.py + +Output: + + [module] symbol — new build adds a required symbol the old build did not have + - [module] symbol — new build drops a required symbol the old build had + +Exit codes: + 0 — no differences + 1 — differences found +""" + +import json +import sys +from pathlib import Path + +old = json.loads(Path(sys.argv[1]).read_text()) +new = json.loads(Path(sys.argv[2]).read_text()) + +all_mods = sorted(set(old) | set(new)) +changes = [] +for mod in all_mods: + added = sorted(set(new.get(mod, [])) - set(old.get(mod, []))) + removed = sorted(set(old.get(mod, [])) - set(new.get(mod, []))) + if added or removed: + changes.append((mod, added, removed)) + +if not changes: + print("OK: no symbol changes between stable and PR build") + sys.exit(0) + +print("Symbol changes detected (+ new requirement in PR build, - dropped by PR build):") +for mod, added, removed in changes: + for sym in added: + print(f" + [{mod}] {sym}") + for sym in removed: + print(f" - [{mod}] {sym}") +sys.exit(1) From 533e84657e3a4b051d01a7ede156562308790162 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 1 Jul 2026 14:43:13 +0200 Subject: [PATCH 74/76] Include libpython .so files into scanned files --- required-symbols/check.sh | 9 +++++-- required-symbols/collect_symbols.py | 37 +++++++++++++++++++---------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/required-symbols/check.sh b/required-symbols/check.sh index afce753..ae328ca 100755 --- a/required-symbols/check.sh +++ b/required-symbols/check.sh @@ -30,11 +30,16 @@ if [ ${#SCAN_DIRS[@]} -eq 0 ]; then exit 1 fi +SCAN_ARGS=("${SCAN_DIRS[@]}") +for f in /usr/lib64/libpython${PYVER}*.so.*; do + [[ -f "$f" && ! -L "$f" ]] && SCAN_ARGS+=("$f") +done + WORK_DIR=$(mktemp -d) trap 'rm -rf "$WORK_DIR"' EXIT echo "=== Collecting PR build symbols ===" -python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_DIRS[@]}" > "$WORK_DIR/new.json" +python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_ARGS[@]}" > "$WORK_DIR/new.json" # Downgrade to the latest stable version in the distribution repos. # If no older version is available, there is nothing to compare against → skip. @@ -60,7 +65,7 @@ fi echo "" echo "=== Collecting stable version symbols ===" -python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_DIRS[@]}" > "$WORK_DIR/old.json" +python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_ARGS[@]}" > "$WORK_DIR/old.json" echo "" echo "=== Comparing PR build against stable ===" diff --git a/required-symbols/collect_symbols.py b/required-symbols/collect_symbols.py index 9550a39..983c223 100755 --- a/required-symbols/collect_symbols.py +++ b/required-symbols/collect_symbols.py @@ -1,11 +1,14 @@ #!/usr/bin/env python3 """ -Collect undefined non-boring external symbols from compiled Python extension modules. +Collect undefined non-boring external symbols from compiled Python extension modules +and libpython shared libraries. -Usage: collect_symbols.py [...] +Usage: collect_symbols.py [...] -Scans all *.cpython-*.so files found recursively, unions symbols across all -variants of each module (regular/debug/freethreading), and prints JSON to stdout. +Each path may be a directory (scanned recursively for *.cpython-*.so) or a file +(scanned directly; intended for libpython*.so.* passed explicitly from the caller). +Symbols are unioned across all variants of each module (regular/debug/freethreading), +and the result is printed as JSON to stdout. """ import json @@ -24,9 +27,11 @@ BORING = re.compile( def module_name(so: Path) -> str: - # Strip ABI tag (d=debug, t=freethreading, td=both) so variants of the same - # module merge together: _ssl.cpython-314td-x86_64-linux-gnu.so → _ssl - return re.sub(r"\.cpython-\d+[a-z]*-[^.]+\.so$", "", so.name) + # _ssl.cpython-314td-x86_64-linux-gnu.so → _ssl + if m := re.match(r"(.+?)\.cpython-", so.name): + return m.group(1) + # libpython3.14.so.1.0 → libpython3.14 + return re.sub(r"\.so.*$", "", so.name) def external_symbols(so: Path) -> list[str]: @@ -42,12 +47,18 @@ def external_symbols(so: Path) -> list[str]: modules: dict[str, set[str]] = {} for path_arg in sys.argv[1:]: - print(f"Scanning: {path_arg}", file=sys.stderr) - for so in sorted(Path(path_arg).rglob("*.cpython-*.so")): - if so.is_symlink(): - continue - if syms := external_symbols(so): - modules.setdefault(module_name(so), set()).update(syms) + p = Path(path_arg) + if p.is_file(): + print(f"Scanning: {p.name}", file=sys.stderr) + if syms := external_symbols(p): + modules.setdefault(module_name(p), set()).update(syms) + else: + print(f"Scanning: {path_arg}", file=sys.stderr) + for so in sorted(p.rglob("*.cpython-*.so")): + if so.is_symlink(): + continue + if syms := external_symbols(so): + modules.setdefault(module_name(so), set()).update(syms) total_symbols = sum(len(v) for v in modules.values()) print(f"Found {len(modules)} modules, {total_symbols} tracked symbols", file=sys.stderr) From 3bc0535c27d7f3e1e33d75035ae065fc5200040c Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 7 Jul 2026 08:32:41 +0200 Subject: [PATCH 75/76] Make sure the downgrade operation is always reverted --- required-symbols/check.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/required-symbols/check.sh b/required-symbols/check.sh index ae328ca..f0727f9 100755 --- a/required-symbols/check.sh +++ b/required-symbols/check.sh @@ -19,6 +19,19 @@ set -eo pipefail PYVER=${VERSION} SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" +WORK_DIR="" +DOWNGRADED=false + +cleanup() { + if [[ "$DOWNGRADED" == true ]]; then + echo "" + echo "=== Reverting package downgrade ===" + dnf history undo last -y 2>&1 || echo "WARNING: dnf history undo failed" >&2 + fi + [[ -n "$WORK_DIR" ]] && rm -rf "$WORK_DIR" +} +trap cleanup EXIT + # Directories containing compiled extension modules SCAN_DIRS=() for d in "/usr/lib64/python${PYVER}" "/usr/lib64/python${PYVER}t"; do @@ -36,7 +49,6 @@ for f in /usr/lib64/libpython${PYVER}*.so.*; do done WORK_DIR=$(mktemp -d) -trap 'rm -rf "$WORK_DIR"' EXIT echo "=== Collecting PR build symbols ===" python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_ARGS[@]}" > "$WORK_DIR/new.json" @@ -62,6 +74,7 @@ if ! dnf downgrade -y "${PKGS[@]}" 2>&1; then echo "INFO: dnf downgrade failed or no stable version available; skipping comparison." >&2 exit 0 fi +DOWNGRADED=true echo "" echo "=== Collecting stable version symbols ===" @@ -69,10 +82,4 @@ python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_ARGS[@]}" > "$WORK_DIR/o echo "" echo "=== Comparing PR build against stable ===" -python${PYVER} "$SCRIPT_DIR/compare_symbols.py" "$WORK_DIR/old.json" "$WORK_DIR/new.json" || COMPARE_RC=$? - -echo "" -echo "=== Reverting package downgrade ===" -dnf history undo last -y 2>&1 - -exit ${COMPARE_RC:-0} +python${PYVER} "$SCRIPT_DIR/compare_symbols.py" "$WORK_DIR/old.json" "$WORK_DIR/new.json" From a83a4480c009c4ac68566c019116f77863d30cae Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 13 Jul 2026 12:13:27 +0200 Subject: [PATCH 76/76] Use reinstall and distrosync instead of downgrade to cover more use-cases --- required-symbols/check.sh | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/required-symbols/check.sh b/required-symbols/check.sh index f0727f9..797f024 100755 --- a/required-symbols/check.sh +++ b/required-symbols/check.sh @@ -20,12 +20,12 @@ PYVER=${VERSION} SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" WORK_DIR="" -DOWNGRADED=false +PKGS_MODIFIED=false cleanup() { - if [[ "$DOWNGRADED" == true ]]; then + if [[ "$PKGS_MODIFIED" == true ]]; then echo "" - echo "=== Reverting package downgrade ===" + echo "=== Reverting package changes ===" dnf history undo last -y 2>&1 || echo "WARNING: dnf history undo failed" >&2 fi [[ -n "$WORK_DIR" ]] && rm -rf "$WORK_DIR" @@ -53,14 +53,10 @@ WORK_DIR=$(mktemp -d) echo "=== Collecting PR build symbols ===" python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_ARGS[@]}" > "$WORK_DIR/new.json" -# Downgrade to the latest stable version in the distribution repos. -# If no older version is available, there is nothing to compare against → skip. echo "" echo "=== Available repos ===" dnf repolist --all -echo "" -echo "=== Downgrading to the latest stable version in repos ===" # Discover packages dynamically from the installed source RPM so we don't need # to hardcode subpackage names — works regardless of which subpackages were built. readarray -t PKGS < <( @@ -68,13 +64,24 @@ readarray -t PKGS < <( awk -v src="python${PYVER}" '$1 ~ "^" src "-[0-9]" { print $2 }' | sort -u ) -echo "Packages to downgrade: ${PKGS[*]}" +echo "Packages to install from stable repos: ${PKGS[*]}" -if ! dnf downgrade -y "${PKGS[@]}" 2>&1; then - echo "INFO: dnf downgrade failed or no stable version available; skipping comparison." >&2 - exit 0 +# Install the stable version from distribution repos, excluding the artifact repo +# that carries the PR build, so we always compare against what is publicly available. +# +# Strategy: +# 1. dnf reinstall — works when the PR did not bump NVR (same version in stable repos) +# 2. dnf distro-sync — fallback when the PR bumped NVR; installs the latest stable NVR +echo "" +echo "=== Installing stable version from repos ===" +if ! dnf reinstall -y --disablerepo=test-artifacts "${PKGS[@]}" 2>&1; then + echo "INFO: reinstall failed (NVR not in stable repos), falling back to distro-sync" >&2 + if ! dnf distro-sync -y --disablerepo=test-artifacts "${PKGS[@]}" 2>&1; then + echo "INFO: distro-sync failed; no stable version available, skipping comparison." >&2 + exit 0 + fi fi -DOWNGRADED=true +PKGS_MODIFIED=true echo "" echo "=== Collecting stable version symbols ==="