diff options
| author | William Deegan <bill@baddogconsulting.com> | 2015-09-21 17:03:12 (GMT) |
|---|---|---|
| committer | William Deegan <bill@baddogconsulting.com> | 2015-09-21 17:03:12 (GMT) |
| commit | 0941093e0e5a030faa49968457638a3a6aee7ad8 (patch) | |
| tree | 6d33513c14eb6eac0531dd050de0ecca4c39bd79 /test/CXX | |
| download | SCons-2.4.0.zip SCons-2.4.0.tar.gz SCons-2.4.0.tar.bz2 | |
release 2.4.02.4.0
Diffstat (limited to 'test/CXX')
| -rw-r--r-- | test/CXX/CC-variables.py | 56 | ||||
| -rw-r--r-- | test/CXX/CCFLAGS.py | 76 | ||||
| -rw-r--r-- | test/CXX/CXX.py | 241 | ||||
| -rw-r--r-- | test/CXX/CXXCOM.py | 86 | ||||
| -rw-r--r-- | test/CXX/CXXCOMSTR.py | 95 | ||||
| -rw-r--r-- | test/CXX/CXXFILESUFFIX.py | 89 | ||||
| -rw-r--r-- | test/CXX/CXXFLAGS.py | 170 | ||||
| -rw-r--r-- | test/CXX/CXXVERSION.py | 83 | ||||
| -rw-r--r-- | test/CXX/SHCXX.py | 89 | ||||
| -rw-r--r-- | test/CXX/SHCXXCOM.py | 86 | ||||
| -rw-r--r-- | test/CXX/SHCXXCOMSTR.py | 95 | ||||
| -rw-r--r-- | test/CXX/SHCXXFLAGS.py | 140 |
12 files changed, 1306 insertions, 0 deletions
diff --git a/test/CXX/CC-variables.py b/test/CXX/CC-variables.py new file mode 100644 index 0000000..a2a2fbe --- /dev/null +++ b/test/CXX/CC-variables.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Verify that initializing a construction environment with just the +g++ tool uses the CCFLAGS. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +env = Environment(tools = ['g++'], CXX = 'g++') +env.Object(target = 'test.obj', source = 'test.cxx') +env.MergeFlags('+for_CCFLAGS -Wp,-for_CPPFLAGS') +""") + +test.write('test.cxx', "test.cxx\n") + +expect = """\ +g++ -o test.obj -c +for_CCFLAGS -Wp,-for_CPPFLAGS test.cxx +""" + +test.run(arguments = '-Q -n test.obj', stdout=expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CCFLAGS.py b/test/CXX/CCFLAGS.py new file mode 100644 index 0000000..061df87 --- /dev/null +++ b/test/CXX/CCFLAGS.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Verify that we can set both $CCFLAGS and $CXXFLAGS and have them +both show up on the compilation lines for C++ source files. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +foo = Environment() +foo.Append(CCFLAGS = '-DFOO', CXXFLAGS = '-DCXX') +bar = Environment() +bar.Append(CCFLAGS = '-DBAR', CXXFLAGS = '-DCXX') +foo_obj = foo.Object(target = 'foo', source = 'prog.cpp') +bar_obj = bar.Object(target = 'bar', source = 'prog.cpp') +foo.Program(target = 'foo', source = foo_obj) +bar.Program(target = 'bar', source = bar_obj) +""") + +test.write('prog.cpp', r""" +#include <stdio.h> +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + argv[argc++] = (char *)"--"; +#ifdef FOO + printf("prog.c: FOO\n"); +#endif +#ifdef BAR + printf("prog.c: BAR\n"); +#endif + exit (0); +} +""") + +test.run(arguments = '.') + +test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n") +test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CXX.py b/test/CXX/CXX.py new file mode 100644 index 0000000..79dbde4 --- /dev/null +++ b/test/CXX/CXX.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python +# +# __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 os +import sys +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +if sys.platform == 'win32': + + test.write('mylink.py', r""" +import sys +args = sys.argv[1:] +while args: + a = args[0] + if a == '-o': + out = args[1] + args = args[2:] + continue + if not a[0] in '/-': + break + args = args[1:] + if a[:5].lower() == '/out:': out = a[5:] +infile = open(args[0], 'rb') +outfile = open(out, 'wb') +for l in infile.readlines(): + if l[:8] != '/*link*/': + outfile.write(l) +sys.exit(0) +""") + + test.write('myc++.py', r""" +import sys +args = sys.argv[1:] +inf = None +while args: + a = args[0] + if a == '-o': + out = args[1] + args = args[2:] + continue + args = args[1:] + if not a[0] in '/-': + if not inf: + inf = a + continue + if a[:3] == '/Fo': out = a[3:] +infile = open(inf, 'rb') +outfile = open(out, 'wb') +for l in infile.readlines(): + if l[:7] != '/*c++*/': + outfile.write(l) +sys.exit(0) +""") + +else: + + test.write('mylink.py', r""" +import getopt +import sys +opts, args = getopt.getopt(sys.argv[1:], 'o:') +for opt, arg in opts: + if opt == '-o': out = arg +infile = open(args[0], 'rb') +outfile = open(out, 'wb') +for l in infile.readlines(): + if l[:8] != '/*link*/': + outfile.write(l) +sys.exit(0) +""") + + test.write('myc++.py', r""" +import getopt +import sys +opts, args = getopt.getopt(sys.argv[1:], 'co:') +for opt, arg in opts: + if opt == '-o': out = arg +infile = open(args[0], 'rb') +outfile = open(out, 'wb') +for l in infile.readlines(): + if l[:7] != '/*c++*/': + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(LINK = r'%(_python_)s mylink.py', + LINKFLAGS = [], + CXX = r'%(_python_)s myc++.py', + CXXFLAGS = []) +env.Program(target = 'test1', source = 'test1.cc') +env.Program(target = 'test2', source = 'test2.cpp') +env.Program(target = 'test3', source = 'test3.cxx') +env.Program(target = 'test4', source = 'test4.c++') +env.Program(target = 'test5', source = 'test5.C++') +""" % locals()) + +test.write('test1.cc', r"""This is a .cc file. +/*c++*/ +/*link*/ +""") + +test.write('test2.cpp', r"""This is a .cpp file. +/*c++*/ +/*link*/ +""") + +test.write('test3.cxx', r"""This is a .cxx file. +/*c++*/ +/*link*/ +""") + +test.write('test4.c++', r"""This is a .c++ file. +/*c++*/ +/*link*/ +""") + +test.write('test5.C++', r"""This is a .C++ file. +/*c++*/ +/*link*/ +""") + +test.run(arguments = '.', stderr = None) + +test.must_match('test1' + _exe, "This is a .cc file.\n") + +test.must_match('test2' + _exe, "This is a .cpp file.\n") + +test.must_match('test3' + _exe, "This is a .cxx file.\n") + +test.must_match('test4' + _exe, "This is a .c++ file.\n") + +test.must_match('test5' + _exe, "This is a .C++ file.\n") + +if TestSCons.case_sensitive_suffixes('.c', '.C'): + + test.write('SConstruct', """ +env = Environment(LINK = r'%(_python_)s mylink.py', + LINKFLAGS = [], + CXX = r'%(_python_)s myc++.py', + CXXFLAGS = []) +env.Program(target = 'test6', source = 'test6.C') +""" % locals()) + + test.write('test6.C', r"""This is a .C file. +/*c++*/ +/*link*/ +""") + + test.run(arguments = '.', stderr = None) + + test.must_match('test6' + _exe, "This is a .C file.\n") + + + + +test.write("wrapper.py", +"""import os +import sys +if '--version' not in sys.argv and '-dumpversion' not in sys.argv: + open('%s', 'wb').write("wrapper.py\\n") +os.system(" ".join(sys.argv[1:])) +""" % test.workpath('wrapper.out').replace('\\', '\\\\')) + +test.write('SConstruct', """ +foo = Environment() +cxx = foo.Dictionary('CXX') +bar = Environment(CXX = r'%(_python_)s wrapper.py ' + cxx) +foo.Program(target = 'foo', source = 'foo.cxx') +bar.Program(target = 'bar', source = 'bar.cxx') +""" % locals()) + +test.write('foo.cxx', r""" +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = (char *)"--"; + printf("foo.cxx\n"); + exit (0); +} +""") + +test.write('bar.cxx', r""" +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = (char *)"--"; + printf("foo.cxx\n"); + exit (0); +} +""") + + +test.run(arguments = 'foo' + _exe) + +test.must_not_exist(test.workpath('wrapper.out')) + +test.run(arguments = 'bar' + _exe) + +test.must_match('wrapper.out', "wrapper.py\n") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CXXCOM.py b/test/CXX/CXXCOM.py new file mode 100644 index 0000000..a3da81a --- /dev/null +++ b/test/CXX/CXXCOM.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Test the ability to configure the $CXXCOM construction variable. +""" + +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mycc.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']: + outfile.write(l) +sys.exit(0) +""") + +alt_cpp_suffix=test.get_alt_cpp_suffix() + +test.write('SConstruct', """ +env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', + OBJSUFFIX='.obj') +env.Object(target = 'test1', source = 'test1.cpp') +env.Object(target = 'test2', source = 'test2.cc') +env.Object(target = 'test3', source = 'test3.cxx') +env.Object(target = 'test4', source = 'test4.c++') +env.Object(target = 'test5', source = 'test5.C++') +env.Object(target = 'test6', source = 'test6%(alt_cpp_suffix)s') +""" % locals()) + +test.write('test1.cpp', "test1.cpp\n/*c++*/\n") +test.write('test2.cc', "test2.cc\n/*c++*/\n") +test.write('test3.cxx', "test3.cxx\n/*c++*/\n") +test.write('test4.c++', "test4.c++\n/*c++*/\n") +test.write('test5.C++', "test5.C++\n/*c++*/\n") +test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n") + +test.run() + +test.must_match('test1.obj', "test1.cpp\n") +test.must_match('test2.obj', "test2.cc\n") +test.must_match('test3.obj', "test3.cxx\n") +test.must_match('test4.obj', "test4.c++\n") +test.must_match('test5.obj', "test5.C++\n") +test.must_match('test6.obj', "test6.C\n") + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CXXCOMSTR.py b/test/CXX/CXXCOMSTR.py new file mode 100644 index 0000000..9d54e91 --- /dev/null +++ b/test/CXX/CXXCOMSTR.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Test that the $CXXCOMSTR construction variable allows you to configure +the C++ compilation output. +""" + +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mycc.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in [l for l in infile.readlines() if l != '/*c++*/\n']: + outfile.write(l) +sys.exit(0) +""") + +alt_cpp_suffix=test.get_alt_cpp_suffix() + +test.write('SConstruct', """ +env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', + CXXCOMSTR = 'Building $TARGET from $SOURCE', + OBJSUFFIX='.obj') +env.Object(target = 'test1', source = 'test1.cpp') +env.Object(target = 'test2', source = 'test2.cc') +env.Object(target = 'test3', source = 'test3.cxx') +env.Object(target = 'test4', source = 'test4.c++') +env.Object(target = 'test5', source = 'test5.C++') +env.Object(target = 'test6', source = 'test6%(alt_cpp_suffix)s') +""" % locals()) + +test.write('test1.cpp', "test1.cpp\n/*c++*/\n") +test.write('test2.cc', "test2.cc\n/*c++*/\n") +test.write('test3.cxx', "test3.cxx\n/*c++*/\n") +test.write('test4.c++', "test4.c++\n/*c++*/\n") +test.write('test5.C++', "test5.C++\n/*c++*/\n") +test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n") + +test.run(stdout = test.wrap_stdout("""\ +Building test1.obj from test1.cpp +Building test2.obj from test2.cc +Building test3.obj from test3.cxx +Building test4.obj from test4.c++ +Building test5.obj from test5.C++ +Building test6.obj from test6%(alt_cpp_suffix)s +""" % locals())) + +test.must_match('test1.obj', "test1.cpp\n") +test.must_match('test2.obj', "test2.cc\n") +test.must_match('test3.obj', "test3.cxx\n") +test.must_match('test4.obj', "test4.c++\n") +test.must_match('test5.obj', "test5.C++\n") +test.must_match('test6.obj', "test6.C\n") + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CXXFILESUFFIX.py b/test/CXX/CXXFILESUFFIX.py new file mode 100644 index 0000000..8439aef --- /dev/null +++ b/test/CXX/CXXFILESUFFIX.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# +# __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 os + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +test.write('mylex.py', """ +import getopt +import sys +cmd_opts, args = getopt.getopt(sys.argv[1:], 't', []) +for a in args: + contents = open(a, 'rb').read() + sys.stdout.write(contents.replace('LEX', 'mylex.py')) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(LEX = r'%(_python_)s mylex.py', tools = ['lex']) +env.CXXFile(target = 'foo', source = 'foo.ll') +env.Clone(CXXFILESUFFIX = '.xyz').CXXFile(target = 'bar', source = 'bar.ll') + +# Make sure that calling a Tool on a construction environment *after* +# we've set CXXFILESUFFIX doesn't overwrite the value. +env2 = Environment(tools = [], CXXFILESUFFIX = '.env2') +env2.Tool('lex') +env2['LEX'] = r'%(_python_)s mylex.py' +env2.CXXFile(target = 'f3', source = 'f3.ll') +""" % locals()) + +input = r""" +int +main(int argc, char *argv[]) +{ + argv[argc++] = (char *)"--"; + printf("LEX\n"); + printf("%s\n"); + exit (0); +} +""" + +test.write('foo.ll', input % 'foo.ll') + +test.write('bar.ll', input % 'bar.ll') + +test.write('f3.ll', input % 'f3.ll') + +test.run(arguments = '.') + +test.must_exist(test.workpath('foo.cc')) + +test.must_exist(test.workpath('bar.xyz')) + +test.must_exist(test.workpath('f3.env2')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CXXFLAGS.py b/test/CXX/CXXFLAGS.py new file mode 100644 index 0000000..8d72708 --- /dev/null +++ b/test/CXX/CXXFLAGS.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Verify that $CXXFLAGS settings are used to build both static +and shared object files. +""" + +import os +import sys + +import TestSCons + +_obj = TestSCons._obj + +if os.name == 'posix': + os.environ['LD_LIBRARY_PATH'] = '.' +if sys.platform.find('irix') > -1: + os.environ['LD_LIBRARYN32_PATH'] = '.' + +test = TestSCons.TestSCons() + +e = test.Environment() + +test.write('SConstruct', """ +foo = Environment(WINDOWS_INSERT_DEF=1) +foo.Append(CXXFLAGS = '-DFOO') +bar = Environment(WINDOWS_INSERT_DEF=1) +bar.Append(CXXFLAGS = '-DBAR') +foo_obj = foo.SharedObject(target = 'fooshared%(_obj)s', source = 'doIt.cpp') +bar_obj = bar.SharedObject(target = 'barshared%(_obj)s', source = 'doIt.cpp') +foo.SharedLibrary(target = 'foo', source = foo_obj) +bar.SharedLibrary(target = 'bar', source = bar_obj) + +fooMain = foo.Clone(LIBS='foo', LIBPATH='.') +foo_obj = fooMain.Object(target='foomain', source='main.c') +fooMain.Program(target='fooprog', source=foo_obj) + +barMain = bar.Clone(LIBS='bar', LIBPATH='.') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=bar_obj) + +foo_obj = foo.Object(target = 'foostatic', source = 'prog.cpp') +bar_obj = bar.Object(target = 'barstatic', source = 'prog.cpp') +foo.Program(target = 'foo', source = foo_obj) +bar.Program(target = 'bar', source = bar_obj) +""" % locals()) + +test.write('foo.def', r""" +LIBRARY "foo" +DESCRIPTION "Foo Shared Library" + +EXPORTS + doIt +""") + +test.write('bar.def', r""" +LIBRARY "bar" +DESCRIPTION "Bar Shared Library" + +EXPORTS + doIt +""") + +test.write('doIt.cpp', r""" +#include <stdio.h> + +extern "C" void +doIt() +{ +#ifdef FOO + printf("doIt.cpp: FOO\n"); +#endif +#ifdef BAR + printf("doIt.cpp: BAR\n"); +#endif +} +""") + +test.write('main.c', r""" + +void doIt(); + +int +main(int argc, char* argv[]) +{ + doIt(); + return 0; +} +""") + +test.write('prog.cpp', r""" +#include <stdio.h> +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + argv[argc++] = (char *)"--"; +#ifdef FOO + printf("prog.c: FOO\n"); +#endif +#ifdef BAR + printf("prog.c: BAR\n"); +#endif + exit (0); +} +""") + +test.run(arguments = '.') + +test.run(program = test.workpath('fooprog'), stdout = "doIt.cpp: FOO\n") +test.run(program = test.workpath('barprog'), stdout = "doIt.cpp: BAR\n") +test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n") +test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") + + + +test.write('SConstruct', """ +bar = Environment(WINDOWS_INSERT_DEF=1) +bar.Append(CXXFLAGS = '-DBAR') +foo_obj = bar.SharedObject(target = 'foo%(_obj)s', source = 'doIt.cpp') +bar_obj = bar.SharedObject(target = 'bar%(_obj)s', source = 'doIt.cpp') +bar.SharedLibrary(target = 'foo', source = foo_obj) +bar.SharedLibrary(target = 'bar', source = bar_obj) + +barMain = bar.Clone(LIBS='bar', LIBPATH='.') +foo_obj = barMain.Object(target='foomain', source='main.c') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=foo_obj) +barMain.Program(target='fooprog', source=bar_obj) +""" % locals()) + +test.run(arguments = '.') + +test.run(program = test.workpath('fooprog'), stdout = "doIt.cpp: BAR\n") +test.run(program = test.workpath('barprog'), stdout = "doIt.cpp: BAR\n") + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CXXVERSION.py b/test/CXX/CXXVERSION.py new file mode 100644 index 0000000..6017001 --- /dev/null +++ b/test/CXX/CXXVERSION.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# +# __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 os +import sys +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + +if sys.platform == 'win32': + test.skip_test('CXXVERSION not set with MSVC, skipping test.') + + +test.write("versioned.py", +"""import os +import sys +if '-dumpversion' in sys.argv: + print '3.9.9' + sys.exit(0) +if '--version' in sys.argv: + print 'this is version 2.9.9 wrapping', sys.argv[2] + sys.exit(0) +if sys.argv[1] not in [ '2.9.9', '3.9.9' ]: + print 'wrong version', sys.argv[1], 'when wrapping', sys.argv[2] + sys.exit(1) +os.system(" ".join(sys.argv[2:])) +""") + +test.write('SConstruct', """ +cxx = Environment().Dictionary('CXX') +foo = Environment(CXX = r'%(_python_)s versioned.py "${CXXVERSION}" ' + cxx) +foo.Program(target = 'foo', source = 'foo.cpp') +""" % locals()) + +test.write('foo.cpp', r""" +#include <stdio.h> +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + printf("foo.c\n"); + exit (0); +} +""") + +test.run(arguments = 'foo' + _exe) + +test.up_to_date(arguments = 'foo' + _exe) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/SHCXX.py b/test/CXX/SHCXX.py new file mode 100644 index 0000000..9a78881 --- /dev/null +++ b/test/CXX/SHCXX.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# +# __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 os + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +test.write("wrapper.py", +"""import os +import sys +open('%s', 'wb').write("wrapper.py\\n") +os.system(" ".join(sys.argv[1:])) +""" % test.workpath('wrapper.out').replace('\\', '\\\\')) + +test.write('SConstruct', """ +foo = Environment() +shcxx = foo.Dictionary('SHCXX') +bar = Environment(SHCXX = r'%(_python_)s wrapper.py ' + shcxx) +foo.SharedObject(target = 'foo/foo', source = 'foo.cpp') +bar.SharedObject(target = 'bar/bar', source = 'bar.cpp') +""" % locals()) + +test.write('foo.cpp', r""" +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = (char *)"--"; + printf("foo.c\n"); + exit (0); +} +""") + +test.write('bar.cpp', r""" +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = (char *)"--"; + printf("foo.c\n"); + exit (0); +} +""") + + +test.run(arguments = 'foo') + +test.fail_test(os.path.exists(test.workpath('wrapper.out'))) + +test.run(arguments = 'bar') + +test.fail_test(test.read('wrapper.out') != "wrapper.py\n") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/SHCXXCOM.py b/test/CXX/SHCXXCOM.py new file mode 100644 index 0000000..7f151ed --- /dev/null +++ b/test/CXX/SHCXXCOM.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Test the ability to configure the $SHCXXCOM construction variable. +""" + +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mycc.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']: + outfile.write(l) +sys.exit(0) +""") + +alt_cpp_suffix=test.get_alt_cpp_suffix() + +test.write('SConstruct', """ +env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', + SHOBJPREFIX='', + SHOBJSUFFIX='.obj') +env.SharedObject(target = 'test1', source = 'test1.cpp') +env.SharedObject(target = 'test2', source = 'test2.cc') +env.SharedObject(target = 'test3', source = 'test3.cxx') +env.SharedObject(target = 'test4', source = 'test4.c++') +env.SharedObject(target = 'test5', source = 'test5.C++') +env.SharedObject(target = 'test6', source = 'test6%(alt_cpp_suffix)s') +""" % locals()) + +test.write('test1.cpp', "test1.cpp\n/*c++*/\n") +test.write('test2.cc', "test2.cc\n/*c++*/\n") +test.write('test3.cxx', "test3.cxx\n/*c++*/\n") +test.write('test4.c++', "test4.c++\n/*c++*/\n") +test.write('test5.C++', "test5.C++\n/*c++*/\n") +test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n") + +test.run() + +test.must_match('test1.obj', "test1.cpp\n") +test.must_match('test2.obj', "test2.cc\n") +test.must_match('test3.obj', "test3.cxx\n") +test.must_match('test4.obj', "test4.c++\n") +test.must_match('test5.obj', "test5.C++\n") +test.must_match('test6.obj', "test6.C\n") + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/SHCXXCOMSTR.py b/test/CXX/SHCXXCOMSTR.py new file mode 100644 index 0000000..716c9ad --- /dev/null +++ b/test/CXX/SHCXXCOMSTR.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Test that the $SHCXXCOMSTR construction variable allows you to customize +the shared object C++ compilation output. +""" + +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mycc.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in [l for l in infile.readlines() if l != '/*c++*/\n']: + outfile.write(l) +sys.exit(0) +""") + +alt_cpp_suffix=test.get_alt_cpp_suffix() + +test.write('SConstruct', """ +env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', + SHCXXCOMSTR = 'Building shared object $TARGET from $SOURCE', + SHOBJPREFIX='', SHOBJSUFFIX='.obj') +env.SharedObject(target = 'test1', source = 'test1.cpp') +env.SharedObject(target = 'test2', source = 'test2.cc') +env.SharedObject(target = 'test3', source = 'test3.cxx') +env.SharedObject(target = 'test4', source = 'test4.c++') +env.SharedObject(target = 'test5', source = 'test5.C++') +env.SharedObject(target = 'test6', source = 'test6%(alt_cpp_suffix)s') +""" % locals()) + +test.write('test1.cpp', "test1.cpp\n/*c++*/\n") +test.write('test2.cc', "test2.cc\n/*c++*/\n") +test.write('test3.cxx', "test3.cxx\n/*c++*/\n") +test.write('test4.c++', "test4.c++\n/*c++*/\n") +test.write('test5.C++', "test5.C++\n/*c++*/\n") +test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n") + +test.run(stdout = test.wrap_stdout("""\ +Building shared object test1.obj from test1.cpp +Building shared object test2.obj from test2.cc +Building shared object test3.obj from test3.cxx +Building shared object test4.obj from test4.c++ +Building shared object test5.obj from test5.C++ +Building shared object test6.obj from test6%(alt_cpp_suffix)s +""" % locals())) + +test.must_match('test1.obj', "test1.cpp\n") +test.must_match('test2.obj', "test2.cc\n") +test.must_match('test3.obj', "test3.cxx\n") +test.must_match('test4.obj', "test4.c++\n") +test.must_match('test5.obj', "test5.C++\n") +test.must_match('test6.obj', "test6.C\n") + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/SHCXXFLAGS.py b/test/CXX/SHCXXFLAGS.py new file mode 100644 index 0000000..343be30 --- /dev/null +++ b/test/CXX/SHCXXFLAGS.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python +# +# __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__" + +""" +Verify that $SHCXXFLAGS settings are used to build shared object files. +""" + +import os +import sys + +import TestSCons + +_obj = TestSCons._obj + +if os.name == 'posix': + os.environ['LD_LIBRARY_PATH'] = '.' +if sys.platform.find('irix') > -1: + os.environ['LD_LIBRARYN32_PATH'] = '.' + +test = TestSCons.TestSCons() + +e = test.Environment() + +test.write('SConstruct', """ +foo = Environment(WINDOWS_INSERT_DEF=1) +foo.Append(SHCXXFLAGS = '-DFOO') +bar = Environment(WINDOWS_INSERT_DEF=1) +bar.Append(SHCXXFLAGS = '-DBAR') +foo_obj = foo.SharedObject(target = 'foo%(_obj)s', source = 'prog.cpp') +bar_obj = bar.SharedObject(target = 'bar%(_obj)s', source = 'prog.cpp') +foo.SharedLibrary(target = 'foo', source = foo_obj) +bar.SharedLibrary(target = 'bar', source = bar_obj) + +fooMain = foo.Clone(LIBS='foo', LIBPATH='.') +foo_obj = fooMain.Object(target='foomain', source='main.c') +fooMain.Program(target='fooprog', source=foo_obj) + +barMain = bar.Clone(LIBS='bar', LIBPATH='.') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=bar_obj) +""" % locals()) + +test.write('foo.def', r""" +LIBRARY "foo" +DESCRIPTION "Foo Shared Library" + +EXPORTS + doIt +""") + +test.write('bar.def', r""" +LIBRARY "bar" +DESCRIPTION "Bar Shared Library" + +EXPORTS + doIt +""") + +test.write('prog.cpp', r""" +#include <stdio.h> + +extern "C" void +doIt() +{ +#ifdef FOO + printf("prog.cpp: FOO\n"); +#endif +#ifdef BAR + printf("prog.cpp: BAR\n"); +#endif +} +""") + +test.write('main.c', r""" + +void doIt(); + +int +main(int argc, char* argv[]) +{ + doIt(); + return 0; +} +""") + +test.run(arguments = '.') + +test.run(program = test.workpath('fooprog'), stdout = "prog.cpp: FOO\n") +test.run(program = test.workpath('barprog'), stdout = "prog.cpp: BAR\n") + +test.write('SConstruct', """ +bar = Environment(WINDOWS_INSERT_DEF=1) +bar.Append(SHCXXFLAGS = '-DBAR') +foo_obj = bar.SharedObject(target = 'foo%(_obj)s', source = 'prog.cpp') +bar_obj = bar.SharedObject(target = 'bar%(_obj)s', source = 'prog.cpp') +bar.SharedLibrary(target = 'foo', source = foo_obj) +bar.SharedLibrary(target = 'bar', source = bar_obj) + +barMain = bar.Clone(LIBS='bar', LIBPATH='.') +foo_obj = barMain.Object(target='foomain', source='main.c') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=foo_obj) +barMain.Program(target='fooprog', source=bar_obj) +""" % locals()) + +test.run(arguments = '.') + +test.run(program = test.workpath('fooprog'), stdout = "prog.cpp: BAR\n") +test.run(program = test.workpath('barprog'), stdout = "prog.cpp: BAR\n") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |
