Skip to content

bpo-38456: Use /bin/true in test_subprocess #16736

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2019

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Oct 12, 2019

Instead of sys.executable, "-c", "pass" or "import sys; sys.exit(0)"
use /bin/true when it is available. On a reasonable machine this
shaves up to two seconds wall time off the otherwise ~40sec execution
on a --with-pydebug build. It should be more notable on many
buildbots or overloaded slower I/O systems (CI, etc).

https://bugs.python.org/issue38456

Instead of sys.executable, "-c", "pass" or "import sys; sys.exit(0)"
use /bin/true when it is available.  On a reasonable machine this
shaves up to two seconds wall time off the otherwise ~40sec execution
on a --with-pydebug build.  It should be more notable on many
buildbots or overloaded slower I/O systems (CI, etc).
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, otherwise LGTM

Thanks for working on this 🎉

@gpshead gpshead merged commit 67b93f8 into python:master Oct 12, 2019
@gpshead gpshead deleted the subprocess-test-speed branch October 12, 2019 23:35
gpshead added a commit to gpshead/cpython that referenced this pull request Oct 12, 2019
* bpo-38456: Use /bin/true in test_subprocess.

Instead of sys.executable, "-c", "pass" or "import sys; sys.exit(0)"
use /bin/true when it is available.  On a reasonable machine this
shaves up to two seconds wall time off the otherwise ~40sec execution
on a --with-pydebug build.  It should be more notable on many
buildbots or overloaded slower I/O systems (CI, etc)..
(cherry picked from commit 67b93f8)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@pablogsal
Copy link
Member

pablogsal commented Oct 13, 2019

We have a failure on Windows:

======================================================================
ERROR: setUpModule (test.test_subprocess)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_subprocess.py", line 62, in setUpModule
    if (os.access(shell_true, os.X_OK) and
TypeError: access: path should be string, bytes or os.PathLike, not NoneType
----------------------------------------------------------------------
Ran 0 tests in 0.014s

I created #16739 to fix the error

gpshead added a commit that referenced this pull request Oct 14, 2019
* [3.8] bpo-38456: Use /bin/true in test_subprocess (GH-16736)

Instead of sys.executable, "-c", "pass" or "import sys; sys.exit(0)"
use /bin/true when it is available.  On a reasonable machine this
shaves up to two seconds wall time off the otherwise ~40sec execution
on a --with-pydebug build.  It should be more notable on many
buildbots or overloaded slower I/O systems (CI, etc)..
(cherry picked from commit 67b93f8)

* Handle when there is no 'true' command

backport of 46113e0 by Pablo Galindo.
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
* bpo-38456: Use /bin/true in test_subprocess.

Instead of sys.executable, "-c", "pass" or "import sys; sys.exit(0)"
use /bin/true when it is available.  On a reasonable machine this
shaves up to two seconds wall time off the otherwise ~40sec execution
on a --with-pydebug build.  It should be more notable on many
buildbots or overloaded slower I/O systems (CI, etc).
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