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 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 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