diff options
author | Dirk Baechle <dl9obn@darc.de> | 2014-09-12 17:59:39 (GMT) |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2014-09-12 17:59:39 (GMT) |
commit | 2607d69b86683acd061491826b5bf304f552284d (patch) | |
tree | a125cf2fc6f5024c9919f4a992b318c1350f0304 | |
parent | 87cb9ca579c9e8cc2d972552f8db6590b991cdeb (diff) | |
parent | 70a6365e0bcf530819a83edaa3b9d9bbc08b218e (diff) | |
download | SCons-2607d69b86683acd061491826b5bf304f552284d.zip SCons-2607d69b86683acd061491826b5bf304f552284d.tar.gz SCons-2607d69b86683acd061491826b5bf304f552284d.tar.bz2 |
Merged in russel/scons (pull request #182), various fixes for the D tools and their tests
27 files changed, 302 insertions, 36 deletions
diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py index 1178b85..048d736 100644 --- a/src/engine/SCons/Tool/gdc.py +++ b/src/engine/SCons/Tool/gdc.py @@ -95,9 +95,9 @@ def generate(env): env['DLINKFLAGS'] = SCons.Util.CLVar('') env['DLINKCOM'] = '$DLINK -o $TARGET $DLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - env['SHDLINK'] = '$DC' - env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared') - env['SHDLINKCOM'] = '$DLINK -o $TARGET $DLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['DSHLINK'] = '$DC' + env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared') + env['SHDLINKCOM'] = '$DLINK -o $TARGET $DSHLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '') diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py index fa50060..d74464f 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -101,7 +101,7 @@ def generate(env): env['DLINKCOM'] = '$DLINK -of=$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' env['DSHLINK'] = '$DC' - env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared') + env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=phobos2') env['SHDLINKCOM'] = '$DLINK -of=$TARGET $DSHLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' diff --git a/test/D/CoreScanner/Image/SConstruct_template b/test/D/CoreScanner/Image/SConstruct_template index a128c67..e91343b 100644 --- a/test/D/CoreScanner/Image/SConstruct_template +++ b/test/D/CoreScanner/Image/SConstruct_template @@ -3,7 +3,6 @@ import os environment = Environment( - ENV=os.environ, tools=['link', '{}']) environment.Program('test1.d') environment.Program('test2.d') diff --git a/test/D/DMD.py b/test/D/DMD.py index 1bde380..2d9333a 100644 --- a/test/D/DMD.py +++ b/test/D/DMD.py @@ -28,16 +28,20 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons +import sys +from os.path import abspath, dirname, join +sys.path.append(join(dirname(abspath(__file__)), 'Support')) +from executablesSearch import isExecutableOfToolAvailable + _exe = TestSCons._exe test = TestSCons.TestSCons() -dmd = test.where_is('dmd') -if not dmd: +if not isExecutableOfToolAvailable(test, 'dmd'): test.skip_test("Could not find 'dmd'; skipping test.\n") test.write('SConstruct', """\ import os -env = Environment(ENV=os.environ) +env = Environment() if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) diff --git a/test/D/DMD2.py b/test/D/DMD2.py index cc8ab93..fc5f79f 100644 --- a/test/D/DMD2.py +++ b/test/D/DMD2.py @@ -28,15 +28,20 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons +import sys +from os.path import abspath, dirname, join +sys.path.append(join(dirname(abspath(__file__)), 'Support')) +from executablesSearch import isExecutableOfToolAvailable + _exe = TestSCons._exe test = TestSCons.TestSCons() -if not test.where_is('dmd') and not test.where_is('gdmd'): - test.skip_test("Could not find 'dmd' or 'gdmd', skipping test.\n") +if not isExecutableOfToolAvailable(test, 'dmd'): + test.skip_test("Could not find 'dmd'; skipping test.\n") test.write('SConstruct', """\ import os -env = Environment(tools=['link', 'dmd'], ENV=os.environ) +env = Environment(tools=['link', 'dmd']) if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) diff --git a/test/D/DMD2_Alt.py b/test/D/DMD2_Alt.py index fbe2f2b..11c061d 100644 --- a/test/D/DMD2_Alt.py +++ b/test/D/DMD2_Alt.py @@ -28,15 +28,20 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons +import sys +from os.path import abspath, dirname, join +sys.path.append(join(dirname(abspath(__file__)), 'Support')) +from executablesSearch import isExecutableOfToolAvailable + _exe = TestSCons._exe test = TestSCons.TestSCons() -if not test.where_is('dmd') and not test.where_is('gdmd'): - test.skip_test("Could not find 'dmd' or 'gdmd', skipping test.\n") +if not isExecutableOfToolAvailable(test, 'dmd'): + test.skip_test("Could not find 'dmd'; skipping test.\n") test.write('SConstruct', """\ import os -env = Environment(tools=['dmd', 'link'], ENV=os.environ) +env = Environment(tools=['dmd', 'link']) if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) diff --git a/test/D/GDC.py b/test/D/GDC.py index e24ec43..b548b94 100644 --- a/test/D/GDC.py +++ b/test/D/GDC.py @@ -36,7 +36,7 @@ if not test.where_is('gdc'): test.write('SConstruct', """\ import os -env = Environment(tools=['link', 'gdc'], ENV=os.environ) +env = Environment(tools=['link', 'gdc']) if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) diff --git a/test/D/GDC_Alt.py b/test/D/GDC_Alt.py index cac7949..27159ee 100644 --- a/test/D/GDC_Alt.py +++ b/test/D/GDC_Alt.py @@ -36,7 +36,7 @@ if not test.where_is('gdc'): test.write('SConstruct', """\ import os -env = Environment(tools=['gdc', 'link'], ENV=os.environ) +env = Environment(tools=['gdc', 'link']) if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) diff --git a/test/D/HSTeoh/LinkingProblem/SConstruct_template b/test/D/HSTeoh/LinkingProblem/SConstruct_template index 6815cdf..a4aa795 100644 --- a/test/D/HSTeoh/LinkingProblem/SConstruct_template +++ b/test/D/HSTeoh/LinkingProblem/SConstruct_template @@ -3,8 +3,7 @@ import os environment = Environment( - ENV=os.environ, - tools = ['cc', 'link' , '{}'], + tools = ['cc', '{}', 'link'], LIBS = ['ncurses']) environment.Object('ncurs_impl.o', 'ncurs_impl.c') diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template index 89c603b..118a7b2 100644 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template @@ -3,7 +3,6 @@ import os environment = Environment( - ENV=os.environ, tools=['link', '{}'], # It might be thought that a single string can contain multiple options space separated. Actually this # is deemed to be a single option, so leads to an error. diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template index c688ab7..e2e7439 100644 --- a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template @@ -3,7 +3,6 @@ import os environment = Environment( - ENV=os.environ, tools=['link', '{}']) environment.Program('helloWorld.d') diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template index 425970a..b38a9f0 100644 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template @@ -3,7 +3,6 @@ import os environment = Environment( - ENV=os.environ, tools=['link', '{}']) objects = environment.Object('helloWorld.d') diff --git a/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py b/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py index 3b178b9..d44c9bd 100644 --- a/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py +++ b/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py @@ -50,7 +50,21 @@ def testForTool(tool): test.run() - for f in ('libstuff.so', 'stuff.os', 'test1', 'test1.o', 'test2', 'test2.o'): + platform = Base()['PLATFORM'] + + if platform == 'posix': + libraryname = 'libstuff.so' + filename = 'stuff.os' + elif platform == 'darwin': + libraryname = 'libstuff.dylib' + filename = 'stuff.os' + elif platform == 'win32': + libraryname = 'stuff.dll' + filename = 'stuff.obj' + else: + test.fail_test('No information about platform: ' + platform) + + for f in (libraryname, filename, 'test1', 'test1.o', 'test2', 'test2.o'): test.must_exist(test.workpath(join('test', 'test1', f))) test.pass_test() diff --git a/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py b/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py index 3b178b9..d44c9bd 100644 --- a/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py +++ b/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py @@ -50,7 +50,21 @@ def testForTool(tool): test.run() - for f in ('libstuff.so', 'stuff.os', 'test1', 'test1.o', 'test2', 'test2.o'): + platform = Base()['PLATFORM'] + + if platform == 'posix': + libraryname = 'libstuff.so' + filename = 'stuff.os' + elif platform == 'darwin': + libraryname = 'libstuff.dylib' + filename = 'stuff.os' + elif platform == 'win32': + libraryname = 'stuff.dll' + filename = 'stuff.obj' + else: + test.fail_test('No information about platform: ' + platform) + + for f in (libraryname, filename, 'test1', 'test1.o', 'test2', 'test2.o'): test.must_exist(test.workpath(join('test', 'test1', f))) test.pass_test() diff --git a/test/D/LDC.py b/test/D/LDC.py index 94acf1c..19070a5 100644 --- a/test/D/LDC.py +++ b/test/D/LDC.py @@ -43,7 +43,7 @@ if not isExecutableOfToolAvailable(test, 'ldc'): test.write('SConstruct', """\ import os -env = Environment(tools=['link', 'ldc'], ENV=os.environ) +env = Environment(tools=['link', 'ldc']) if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) diff --git a/test/D/LDC_Alt.py b/test/D/LDC_Alt.py index 571b8f0..bca7dd6 100644 --- a/test/D/LDC_Alt.py +++ b/test/D/LDC_Alt.py @@ -43,7 +43,7 @@ if not isExecutableOfToolAvailable(test, 'ldc'): test.write('SConstruct', """\ import os -env = Environment(tools=['ldc', 'link'], ENV=os.environ) +env = Environment(tools=['ldc', 'link']) if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct index 47870d7..5cf58a3 100644 --- a/test/D/MixedDAndC/Image/SConstruct +++ b/test/D/MixedDAndC/Image/SConstruct @@ -3,7 +3,6 @@ import os environment = Environment( - ENV=os.environ, DFLAGS=['-m64', '-O']) environment.Program('proj', [ diff --git a/test/D/Scanner.py b/test/D/Scanner.py index 48af057..b005adf 100644 --- a/test/D/Scanner.py +++ b/test/D/Scanner.py @@ -31,12 +31,16 @@ a single statement. import TestSCons +import sys +from os.path import abspath, dirname, join +sys.path.append(join(dirname(abspath(__file__)), 'Support')) +from executablesSearch import isExecutableOfToolAvailable + test = TestSCons.TestSCons() _obj = TestSCons._obj -dmd = test.where_is('dmd') -if not dmd: +if not isExecutableOfToolAvailable(test, 'dmd'): test.skip_test("Could not find 'dmd'; skipping test.\n") test.subdir(['p']) diff --git a/test/D/SharedObjects/Common/__init__.py b/test/D/SharedObjects/Common/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/D/SharedObjects/Common/__init__.py diff --git a/test/D/SharedObjects/Common/common.py b/test/D/SharedObjects/Common/common.py new file mode 100644 index 0000000..a5d7b27 --- /dev/null +++ b/test/D/SharedObjects/Common/common.py @@ -0,0 +1,80 @@ +""" +Support functions for all the tests. +""" + +# +# __COPYRIGHT__ +# +# 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. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons + +from SCons.Environment import Base + +from os.path import abspath, dirname + +import sys +sys.path.insert(1, abspath(dirname(__file__) + '/../../Support')) + +from executablesSearch import isExecutableOfToolAvailable + +def testForTool(tool): + + test = TestSCons.TestSCons() + + if not isExecutableOfToolAvailable(test, tool) : + test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) + + test.dir_fixture('Image') + test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) + + if tool == 'dmd': + # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr + # that cause inappropriate failure of the tests, so simply ignore them. + test.run(stderr=None) + else: + test.run() + + platform = Base()['PLATFORM'] + if platform == 'posix': + filename = 'code.o' + libraryname = 'libanswer.so' + elif platform == 'darwin': + filename = 'code.o' + libraryname = 'libanswer.dylib' + elif platform == 'win32' or platform == 'win64': + filename = 'code.obj' + libraryname = 'answer.dll' + else: + test.fail_test() + + test.must_exist(test.workpath(filename)) + test.must_exist(test.workpath(libraryname)) + + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/SharedObjects/Common/sconstest.skip b/test/D/SharedObjects/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/D/SharedObjects/Common/sconstest.skip diff --git a/test/D/SharedObjects/Image/SConstruct_template b/test/D/SharedObjects/Image/SConstruct_template new file mode 100644 index 0000000..213de7e --- /dev/null +++ b/test/D/SharedObjects/Image/SConstruct_template @@ -0,0 +1,8 @@ +# -*- mode:python; coding:utf-8; -*- + +import os + +environment = Environment( + tools=['{}', 'link']) + +environment.SharedLibrary('answer', 'code.d') diff --git a/test/D/SharedObjects/Image/code.d b/test/D/SharedObjects/Image/code.d new file mode 100644 index 0000000..0d9d1d7 --- /dev/null +++ b/test/D/SharedObjects/Image/code.d @@ -0,0 +1,3 @@ +int returnTheAnswer() { + return 42; +} diff --git a/test/D/SharedObjects/sconstest-dmd.py b/test/D/SharedObjects/sconstest-dmd.py new file mode 100644 index 0000000..df6ddeb --- /dev/null +++ b/test/D/SharedObjects/sconstest-dmd.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the dmd tool. +""" + +# +# __COPYRIGHT__ +# +# 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. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +from Common.common import testForTool +testForTool('dmd') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/SharedObjects/sconstest-gdc.py b/test/D/SharedObjects/sconstest-gdc.py new file mode 100644 index 0000000..7d0f28c --- /dev/null +++ b/test/D/SharedObjects/sconstest-gdc.py @@ -0,0 +1,40 @@ +""" +Test compiling and executing using the gcd tool. +""" + +# +# __COPYRIGHT__ +# +# 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. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons +TestSCons.TestSCons().skip_test('SKIPPED... gdc does not, as at version 4.9.1, support shared libraries.\n') + +from Common.common import testForTool +testForTool('gdc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/SharedObjects/sconstest-ldc.py b/test/D/SharedObjects/sconstest-ldc.py new file mode 100644 index 0000000..f61efbc --- /dev/null +++ b/test/D/SharedObjects/sconstest-ldc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the ldc tool. +""" + +# +# __COPYRIGHT__ +# +# 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. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +from Common.common import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/Support/executablesSearch.py b/test/D/Support/executablesSearch.py index e0487f6..17d9990 100755 --- a/test/D/Support/executablesSearch.py +++ b/test/D/Support/executablesSearch.py @@ -29,39 +29,60 @@ Support functions for all the tests. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +if __name__ == '__main__': + import sys + import os.path + sys.path.append(os.path.abspath('../../../src/engine')) + +from SCons.Environment import Base + +path = Base()['ENV']['PATH'] + def isExecutableOfToolAvailable(test, tool): for executable in { 'dmd': ['dmd', 'gdmd'], 'gdc': ['gdc'], - 'ldc': ['ldc2', 'ldc']}[tool]: - if test.where_is(executable): + 'ldc': ['ldc2', 'ldc'], + }[tool]: + if test.where_is(executable, path): return True return False + if __name__ == '__main__': import unittest - import sys - import os.path sys.path.append(os.path.abspath('../../../QMTest')) - sys.path.append(os.path.abspath('../../../src/engine')) + import TestSCons class VariousTests(unittest.TestCase): + ''' + These tests are somewhat self referential in that + isExecutableOfToolAvailable uses where_is to do most of it's + work and we use the same function in the tests. + ''' def setUp(self): self.test = TestSCons.TestSCons() + + def tearDown(self): + self.test = None + def test_None_tool(self): self.assertRaises(KeyError, isExecutableOfToolAvailable, self.test, None) + def test_dmd_tool(self): self.assertEqual( - self.test.where_is('dmd') is not None or self.test.where_is('gdmd') is not None, + self.test.where_is('dmd', path) is not None or self.test.where_is('gdmd', path) is not None, isExecutableOfToolAvailable(self.test, 'dmd')) + def test_gdc_tool(self): self.assertEqual( - self.test.where_is('gdc') is not None, + self.test.where_is('gdc', path) is not None, isExecutableOfToolAvailable(self.test, 'gdc')) + def test_ldc_tool(self): self.assertEqual( - self.test.where_is('ldc2') is not None or self.test.where_is('ldc') is not None, + self.test.where_is('ldc2', path) is not None or self.test.where_is('ldc', path) is not None, isExecutableOfToolAvailable(self.test, 'ldc')) unittest.main() |