diff options
author | Russel Winder <russel@winder.org.uk> | 2017-04-17 16:51:16 (GMT) |
---|---|---|
committer | Russel Winder <russel@winder.org.uk> | 2017-04-17 16:51:16 (GMT) |
commit | 5ff62a39470b028178ab923a3efe0151fe64de7c (patch) | |
tree | 5d8d21d00d171dca2aa8ed9e0461dd6483fcae2d /test/D | |
parent | 3e6dce496daca4c98655b4544541828f36dce707 (diff) | |
download | SCons-5ff62a39470b028178ab923a3efe0151fe64de7c.zip SCons-5ff62a39470b028178ab923a3efe0151fe64de7c.tar.gz SCons-5ff62a39470b028178ab923a3efe0151fe64de7c.tar.bz2 |
Add an 'all at once' builder to the D tools.
Diffstat (limited to 'test/D')
-rw-r--r-- | test/D/AllAtOnce/Common/__init__.py | 0 | ||||
-rw-r--r-- | test/D/AllAtOnce/Common/common.py | 71 | ||||
-rw-r--r-- | test/D/AllAtOnce/Common/sconstest.skip | 0 | ||||
-rw-r--r-- | test/D/AllAtOnce/Image/SConstruct_template | 13 | ||||
-rw-r--r-- | test/D/AllAtOnce/Image/amod.d | 5 | ||||
-rw-r--r-- | test/D/AllAtOnce/Image/bmod.d | 3 | ||||
-rw-r--r-- | test/D/AllAtOnce/Image/main.d | 8 | ||||
-rw-r--r-- | test/D/AllAtOnce/sconstest-dmd.py | 37 | ||||
-rw-r--r-- | test/D/AllAtOnce/sconstest-gdc.py | 37 | ||||
-rw-r--r-- | test/D/AllAtOnce/sconstest-ldc.py | 37 | ||||
-rw-r--r-- | test/D/Issues/2994/image/SConstruct | 2 | ||||
-rw-r--r-- | test/D/MixedDAndC/Image/SConstruct | 2 |
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 0000000..e69de29 --- /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 0000000..8750221 --- /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 0000000..e69de29 --- /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 0000000..89d058e --- /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 0000000..a32aa75 --- /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 0000000..e4c1e1b --- /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 0000000..8b99458 --- /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 0000000..df66255 --- /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 0000000..7ac95c0 --- /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 0000000..f9ab342 --- /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 3d059e7..92f76c2 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 176c4d3..f24e2b3 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 |