summaryrefslogtreecommitdiffstats
path: root/test/D
diff options
context:
space:
mode:
Diffstat (limited to 'test/D')
-rw-r--r--test/D/CoreScanner/Common/common.py2
-rw-r--r--test/D/CoreScanner/Image/SConstruct_template1
-rw-r--r--test/D/DMD.py10
-rw-r--r--test/D/DMD2.py12
-rw-r--r--test/D/DMD2_Alt.py12
-rw-r--r--test/D/GDC.py2
-rw-r--r--test/D/GDC_Alt.py2
-rw-r--r--test/D/HSTeoh/ArLibIssue/SConstruct_template3
-rw-r--r--test/D/HSTeoh/Common/arLibIssue.py4
-rw-r--r--test/D/HSTeoh/Common/libCompileOptions.py4
-rw-r--r--test/D/HSTeoh/Common/linkingProblem.py7
-rw-r--r--test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py6
-rw-r--r--test/D/HSTeoh/LibCompileOptions/SConstruct_template3
-rw-r--r--test/D/HSTeoh/LinkingProblem/SConstruct_template5
-rw-r--r--test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template1
-rw-r--r--test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py2
-rw-r--r--test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template1
-rw-r--r--test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py2
-rw-r--r--test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template1
-rw-r--r--test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py20
-rw-r--r--test/D/Issues/2939_Ariovistus/Project/SConstruct_template3
-rw-r--r--test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py22
-rw-r--r--test/D/Issues/2940_Ariovistus/Project/SConstruct_template3
-rw-r--r--test/D/Issues/2994/D_changed_DFLAGS_not_rebuilding.py23
-rw-r--r--test/D/Issues/2994/image/SConstruct9
-rw-r--r--test/D/Issues/2994/image/main.d11
-rw-r--r--test/D/LDC.py2
-rw-r--r--test/D/LDC_Alt.py2
-rw-r--r--test/D/MixedDAndC/Common/common.py13
-rw-r--r--test/D/MixedDAndC/Image/SConstruct6
-rw-r--r--test/D/Scanner.py8
-rw-r--r--test/D/SharedObjects/Common/__init__.py0
-rw-r--r--test/D/SharedObjects/Common/common.py89
-rw-r--r--test/D/SharedObjects/Common/sconstest.skip0
-rw-r--r--test/D/SharedObjects/Image/SConstruct_template10
-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.py37
-rw-r--r--test/D/SharedObjects/sconstest-ldc.py37
-rwxr-xr-xtest/D/Support/executablesSearch.py37
40 files changed, 404 insertions, 48 deletions
diff --git a/test/D/CoreScanner/Common/common.py b/test/D/CoreScanner/Common/common.py
index 657e83e..1d2fde0 100644
--- a/test/D/CoreScanner/Common/common.py
+++ b/test/D/CoreScanner/Common/common.py
@@ -44,7 +44,7 @@ def testForTool(tool):
_obj = TestSCons._obj
if not isExecutableOfToolAvailable(test, tool) :
- test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool))
+ test.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('Image')
test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))
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..84ceb51 100644
--- a/test/D/DMD2.py
+++ b/test/D/DMD2.py
@@ -28,15 +28,21 @@ __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'])
+env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
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..3bd58b4 100644
--- a/test/D/DMD2_Alt.py
+++ b/test/D/DMD2_Alt.py
@@ -28,15 +28,21 @@ __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'])
+env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
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/ArLibIssue/SConstruct_template b/test/D/HSTeoh/ArLibIssue/SConstruct_template
index 81f81f5..b17847a 100644
--- a/test/D/HSTeoh/ArLibIssue/SConstruct_template
+++ b/test/D/HSTeoh/ArLibIssue/SConstruct_template
@@ -1,3 +1,6 @@
env = Environment({})
+import os
+env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
+
env.StaticLibrary('mylib', ['a.d', 'b.d'])
diff --git a/test/D/HSTeoh/Common/arLibIssue.py b/test/D/HSTeoh/Common/arLibIssue.py
index fe5902b..9bca3d8 100644
--- a/test/D/HSTeoh/Common/arLibIssue.py
+++ b/test/D/HSTeoh/Common/arLibIssue.py
@@ -43,10 +43,10 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('ArLibIssue')
- test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "ar"]'.format(tool)))
+ test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{0}", "ar"]'.format(tool)))
test.run()
diff --git a/test/D/HSTeoh/Common/libCompileOptions.py b/test/D/HSTeoh/Common/libCompileOptions.py
index dd95fc8..4a21c45 100644
--- a/test/D/HSTeoh/Common/libCompileOptions.py
+++ b/test/D/HSTeoh/Common/libCompileOptions.py
@@ -43,10 +43,10 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('LibCompileOptions')
- test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "link", "ar"]'.format(tool)))
+ test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{0}", "link", "ar"]'.format(tool)))
test.run()
diff --git a/test/D/HSTeoh/Common/linkingProblem.py b/test/D/HSTeoh/Common/linkingProblem.py
index 59b409f..b526ad7 100644
--- a/test/D/HSTeoh/Common/linkingProblem.py
+++ b/test/D/HSTeoh/Common/linkingProblem.py
@@ -29,7 +29,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
-from os.path import abspath, dirname
+from os.path import abspath, dirname, exists
import sys
sys.path.insert(1, abspath(dirname(__file__) + '/../../Support'))
@@ -41,7 +41,10 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
+
+ if not exists('/usr/include/ncurses.h'):
+ test.skip_test("ncurses not apparently installed, skip this test.")
test.dir_fixture('LinkingProblem')
test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))
diff --git a/test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py b/test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py
index 4dabf7b..4716f1c 100644
--- a/test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py
+++ b/test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py
@@ -42,7 +42,7 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('SingleStringCannotBeMultipleOptions')
test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))
@@ -55,6 +55,10 @@ def testForTool(tool):
'ldc': ".*Unknown command line argument '-m64 -O'.*",
}[tool]
+ from SCons.Environment import Base
+ if tool == 'dmd' and Base()['DC'] == 'gdmd':
+ result = ".*unrecognized command line option '-m64 -O'.*"
+
test.fail_test(not test.match_re_dotall(test.stderr(), result))
test.pass_test()
diff --git a/test/D/HSTeoh/LibCompileOptions/SConstruct_template b/test/D/HSTeoh/LibCompileOptions/SConstruct_template
index 7031f5c..1489624 100644
--- a/test/D/HSTeoh/LibCompileOptions/SConstruct_template
+++ b/test/D/HSTeoh/LibCompileOptions/SConstruct_template
@@ -1,5 +1,8 @@
env = Environment({})
+import os
+env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
+
env.Library('mylib', 'mylib.d')
prog_env = env.Clone(
diff --git a/test/D/HSTeoh/LinkingProblem/SConstruct_template b/test/D/HSTeoh/LinkingProblem/SConstruct_template
index 6815cdf..2c53b54 100644
--- a/test/D/HSTeoh/LinkingProblem/SConstruct_template
+++ b/test/D/HSTeoh/LinkingProblem/SConstruct_template
@@ -3,10 +3,11 @@
import os
environment = Environment(
- ENV=os.environ,
- tools = ['cc', 'link' , '{}'],
+ tools = ['cc', '{}', 'link'],
LIBS = ['ncurses'])
+environment['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
+
environment.Object('ncurs_impl.o', 'ncurs_impl.c')
environment.Program('prog', Split("""
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/Common/common.py b/test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py
index 618041b..e757d47 100644
--- a/test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py
+++ b/test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py
@@ -41,7 +41,7 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('Image')
test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))
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/Common/common.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py
index 618041b..e757d47 100644
--- a/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py
+++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py
@@ -41,7 +41,7 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('Image')
test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))
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..1b42580 100644
--- a/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py
+++ b/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py
@@ -43,14 +43,28 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('Project')
- test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "link"]'.format(tool)))
+ test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{0}", "link"]'.format(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/2939_Ariovistus/Project/SConstruct_template b/test/D/Issues/2939_Ariovistus/Project/SConstruct_template
index 55f02aa..c78ba96 100644
--- a/test/D/Issues/2939_Ariovistus/Project/SConstruct_template
+++ b/test/D/Issues/2939_Ariovistus/Project/SConstruct_template
@@ -2,6 +2,9 @@ from os.path import join
environment = Environment({})
+import os
+environment['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
+
Export('environment')
environment.SConscript([
diff --git a/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py b/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py
index 3b178b9..8060add 100644
--- a/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py
+++ b/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py
@@ -43,14 +43,30 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
+
+ platform = Base()['PLATFORM']
+ if platform == 'posix':
+ libraryname = 'libstuff.so'
+ filename = 'stuff.os'
+ elif platform == 'darwin':
+ libraryname = 'libstuff.dylib'
+ filename = 'stuff.os'
+ # As at 2014-09-14, DMD 2.066, LDC master head, and GDC 4.9.1 do not support
+ # shared libraries on OSX.
+ test.skip_test('Dynamic libraries not yet supported on OSX.\n')
+ elif platform == 'win32':
+ libraryname = 'stuff.dll'
+ filename = 'stuff.obj'
+ else:
+ test.fail_test('No information about platform: ' + platform)
test.dir_fixture('Project')
- test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "link"]'.format(tool)))
+ test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{0}", "link"]'.format(tool)))
test.run()
- for f in ('libstuff.so', 'stuff.os', 'test1', 'test1.o', 'test2', 'test2.o'):
+ 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/Project/SConstruct_template b/test/D/Issues/2940_Ariovistus/Project/SConstruct_template
index 55f02aa..c78ba96 100644
--- a/test/D/Issues/2940_Ariovistus/Project/SConstruct_template
+++ b/test/D/Issues/2940_Ariovistus/Project/SConstruct_template
@@ -2,6 +2,9 @@ from os.path import join
environment = Environment({})
+import os
+environment['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
+
Export('environment')
environment.SConscript([
diff --git a/test/D/Issues/2994/D_changed_DFLAGS_not_rebuilding.py b/test/D/Issues/2994/D_changed_DFLAGS_not_rebuilding.py
new file mode 100644
index 0000000..1d9854f
--- /dev/null
+++ b/test/D/Issues/2994/D_changed_DFLAGS_not_rebuilding.py
@@ -0,0 +1,23 @@
+# Test to check for issue reported in tigris bug 2994
+# http://scons.tigris.org/issues/show_bug.cgi?id=2994
+#
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+dmd_present = test.detect_tool('dmd', prog='dmd')
+ldc_present = test.detect_tool('ldc',prog='ldc2')
+gdc_present = test.detect_tool('gdc',prog='gdc')
+
+if not (dmd_present or ldc_present or gdc_present):
+ test.skip_test("Could not load dmd ldc or gdc Tool; skipping test(s).\n")
+
+
+test.dir_fixture('image')
+test.run()
+test.fail_test('main.o' not in test.stdout())
+test.run(arguments='change=1')
+test.fail_test('is up to date' in test.stdout())
+
+test.pass_test()
diff --git a/test/D/Issues/2994/image/SConstruct b/test/D/Issues/2994/image/SConstruct
new file mode 100644
index 0000000..3d059e7
--- /dev/null
+++ b/test/D/Issues/2994/image/SConstruct
@@ -0,0 +1,9 @@
+# -*- coding:utf-8; -*-
+
+env=Environment()
+
+change = ARGUMENTS.get('change', 0)
+if int(change):
+ env.Append(DFLAGS = '-I.')
+
+env.Program('proj', ['main.d'])
diff --git a/test/D/Issues/2994/image/main.d b/test/D/Issues/2994/image/main.d
new file mode 100644
index 0000000..f0aa23a
--- /dev/null
+++ b/test/D/Issues/2994/image/main.d
@@ -0,0 +1,11 @@
+/* This program prints a
+ hello world message
+ to the console. */
+
+import std.stdio;
+
+void main()
+{
+ writeln("Hello, World!");
+}
+
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/Common/common.py b/test/D/MixedDAndC/Common/common.py
index 66c738f..852e2e2 100644
--- a/test/D/MixedDAndC/Common/common.py
+++ b/test/D/MixedDAndC/Common/common.py
@@ -30,6 +30,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
from os.path import abspath, dirname
+from platform import architecture
import sys
sys.path.insert(1, abspath(dirname(__file__) + '/../../Support'))
@@ -41,10 +42,20 @@ 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.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
test.dir_fixture('Image')
+# There was an issue with Russel mentioned but couldn't remember the details
+# Which drove him to add the following logic. For now removing until
+# we can determine what that issue is and if there's not a better
+# way to handle the corner case
+# if architecture()[0] == '32bit':
+# test.run(status=2)
+# test.fail_test('64-bit mode not compiled in' not in test.stderr())
+# else:
+# test.run()
+
test.run()
test.pass_test()
diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct
index 47870d7..176c4d3 100644
--- a/test/D/MixedDAndC/Image/SConstruct
+++ b/test/D/MixedDAndC/Image/SConstruct
@@ -3,8 +3,10 @@
import os
environment = Environment(
- ENV=os.environ,
- DFLAGS=['-m64', '-O'])
+)
+# CFLAGS=['-m64'],
+# DLINKFLAGS=['-m64'],
+# DFLAGS=['-m64', '-O'])
environment.Program('proj', [
'proj.d',
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..280c6f2
--- /dev/null
+++ b/test/D/SharedObjects/Common/common.py
@@ -0,0 +1,89 @@
+"""
+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 '{0}' not found, skipping test.\n".format(tool))
+
+ if tool == 'gdc':
+ test.skip_test('gdc in GCC distribution does not, as at version 5.3.1, support shared libraries.\n')
+
+ if tool == 'dmd' and Base()['DC'] == 'gdmd':
+ test.skip_test('gdmd does not recognize the -shared option so cannot support linking of shared objects.\n')
+
+ platform = Base()['PLATFORM']
+ if platform == 'posix':
+ filename = 'code.o'
+ libraryname = 'libanswer.so'
+ elif platform == 'darwin':
+ filename = 'code.o'
+ libraryname = 'libanswer.dylib'
+ # As at 2014-09-14, DMD 2.066, LDC master head, and GDC 4.9.1 do not support
+ # shared libraries on OSX.
+ test.skip_test('Dynamic libraries not yet supported on OSX.\n')
+ elif platform == 'win32':
+ filename = 'code.obj'
+ libraryname = 'answer.dll'
+ else:
+ test.fail_test()
+
+ 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()
+
+ 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..cae8713
--- /dev/null
+++ b/test/D/SharedObjects/Image/SConstruct_template
@@ -0,0 +1,10 @@
+# -*- mode:python; coding:utf-8; -*-
+
+import os
+
+environment = Environment(
+ tools=['{}', 'link'])
+
+environment['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd
+
+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..43bb8eb
--- /dev/null
+++ b/test/D/SharedObjects/sconstest-gdc.py
@@ -0,0 +1,37 @@
+"""
+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__"
+
+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()