diff options
author | Mats Wichmann <mats@linux.com> | 2021-11-26 17:25:50 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2021-11-26 18:16:59 (GMT) |
commit | 9649d0fd2326d607ee545625cea45cf72aab87a6 (patch) | |
tree | f1dfbf812ca0624b9836a583d7da6c14af14d450 /testing | |
parent | c335e187fb9b2c79fe03489c13cb7859969ed25c (diff) | |
download | SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.zip SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.tar.gz SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.tar.bz2 |
Fix tests to not hang on Windows with bad .py assoc
For systems where the association for .py files is not to an actual
Python interpreter, those few cases where we need to run a Python script
directly as a program don't work. This could be because the association
was never set up, or because some other program (e.g. Visual Studio Code)
has taken it over. In some cases may appear to "hang" because the
alternate program is waiting for user interaction
runtest.py now has a mechanism to check (thanks to Brett Cannon for
providing this incantation). It isn't super precise (looks for the
substring "py" in the queried association), but should work out.
It sets an environment variable which the test framework can read
and as a result set a flag which individual tests can read.
Two tests in scons-time which had previously been set to skip-if-win32
now look at this flag instead. Three tests in sconsign now also look at
this flag. This allows a clean run on my dev box with VS Code having
taken over the .py association.
Various things can break if the environment used to fire off
Windows processes doesn't contain %UserProfile%. Added this to the
short list of passthrough env vars. Apparently an environment without
this value is now considered invalid (it blew up the erroneously
launched VS Code, but we've apparently been lucky it hasn't blown
up more things - believe there was also a report of a problem
with the Visual Studio setup scripts).
A little extra cleanup:
- a couple of Py2-isms were cleaned out (Script/Main.py and in the test
framework)
- The paths to look for site-scons were rewritten (part of this was
another Py2-ism), and the system path changed a bit - the old path is
still checked, and the manpage updated to reflect this.
- runtest.py dropped the unused whereis functions.
- the three sconsign tests now use f-string formatting, mostly as an
experiment to see how easy it is to convert.
Fixes #4053
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'testing')
-rw-r--r-- | testing/framework/TestCmd.py | 4 | ||||
-rw-r--r-- | testing/framework/TestSCons.py | 2 | ||||
-rw-r--r-- | testing/framework/TestSConsMSVS.py | 8 |
3 files changed, 2 insertions, 12 deletions
diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index 903bee6..79b16f5 100644 --- a/testing/framework/TestCmd.py +++ b/testing/framework/TestCmd.py @@ -312,17 +312,15 @@ import traceback from collections import UserList, UserString from subprocess import PIPE, STDOUT - IS_WINDOWS = sys.platform == 'win32' IS_MACOS = sys.platform == 'darwin' IS_64_BIT = sys.maxsize > 2**32 IS_PYPY = hasattr(sys, 'pypy_translation_info') - +NEED_HELPER = os.environ.get('SCONS_NO_DIRECT_SCRIPT') # sentinel for cases where None won't do _Null = object() - __all__ = [ 'diff_re', 'fail_test', diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 99764c5..b6b9694 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -307,8 +307,6 @@ class TestSCons(TestCommon): kw['program'] = os.path.join(self.orig_cwd, kw['program']) if 'interpreter' not in kw and not os.environ.get('SCONS_EXEC'): kw['interpreter'] = [python, ] - if sys.version_info[0] < 3: - kw['interpreter'].append('-tt') if 'match' not in kw: kw['match'] = match_exact if 'workdir' not in kw: diff --git a/testing/framework/TestSConsMSVS.py b/testing/framework/TestSConsMSVS.py index fc0a411..6e5e01b 100644 --- a/testing/framework/TestSConsMSVS.py +++ b/testing/framework/TestSConsMSVS.py @@ -763,8 +763,7 @@ print("self._msvs_versions =%%s"%%str(SCons.Tool.MSCommon.query_versions())) return result def get_vs_host_arch(self): - """ Get an MSVS, SDK , and/or MSVS acceptable platform arch - """ + """ Returns an MSVS, SDK , and/or MSVS acceptable platform arch. """ # Dict to 'canonalize' the arch _ARCH_TO_CANONICAL = { @@ -778,11 +777,6 @@ print("self._msvs_versions =%%s"%%str(SCons.Tool.MSCommon.query_versions())) } host_platform = platform.machine() - # TODO(2.5): the native Python platform.machine() function returns - # '' on all Python versions before 2.6, after which it also uses - # PROCESSOR_ARCHITECTURE. - if not host_platform: - host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '') try: host = _ARCH_TO_CANONICAL[host_platform] |