summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2014-09-12 19:59:39 +0200
committerDirk Baechle <dl9obn@darc.de>2014-09-12 19:59:39 +0200
commit7382c3b21d8d1ca3d8c13c53f3c9c4f97a878818 (patch)
treea125cf2fc6f5024c9919f4a992b318c1350f0304
parentd9a0133cb767503aed23e4c09e77a2c6e34db25e (diff)
parent5ea32b431e4184f7662cd90592bf59fbb7b96bed (diff)
downloadscons-7382c3b21d8d1ca3d8c13c53f3c9c4f97a878818.tar.gz
Merged in russel/scons (pull request #182), various fixes for the D tools and their tests
-rw-r--r--src/engine/SCons/Tool/gdc.py6
-rw-r--r--src/engine/SCons/Tool/ldc.py2
-rw-r--r--test/D/CoreScanner/Image/SConstruct_template1
-rw-r--r--test/D/DMD.py10
-rw-r--r--test/D/DMD2.py11
-rw-r--r--test/D/DMD2_Alt.py11
-rw-r--r--test/D/GDC.py2
-rw-r--r--test/D/GDC_Alt.py2
-rw-r--r--test/D/HSTeoh/LinkingProblem/SConstruct_template3
-rw-r--r--test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template1
-rw-r--r--test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template1
-rw-r--r--test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template1
-rw-r--r--test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py16
-rw-r--r--test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py16
-rw-r--r--test/D/LDC.py2
-rw-r--r--test/D/LDC_Alt.py2
-rw-r--r--test/D/MixedDAndC/Image/SConstruct1
-rw-r--r--test/D/Scanner.py8
-rw-r--r--test/D/SharedObjects/Common/__init__.py0
-rw-r--r--test/D/SharedObjects/Common/common.py80
-rw-r--r--test/D/SharedObjects/Common/sconstest.skip0
-rw-r--r--test/D/SharedObjects/Image/SConstruct_template8
-rw-r--r--test/D/SharedObjects/Image/code.d3
-rw-r--r--test/D/SharedObjects/sconstest-dmd.py37
-rw-r--r--test/D/SharedObjects/sconstest-gdc.py40
-rw-r--r--test/D/SharedObjects/sconstest-ldc.py37
-rwxr-xr-xtest/D/Support/executablesSearch.py37
27 files changed, 302 insertions, 36 deletions
diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py
index 1178b855..048d7360 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 fa500604..d74464ff 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 a128c67b..e91343be 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 1bde3805..2d9333a6 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 cc8ab93c..fc5f79f7 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 fbe2f2b8..11c061d5 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 e24ec438..b548b94f 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 cac79499..27159eeb 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 6815cdf3..a4aa7956 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 89c603b1..118a7b24 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 c688ab7f..e2e74394 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 425970a1..b38a9f02 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 3b178b94..d44c9bd2 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 3b178b94..d44c9bd2 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 94acf1ca..19070a56 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 571b8f04..bca7dd64 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 47870d7a..5cf58a39 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 48af057f..b005adfe 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 00000000..e69de29b
--- /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 00000000..a5d7b275
--- /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 00000000..e69de29b
--- /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 00000000..213de7e9
--- /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 00000000..0d9d1d73
--- /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 00000000..df6ddebd
--- /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 00000000..7d0f28c1
--- /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 00000000..f61efbc6
--- /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 e0487f6c..17d99907 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()