summaryrefslogtreecommitdiff
path: root/test/D
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2017-04-17 17:51:16 +0100
committerRussel Winder <russel@winder.org.uk>2017-04-17 17:51:16 +0100
commit5d391c62f9d39e22479a47d94e271cbb7f1acc08 (patch)
tree5d8d21d00d171dca2aa8ed9e0461dd6483fcae2d /test/D
parentb880e2f50e9bd2266ace70a057241cf4eeca4fd1 (diff)
downloadscons-5d391c62f9d39e22479a47d94e271cbb7f1acc08.tar.gz
Add an 'all at once' builder to the D tools.
Diffstat (limited to 'test/D')
-rw-r--r--test/D/AllAtOnce/Common/__init__.py0
-rw-r--r--test/D/AllAtOnce/Common/common.py71
-rw-r--r--test/D/AllAtOnce/Common/sconstest.skip0
-rw-r--r--test/D/AllAtOnce/Image/SConstruct_template13
-rw-r--r--test/D/AllAtOnce/Image/amod.d5
-rw-r--r--test/D/AllAtOnce/Image/bmod.d3
-rw-r--r--test/D/AllAtOnce/Image/main.d8
-rw-r--r--test/D/AllAtOnce/sconstest-dmd.py37
-rw-r--r--test/D/AllAtOnce/sconstest-gdc.py37
-rw-r--r--test/D/AllAtOnce/sconstest-ldc.py37
-rw-r--r--test/D/Issues/2994/image/SConstruct2
-rw-r--r--test/D/MixedDAndC/Image/SConstruct2
12 files changed, 213 insertions, 2 deletions
diff --git a/test/D/AllAtOnce/Common/__init__.py b/test/D/AllAtOnce/Common/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/D/AllAtOnce/Common/__init__.py
diff --git a/test/D/AllAtOnce/Common/common.py b/test/D/AllAtOnce/Common/common.py
new file mode 100644
index 00000000..8750221f
--- /dev/null
+++ b/test/D/AllAtOnce/Common/common.py
@@ -0,0 +1,71 @@
+"""
+Test compiling and executing a project with a C module.
+"""
+
+#
+# __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 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))
+
+ test.dir_fixture('Image')
+ test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))
+
+ test.run()
+
+ test.must_not_exist(test.workpath('amod.o'))
+ test.must_not_exist(test.workpath('bmod.o'))
+ test.must_not_exist(test.workpath('main.o'))
+ if tool == 'gdc':
+ test.must_not_exist(test.workpath('project.o'))
+ else:
+ test.must_exist(test.workpath('project.o'))
+ test.must_exist(test.workpath('project'))
+
+ test.run(program=test.workpath('project'+TestSCons._exe))
+ test.fail_test(test.stdout() != '''This is a test program for a new SCons D builder.
+The value is 42.
+''')
+
+ 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/AllAtOnce/Common/sconstest.skip b/test/D/AllAtOnce/Common/sconstest.skip
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/D/AllAtOnce/Common/sconstest.skip
diff --git a/test/D/AllAtOnce/Image/SConstruct_template b/test/D/AllAtOnce/Image/SConstruct_template
new file mode 100644
index 00000000..89d058e2
--- /dev/null
+++ b/test/D/AllAtOnce/Image/SConstruct_template
@@ -0,0 +1,13 @@
+# -*- coding:utf-8; -*-
+
+import os
+
+environment = Environment(
+ tools=['{}', 'link'],
+)
+
+environment.ProgramAllAtOnce('project', [
+'main.d',
+'amod.d',
+'bmod.d',
+])
diff --git a/test/D/AllAtOnce/Image/amod.d b/test/D/AllAtOnce/Image/amod.d
new file mode 100644
index 00000000..a32aa759
--- /dev/null
+++ b/test/D/AllAtOnce/Image/amod.d
@@ -0,0 +1,5 @@
+import std.stdio;
+
+void print_message() {
+ writeln("This is a test program for a new SCons D builder.");
+}
diff --git a/test/D/AllAtOnce/Image/bmod.d b/test/D/AllAtOnce/Image/bmod.d
new file mode 100644
index 00000000..e4c1e1be
--- /dev/null
+++ b/test/D/AllAtOnce/Image/bmod.d
@@ -0,0 +1,3 @@
+int calculate_value() {
+ return 42;
+}
diff --git a/test/D/AllAtOnce/Image/main.d b/test/D/AllAtOnce/Image/main.d
new file mode 100644
index 00000000..8b99458e
--- /dev/null
+++ b/test/D/AllAtOnce/Image/main.d
@@ -0,0 +1,8 @@
+import std.stdio: writefln;
+import amod: print_message;
+import bmod: calculate_value;
+
+void main() {
+ print_message();
+ writefln("The value is %d.", calculate_value());
+}
diff --git a/test/D/AllAtOnce/sconstest-dmd.py b/test/D/AllAtOnce/sconstest-dmd.py
new file mode 100644
index 00000000..df662556
--- /dev/null
+++ b/test/D/AllAtOnce/sconstest-dmd.py
@@ -0,0 +1,37 @@
+"""
+Test compiling and executing a project with a C module.
+"""
+
+#
+# __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/AllAtOnce/sconstest-gdc.py b/test/D/AllAtOnce/sconstest-gdc.py
new file mode 100644
index 00000000..7ac95c08
--- /dev/null
+++ b/test/D/AllAtOnce/sconstest-gdc.py
@@ -0,0 +1,37 @@
+"""
+Test compiling and executing a project with a C module.
+"""
+
+#
+# __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/AllAtOnce/sconstest-ldc.py b/test/D/AllAtOnce/sconstest-ldc.py
new file mode 100644
index 00000000..f9ab3429
--- /dev/null
+++ b/test/D/AllAtOnce/sconstest-ldc.py
@@ -0,0 +1,37 @@
+"""
+Test compiling and executing a project with a C module.
+"""
+
+#
+# __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/Issues/2994/image/SConstruct b/test/D/Issues/2994/image/SConstruct
index 3d059e7e..92f76c23 100644
--- a/test/D/Issues/2994/image/SConstruct
+++ b/test/D/Issues/2994/image/SConstruct
@@ -1,4 +1,4 @@
-# -*- coding:utf-8; -*-
+# -*- mode:python; coding:utf-8; -*-
env=Environment()
diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct
index 176c4d31..f24e2b37 100644
--- a/test/D/MixedDAndC/Image/SConstruct
+++ b/test/D/MixedDAndC/Image/SConstruct
@@ -1,4 +1,4 @@
-# -*- codig:utf-8; -*-
+# -*- mode:python; coding:utf-8; -*-
import os