Merge pull request #4584 from siegria/fix_piped_spawn_encoding
[scons.git] / test / MSVS / vs-7.1-files.py
blobe2a40a813d035ad71400b13859f13f00ab48dca2
1 #!/usr/bin/env python
3 # __COPYRIGHT__
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
27 """
28 Test that we can generate Visual Studio 7.1 project (.vcproj) and
29 solution (.sln) files that look correct.
30 """
32 import os
34 import TestSConsMSVS
36 test = TestSConsMSVS.TestSConsMSVS()
37 host_arch = test.get_vs_host_arch()
40 # Make the test infrastructure think we have this version of MSVS installed.
41 test._msvs_versions = ['7.1']
45 expected_slnfile = TestSConsMSVS.expected_slnfile_7_1
46 expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_1
47 SConscript_contents = TestSConsMSVS.SConscript_contents_7_1
51 test.write('SConstruct', SConscript_contents%{'HOST_ARCH': host_arch})
53 test.run(arguments="Test.vcproj")
55 test.must_exist(test.workpath('Test.vcproj'))
56 vcproj = test.read('Test.vcproj', 'r')
57 expect = test.msvs_substitute(expected_vcprojfile, '7.1', None, 'SConstruct')
58 # don't compare the pickled data
59 assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
61 test.must_exist(test.workpath('Test.sln'))
62 sln = test.read('Test.sln', 'r')
63 expect = test.msvs_substitute(expected_slnfile, '7.1', None, 'SConstruct')
64 # don't compare the pickled data
65 assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
67 test.run(arguments='-c .')
69 test.must_not_exist(test.workpath('Test.vcproj'))
70 test.must_not_exist(test.workpath('Test.sln'))
72 test.run(arguments='Test.vcproj')
74 test.must_exist(test.workpath('Test.vcproj'))
75 test.must_exist(test.workpath('Test.sln'))
77 test.run(arguments='-c Test.sln')
79 test.must_not_exist(test.workpath('Test.vcproj'))
80 test.must_not_exist(test.workpath('Test.sln'))
84 # Test that running SCons with $PYTHON_ROOT in the environment
85 # changes the .vcproj output as expected.
86 os.environ['PYTHON_ROOT'] = 'xyzzy'
87 python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSConsMSVS.python)[1])
89 test.run(arguments='Test.vcproj')
91 test.must_exist(test.workpath('Test.vcproj'))
92 vcproj = test.read('Test.vcproj', 'r')
93 expect = test.msvs_substitute(expected_vcprojfile, '7.1', None, 'SConstruct',
94 python=python)
95 # don't compare the pickled data
96 assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
100 test.pass_test()
102 # Local Variables:
103 # tab-width:4
104 # indent-tabs-mode:nil
105 # End:
106 # vim: set expandtab tabstop=4 shiftwidth=4: