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/MSVC | |
| 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/MSVC')
| -rw-r--r-- | test/MSVC/PCH-source.py | 102 | ||||
| -rw-r--r-- | test/MSVC/PCHCOM.py | 69 | ||||
| -rw-r--r-- | test/MSVC/PCHCOMSTR.py | 73 | ||||
| -rw-r--r-- | test/MSVC/PCHSTOP-errors.py | 74 | ||||
| -rw-r--r-- | test/MSVC/RCCOM.py | 70 | ||||
| -rw-r--r-- | test/MSVC/RCCOMSTR.py | 73 | ||||
| -rw-r--r-- | test/MSVC/TARGET_ARCH.py | 65 | ||||
| -rw-r--r-- | test/MSVC/batch-longlines.py | 61 | ||||
| -rw-r--r-- | test/MSVC/batch.py | 170 | ||||
| -rw-r--r-- | test/MSVC/embed-manifest.py | 94 | ||||
| -rw-r--r-- | test/MSVC/generate-rc.py | 76 | ||||
| -rw-r--r-- | test/MSVC/hierarchical.py | 95 | ||||
| -rw-r--r-- | test/MSVC/msvc.py | 207 | ||||
| -rw-r--r-- | test/MSVC/multiple-pdb.py | 85 | ||||
| -rw-r--r-- | test/MSVC/pch-basics.py | 79 | ||||
| -rw-r--r-- | test/MSVC/pch-spaces-subdir.py | 82 | ||||
| -rw-r--r-- | test/MSVC/pdb-VariantDir-path.py | 78 | ||||
| -rw-r--r-- | test/MSVC/pdb-manifest.py | 83 | ||||
| -rw-r--r-- | test/MSVC/query_vcbat.py | 62 |
19 files changed, 1698 insertions, 0 deletions
diff --git a/test/MSVC/PCH-source.py b/test/MSVC/PCH-source.py new file mode 100644 index 0000000..6015fec --- /dev/null +++ b/test/MSVC/PCH-source.py @@ -0,0 +1,102 @@ +#!/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 use of pre-compiled headers when the source .cpp file shows
+up in both the env.PCH() and the env.Program() source list.
+
+Issue 2505: http://scons.tigris.org/issues/show_bug.cgi?id=2505
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.skip_if_not_msvc()
+
+test.write('SConstruct', """\
+env = Environment(tools=['msvc', 'mslink'])
+env['PCH'] = env.PCH('Source1.cpp')[0]
+env['PCHSTOP'] = 'Header1.hpp'
+env.Program('foo', ['foo.cpp', 'Source2.cpp', 'Source1.cpp'])
+""" % locals())
+
+test.write('Header1.hpp', r"""
+""")
+
+test.write('Source1.cpp', r"""
+#include <stdio.h>
+
+#include "Header1.hpp"
+
+void
+Source1(void) {
+ printf("Source1.cpp\n");
+}
+""")
+
+test.write('Source2.cpp', r"""
+#include <stdio.h>
+
+#include "Header1.hpp"
+
+void
+Source2(void) {
+ printf("Source2.cpp\n");
+}
+""")
+
+test.write('foo.cpp', r"""
+#include <stdio.h>
+
+#include "Header1.hpp"
+
+void Source1(void);
+void Source2(void);
+
+int
+main(int argc, char *argv[])
+{
+ Source1();
+ Source2();
+ printf("foo.cpp\n");
+}
+""")
+
+test.run(arguments = ".")
+
+test.run(program=test.workpath('foo'+TestSCons._exe),
+ stdout="Source1.cpp\nSource2.cpp\nfoo.cpp\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/MSVC/PCHCOM.py b/test/MSVC/PCHCOM.py new file mode 100644 index 0000000..ff27e10 --- /dev/null +++ b/test/MSVC/PCHCOM.py @@ -0,0 +1,69 @@ +#!/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 $PCHCOM construction variable. +""" + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + + + +test.write('mypch.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in [l for l in infile.readlines() if l != '/*pch*/\\n']: + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + PCHCOM = r'%(_python_)s mypch.py $TARGET $SOURCES') +env.PCH(target = 'aaa', source = 'aaa.h') +""" % locals()) + +test.write('aaa.h', "aaa.h\n/*pch*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.pch', "aaa.h\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/MSVC/PCHCOMSTR.py b/test/MSVC/PCHCOMSTR.py new file mode 100644 index 0000000..51f56fb --- /dev/null +++ b/test/MSVC/PCHCOMSTR.py @@ -0,0 +1,73 @@ +#!/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 $PCHCOMSTR construction variable allows you to customize +the displayed string when pch is called. +""" + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + + + +test.write('mypch.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in [l for l in infile.readlines() if l != '/*pch*/\\n']: + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + PCHCOM = r'%(_python_)s mypch.py $TARGET $SOURCES', + PCHCOMSTR = 'PCHing $TARGET from $SOURCE') +env.PCH(target = 'aaa', source = 'aaa.h') +""" % locals()) + +test.write('aaa.h', "aaa.h\n/*pch*/\n") + +test.run(stdout = test.wrap_stdout("""\ +PCHing aaa.pch from aaa.h +""")) + +test.must_match('aaa.pch', "aaa.h\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/MSVC/PCHSTOP-errors.py b/test/MSVC/PCHSTOP-errors.py new file mode 100644 index 0000000..aa14a3f --- /dev/null +++ b/test/MSVC/PCHSTOP-errors.py @@ -0,0 +1,74 @@ +#!/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 error reporting +""" + +import re + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re) + +test.skip_if_not_msvc() + +SConstruct_path = test.workpath('SConstruct') + +test.write(SConstruct_path, """\ +env = Environment() +env['PDB'] = File('test.pdb') +env['PCH'] = env.PCH('StdAfx.cpp')[0] +if int(ARGUMENTS.get('SET_PCHSTOP')): + env['PCHSTOP'] = File('StdAfx.h') +env.Program('test', 'test.cpp') +""") + + + +expect_stderr = r''' +scons: \*\*\* The PCHSTOP construction must be defined if PCH is defined. +''' + TestSCons.file_expr + +test.run(arguments='SET_PCHSTOP=0', status=2, stderr=expect_stderr) + + + +expect_stderr = r''' +scons: \*\*\* The PCHSTOP construction variable must be a string: .+ +''' + TestSCons.file_expr + +test.run(arguments='SET_PCHSTOP=1', status=2, stderr=expect_stderr) + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/RCCOM.py b/test/MSVC/RCCOM.py new file mode 100644 index 0000000..05382b8 --- /dev/null +++ b/test/MSVC/RCCOM.py @@ -0,0 +1,70 @@ +#!/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 $RCCOM construction variable +when using MSVC. +""" + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in [l for l in infile.readlines() if l != '/*rc*/\\n']: + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.res', "aaa.rc\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/MSVC/RCCOMSTR.py b/test/MSVC/RCCOMSTR.py new file mode 100644 index 0000000..8425d73 --- /dev/null +++ b/test/MSVC/RCCOMSTR.py @@ -0,0 +1,73 @@ +#!/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 $RCCOMSTR construction variable allows you to customize +the displayed string when rc is called. +""" + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in [l for l in infile.readlines() if l != '/*rc*/\\n']: + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES', + RCCOMSTR = 'RCing $TARGET from $SOURCE') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(stdout = test.wrap_stdout("""\ +RCing aaa.res from aaa.rc +""")) + +test.must_match('aaa.res', "aaa.rc\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/MSVC/TARGET_ARCH.py b/test/MSVC/TARGET_ARCH.py new file mode 100644 index 0000000..1df28d0 --- /dev/null +++ b/test/MSVC/TARGET_ARCH.py @@ -0,0 +1,65 @@ +#!/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 $TARGET_ARCH construction variable. +""" + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +test.skip_if_not_msvc() + +test.write('SConstruct', """ +env_64 = Environment(tools=['default', 'msvc'], + TARGET_ARCH = 'amd64') +env_32 = Environment(tools=['default', 'msvc'], + TARGET_ARCH = 'x86') +""" % locals()) + +test.run(arguments = ".") + +# test.pass_test() + +test.write('SConstruct', """ +env_xx = Environment(tools=['default', 'msvc'], + TARGET_ARCH = 'nosucharch') +""" % locals()) + +test.run(arguments = ".", status=2, stderr=None) +test.must_contain_any_line(test.stderr(), "Unrecognized target architecture") +test.must_contain_any_line(test.stderr(), "Valid architectures") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/batch-longlines.py b/test/MSVC/batch-longlines.py new file mode 100644 index 0000000..ef7233b --- /dev/null +++ b/test/MSVC/batch-longlines.py @@ -0,0 +1,61 @@ +#!/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 operation of Visual C/C++ batch builds with long lines.
+
+Only runs on Windows.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.skip_if_not_msvc()
+
+_python_ = TestSCons._python_
+
+for i in xrange(1,200):
+ test.write('source-file-with-quite-a-long-name-maybe-unrealistic-but-who-cares-%05d.cxx'%i,
+ '/* source file %d */\nint var%d;\n'%(i,i))
+
+test.write('SConstruct', """
+env = Environment(tools=['msvc', 'mslink'],
+ MSVC_BATCH=ARGUMENTS.get('MSVC_BATCH'))
+env.SharedLibrary('mylib', Glob('source*.cxx'))
+""" % locals())
+
+test.run(arguments = 'MSVC_BATCH=1 .')
+
+test.must_exist('mylib.dll')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/MSVC/batch.py b/test/MSVC/batch.py new file mode 100644 index 0000000..fbb3218 --- /dev/null +++ b/test/MSVC/batch.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 operation of Visual C/C++ batch builds. + +This uses a fake compiler and linker script, fake command lines, and +explicit suffix settings so that the test should work when run on any +platform. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +_python_ = TestSCons._python_ + +test.write('fake_cl.py', """\ +import os +import sys +input_files = sys.argv[2:] +if sys.argv[1][-1] in (os.sep, '\\\\'): + # The output (/Fo) argument ends with a backslash, indicating an + # output directory. We accept ending with a slash as well so this + # test runs on non-Windows systems. Strip either character and + # record the directory name. + sys.argv[1] = sys.argv[1][:-1] + dir = sys.argv[1][3:] +else: + dir = None + output = sys.argv[1][3:] +# Delay writing the .log output until here so any trailing slash or +# backslash has been stripped, and the output comparisons later in this +# script don't have to account for the difference. +open('fake_cl.log', 'ab').write(" ".join(sys.argv[1:]) + '\\n') +for infile in input_files: + if dir: + outfile = os.path.join(dir, infile.replace('.c', '.obj')) + else: + outfile = output + open(outfile, 'wb').write(open(infile, 'rb').read()) +""") + +test.write('fake_link.py', """\ +import sys +ofp = open(sys.argv[1], 'wb') +for infile in sys.argv[2:]: + ofp.write(open(infile, 'rb').read()) +""") + +test.write('SConstruct', """ +cccom = '%(_python_)s fake_cl.py $_MSVC_OUTPUT_FLAG $CHANGED_SOURCES' +linkcom = '%(_python_)s fake_link.py ${TARGET.windows} $SOURCES' +env = Environment(tools=['msvc', 'mslink'], + CCCOM=cccom, + LINKCOM=linkcom, + PROGSUFFIX='.exe', + OBJSUFFIX='.obj', + MSVC_BATCH=ARGUMENTS.get('MSVC_BATCH')) +p = env.Object('prog.c') +f1 = env.Object('f1.c') +f2 = env.Object('f2.c') +env.Program(p + f1 + f2) +""" % locals()) + +test.write('prog.c', "prog.c\n") +test.write('f1.c', "f1.c\n") +test.write('f2.c', "f2.c\n") + + + +test.run(arguments = 'MSVC_BATCH=1 .') + +test.must_match('prog.exe', "prog.c\nf1.c\nf2.c\n") +test.must_match('fake_cl.log', """\ +/Fo. prog.c f1.c f2.c +""") + +test.up_to_date(options = 'MSVC_BATCH=1', arguments = '.') + + + +test.write('f1.c', "f1.c 2\n") + +test.run(arguments = 'MSVC_BATCH=1 .') + +test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n") +test.must_match('fake_cl.log', """\ +/Fo. prog.c f1.c f2.c +/Fo. f1.c +""") + +test.up_to_date(options = 'MSVC_BATCH=1', arguments = '.') + + + +test.run(arguments = '-c .') + +test.unlink('fake_cl.log') + + + +test.run(arguments = '. MSVC_BATCH=0') + +test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n") +test.must_match('fake_cl.log', """\ +/Fof1.obj f1.c +/Fof2.obj f2.c +/Foprog.obj prog.c +""") + +test.run(arguments = '-c .') +test.unlink('fake_cl.log') + + +test.run(arguments = '. MSVC_BATCH=False') + +test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n") +test.must_match('fake_cl.log', """\ +/Fof1.obj f1.c +/Fof2.obj f2.c +/Foprog.obj prog.c +""") + + + +test.write('f1.c', "f1.c 3\n") + +test.run(arguments = '. MSVC_BATCH=0') + +test.must_match('prog.exe', "prog.c\nf1.c 3\nf2.c\n") +test.must_match('fake_cl.log', """\ +/Fof1.obj f1.c +/Fof2.obj f2.c +/Foprog.obj prog.c +/Fof1.obj f1.c +""") + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/embed-manifest.py b/test/MSVC/embed-manifest.py new file mode 100644 index 0000000..13f1def --- /dev/null +++ b/test/MSVC/embed-manifest.py @@ -0,0 +1,94 @@ +#!/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 manifest files get embedded correctly in EXEs and DLLs
+"""
+
+import TestSCons
+
+_exe = TestSCons._exe
+_dll = TestSCons._dll
+_lib = TestSCons._lib
+
+test = TestSCons.TestSCons()
+
+test.skip_if_not_msvc()
+
+test.write('SConstruct', """\
+env=Environment(WINDOWS_EMBED_MANIFEST=True)
+env.Append(CCFLAGS = '/MD')
+env.Append(LINKFLAGS = '/MANIFEST')
+env.Append(SHLINKFLAGS = '/MANIFEST')
+exe=env.Program('test.cpp')
+dll=env.SharedLibrary('testdll.cpp')
+env.Command('exe-extracted.manifest', exe,
+ '$MT /nologo -inputresource:${SOURCE};1 -out:${TARGET}')
+env.Command('dll-extracted.manifest', dll,
+ '$MT /nologo -inputresource:${SOURCE};2 -out:${TARGET}')
+env2=Environment(WINDOWS_EMBED_MANIFEST=True) # no /MD here
+env2.Program('test-nomanifest', env2.Object('test-nomanifest', 'test.cpp'))
+""")
+
+test.write('test.cpp', """\
+#include <stdio.h>
+#include <stdlib.h>
+int
+main(int argc, char *argv)
+{
+ printf("test.cpp\\n");
+ exit (0);
+}
+""")
+
+test.write('testdll.cpp', """\
+#include <stdio.h>
+#include <stdlib.h>
+
+__declspec(dllexport) int
+testdll(int argc, char *argv)
+{
+ printf("testdll.cpp\\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.')
+
+test.must_exist('test%s' % _exe)
+test.must_exist('test%s.manifest' % _exe)
+test.must_contain('exe-extracted.manifest', '</assembly>')
+test.must_exist('testdll%s' % _dll)
+test.must_exist('testdll%s.manifest' % _dll)
+test.must_contain('dll-extracted.manifest', '</assembly>')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/MSVC/generate-rc.py b/test/MSVC/generate-rc.py new file mode 100644 index 0000000..40ef95e --- /dev/null +++ b/test/MSVC/generate-rc.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__" + +""" +Test adding a src_builder to the RES builder so that RC files can +be generated. +""" + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +fake_rc = test.workpath('fake_rc.py') + +test.write(fake_rc, """\ +import sys +contents = open(sys.argv[2], 'rb').read() +open(sys.argv[1], 'wb').write("fake_rc.py\\n" + contents) +""") + +test.write('SConstruct', """ +def generate_rc(target, source, env): + t = str(target[0]) + s = str(source[0]) + tfp = open(t, 'wb') + tfp.write('generate_rc\\n' + open(s, 'r').read()) + +env = Environment(tools=['msvc'], + RCCOM=r'%(_python_)s %(fake_rc)s $TARGET $SOURCE') +env['BUILDERS']['GenerateRC'] = Builder(action=generate_rc, + suffix='.rc', + src_suffix='.in') +env['BUILDERS']['RES'].src_builder.append('GenerateRC') + +env.RES('my.in') +""" % locals()) + +test.write('my.in', "my.in\n") + +test.run(arguments = '.') + +test.must_match('my.rc', "generate_rc\nmy.in\n") +test.must_match('my.res', "fake_rc.py\ngenerate_rc\nmy.in\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/MSVC/hierarchical.py b/test/MSVC/hierarchical.py new file mode 100644 index 0000000..0b19483 --- /dev/null +++ b/test/MSVC/hierarchical.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__" + +""" +Verify use of Visual Studio with a hierarchical build. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re) + +test.skip_if_not_msvc() + +test.subdir('src', 'build', 'out') + +test.write('SConstruct', """ +VariantDir('build', 'src', duplicate=0) +SConscript('build/SConscript') +""") + +test.write('src/SConscript',""" +import os +# TODO: this is order-dependent (putting 'mssdk' second or third breaks), +# and ideally we shouldn't need to specify the tools= list anyway. +env = Environment(tools=['mssdk', 'msvc', 'mslink']) +env.Append(CPPPATH=os.environ.get('INCLUDE', ''), + LIBPATH=os.environ.get('LIB', '')) +env['PCH'] = 'StdAfx.pch' +env['PDB'] = '#out/test.pdb' +env['PCHSTOP'] = 'StdAfx.h' +env.PCH('StdAfx.cpp') +env.Program('#out/test.exe', 'test.cpp') +""") + +test.write('src/test.cpp', ''' +#include "StdAfx.h" + +int main(void) +{ + return 1; +} +''') + +test.write('src/StdAfx.h', ''' +#include <windows.h> +''') + +test.write('src/StdAfx.cpp', ''' +#include "StdAfx.h" +''') + +test.run(arguments='out', stderr=None) + +test.must_exist(test.workpath('out/test.pdb')) +test.must_exist(test.workpath('build/StdAfx.pch')) +test.must_exist(test.workpath('build/StdAfx.obj')) + +test.run(arguments='-c out') + +test.must_not_exist(test.workpath('out/test.pdb')) +test.must_not_exist(test.workpath('build/StdAfx.pch')) +test.must_not_exist(test.workpath('build/StdAfx.obj')) + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py new file mode 100644 index 0000000..c68fb45 --- /dev/null +++ b/test/MSVC/msvc.py @@ -0,0 +1,207 @@ +#!/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 basic invocation of Microsoft Visual C/C++, including use +of a precompiled header with the $CCFLAGS variable. +""" + +import time + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re) + +test.skip_if_not_msvc() + +##### +# Test the basics + +test.write('SConstruct',""" +import os +# TODO: this is order-dependent (putting 'mssdk' second or third breaks), +# and ideally we shouldn't need to specify the tools= list anyway. +env = Environment(tools=['mssdk', 'msvc', 'mslink']) +env.Append(CPPPATH=os.environ.get('INCLUDE', ''), + LIBPATH=os.environ.get('LIB', ''), + CCFLAGS='/DPCHDEF') +env['PDB'] = File('test.pdb') +env['PCHSTOP'] = 'StdAfx.h' +env['PCH'] = env.PCH('StdAfx.cpp')[0] +env.Program('test', ['test.cpp', env.RES('test.rc')], LIBS=['user32']) + +env.Object('fast', 'foo.cpp') +env.Object('slow', 'foo.cpp', PCH=0) +""") + +test.write('test.cpp', ''' +#include "StdAfx.h" +#include "resource.h" + +int main(void) +{ + char test[1024]; + LoadString(GetModuleHandle(NULL), IDS_TEST, test, sizeof(test)); + printf("%d %s\\n", IDS_TEST, test); + return 0; +} +''') + +test.write('test.rc', ''' +#include "resource.h" + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TEST "test 1" +END +''') + +test.write('resource.h', ''' +#define IDS_TEST 2001 +''') + + +test.write('foo.cpp', ''' +#include "StdAfx.h" +''') + +test.write('StdAfx.h', ''' +#include <windows.h> +#include <stdio.h> +#include "resource.h" +''') + +test.write('StdAfx.cpp', ''' +#include "StdAfx.h" +#ifndef PCHDEF +this line generates an error if PCHDEF is not defined! +#endif +''') + +# Visual Studio 8 has deprecated the /Yd option and prints warnings +# about it, so ignore stderr when running SCons. + +test.run(arguments='test.exe', stderr=None) + +test.must_exist(test.workpath('test.exe')) +test.must_exist(test.workpath('test.res')) +test.must_exist(test.workpath('test.pdb')) +test.must_exist(test.workpath('StdAfx.pch')) +test.must_exist(test.workpath('StdAfx.obj')) + +test.run(program=test.workpath('test.exe'), stdout='2001 test 1\n') + +test.write('resource.h', ''' +#define IDS_TEST 2002 +''') +test.run(arguments='test.exe', stderr=None) +test.run(program=test.workpath('test.exe'), stdout='2002 test 1\n') + +test.write('test.rc', ''' +#include "resource.h" + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TEST "test 2" +END +''') +test.run(arguments='test.exe', stderr=None) +test.run(program=test.workpath('test.exe'), stdout='2002 test 2\n') + +test.run(arguments='-c .') + +test.must_not_exist(test.workpath('test.exe')) +test.must_not_exist(test.workpath('test.pdb')) +test.must_not_exist(test.workpath('test.res')) +test.must_not_exist(test.workpath('StdAfx.pch')) +test.must_not_exist(test.workpath('StdAfx.obj')) + +test.run(arguments='test.exe', stderr=None) + +test.must_exist(test.workpath('test.pdb')) +test.must_exist(test.workpath('StdAfx.pch')) +test.must_exist(test.workpath('StdAfx.obj')) + +test.run(arguments='-c test.pdb') +test.must_not_exist(test.workpath('test.exe')) +test.must_not_exist(test.workpath('test.obj')) +test.must_not_exist(test.workpath('test.pdb')) +test.must_not_exist(test.workpath('StdAfx.pch')) +test.must_not_exist(test.workpath('StdAfx.obj')) + +test.run(arguments='StdAfx.pch', stderr=None) + +test.must_not_exist(test.workpath('test.pdb')) +test.must_exist(test.workpath('StdAfx.pch')) +test.must_exist(test.workpath('StdAfx.obj')) + +test.run(arguments='-c test.exe') +test.must_not_exist(test.workpath('test.exe')) +test.must_not_exist(test.workpath('test.obj')) +test.must_not_exist(test.workpath('test.pdb')) +test.must_not_exist(test.workpath('StdAfx.pch')) +test.must_not_exist(test.workpath('StdAfx.obj')) + +test.run(arguments='test.obj', stderr=None) +test.must_not_exist(test.workpath('test.pdb')) +test.must_exist(test.workpath('test.obj')) + + +start = time.time() +test.run(arguments='fast.obj', stderr=None) +fast = time.time() - start + +start = time.time() +test.run(arguments='slow.obj', stderr=None) +slow = time.time() - start + +# using precompiled headers should be faster +limit = slow*0.90 +if fast >= limit: + print "Using precompiled headers was not fast enough:" + print "slow.obj: %.3fs" % slow + print "fast.obj: %.3fs (expected less than %.3fs)" % (fast, limit) + test.fail_test() + +# Modifying resource.h should cause both the resource and precompiled header to be rebuilt: +test.write('resource.h', ''' +#define IDS_TEST 2003 +''') + +test.not_up_to_date(arguments='test.res', stderr=None) +test.not_up_to_date(arguments='StdAfx.pch', stderr=None) +test.not_up_to_date(arguments='test.exe', stderr=None) +test.run(program=test.workpath('test.exe'), stdout='2003 test 2\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/MSVC/multiple-pdb.py b/test/MSVC/multiple-pdb.py new file mode 100644 index 0000000..78805e3 --- /dev/null +++ b/test/MSVC/multiple-pdb.py @@ -0,0 +1,85 @@ +#!/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 setting $PDB to '${TARGET}.pdb allows us to build multiple +programs with separate .pdb files from the same environment. + +Under the covers, this verifies that emitters support expansion of the +$TARGET variable (and implicitly $SOURCE), using the original specified +list(s). +""" + +import TestSCons + +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + +test.skip_if_not_msvc() + +test.write('SConstruct', """\ +env = Environment(PDB = '${TARGET.base}.pdb') +env.Program('test1.cpp') +env.Program('test2.cpp') +""") + +test.write('test1.cpp', """\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv) +{ + printf("test1.cpp\\n"); + exit (0); +} +""") + +test.write('test2.cpp', """\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv) +{ + printf("test2.cpp\\n"); + exit (0); +} +""") + +test.run(arguments = '.') + +test.must_exist('test1%s' % _exe) +test.must_exist('test1.pdb') +test.must_exist('test2%s' % _exe) +test.must_exist('test2.pdb') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/pch-basics.py b/test/MSVC/pch-basics.py new file mode 100644 index 0000000..45735ed --- /dev/null +++ b/test/MSVC/pch-basics.py @@ -0,0 +1,79 @@ +#!/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 PCH works to build a simple exe and a simple dll. +""" + +import time + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re) + +test.skip_if_not_msvc() + +test.write('Main.cpp', """\ +#include "Precompiled.h" + +int main() +{ + return testf(); +} +""") + +test.write('Precompiled.cpp', """\ +#include "Precompiled.h" +""") + +test.write('Precompiled.h', """\ +#pragma once + +static int testf() +{ + return 0; +} +""") + +test.write('SConstruct', """\ +env = Environment() + +env['PCHSTOP'] = 'Precompiled.h' +env['PCH'] = env.PCH('Precompiled.cpp')[0] + +env.SharedLibrary('pch_dll', 'Main.cpp') +env.Program('pch_exe', 'Main.cpp') +""") + +test.run(arguments='.', stderr=None) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/pch-spaces-subdir.py b/test/MSVC/pch-spaces-subdir.py new file mode 100644 index 0000000..3a65b44 --- /dev/null +++ b/test/MSVC/pch-spaces-subdir.py @@ -0,0 +1,82 @@ +#!/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 PCH works if variant dir has spaces in its name +""" + +import time + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re) + +test.skip_if_not_msvc() + +test.write('Main.cpp', """\ +#include "Precompiled.h" + +int main() +{ + return testf(); +} +""") + +test.write('Precompiled.cpp', """\ +#include "Precompiled.h" +""") + +test.write('Precompiled.h', """\ +#pragma once + +static int testf() +{ + return 0; +} +""") + +test.write('SConstruct', """\ +SConscript('SConscript', variant_dir='Release Output', duplicate=0) +""") + +test.write('SConscript', """\ +env = Environment() + +env['PCHSTOP'] = 'Precompiled.h' +env['PCH'] = env.PCH('Precompiled.cpp')[0] + +env.Program('Main.cpp') +""") + +test.run(arguments='.', stderr=None) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/pdb-VariantDir-path.py b/test/MSVC/pdb-VariantDir-path.py new file mode 100644 index 0000000..838487c --- /dev/null +++ b/test/MSVC/pdb-VariantDir-path.py @@ -0,0 +1,78 @@ +#!/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 .pdb files get put in a variant_dir correctly. +""" + +import TestSCons + +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + +test.skip_if_not_msvc() + +test.subdir('src') + +test.write('SConstruct', """\ +env = Environment() +env.Append(BINDIR = '#bin') + +Export('env') +SConscript('#src/SConscript', duplicate = 0, variant_dir = '#.build') +""") + +test.write(['src', 'SConscript'], """\ +Import('env') +env['PDB'] = '${TARGET}.pdb' +p = env.Program('test.exe', 'test.cpp') +env.Install(env['BINDIR'], p) +""") + +test.write(['src', 'test.cpp'], """\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv) +{ + printf("test.cpp\\n"); + exit (0); +} +""") + +test.run(arguments = '.') + +test.must_exist(['.build', 'test%s' % _exe]) +test.must_exist(['.build', 'test%s.pdb' % _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/MSVC/pdb-manifest.py b/test/MSVC/pdb-manifest.py new file mode 100644 index 0000000..e06fe0c --- /dev/null +++ b/test/MSVC/pdb-manifest.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__" + +""" +Verify that .pdb files work correctly in conjunction with manifest files. +""" + +import TestSCons + +_exe = TestSCons._exe +_dll = TestSCons._dll +_lib = TestSCons._lib + +test = TestSCons.TestSCons() + +test.skip_if_not_msvc() + +test.write('SConstruct', """\ +env = Environment() + +env['WINDOWS_INSERT_DEF'] = True +env['WINDOWS_INSERT_MANIFEST'] = True +env['PDB'] = '${TARGET.base}.pdb' +env.Program('test', 'test.cpp') +env.SharedLibrary('sharedlib', 'test.cpp') +env.StaticLibrary('staticlib', 'test.cpp') +""") + +test.write('test.cpp', """\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv) +{ + printf("test.cpp\\n"); + exit (0); +} +""") + +test.write('sharedlib.def', """\ +""") + +test.run(arguments = '.') + +test.must_exist('test%s' % _exe) +test.must_exist('test.pdb') + +test.must_exist('sharedlib%s' % _dll) +test.must_exist('sharedlib.pdb') + +test.must_exist('staticlib%s' % _lib) +test.must_not_exist('staticlib.pdb') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/query_vcbat.py b/test/MSVC/query_vcbat.py new file mode 100644 index 0000000..328345d --- /dev/null +++ b/test/MSVC/query_vcbat.py @@ -0,0 +1,62 @@ +# +# __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 + +test = TestSCons.TestSCons(match = TestSCons.match_re) + +test.skip_if_not_msvc() + +##### +# Test the basics + +test.write('SConstruct', """ +#from SCons.Tool.MSCommon.misc import FindMSVSBatFile, \\ +# ParseBatFile, \\ +# MergeMSVSBatFile +from SCons.Tool.MSCommon import query_versions +#env = Environment(tools = ['mingw']) +DefaultEnvironment(tools = []) +#for v in [9, 8, 7.1, 7]: +# print " ==== Testing for version %s ==== " % str(v) +# bat = FindMSVSBatFile(v) +# print bat +# if bat: +# d = ParseBatFile(bat) +# for k, v in d.items(): +# print k, v +#MergeMSVSBatFile(env, 9.0) +#print env['ENV']['PATH'] +print query_versions() +""") + +test.run(stderr = None) +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |
