This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients vstinner, xdegaye
Date 2017-12-11.11:14:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512990871.06.0.213398074469.issue32246@psf.upfronthosting.co.za>
In-reply-to
Content
To debug and reproduce the problem on Android, one must checkout from the bpo-30386 branch https://github.com/python/cpython/pull/1629/commits/c0ca089220cd39851d7625b55510be63b340e188.

faulthandler._sigsegv() does crash the crasher in test_crashed, so test_crashed must not be disabled.

> How is it possible that the new file that alters the environment be a test_python_* directory (see my initial post) when all the tests are run inside a TEMPDIR/test_python_* directory.

Both test_crashed tests are run in nested tests directories (i.e. in $TEMPDIR/test_python_*/test_python_*) on Android. As a consequence the test_python_* directory that is not removed by the crasher because it crashed, is reported by test_crashed as altering the environment. This also explains the other points raised previously.

A remote interactive shell is run by the 'adb shell' command and the TMPDIR environment variable is set in that shell. A command may be run remotely with the command 'adb shell /path/to/command' and the TMPDIR variable is *not set* (but most if not all the other shell environment variables are set) and since on Android /tmp does not exist, then tempfile.gettempdir() uses the current directory. This explains why the test directories are doubly nested.

On the commit that is the child of commit c0ca089220cd39... which we are using here, TMPDIR has been made to be set in the script that runs Tools/script/run_tests.py and so it does fix inadvertently the issue for the reason explained in the previous paragraph.

This bug can only exist on platforms where tempfile.gettempdir() falls back to using the current directory because '/tmp', '/var/tmp' and '/usr/tmp' do not exist and where none of the 'TMPDIR', 'TEMP', 'TMP' variables is set. Therefore we can either close this issue as not a bug or use the following patch that fixes the problem, it is similar to the fix made in issue 15300:

diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 8364767b3a..3a213e12c4 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -468,10 +468,13 @@ class BaseTestCase(unittest.TestCase):
             input = ''
         if 'stderr' not in kw:
             kw['stderr'] = subprocess.PIPE
+        savedcwd = (support.SAVEDCWD if
+                    any(x.startswith('-j') for x in args) else None)
         proc = subprocess.run(args,
                               universal_newlines=True,
                               input=input,
                               stdout=subprocess.PIPE,
+                              cwd=savedcwd,
                               **kw)
         if proc.returncode != exitcode:
             msg = ("Command %s failed with exit code %s\n"
History
Date User Action Args
2017-12-11 11:14:31xdegayesetrecipients: + xdegaye, vstinner
2017-12-11 11:14:31xdegayesetmessageid: <1512990871.06.0.213398074469.issue32246@psf.upfronthosting.co.za>
2017-12-11 11:14:31xdegayelinkissue32246 messages
2017-12-11 11:14:30xdegayecreate