diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/D/SharedObjects/Common/common.py | 17 | ||||
-rw-r--r-- | test/Install/rec-sub-dir.py | 66 | ||||
-rw-r--r-- | test/SWIG/SWIGOUTDIR.py | 6 | ||||
-rw-r--r-- | test/SWIG/generated_swigfile.py | 23 | ||||
-rw-r--r-- | test/_CPPINCFLAGS.py | 6 |
5 files changed, 89 insertions, 29 deletions
diff --git a/test/D/SharedObjects/Common/common.py b/test/D/SharedObjects/Common/common.py index 1bb2d50..6a75e34 100644 --- a/test/D/SharedObjects/Common/common.py +++ b/test/D/SharedObjects/Common/common.py @@ -29,8 +29,9 @@ import TestSCons from SCons.Environment import Base +import re +import subprocess from os.path import abspath, dirname -from subprocess import check_output import sys sys.path.insert(1, abspath(dirname(__file__) + '/../../Support')) @@ -45,9 +46,17 @@ def testForTool(tool): test.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool)) if tool == 'gdc': - result = check_output(('gdc', '--version')) - version = result.decode().splitlines()[0].split()[3] - major, minor, debug = [int(x) for x in version.split('.')] + cp = subprocess.run(('gdc', '--version'), stdout=subprocess.PIPE) + # different version strings possible, i.e.: + # gdc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)\nCopyright (C)... + # gdc (Ubuntu 10.2.0-5ubuntu1~20.04) 10.20.0\nCopyright (C)... + vstr = cp.stdout.decode().splitlines()[0] + match = re.search(r'[0-9]+(\.[0-9]+)+', vstr) + if match: + version = match.group(0) + major, minor, debug = [int(x) for x in version.split('.')] + else: + major = 0 if (major < 6) or (major == 6 and minor < 3): test.skip_test('gdc prior to version 6.0.0 does not support shared libraries.\n') diff --git a/test/Install/rec-sub-dir.py b/test/Install/rec-sub-dir.py new file mode 100644 index 0000000..0a11928 --- /dev/null +++ b/test/Install/rec-sub-dir.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# MIT Licenxe +# +# Copyright The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +""" +Test using Install() on directory that contains existing subdirectories +causing copytree recursion where the directory already exists. +""" + +import os.path + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """\ +DefaultEnvironment(tools=[]) +Execute(Mkdir('a/b/c')) +Execute(Mkdir('b/c/d')) +Install('z', 'a') +Install('z/a', 'b') +""") + +expect="""\ +Mkdir("a/b/c") +Mkdir("b/c/d") +Install directory: "a" as "z%sa" +Install directory: "b" as "z%sa%sb" +""" % (os.sep, os.sep, os.sep) +test.run(arguments=["-Q"], stdout=expect) + +test.must_exist(test.workpath('a', 'b', 'c')) +test.must_exist(test.workpath('b', 'c', 'd')) +test.must_exist(test.workpath('z', 'a', 'b', 'c', 'd')) + +# this run used to fail on Windows with an OS error before the copytree fix +test.run(arguments=["-Q"]) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/SWIG/SWIGOUTDIR.py b/test/SWIG/SWIGOUTDIR.py index 10b1575..6b600d7 100644 --- a/test/SWIG/SWIGOUTDIR.py +++ b/test/SWIG/SWIGOUTDIR.py @@ -1,6 +1,7 @@ #!/usr/bin/env python +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +21,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that use of the $SWIGOUTDIR variable causes SCons to recognize diff --git a/test/SWIG/generated_swigfile.py b/test/SWIG/generated_swigfile.py index 145349b..8d2a2c9 100644 --- a/test/SWIG/generated_swigfile.py +++ b/test/SWIG/generated_swigfile.py @@ -1,6 +1,7 @@ #!/usr/bin/env python +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +21,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that SCons realizes the -noproxy option means no .py file will @@ -38,14 +36,8 @@ import TestSCons if sys.platform == 'win32': _dll = '.dll' else: - _dll = '.so' + _dll = '.so' -# swig-python expects specific filenames. -# the platform specific suffix won't necessarily work. -if sys.platform == 'win32': - _dll = '.dll' -else: - _dll = '.so' test = TestSCons.TestSCons() @@ -54,12 +46,11 @@ if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') python, python_include, python_libpath, python_lib = \ - test.get_platform_python_info(python_h_required=True) + test.get_platform_python_info(python_h_required=True) # handle testing on other platforms: ldmodule_prefix = '_' - test.write('SConstruct', """ foo = Environment(CPPPATH=[r'%(python_include)s'], SWIG=[r'%(swig)s'], @@ -69,7 +60,6 @@ python_interface = foo.Command( 'test_py_swig.i', Value(1), 'echo %%module test_ python_c_file = foo.CFile( target='python_swig_test',source=python_interface, SWIGFLAGS = '-python -c++' ) java_interface = foo.Command( 'test_java_swig.i', Value(1),'echo %%module test_java_swig > test_java_swig.i' ) java_c_file = foo.CFile( target='java_swig_test' ,source=java_interface, SWIGFLAGS = '-java -c++' ) - """ % locals()) expected_stdout = """\ @@ -78,12 +68,11 @@ echo %%module test_java_swig > test_java_swig.i echo %%module test_py_swig > test_py_swig.i %(swig)s -o python_swig_test_wrap.cc -python -c++ test_py_swig.i """ % locals() -test.run(arguments = '.',stdout=test.wrap_stdout(expected_stdout)) - +test.run(arguments='.', stdout=test.wrap_stdout(expected_stdout)) # If we mistakenly depend on the .py file that SWIG didn't create # (suppressed by the -noproxy option) then the build won't be up-to-date. -test.up_to_date(arguments = '.') +test.up_to_date(arguments='.') test.pass_test() diff --git a/test/_CPPINCFLAGS.py b/test/_CPPINCFLAGS.py index c5096ba..8bb8261 100644 --- a/test/_CPPINCFLAGS.py +++ b/test/_CPPINCFLAGS.py @@ -1,6 +1,7 @@ #!/usr/bin/env python +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +21,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test that we can expand $_CPPINCFLAGS correctly regardless of whether |