Skip to content

gh-94751: Install, import and run the test C++ extension (MVP) - #94754

Merged
encukou merged 2 commits into
python:mainfrom
encukou:cppext-run
Jul 12, 2022
Merged

encukou merged 2 commits into
python:mainfrom
encukou:cppext-run

Conversation

@encukou

@encukou encukou commented Jul 11, 2022 •

Copy link
Copy Markdown
Member

This is a quick-and-dirty way to run the C++ tests. It can definitely be improved in the future, but it should fail when things go wrong.

  • Run test functions on import (yes, this can definitely be improved)
  • Fudge setuptools metadata (name & version) to make the extension installable
  • Install and import the extension in test_cppext

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension
  installable
- Install and import the extension in test_cppext
@encukou encukou added tests Tests in the Lib/test dir skip news needs backport to 3.11 only security fixes labels Jul 11, 2022
@encukou encukou changed the title bpo-94751: Install, import and run the test C++ extension (MVP) gh-94751: Install, import and run the test C++ extension (MVP) Jul 11, 2022
@da-woods

Copy link
Copy Markdown
Contributor

It looks good to me as based on a quick read through. I think it's definitely worth running the tests rather than assuming that it's fine if it compiles.

It looks like '-X', 'showrefcount', is just going to require inspecting by eye? That's probably reasonable to defer for a future improvement, but it obviously reduces the chance of it catching any issues.

@encukou

encukou commented Jul 11, 2022

Copy link
Copy Markdown
Member Author

Thank you!

It looks like '-X', 'showrefcount', is just going to require inspecting by eye? That's probably reasonable to defer for a future improvement

Yes. I filed #94755 for the future improvement.

@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2022
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit a615602 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2022
@encukou
encukou merged commit ec5db53 into python:main Jul 12, 2022
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@encukou
encukou deleted the cppext-run branch July 12, 2022 15:06
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 12, 2022
…ythonGH-94754)

This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
(cherry picked from commit ec5db53)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 12, 2022
@bedevere-bot

Copy link
Copy Markdown

GH-94780 is a backport of this pull request to the 3.11 branch.

@da-woods

Copy link
Copy Markdown
Contributor

I'm seeing segfaults on from test_cppext on what should be an unrelated PR https://github.com/python/cpython/runs/7316060423?check_suite_focus=true

======================================================================
ERROR: test_build_cpp03 (test.test_cppext.TestCPPExt.test_build_cpp03)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_cppext.py", line 23, in test_build_cpp03
    self.check_build(True, '_testcpp03ext')
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_cppext.py", line 33, in check_build
    self._check_build(std_cpp03, extension_name)
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_cppext.py", line 95, in _check_build
    run_cmd('Import', cmd)
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_cppext.py", line 58, in run_cmd
    subprocess.run(cmd, check=True)
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/subprocess.py", line 558, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['env/bin/python', '-X', 'dev', '-X', 'showrefcount', '-c', 'import _testcpp03ext']' died with <Signals.SIGSEGV: 11>.

encukou added a commit that referenced this pull request Jul 13, 2022
) (#94780)

This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
(cherry picked from commit ec5db53)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@encukou

encukou commented Jul 13, 2022

Copy link
Copy Markdown
Member Author

You've accidentally included the failing reproducer in that unrelated PR.

Context switching is hard! Thanks for doing it to come up with the reproducer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants