From 57d09cd12f950ba938ab0164f3b68ed937353318 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 13 Aug 2018 01:28:05 -0400 Subject: updated vc and tests to check the msvc cl binary --- src/engine/SCons/Tool/MSCommon/vc.py | 14 ++++++++++++-- test/MSVS/vs-10.0Exp-exec.py | 8 ++++++-- test/MSVS/vs-11.0-exec.py | 8 ++++++-- test/MSVS/vs-11.0Exp-exec.py | 8 ++++++-- test/MSVS/vs-14.0-exec.py | 8 ++++++-- test/MSVS/vs-6.0-clean.py | 2 +- test/MSVS/vs-6.0-exec.py | 8 ++++++-- test/MSVS/vs-7.0-exec.py | 8 ++++++-- test/MSVS/vs-7.1-exec.py | 8 ++++++-- test/MSVS/vs-8.0-exec.py | 7 ++++++- test/MSVS/vs-8.0Exp-exec.py | 8 ++++++-- test/MSVS/vs-9.0-exec.py | 8 ++++++-- test/MSVS/vs-9.0Exp-exec.py | 8 ++++++-- 13 files changed, 79 insertions(+), 24 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 53bd397..e5c9aaf 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -43,6 +43,7 @@ import platform from string import digits as string_digits import SCons.Warnings +from SCons.Tool import find_program_path from . import common @@ -357,9 +358,13 @@ def get_installed_vcs(): for ver in _VCVER: debug('trying to find VC %s' % ver) try: - if find_vc_pdir(ver): + VC_DIR = find_vc_pdir(ver) + if VC_DIR: debug('found VC %s' % ver) - installed_versions.append(ver) + if os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')): + installed_versions.append(ver) + else: + debug('find_vc_pdir no cl.exe found %s' % ver) else: debug('find_vc_pdir return None for ver %s' % ver) except VisualCException as e: @@ -565,6 +570,11 @@ def msvc_setup_env(env): for k, v in d.items(): debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v)) env.PrependENVPath(k, v, delete_existing=True) + + msvc_cl = find_program_path(env, 'cl') + if not msvc_cl: + SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, + "Could not find MSVC compiler 'cl.exe', it may need to be installed separately with Visual Studio") def msvc_exists(version=None): vcs = cached_get_installed_vcs() diff --git a/test/MSVS/vs-10.0Exp-exec.py b/test/MSVS/vs-10.0Exp-exec.py index a63f6c4..d6114bd 100644 --- a/test/MSVS/vs-10.0Exp-exec.py +++ b/test/MSVS/vs-10.0Exp-exec.py @@ -55,10 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-11.0-exec.py b/test/MSVS/vs-11.0-exec.py index 21645f5..48acd1c 100644 --- a/test/MSVS/vs-11.0-exec.py +++ b/test/MSVS/vs-11.0-exec.py @@ -55,10 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-11.0Exp-exec.py b/test/MSVS/vs-11.0Exp-exec.py index be48971..6a288a5 100644 --- a/test/MSVS/vs-11.0Exp-exec.py +++ b/test/MSVS/vs-11.0Exp-exec.py @@ -55,10 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-14.0-exec.py b/test/MSVS/vs-14.0-exec.py index f2a826c..d2b7112 100644 --- a/test/MSVS/vs-14.0-exec.py +++ b/test/MSVS/vs-14.0-exec.py @@ -55,10 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-6.0-clean.py b/test/MSVS/vs-6.0-clean.py index 6b9bd98..0cbadba 100644 --- a/test/MSVS/vs-6.0-clean.py +++ b/test/MSVS/vs-6.0-clean.py @@ -72,7 +72,7 @@ env.MSVSSolution(target = 'Test.dsw', variant = 'Release') """%{'HOST_ARCH':host_arch}) -test.run(arguments=".") +test.run() test.must_exist(test.workpath('Test.dsp')) dsp = test.read('Test.dsp', 'r') diff --git a/test/MSVS/vs-6.0-exec.py b/test/MSVS/vs-6.0-exec.py index d017790..0864f76 100644 --- a/test/MSVS/vs-6.0-exec.py +++ b/test/MSVS/vs-6.0-exec.py @@ -54,10 +54,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-7.0-exec.py b/test/MSVS/vs-7.0-exec.py index e62ee77..e95ca83 100644 --- a/test/MSVS/vs-7.0-exec.py +++ b/test/MSVS/vs-7.0-exec.py @@ -54,10 +54,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-7.1-exec.py b/test/MSVS/vs-7.1-exec.py index 42f6ae8..11ea617 100644 --- a/test/MSVS/vs-7.1-exec.py +++ b/test/MSVS/vs-7.1-exec.py @@ -54,10 +54,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-8.0-exec.py b/test/MSVS/vs-8.0-exec.py index 96c4c29..4b0a6dd 100644 --- a/test/MSVS/vs-8.0-exec.py +++ b/test/MSVS/vs-8.0-exec.py @@ -55,9 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print("os.environ.update(%%s)" %% repr(env['ENV'])) +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-8.0Exp-exec.py b/test/MSVS/vs-8.0Exp-exec.py index 66196f1..0e4396d 100644 --- a/test/MSVS/vs-8.0Exp-exec.py +++ b/test/MSVS/vs-8.0Exp-exec.py @@ -55,10 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-9.0-exec.py b/test/MSVS/vs-9.0-exec.py index 7b544aa..3f823fa 100644 --- a/test/MSVS/vs-9.0-exec.py +++ b/test/MSVS/vs-9.0-exec.py @@ -55,10 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) diff --git a/test/MSVS/vs-9.0Exp-exec.py b/test/MSVS/vs-9.0Exp-exec.py index caa763e..5a65faf 100644 --- a/test/MSVS/vs-9.0Exp-exec.py +++ b/test/MSVS/vs-9.0Exp-exec.py @@ -55,10 +55,14 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -sconsEnv = repr(env['ENV']) -print("os.environ.update(" + sconsEnv + ")") +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) """ % locals()) +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + exec(test.stdout()) -- cgit v0.12 From 2fc51a43533f7700cf8084da3d688e1746bbfa8c Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 13 Aug 2018 01:43:02 -0400 Subject: also check for 64 bit compiler and added some comments --- src/engine/SCons/Tool/MSCommon/vc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index e5c9aaf..32ee96f 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -361,7 +361,9 @@ def get_installed_vcs(): VC_DIR = find_vc_pdir(ver) if VC_DIR: debug('found VC %s' % ver) - if os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')): + # check to see if the x86 or 64 bit compiler is in the bin dir + if (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')) + or os.path.exists(os.path.join(VC_DIR, r'bin\amd64\cl.exe'))): installed_versions.append(ver) else: debug('find_vc_pdir no cl.exe found %s' % ver) @@ -571,6 +573,7 @@ def msvc_setup_env(env): debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v)) env.PrependENVPath(k, v, delete_existing=True) + # final check to issue a warning if the compiler is not present msvc_cl = find_program_path(env, 'cl') if not msvc_cl: SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, -- cgit v0.12 From c91224a97b07b4793817f8bf28be86ad082dd7f1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 13 Aug 2018 01:44:15 -0400 Subject: updated CHANGES.txt --- src/CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6534f3a..662873d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -9,6 +9,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Daniel Moody: - Updated FS.py to handle removal of splitunc function from python 3.7 + - Updated the vc.py to ignore MSVS versions where not compiler could be found From Matthew Marinets: - Fixed an issue that caused the Java emitter to incorrectly parse arguments to constructors that -- cgit v0.12 From 2a39eb278ecca56f66011f2d602e12b924ad0e2c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 13 Aug 2018 10:40:42 -0600 Subject: SWIG recursive test checkes for Python.h The generated code will #include , so skip the test if the appropriate development support for Python is not installed, the test will FAIL otherwise. The other SWIG tests do this already. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + test/SWIG/recursive-includes-cpp.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6534f3a..be5a90a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -120,6 +120,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - quiet py3 warning in UtilTests.py - fix tests specifying octal constants for py3 - fix must_contain tests for py3 + - one swig test now checks for Python.h instead of failing From Hao Wu - typo in customized decider example in user guide diff --git a/test/SWIG/recursive-includes-cpp.py b/test/SWIG/recursive-includes-cpp.py index b943406..34c7d6e 100644 --- a/test/SWIG/recursive-includes-cpp.py +++ b/test/SWIG/recursive-includes-cpp.py @@ -44,6 +44,12 @@ for pre_req in ['swig', 'python']: if not test.where_is(pre_req): test.skip_test('Can not find installed "' + pre_req + '", skipping test.%s' % os.linesep) +# file generated by swig will #include , make sure we have one +python, py_include, py_libpath, py_lib = test.get_platform_python_info() +Python_h = os.path.join(py_include, 'Python.h') +if not os.path.exists(Python_h): + test.skip_test('Can not find %s, skipping test.\n' % Python_h) + if sys.platform == 'win32': python_lib = os.path.dirname(sys.executable) + "/libs/" + ('python%d%d'%(sys.version_info[0],sys.version_info[1])) + '.lib' if( not os.path.isfile(python_lib)): @@ -150,4 +156,4 @@ test.pass_test() # tab-width:4 # indent-tabs-mode:nil # End: -# vim: set expandtab tabstop=4 shiftwidth=4: \ No newline at end of file +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From a5c17eae4d5197d423a8fcef40b1d31e74439772 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 13 Aug 2018 14:55:01 -0600 Subject: Quiet Py3.6+ ResourceWarnings on tests When a test calls _subproc to set up a subprocess.Popen call, if the arg vector contains the string 'devnull' os.devnull is opened and the resulting file object is stored in the kw vector prior to passing it to Popen. Reigster a close() call with atexit in this case. Eliminates a lot of Python 3.6+ ResourceWarning messages - 336 on this machine. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + src/engine/SCons/Action.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6534f3a..7c5abba 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -120,6 +120,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - quiet py3 warning in UtilTests.py - fix tests specifying octal constants for py3 - fix must_contain tests for py3 + - if test opens os.devnull, register with atexit so file opens do not leak. From Hao Wu - typo in customized decider example in user guide diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index b44088b..249363f 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -107,6 +107,7 @@ import sys import subprocess import itertools import inspect +import atexit import SCons.Debug from SCons.Debug import logInstanceCreation @@ -772,12 +773,15 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): io = kw.get('stdin') if is_String(io) and io == 'devnull': kw['stdin'] = open(os.devnull) + atexit.register(kw['stdin'].close) io = kw.get('stdout') if is_String(io) and io == 'devnull': kw['stdout'] = open(os.devnull, 'w') + atexit.register(kw['stdout'].close) io = kw.get('stderr') if is_String(io) and io == 'devnull': kw['stderr'] = open(os.devnull, 'w') + atexit.register(kw['stderr'].close) # Figure out what shell environment to use ENV = kw.get('env', None) -- cgit v0.12 From 2252e4b3ca7cb9ee75e739cabceee6fd8d324476 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 13 Aug 2018 16:08:21 -0500 Subject: use clang from local/bin instead of installing --- .travis.yml | 5 ++++- .travis/install.sh | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 58ca595..01c5eed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,9 @@ jobs: include: - &test_job stage: Test - script: python runtest.py -a || if [[ $? == 2 ]]; then true; else false; fi + script: + - export PATH=/usr/local/bin:$PATH + - python runtest.py -a || if [[ $? == 2 ]]; then true; else false; fi before_script: skip after_success: skip python: 2.7 @@ -67,6 +69,7 @@ jobs: - echo "coverage.process_startup()" | sudo tee --append ${PYSITEDIR}/usercustomize.py script: + - export PATH=/usr/local/bin:$PATH - export TOTAL_BUILD_JOBS=8 # write the coverage config file - export COVERAGE_PROCESS_START=$PWD/.coveragerc diff --git a/.travis/install.sh b/.travis/install.sh index 24735a8..d61872d 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -x -# dependencies for clang tests -sudo apt-get -y install clang # dependencies for gdc tests sudo apt-get -y install gdc # dependencies for docbook tests -- cgit v0.12 From ceb52d82b137d5fc6c9c2bab773f0d6e3a8b515b Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 13 Aug 2018 14:13:42 -0700 Subject: Fix wrong path to testing frameworks SConscript (was breaking bootstrap builds) --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index fc94abd..f644d6d 100644 --- a/SConstruct +++ b/SConstruct @@ -825,7 +825,7 @@ for p in [ scons ]: # Export('build_dir', 'env') -SConscript('testing/SConscript') +SConscript('testing/framework/SConscript') # # -- cgit v0.12 From 51704ca99e0787de2a6a6b7ba9502d2043b95546 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 13 Aug 2018 16:26:28 -0500 Subject: testing symbolic links instead of messing with the environment --- .travis.yml | 86 +----------------------------------------------------- .travis/install.sh | 5 ++++ 2 files changed, 6 insertions(+), 85 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01c5eed..2c2896d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,93 +19,9 @@ jobs: - &test_job stage: Test script: - - export PATH=/usr/local/bin:$PATH - - python runtest.py -a || if [[ $? == 2 ]]; then true; else false; fi + - python runtest.py test/Clang before_script: skip after_success: skip python: 2.7 env: PYVER=27 sudo: required - - - <<: *test_job - python: 3.5 - env: PYVER=35 - sudo: required - - - <<: *test_job - python: 3.6 - env: PYVER=36 - sudo: required - - - <<: *test_job - python: 3.7-dev - env: PYVER=37 - sudo: required - - - <<: *test_job - python: pypy - env: PYVER=pypy - sudo: required - - - - &coverage_jobs - stage: Coverage - - before_script: - - sudo pip install coverage - - sudo pip install coveralls - # set this ensure user sites are available - - export PYTHONNOUSERSITE= - # attempt to get a location where we can store the usercustomize.py file - - python -m site - - export PYSITEDIR=$(python -m site --user-site) - - sudo mkdir -p $PYSITEDIR - - sudo touch ${PYSITEDIR}/usercustomize.py - - export COVERAGE_FILE=$PWD/.coverage_file - # write the usercustomize.py file so all python processes use coverage and know where the config file is - - echo "import os" | sudo tee --append ${PYSITEDIR}/usercustomize.py - - echo "os.environ['COVERAGE_PROCESS_START'] = '$PWD/.coveragerc'" | sudo tee --append ${PYSITEDIR}/usercustomize.py - - echo "import coverage" | sudo tee --append ${PYSITEDIR}/usercustomize.py - - echo "coverage.process_startup()" | sudo tee --append ${PYSITEDIR}/usercustomize.py - - script: - - export PATH=/usr/local/bin:$PATH - - export TOTAL_BUILD_JOBS=8 - # write the coverage config file - - export COVERAGE_PROCESS_START=$PWD/.coveragerc - - echo "[run]" >> .coveragerc - - echo "source = $PWD/src" >> .coveragerc - - echo "parallel = True" >> .coveragerc - - printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsrc/setup.py\n\n" >> .coveragerc - - echo "[path] = $PWD" >> .coveragerc - # get a list of all the tests to split them up - - python runtest.py -l -a > all_tests - - let "start = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * (${BUILD_JOB_NUM} - 1)"; true; - - let "end = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * ${BUILD_JOB_NUM}" - - if (( ${BUILD_JOB_NUM} == ${TOTAL_BUILD_JOBS} )); then end=$(wc -l < all_tests); fi - - if (( ${start} == 0 )); then start=1; fi - - sed -n ${start},${end}p all_tests > build_tests - - coverage run -p --rcfile=$PWD/.coveragerc runtest.py -f build_tests || if [[ $? == 2 ]]; then true; else false; fi - - after_success: - - coverage combine - - coverage report - - coveralls --rcfile=$PWD/.coveragerc - - env: BUILD_JOB_NUM=1 - - - <<: *coverage_jobs - env: BUILD_JOB_NUM=2 - - <<: *coverage_jobs - env: BUILD_JOB_NUM=3 - - <<: *coverage_jobs - env: BUILD_JOB_NUM=4 - - <<: *coverage_jobs - env: BUILD_JOB_NUM=5 - - <<: *coverage_jobs - env: BUILD_JOB_NUM=6 - - <<: *coverage_jobs - env: BUILD_JOB_NUM=7 - - <<: *coverage_jobs - env: BUILD_JOB_NUM=8 - diff --git a/.travis/install.sh b/.travis/install.sh index d61872d..e404499 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -x +sudo ln -s /usr/local/bin/clang /usr/bin/clang +sudo ln -s /usr/local/bin/clang++ /usr/bin/clang++ + +return + # dependencies for gdc tests sudo apt-get -y install gdc # dependencies for docbook tests -- cgit v0.12 From 0690e461007d2ffdf77740c3c4d88f34115d33b1 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 13 Aug 2018 16:41:06 -0500 Subject: using the correct path --- .travis/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index e404499..8b51bec 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -x -sudo ln -s /usr/local/bin/clang /usr/bin/clang -sudo ln -s /usr/local/bin/clang++ /usr/bin/clang++ +sudo ln -s /usr/local/clang-5.0.0/bin/clang /usr/bin/clang +sudo ln -s /usr/local/clang-5.0.0/bin/clang++ /usr/bin/clang++ return -- cgit v0.12 From 2677cc2b860128928efee8897b42caad6e7ba8cd Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 13 Aug 2018 16:49:46 -0500 Subject: reverting travis back to master --- .travis.yml | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c2896d..58ca595 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,10 +18,91 @@ jobs: include: - &test_job stage: Test - script: - - python runtest.py test/Clang + script: python runtest.py -a || if [[ $? == 2 ]]; then true; else false; fi before_script: skip after_success: skip python: 2.7 env: PYVER=27 sudo: required + + - <<: *test_job + python: 3.5 + env: PYVER=35 + sudo: required + + - <<: *test_job + python: 3.6 + env: PYVER=36 + sudo: required + + - <<: *test_job + python: 3.7-dev + env: PYVER=37 + sudo: required + + - <<: *test_job + python: pypy + env: PYVER=pypy + sudo: required + + + - &coverage_jobs + stage: Coverage + + before_script: + - sudo pip install coverage + - sudo pip install coveralls + # set this ensure user sites are available + - export PYTHONNOUSERSITE= + # attempt to get a location where we can store the usercustomize.py file + - python -m site + - export PYSITEDIR=$(python -m site --user-site) + - sudo mkdir -p $PYSITEDIR + - sudo touch ${PYSITEDIR}/usercustomize.py + - export COVERAGE_FILE=$PWD/.coverage_file + # write the usercustomize.py file so all python processes use coverage and know where the config file is + - echo "import os" | sudo tee --append ${PYSITEDIR}/usercustomize.py + - echo "os.environ['COVERAGE_PROCESS_START'] = '$PWD/.coveragerc'" | sudo tee --append ${PYSITEDIR}/usercustomize.py + - echo "import coverage" | sudo tee --append ${PYSITEDIR}/usercustomize.py + - echo "coverage.process_startup()" | sudo tee --append ${PYSITEDIR}/usercustomize.py + + script: + - export TOTAL_BUILD_JOBS=8 + # write the coverage config file + - export COVERAGE_PROCESS_START=$PWD/.coveragerc + - echo "[run]" >> .coveragerc + - echo "source = $PWD/src" >> .coveragerc + - echo "parallel = True" >> .coveragerc + - printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsrc/setup.py\n\n" >> .coveragerc + - echo "[path] = $PWD" >> .coveragerc + # get a list of all the tests to split them up + - python runtest.py -l -a > all_tests + - let "start = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * (${BUILD_JOB_NUM} - 1)"; true; + - let "end = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * ${BUILD_JOB_NUM}" + - if (( ${BUILD_JOB_NUM} == ${TOTAL_BUILD_JOBS} )); then end=$(wc -l < all_tests); fi + - if (( ${start} == 0 )); then start=1; fi + - sed -n ${start},${end}p all_tests > build_tests + - coverage run -p --rcfile=$PWD/.coveragerc runtest.py -f build_tests || if [[ $? == 2 ]]; then true; else false; fi + + after_success: + - coverage combine + - coverage report + - coveralls --rcfile=$PWD/.coveragerc + + env: BUILD_JOB_NUM=1 + + - <<: *coverage_jobs + env: BUILD_JOB_NUM=2 + - <<: *coverage_jobs + env: BUILD_JOB_NUM=3 + - <<: *coverage_jobs + env: BUILD_JOB_NUM=4 + - <<: *coverage_jobs + env: BUILD_JOB_NUM=5 + - <<: *coverage_jobs + env: BUILD_JOB_NUM=6 + - <<: *coverage_jobs + env: BUILD_JOB_NUM=7 + - <<: *coverage_jobs + env: BUILD_JOB_NUM=8 + -- cgit v0.12 From cb85766498fa08cdf1f306824ab00b77624a730e Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 13 Aug 2018 16:50:28 -0500 Subject: added comments to the travis install script --- .travis/install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index 8b51bec..ddef1e6 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,11 +1,10 @@ #!/usr/bin/env bash set -x +# setup clang for clang tests using local clang installation sudo ln -s /usr/local/clang-5.0.0/bin/clang /usr/bin/clang sudo ln -s /usr/local/clang-5.0.0/bin/clang++ /usr/bin/clang++ -return - # dependencies for gdc tests sudo apt-get -y install gdc # dependencies for docbook tests -- cgit v0.12 From b4b5abd17a3357561a3b7b9f7f7916778a719d93 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 14 Aug 2018 15:00:29 -0600 Subject: Redo fix for file closing in SCons.Action._subproc When the _subproc wrapper is called, a keyword dictionary is used to hold open file objects if any were indicated as being redirected to os.devull. These objects just go missing when SCons.Action._subproc is done. A previous iteration registered the close method of the object with atexit, which made Python 3 happy the open file resources were not leaking, but has some unexpected side effects. Apparently Action cannot import either atexit or the SCons equivalent, SCons.exitfuncs without triggering these effects. As an alternative, close the objects in the parent's kw dictionary that have close methods after the subprocess.Popen object has been created. Signed-off-by: Mats Wichmann --- src/engine/SCons/Action.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 249363f..32ceaa9 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -107,7 +107,6 @@ import sys import subprocess import itertools import inspect -import atexit import SCons.Debug from SCons.Debug import logInstanceCreation @@ -116,8 +115,7 @@ import SCons.Util import SCons.Subst # we use these a lot, so try to optimize them -is_String = SCons.Util.is_String -is_List = SCons.Util.is_List +from SCons.Util import is_String, is_List class _null(object): pass @@ -773,15 +771,12 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): io = kw.get('stdin') if is_String(io) and io == 'devnull': kw['stdin'] = open(os.devnull) - atexit.register(kw['stdin'].close) io = kw.get('stdout') if is_String(io) and io == 'devnull': kw['stdout'] = open(os.devnull, 'w') - atexit.register(kw['stdout'].close) io = kw.get('stderr') if is_String(io) and io == 'devnull': kw['stderr'] = open(os.devnull, 'w') - atexit.register(kw['stderr'].close) # Figure out what shell environment to use ENV = kw.get('env', None) @@ -807,7 +802,7 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): kw['env'] = new_env try: - return subprocess.Popen(cmd, **kw) + pobj = subprocess.Popen(cmd, **kw) except EnvironmentError as e: if error == 'raise': raise # return a dummy Popen instance that only returns error @@ -821,7 +816,14 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): def readline(self): return '' def __iter__(self): return iter(()) stdout = stderr = f() - return dummyPopen(e) + pobj = dummyPopen(e) + finally: + # clean up open file handles stored in parent's kw + import io + for k, v in kw.items(): + if hasattr(v, 'close'): + v.close() + return pobj class CommandAction(_ActionAction): -- cgit v0.12 From 52ecb92eb30698b67de2662a892e20be3f1fda20 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 15 Aug 2018 08:16:11 -0600 Subject: Move checking for python header to common location A previous change added a check for Python.h in one SWIG test which did not have it which turns that test into a skip instead of a fail if the header is not installed. It was pointed out that having 12 tests check for the same thing might be optimised by putting the check in the routine which returns info about the python development environment, so this change makes that modification. Signed-off-by: Mats Wichmann --- test/SWIG/SWIGOUTDIR-python.py | 6 +--- test/SWIG/build-dir.py | 6 +--- test/SWIG/generated_swigfile.py | 6 +--- test/SWIG/live.py | 11 +++----- test/SWIG/module-deduced-name.py | 6 +--- test/SWIG/module-parens.py | 6 +--- test/SWIG/module-quoted.py | 6 +--- test/SWIG/module-spaces.py | 6 +--- test/SWIG/noproxy.py | 6 +--- test/SWIG/recursive-includes-cpp.py | 7 ++--- test/SWIG/remove-modules.py | 6 +--- test/SWIG/subdir.py | 6 +--- testing/framework/TestSCons.py | 55 +++++++++++++++++++++++++------------ 13 files changed, 53 insertions(+), 80 deletions(-) diff --git a/test/SWIG/SWIGOUTDIR-python.py b/test/SWIG/SWIGOUTDIR-python.py index db0cc95..53b5bdf 100644 --- a/test/SWIG/SWIGOUTDIR-python.py +++ b/test/SWIG/SWIGOUTDIR-python.py @@ -30,7 +30,6 @@ that Python files are created in the specified output directory. """ import TestSCons -import os import sys test = TestSCons.TestSCons() @@ -39,11 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # On Windows, build a 32-bit exe if on 32-bit python. if sys.platform == 'win32' and sys.maxsize <= 2**32: diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py index eba3fea..b203abe 100644 --- a/test/SWIG/build-dir.py +++ b/test/SWIG/build-dir.py @@ -29,7 +29,6 @@ Make sure SWIG works when a VariantDir (or variant_dir) is used. Test case courtesy Joe Maruszewski. """ -import os.path import sys import TestSCons @@ -49,11 +48,8 @@ else: test.subdir(['source']) -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) if sys.platform == 'win32' and sys.maxsize <= 2**32: swig_arch_var="TARGET_ARCH='x86'," diff --git a/test/SWIG/generated_swigfile.py b/test/SWIG/generated_swigfile.py index d09b473..4686dae 100644 --- a/test/SWIG/generated_swigfile.py +++ b/test/SWIG/generated_swigfile.py @@ -29,7 +29,6 @@ Verify that SCons realizes the -noproxy option means no .py file will be created. """ -import os import sys import TestSCons @@ -54,11 +53,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # handle testing on other platforms: ldmodule_prefix = '_' diff --git a/test/SWIG/live.py b/test/SWIG/live.py index 7c4bdce..f0cf1d5 100644 --- a/test/SWIG/live.py +++ b/test/SWIG/live.py @@ -28,7 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test SWIG behavior with a live, installed SWIG. """ -import os.path +import os import sys import TestSCons @@ -46,12 +46,9 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') - -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = python_include + '/Python.h' -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) + swig = swig.replace('\\','/') python = python.replace('\\','/') python_include = python_include.replace('\\','/') @@ -170,4 +167,4 @@ test.pass_test() # tab-width:4 # indent-tabs-mode:nil # End: -# vim: set expandtab tabstop=4 shiftwidth=4: \ No newline at end of file +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/SWIG/module-deduced-name.py b/test/SWIG/module-deduced-name.py index bdaef4f..6b4d6d9 100644 --- a/test/SWIG/module-deduced-name.py +++ b/test/SWIG/module-deduced-name.py @@ -31,7 +31,6 @@ emitter should return the basename of the module only. """ import TestSCons -import os import sys test = TestSCons.TestSCons() @@ -40,11 +39,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Cannot find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Cannot find %s, skipping test.\n' % Python_h) # On Windows, build a 32-bit exe if on 32-bit python. if sys.platform == 'win32' and sys.maxsize <= 2**32: diff --git a/test/SWIG/module-parens.py b/test/SWIG/module-parens.py index d8c1744..040ef28 100644 --- a/test/SWIG/module-parens.py +++ b/test/SWIG/module-parens.py @@ -29,7 +29,6 @@ Verify that we handle %module(directors="1") statements, both with and without white space before the opening parenthesis. """ -import os.path import sys import TestSCons @@ -39,11 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. diff --git a/test/SWIG/module-quoted.py b/test/SWIG/module-quoted.py index 6f4b891..8bf9e86 100644 --- a/test/SWIG/module-quoted.py +++ b/test/SWIG/module-quoted.py @@ -29,7 +29,6 @@ Verify that we correctly parse quoted module names; e.g. %module "test" (SWIG permits double-quoted names but not single-quoted ones.) """ -import os.path import sys import TestSCons @@ -39,11 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. diff --git a/test/SWIG/module-spaces.py b/test/SWIG/module-spaces.py index 2833dff..ce16497 100644 --- a/test/SWIG/module-spaces.py +++ b/test/SWIG/module-spaces.py @@ -29,7 +29,6 @@ Verify that we correctly parse module names with spaces on the line after the module name ; e.g. "%module test " """ -import os.path import sys import TestSCons @@ -39,11 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. diff --git a/test/SWIG/noproxy.py b/test/SWIG/noproxy.py index 1aaeb08..b4abbc3 100644 --- a/test/SWIG/noproxy.py +++ b/test/SWIG/noproxy.py @@ -29,7 +29,6 @@ Verify that SCons realizes the -noproxy option means no .py file will be created. """ -import os import sys import TestSCons @@ -47,11 +46,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # handle testing on other platforms: ldmodule_prefix = '_' diff --git a/test/SWIG/recursive-includes-cpp.py b/test/SWIG/recursive-includes-cpp.py index 34c7d6e..4cb8fe5 100644 --- a/test/SWIG/recursive-includes-cpp.py +++ b/test/SWIG/recursive-includes-cpp.py @@ -44,11 +44,8 @@ for pre_req in ['swig', 'python']: if not test.where_is(pre_req): test.skip_test('Can not find installed "' + pre_req + '", skipping test.%s' % os.linesep) -# file generated by swig will #include , make sure we have one -python, py_include, py_libpath, py_lib = test.get_platform_python_info() -Python_h = os.path.join(py_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) +python, python_include, python_libpath, python_lib, python_h = \ + test.get_platform_python_info() if sys.platform == 'win32': python_lib = os.path.dirname(sys.executable) + "/libs/" + ('python%d%d'%(sys.version_info[0],sys.version_info[1])) + '.lib' diff --git a/test/SWIG/remove-modules.py b/test/SWIG/remove-modules.py index f5ce60d..ecbc19c 100644 --- a/test/SWIG/remove-modules.py +++ b/test/SWIG/remove-modules.py @@ -29,7 +29,6 @@ Verify that swig-generated modules are removed. The %module directive specifies the module name. """ -import os.path import sys import TestSCons @@ -47,11 +46,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # handle testing on other platforms: ldmodule_prefix = '_' diff --git a/test/SWIG/subdir.py b/test/SWIG/subdir.py index e23b858..062f8dc 100644 --- a/test/SWIG/subdir.py +++ b/test/SWIG/subdir.py @@ -29,7 +29,6 @@ Verify that we expect the .py file created by the -python flag to be in the same subdirectory as the taget. """ -import os import sys import TestSCons @@ -49,11 +48,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib = \ +python, python_include, python_libpath, python_lib, python_h = \ test.get_platform_python_info() -Python_h = os.path.join(python_include, 'Python.h') -if not os.path.exists(Python_h): - test.skip_test('Can not find %s, skipping test.\n' % Python_h) # handle testing on other platforms: ldmodule_prefix = '_' diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 50942ab..14a8fcc 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -564,7 +564,7 @@ class TestSCons(TestCommon): Returns a Python error line for output comparisons. The exec of the traceback line gives us the correct format for - this version of Python. + this version of Python. File "", line 1, @@ -607,7 +607,7 @@ class TestSCons(TestCommon): pattern = to_bytes(pattern) repl = to_bytes(repl) return re.sub(pattern, repl, str, count, flags) - + def normalize_pdf(self, s): s = self.to_bytes_re_sub(r'/(Creation|Mod)Date \(D:[^)]*\)', r'/\1Date (D:XXXX)', s) @@ -811,7 +811,7 @@ class TestSCons(TestCommon): where_jar = self.where_is('jar', ENV['PATH']) if not where_jar: self.skip_test("Could not find Java jar, skipping test(s).\n") - elif sys.platform == "darwin": + elif sys.platform == "darwin": self.java_mac_check(where_jar, 'jar') return where_jar @@ -885,7 +885,7 @@ class TestSCons(TestCommon): self.skip_test("Could not find Java rmic, skipping non-simulated test(s).\n") return where_rmic - + def java_get_class_files(self, dir): result = [] for dirpath, dirnames, filenames in os.walk(dir): @@ -1078,7 +1078,7 @@ SConscript( sconscript ) doCheckLog=True, doCheckStdout=True): """ Used to verify the expected output from using Configure() - via the contents of one or both of stdout or config.log file. + via the contents of one or both of stdout or config.log file. The checks, results, cached parameters all are zipped together for use in comparing results. @@ -1160,19 +1160,19 @@ SConscript( sconscript ) sconstruct = sconstruct log = r'file\ \S*%s\,line \d+:' % re.escape(sconstruct) + ls - if doCheckLog: + if doCheckLog: lastEnd = matchPart(log, logfile, lastEnd) log = "\t" + re.escape("Configure(confdir = %s)" % sconf_dir) + ls - if doCheckLog: + if doCheckLog: lastEnd = matchPart(log, logfile, lastEnd) - + rdstr = "" cnt = 0 for check,result,cache_desc in zip(checks, results, cached): log = re.escape("scons: Configure: " + check) + ls - if doCheckLog: + if doCheckLog: lastEnd = matchPart(log, logfile, lastEnd) log = "" @@ -1217,7 +1217,7 @@ SConscript( sconscript ) rdstr = rdstr + re.escape(check) + re.escape(result) + "\n" log=log + re.escape("scons: Configure: " + result) + ls + ls - if doCheckLog: + if doCheckLog: lastEnd = matchPart(log, logfile, lastEnd) log = "" @@ -1260,9 +1260,12 @@ SConscript( sconscript ) """ Returns a path to a Python executable suitable for testing on this platform and its associated include path, library path, - and library name. + library name, and the path to the Python.h header if found. + If the Python executable or Python header is not found, + the test is skipped. + Returns: - (path to python, include path, library path, library name) + (path to python, include path, library path, library name, header path) """ python = os.environ.get('python_executable', self.where_is('python')) if not python: @@ -1279,28 +1282,44 @@ except AttributeError: try: import distutils.sysconfig exec_prefix = distutils.sysconfig.EXEC_PREFIX - print(distutils.sysconfig.get_python_inc()) + include = distutils.sysconfig.get_python_inc() + print(include) lib_path = os.path.join(exec_prefix, 'libs') if not os.path.exists(lib_path): lib_path = os.path.join(exec_prefix, 'lib') print(lib_path) except: - print(os.path.join(sys.prefix, 'include', py_ver)) + include = os.path.join(sys.prefix, 'include', py_ver) + print(include) print(os.path.join(sys.prefix, 'lib', py_ver, 'config')) print(py_ver) - """) +Python_h = os.path.join(include, "Python.h") +if os.path.exists(Python_h): + print(Python_h) +else: + print("False") +""") else: self.run(program=python, stdin="""\ -import sys, sysconfig -print(sysconfig.get_config_var("INCLUDEPY")) +import sys, sysconfig, os.path +include = sysconfig.get_config_var("INCLUDEPY") +print(include) print(sysconfig.get_config_var("LIBDIR")) py_library_ver = sysconfig.get_config_var("LDVERSION") if not py_library_ver: py_library_ver = '%d.%d' % sys.version_info[:2] print("python"+py_library_ver) +Python_h = os.path.join(include, "Python.h") +if os.path.exists(Python_h): + print(Python_h) +else: + print("False") """) + detected = self.stdout().strip().split('\n') + if detected[3] == "False": + self.skip_test('Can not find required "Python.h", skipping test.\n') - return [python] + self.stdout().strip().split('\n') + return [python] + detected def start(self, *args, **kw): """ -- cgit v0.12 From e83bf211d3419e157af0e445240b13f07b3f6496 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 15 Aug 2018 13:28:06 -0600 Subject: Remove unintended "import io" During develoment of PR#3177, an interation checked objects for being a subclass of io.IOBase, which necessitated importing the io module. Later the check was changed to see if the object simply had a close method, in which case that is called. The import was not removed; cleaning that up. Signed-off-by: Mats Wichmann --- src/engine/SCons/Action.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 32ceaa9..44ddacd 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -819,7 +819,6 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): pobj = dummyPopen(e) finally: # clean up open file handles stored in parent's kw - import io for k, v in kw.items(): if hasattr(v, 'close'): v.close() -- cgit v0.12 From 8b47503f49fa423404cad0d95f070c1674dd8c5a Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 17 Aug 2018 09:04:31 -0600 Subject: get_platform_python_info fail on missing Python.h evolved the get_platform_python_info test method to fail only if a new flag python_h_required is True. Rolled back the previous change to have the method return the path to the Python.h, this was not really needed since the include path is already returned. Signed-off-by: Mats Wichmann --- test/SWIG/SWIGOUTDIR-python.py | 4 ++-- test/SWIG/build-dir.py | 4 ++-- test/SWIG/generated_swigfile.py | 4 ++-- test/SWIG/live.py | 4 ++-- test/SWIG/module-deduced-name.py | 4 ++-- test/SWIG/module-parens.py | 4 ++-- test/SWIG/module-quoted.py | 4 ++-- test/SWIG/module-spaces.py | 4 ++-- test/SWIG/noproxy.py | 4 ++-- test/SWIG/recursive-includes-cpp.py | 4 ++-- test/SWIG/remove-modules.py | 4 ++-- test/SWIG/subdir.py | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/SWIG/SWIGOUTDIR-python.py b/test/SWIG/SWIGOUTDIR-python.py index 53b5bdf..8d6703f 100644 --- a/test/SWIG/SWIGOUTDIR-python.py +++ b/test/SWIG/SWIGOUTDIR-python.py @@ -38,8 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # On Windows, build a 32-bit exe if on 32-bit python. if sys.platform == 'win32' and sys.maxsize <= 2**32: diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py index b203abe..d268c87 100644 --- a/test/SWIG/build-dir.py +++ b/test/SWIG/build-dir.py @@ -48,8 +48,8 @@ else: test.subdir(['source']) -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) if sys.platform == 'win32' and sys.maxsize <= 2**32: swig_arch_var="TARGET_ARCH='x86'," diff --git a/test/SWIG/generated_swigfile.py b/test/SWIG/generated_swigfile.py index 4686dae..145349b 100644 --- a/test/SWIG/generated_swigfile.py +++ b/test/SWIG/generated_swigfile.py @@ -53,8 +53,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # handle testing on other platforms: ldmodule_prefix = '_' diff --git a/test/SWIG/live.py b/test/SWIG/live.py index f0cf1d5..a64defe 100644 --- a/test/SWIG/live.py +++ b/test/SWIG/live.py @@ -46,8 +46,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) swig = swig.replace('\\','/') python = python.replace('\\','/') diff --git a/test/SWIG/module-deduced-name.py b/test/SWIG/module-deduced-name.py index 6b4d6d9..14d23a2 100644 --- a/test/SWIG/module-deduced-name.py +++ b/test/SWIG/module-deduced-name.py @@ -39,8 +39,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Cannot find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # On Windows, build a 32-bit exe if on 32-bit python. if sys.platform == 'win32' and sys.maxsize <= 2**32: diff --git a/test/SWIG/module-parens.py b/test/SWIG/module-parens.py index 040ef28..4ce7511 100644 --- a/test/SWIG/module-parens.py +++ b/test/SWIG/module-parens.py @@ -38,8 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. diff --git a/test/SWIG/module-quoted.py b/test/SWIG/module-quoted.py index 8bf9e86..60bc0b0 100644 --- a/test/SWIG/module-quoted.py +++ b/test/SWIG/module-quoted.py @@ -38,8 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. diff --git a/test/SWIG/module-spaces.py b/test/SWIG/module-spaces.py index ce16497..6a3f270 100644 --- a/test/SWIG/module-spaces.py +++ b/test/SWIG/module-spaces.py @@ -38,8 +38,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. diff --git a/test/SWIG/noproxy.py b/test/SWIG/noproxy.py index b4abbc3..f94f553 100644 --- a/test/SWIG/noproxy.py +++ b/test/SWIG/noproxy.py @@ -46,8 +46,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # handle testing on other platforms: ldmodule_prefix = '_' diff --git a/test/SWIG/recursive-includes-cpp.py b/test/SWIG/recursive-includes-cpp.py index 4cb8fe5..3999cc3 100644 --- a/test/SWIG/recursive-includes-cpp.py +++ b/test/SWIG/recursive-includes-cpp.py @@ -44,8 +44,8 @@ for pre_req in ['swig', 'python']: if not test.where_is(pre_req): test.skip_test('Can not find installed "' + pre_req + '", skipping test.%s' % os.linesep) -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) if sys.platform == 'win32': python_lib = os.path.dirname(sys.executable) + "/libs/" + ('python%d%d'%(sys.version_info[0],sys.version_info[1])) + '.lib' diff --git a/test/SWIG/remove-modules.py b/test/SWIG/remove-modules.py index ecbc19c..a4d7b16 100644 --- a/test/SWIG/remove-modules.py +++ b/test/SWIG/remove-modules.py @@ -46,8 +46,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # handle testing on other platforms: ldmodule_prefix = '_' diff --git a/test/SWIG/subdir.py b/test/SWIG/subdir.py index 062f8dc..6951753 100644 --- a/test/SWIG/subdir.py +++ b/test/SWIG/subdir.py @@ -48,8 +48,8 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') -python, python_include, python_libpath, python_lib, python_h = \ - test.get_platform_python_info() +python, python_include, python_libpath, python_lib = \ + test.get_platform_python_info(python_h_required=True) # handle testing on other platforms: ldmodule_prefix = '_' -- cgit v0.12 From bd27fe421c384dffebdcd3a1732a925480e2db1f Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 17 Aug 2018 09:14:03 -0600 Subject: add missed TestCmd.py changes Signed-off-by: Mats Wichmann --- testing/framework/TestSCons.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 14a8fcc..bf6aabb 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -1256,21 +1256,25 @@ SConscript( sconscript ) # see also sys.prefix documentation return python_minor_version_string() - def get_platform_python_info(self): + def get_platform_python_info(self, python_h_required=False): """ Returns a path to a Python executable suitable for testing on - this platform and its associated include path, library path, - library name, and the path to the Python.h header if found. - If the Python executable or Python header is not found, - the test is skipped. + this platform and its associated include path, library path and + library name. - Returns: - (path to python, include path, library path, library name, header path) + If the Python executable or Python header (if required) + is not found, the test is skipped. + + Returns a tuple: + (path to python, include path, library path, library name) """ python = os.environ.get('python_executable', self.where_is('python')) if not python: self.skip_test('Can not find installed "python", skipping test.\n') + # construct a program to run in the intended environment + # in order to fetch the characteristics of that Python. + # Windows Python doesn't store all the info in config vars. if sys.platform == 'win32': self.run(program=python, stdin="""\ import sysconfig, sys, os.path @@ -1315,11 +1319,11 @@ if os.path.exists(Python_h): else: print("False") """) - detected = self.stdout().strip().split('\n') - if detected[3] == "False": + incpath, libpath, libname, python_h = self.stdout().strip().split('\n') + if python_h == "False" and python_h_required: self.skip_test('Can not find required "Python.h", skipping test.\n') - return [python] + detected + return (python, incpath, libpath, libname) def start(self, *args, **kw): """ -- cgit v0.12 From 9968415b4bbb46ab95023077844590b962e1ffcf Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 19 Aug 2018 18:01:34 -0700 Subject: Fix test/AS/nasm.py as it previously would only run with nasm version 0.98 --- test/AS/nasm.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/AS/nasm.py b/test/AS/nasm.py index 1733789..4d57951 100644 --- a/test/AS/nasm.py +++ b/test/AS/nasm.py @@ -47,17 +47,17 @@ if sys.platform.find('linux') == -1: test.skip_test("skipping test on non-Linux platform '%s'\n" % sys.platform) try: - import popen2 - stdout = popen2.popen2('nasm -v')[0] + import subprocess + stdout = subprocess.check_output(['nasm','-v']) except OSError: test.skip_test('could not determine nasm version; skipping test\n') else: - version = stdout.read().split()[2] - if version[:4] != '0.98': + version = stdout.split()[2].split('.') + if int(version[0]) ==0 and int(version[1]) < 98: test.skip_test("skipping test of nasm version %s\n" % version) machine = os.uname()[4] - if not machine in ('i386', 'i486', 'i586', 'i686'): + if not machine in ('i386', 'i486', 'i586', 'i686', 'x86_64'): fmt = "skipping test of nasm %s on non-x86 machine '%s'\n" test.skip_test(fmt % (version, machine)) @@ -78,6 +78,8 @@ test.file_fixture('wrapper.py') test.write('SConstruct', """ eee = Environment(tools = ['gcc', 'gnulink', 'nasm'], + CFLAGS = ['-m32'], + LINKFLAGS = '-m32', ASFLAGS = '-f %(nasm_format)s') fff = eee.Clone(AS = r'%(_python_)s wrapper.py ' + WhereIs('nasm')) eee.Program(target = 'eee', source = ['eee.asm', 'eee_main.c']) @@ -99,6 +101,7 @@ name: """) test.write('eee_main.c', r""" +#include extern char name[]; int -- cgit v0.12 From 6719b7292b7bd42d9e8e62391134a2e3d10001bf Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 20 Aug 2018 07:43:39 -0700 Subject: Fix bytes->string decoding issue as subprocess returned stdout is bytes in py3 --- test/AS/nasm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/AS/nasm.py b/test/AS/nasm.py index 4d57951..4d93c7f 100644 --- a/test/AS/nasm.py +++ b/test/AS/nasm.py @@ -52,6 +52,7 @@ try: except OSError: test.skip_test('could not determine nasm version; skipping test\n') else: + stdout = stdout.decode() version = stdout.split()[2].split('.') if int(version[0]) ==0 and int(version[1]) < 98: test.skip_test("skipping test of nasm version %s\n" % version) -- cgit v0.12 From c25ff60873b0e2ec170afc988090605f9f1e6620 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 22 Aug 2018 12:04:39 +0200 Subject: Travis CI: Upgrade to Python 3.7 production release Upgrade Python 3.7 from pre-release to production release in alignment with travis-ci/travis-ci#9069 @bdbaddog --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 58ca595..8894823 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,9 +36,10 @@ jobs: sudo: required - <<: *test_job - python: 3.7-dev + python: 3.7 env: PYVER=37 sudo: required + dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069) - <<: *test_job python: pypy -- cgit v0.12 From 0357e3670d475fbd0a1b56b6fb05f78e92ad8485 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 29 Aug 2018 10:52:54 -0700 Subject: Add ghostscript to travis package install to get dvipdf --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index ddef1e6..50331e5 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -10,7 +10,7 @@ sudo apt-get -y install gdc # dependencies for docbook tests sudo apt-get -y install docbook-xml xsltproc libxml2-dev libxslt-dev fop docbook-xsl-doc-pdf # dependencies for latex tests -sudo apt-get -y install texlive texlive-latex3 biber texmaker +sudo apt-get -y install texlive texlive-latex3 biber texmaker ghostscript # need some things for building dependencies for other tests sudo apt-get -y install python-pip python-dev build-essential libpcre3-dev autoconf automake libtool bison subversion git # dependencies for docbook tests continued -- cgit v0.12 From 68c0272e4b60b1eb9cbee62ae1fddbcec4867e69 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 29 Aug 2018 08:22:09 -0600 Subject: win32 handle exception object correctly Code inspection reveals this problem (4 instances): Class 'OSError' does not define '__getitem__' so the [] operator cannot be used on its instances. Use e.errno for e[0] and e.strerror for e[1]. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + src/engine/SCons/Platform/win32.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index ab15214..7feec12 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -123,6 +123,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - fix must_contain tests for py3 - one swig test now checks for Python.h instead of failing - if test opens os.devnull, register with atexit so file opens do not leak. + - win32.py handle exception object appropriately for class From Hao Wu - typo in customized decider example in user guide diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py index 5c877b5..351684a 100644 --- a/src/engine/SCons/Platform/win32.py +++ b/src/engine/SCons/Platform/win32.py @@ -202,9 +202,9 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr): try: ret = exitvalmap[e[0]] except KeyError: - sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e[0], cmd, e[1])) + sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e.errno, cmd, e.strerror)) if stderr is not None: - stderr.write("scons: %s: %s\n" % (cmd, e[1])) + stderr.write("scons: %s: %s\n" % (cmd, e.strerror)) # copy child output from tempfiles to our streams # and do clean up stuff if stdout is not None and stdoutRedirected == 0: -- cgit v0.12 From c487700ccd4cae873170b812c2f201f1400d8dea Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 30 Aug 2018 09:31:21 -0600 Subject: Do not use time.clock for Py3 in runtest time.clock is deprecated since Python 3.3 and will be removed in Python 3.8. 3.7 started issuing DeprecationWarning, which fails about 16 tests in AppVeyor CI (and running manually), since the warning appears in stderr stream and so real vs expected does not match any longer. Arguably the tests could be fixed to do a different check (contains rather than exactly-equal), but a change needs to be made anyway. use time.perf_counter as the time function for Python 3. This works for Windows and non-Windows; however since this function did not exist in 2.7 (added for 3.3), the Py2 case is left, which selects between time.clock and time.time depending on OS. Note this addresses runtest.py, but not code in bench/, which need attention also. Suggest that be a separate change since it's not failing tests. Signed-off-by: Mats Wichmann --- runtest.py | 12 ++++++++---- src/CHANGES.txt | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/runtest.py b/runtest.py index 293e4ca..1cac45b 100755 --- a/runtest.py +++ b/runtest.py @@ -95,11 +95,12 @@ import time import threading try: # python3 from queue import Queue + PY3=True except ImportError as e: # python2 from Queue import Queue + PY3=False import subprocess - cwd = os.getcwd() baseline = 0 @@ -770,10 +771,13 @@ os.environ["python_executable"] = python # but time.time() does a better job on Linux systems, so let that be # the non-Windows default. -if sys.platform == 'win32': - time_func = time.clock +if PY3: + time_func = time.perf_counter else: - time_func = time.time + if sys.platform == 'win32': + time_func = time.clock + else: + time_func = time.time if print_times: print_time_func = lambda fmt, time: sys.stdout.write(fmt % time) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index ab15214..27fe66a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -123,6 +123,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - fix must_contain tests for py3 - one swig test now checks for Python.h instead of failing - if test opens os.devnull, register with atexit so file opens do not leak. + - for py3, use time.perf_counter instead of depr time.clock, which is + used in win32 case for py2. py37 depr warnings were failing a bunch + of tests on windows since warn messes up expected stderr. From Hao Wu - typo in customized decider example in user guide -- cgit v0.12 From b215cbc5022148bff6fe6986780794fa80e75b2b Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 30 Aug 2018 10:48:27 -0600 Subject: Rework the time.clock -> time.perf_counter change Signed-off-by: Mats Wichmann --- runtest.py | 5 ++--- src/CHANGES.txt | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runtest.py b/runtest.py index 1cac45b..697b872 100755 --- a/runtest.py +++ b/runtest.py @@ -95,10 +95,8 @@ import time import threading try: # python3 from queue import Queue - PY3=True except ImportError as e: # python2 from Queue import Queue - PY3=False import subprocess cwd = os.getcwd() @@ -771,7 +769,8 @@ os.environ["python_executable"] = python # but time.time() does a better job on Linux systems, so let that be # the non-Windows default. -if PY3: +#TODO: clean up when py2 support is dropped +try: time_func = time.perf_counter else: if sys.platform == 'win32': diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 27fe66a..d81a9f9 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -123,9 +123,10 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - fix must_contain tests for py3 - one swig test now checks for Python.h instead of failing - if test opens os.devnull, register with atexit so file opens do not leak. - - for py3, use time.perf_counter instead of depr time.clock, which is - used in win32 case for py2. py37 depr warnings were failing a bunch - of tests on windows since warn messes up expected stderr. + - use time.perf_counter instead of time.clock if it exists. + time.clock deprecated since py3.3, due to remove in 3.8. deprecation + warnings from py3.7 were failing a bunch of tests on Windows since they + mess up expected stderr. From Hao Wu - typo in customized decider example in user guide -- cgit v0.12 From 4913b28bfc6738f49241113202ce1be02bbe9368 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 30 Aug 2018 11:34:19 -0600 Subject: Part of previous change restored somehow the change from if test to try block got partly lost during commit. changing else->except --- runtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtest.py b/runtest.py index 697b872..45ffffc 100755 --- a/runtest.py +++ b/runtest.py @@ -772,7 +772,7 @@ os.environ["python_executable"] = python #TODO: clean up when py2 support is dropped try: time_func = time.perf_counter -else: +except AttributeError: if sys.platform == 'win32': time_func = time.clock else: -- cgit v0.12 From 40982e03a34d869900d6ae2201c19cbdcf9a6d6f Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 30 Aug 2018 18:38:25 -0700 Subject: see if defining _JAVA_OPTIONS= to nothing will quiet STDERR from java which is breaking tests for py3.7 --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8894823..3ee530e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,9 @@ jobs: - <<: *test_job python: 3.7 - env: PYVER=37 + env: + - PYVER=37 + - _JAVA_OPTIONS= sudo: required dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069) -- cgit v0.12 From 3de25a92e801acec7afcdb9b563a132ca327327c Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 30 Aug 2018 20:09:25 -0700 Subject: Attempt to fix py37 java falures. Which are likely caused by newer oracle java echoing values in _JAVA_OPTIONS env variable to stderr. --- .travis/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis/install.sh b/.travis/install.sh index 50331e5..7cdfaa7 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -33,3 +33,7 @@ if [[ "$PYVER" == 27 ]]; then tar xzf rel-3.0.12.tar.gz cd swig-rel-3.0.12 && ./autogen.sh && ./configure --prefix=/usr && make && sudo make install && cd .. fi + +# Clear this flag as newer Oracle Java's will echo to stderr any values set in it which breaks several java +# tests +unset _JAVA_OPTIONS \ No newline at end of file -- cgit v0.12 From 26be7837c6bef1afe1e5b574eaa7f5166629005f Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 30 Aug 2018 20:33:42 -0700 Subject: More deletion of _JAVA_OPTIONS to runtest.py from travis startup files. --- .travis.yml | 1 - .travis/install.sh | 6 +----- runtest.py | 4 ++++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ee530e..4c4a1f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,6 @@ jobs: python: 3.7 env: - PYVER=37 - - _JAVA_OPTIONS= sudo: required dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069) diff --git a/.travis/install.sh b/.travis/install.sh index 7cdfaa7..6f2cfe2 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -32,8 +32,4 @@ if [[ "$PYVER" == 27 ]]; then wget https://github.com/swig/swig/archive/rel-3.0.12.tar.gz tar xzf rel-3.0.12.tar.gz cd swig-rel-3.0.12 && ./autogen.sh && ./configure --prefix=/usr && make && sudo make install && cd .. -fi - -# Clear this flag as newer Oracle Java's will echo to stderr any values set in it which breaks several java -# tests -unset _JAVA_OPTIONS \ No newline at end of file +fi \ No newline at end of file diff --git a/runtest.py b/runtest.py index 45ffffc..9ffe374 100755 --- a/runtest.py +++ b/runtest.py @@ -618,6 +618,10 @@ os.environ['SCONS_VERSION'] = version old_pythonpath = os.environ.get('PYTHONPATH') +# Clear _JAVA_OPTIONS which java tools output to stderr when run breaking tests +if '_JAVA_OPTIONS' in os.environ: + del os.environ['_JAVA_OPTIONS'] + # FIXME: the following is necessary to pull in half of the testing # harness from $srcdir/etc. Those modules should be transfered # to testing/, in which case this manipulation of PYTHONPATH -- cgit v0.12 From f9aa719a202271b6786510a8025e8065cb8835bb Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 31 Aug 2018 08:15:08 -0600 Subject: Convert one more e[0] to e.errno for OSError usage Signed-off-by: Mats Wichmann --- src/engine/SCons/Platform/win32.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py index 351684a..ea2fd3f 100644 --- a/src/engine/SCons/Platform/win32.py +++ b/src/engine/SCons/Platform/win32.py @@ -200,7 +200,7 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr): except OSError as e: # catch any error try: - ret = exitvalmap[e[0]] + ret = exitvalmap[e.errno] except KeyError: sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e.errno, cmd, e.strerror)) if stderr is not None: -- cgit v0.12 From 701d5330aa9f5bca4601353a05ac86ca88e745a6 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 31 Aug 2018 09:04:30 -0700 Subject: Have travis-ci post #scons when builds complete. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4c4a1f9..ea63e57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,9 @@ dist: trusty language: python +notifications: + irc: "chat.freenode.net#scons" + addons: apt: update: true -- cgit v0.12