#24 Reenable test_distutils and test_bdist_rpm
Closed 4 years ago by churchyard. Opened 4 years ago by vstinner.
rpms/ vstinner/python38 reenable_test_distutils  into  master

file modified
+8 -4
@@ -204,8 +204,8 @@ 

  %endif

  

  %if %{without bootstrap}

- # for make regen-all

- BuildRequires: python3

+ # for make regen-all and distutils.tests.test_bdist_rpm

+ BuildRequires: python%{pyshortver}

  %endif

  

  # =======================
@@ -625,7 +625,7 @@ 

  

  %if %{without bootstrap}

    # Regenerate generated files (needs python3)

-   %make_build regen-all PYTHON_FOR_REGEN="python3"

+   %make_build regen-all PYTHON_FOR_REGEN="python%{pybasever}"

  %endif

  

  
@@ -952,10 +952,14 @@ 

    #   https://bugzilla.redhat.com/show_bug.cgi?id=1678277

    # test_asyncio skipped:

    #   https://bugs.python.org/issue35998

+   # test_distutils

+   #   distutils.tests.test_bdist_rpm tests fail when bootstraping the Python

+   #   package: rpmbuild requires /usr/bin/pythonX.Y to be installed

    LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \

      -wW --slowest -j0 \

+     %if %{with bootstrap}

      -x test_distutils \

-     -x test_bdist_rpm \

+     %endif

      %ifarch %{arm} s390x

      -x test_gdb \

      %endif

Resolves: rhbz#1685557

test_bdist_rpm requires /usr/bin/python3, doesn't it? could you test with bootstrap?

test_bdist_rpm requires /usr/bin/python3, doesn't it? could you test with bootstrap?

I'm sorry, I don't know how to test with bootstrap. Would you mind to ping me to explain me that once your are available?

I can. Before we ping each other, here is how:

  1. locate the bcond bootstrap definition in the specifle (%bcond_with bootstrap)
  2. flip it (make it %bcond_without bootstrap)
  3. build the package (in mock or Koji - fedpkg --release master build --nowait --scratch --srpm)

Scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=35594007

It's based on this PR + the following change:

diff --git a/python38.spec b/python38.spec
index 73113c4..52384a7 100644
--- a/python38.spec
+++ b/python38.spec
@@ -45,7 +45,7 @@ License: Python
 #   IMPORTANT: When bootstrapping, it's very likely the wheels for pip and
 #   setuptools are not available. Turn off the rpmwheels bcond until
 #   the two packages are built with wheels to get around the issue.
-%bcond_with bootstrap
+%bcond_without bootstrap

 # Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
 # Uses upstream bundled prebuilt wheels otherwise
======================================================================
ERROR: test_no_optimize_flag (distutils.tests.test_bdist_rpm.BuildRpmTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/tests/test_bdist_rpm.py", line 120, in test_no_optimize_flag
    cmd.run()
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/command/bdist_rpm.py", line 366, in run
    self.spawn(rpm_cmd)
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/cmd.py", line 365, in spawn
    spawn(cmd, search_path, dry_run=self.dry_run)
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/spawn.py", line 157, in _spawn_posix
    raise DistutilsExecError(
distutils.errors.DistutilsExecError: command 'rpmbuild' failed with exit status 1
======================================================================
ERROR: test_quiet (distutils.tests.test_bdist_rpm.BuildRpmTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/tests/test_bdist_rpm.py", line 77, in test_quiet
    cmd.run()
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/command/bdist_rpm.py", line 366, in run
    self.spawn(rpm_cmd)
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/cmd.py", line 365, in spawn
    spawn(cmd, search_path, dry_run=self.dry_run)
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/builddir/build/BUILD/Python-3.8.0b1/Lib/distutils/spawn.py", line 157, in _spawn_posix
    raise DistutilsExecError(
distutils.errors.DistutilsExecError: command 'rpmbuild' failed with exit status 1
----------------------------------------------------------------------
Ran 248 tests in 2.201s
FAILED (errors=2, skipped=29)
1 test failed again:
    test_distutils
== Tests result: FAILURE then FAILURE ==

The test expects /usr/bin/python3. It doesn't have it. If we really need this, there are several options:

  • (easy) only enable the tests without bootstrap
  • (hard) fix the test to be able to run without system-installed Python (aka define %__python3 or something liek that to sys.executable being tested)

1 new commit added

  • Skip test_distutils if bootstraping
4 years ago

(easy) only enable the tests without bootstrap

Ok, let me try that: https://koji.fedoraproject.org/koji/taskinfo?taskID=35597876

I hope that I didn't write the if backwards :-D

diff --git a/python38.spec b/python38.spec
index 54309ca..a0708d1 100644
--- a/python38.spec
+++ b/python38.spec
@@ -45,7 +45,7 @@ License: Python
 #   IMPORTANT: When bootstrapping, it's very likely the wheels for pip and
 #   setuptools are not available. Turn off the rpmwheels bcond until
 #   the two packages are built with wheels to get around the issue.
-%bcond_with bootstrap
+%bcond_without bootstrap

 # Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
 # Uses upstream bundled prebuilt wheels otherwise

Oh wow, now there are multiple problems.

simple-koji-ci failed with my 2nd commit:

BUILDSTDERR: test_ensure_relativfind: ‘debug’: No such file or directory
BUILDSTDERR: /usr/lib/rpm/brp-python-bytecompile: line 27: /usr/bin/python3.8: No such file or directory
BUILDSTDERR: cat: write error: Broken pipe
BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.iYetAG (%install)
BUILDSTDERR:     Bad exit status from /var/tmp/rpm-tmp.iYetAG (%install)
BUILDSTDERR: find: ‘debug’: No such file or directory
BUILDSTDERR: /usr/lib/rpm/brp-python-bytecompile: line 27: /usr/bin/python3.8: No such file or directory
BUILDSTDERR: cat: write error: Broken pipe
BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.EJd31e (%install)
BUILDSTDERR:     Bad exit status from /var/tmp/rpm-tmp.EJd31e (%install)

test_no_optimize_flag (distutils.tests.test_bdist_rpm.BuildRpmTestCase) ... ERROR
test_quiet (distutils.tests.test_bdist_rpm.BuildRpmTestCase) ... ERROR

ERROR: test_no_optimize_flag (distutils.tests.test_bdist_rpm.BuildRpmTestCase)
distutils.errors.DistutilsExecError: command 'rpmbuild' failed with exit status 1

ERROR: test_quiet (distutils.tests.test_bdist_rpm.BuildRpmTestCase)
distutils.errors.DistutilsExecError: command 'rpmbuild' failed with exit status 1

But previously, it worked no? I'm now confused.


In my latest scratch build with boostrap, tests were run with "python -m test.regrtest -wW --slowest -j0 -x test_distutils -x test_asyncio": test_distutils is skipped as expected.

But test_gdb failed which is unrelated: https://koji.fedoraproject.org/koji/taskinfo?taskID=35597876

  • aarch64: test_gdb failed
  • ppc64le: test_gdb failed

PGO compiler optimization is disabled on aarch64 and ppc64le (only enabled on x86 and x86-64).

this is weird:

/usr/lib/rpm/brp-python-bytecompile: line 27: /usr/bin/python3.8: No such file or directory

There was a recent problem with the Python macros, could you try again please?

Oh, I (think I) know.

When without boostrap, we require and use /usr/bin/python3. In order to make this work we would need to require and use /usr/bin/python3.X. See https://src.fedoraproject.org/rpms/python38/pull-request/13

1 new commit added

  • regen-all: use PYTHON_FOR_REGEN="python3.8"
4 years ago

1 new commit added

  • Don't hardcode Python versions
4 years ago

for make regen-all and distutils.tests.test_bdist_rpm

1 new commit added

  • Update python requires comment
4 years ago

simple-koji-ci failed: test_gdb failed on aarc64 and ppc64. That's: https://bugzilla.redhat.com/show_bug.cgi?id=1721483

Could you please rebase this somehow (maybe squash a little), so the simple-koji-ci starts again?

Pull-Request has been closed by churchyard

4 years ago