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__"
28 Test that we can generate Visual Studio 10.0 or later project (.vcxproj) and
29 solution (.sln) files that look correct.
36 for vc_version
in TestSConsMSVS
.get_tested_proj_file_vc_versions():
37 test
= TestSConsMSVS
.TestSConsMSVS()
38 host_arch
= test
.get_vs_host_arch()
40 # Make the test infrastructure think we have this version of MSVS installed.
41 test
._msvs
_versions
= [vc_version
]
43 dirs
= ['inc1', 'inc2']
44 major
, minor
= test
.parse_vc_version(vc_version
)
45 project_file
= 'Test.vcproj' if major
<= 9 else 'Test.vcxproj'
46 filters_file
= project_file
+ '.filters'
47 filters_file_expected
= major
>= 10
48 expected_slnfile
= test
.get_expected_sln_file_contents(vc_version
, project_file
)
49 expected_vcprojfile
= test
.get_expected_proj_file_contents(vc_version
, dirs
, project_file
)
51 test
.write('SConstruct', test
.get_expected_sconscript_file_contents(vc_version
, project_file
))
53 test
.run(arguments
=project_file
)
55 test
.must_exist(test
.workpath(project_file
))
56 if filters_file_expected
:
57 test
.must_exist(test
.workpath(filters_file
))
59 test
.must_not_exist(test
.workpath(filters_file
))
60 vcxproj
= test
.read(project_file
, 'r')
61 expect
= test
.msvs_substitute(expected_vcprojfile
, vc_version
, None, 'SConstruct')
62 # don't compare the pickled data
63 assert vcxproj
[:len(expect
)] == expect
, test
.diff_substr(expect
, vcxproj
)
65 test
.must_exist(test
.workpath('Test.sln'))
66 sln
= test
.read('Test.sln', 'r')
67 expect
= test
.msvs_substitute(expected_slnfile
, vc_version
, None, 'SConstruct')
68 # don't compare the pickled data
69 assert sln
[:len(expect
)] == expect
, test
.diff_substr(expect
, sln
)
71 test
.run(arguments
='-c .')
73 test
.must_not_exist(test
.workpath(project_file
))
74 test
.must_not_exist(test
.workpath(filters_file
))
75 test
.must_not_exist(test
.workpath('Test.sln'))
77 test
.run(arguments
=project_file
)
79 test
.must_exist(test
.workpath(project_file
))
80 if filters_file_expected
:
81 test
.must_exist(test
.workpath(filters_file
))
83 test
.must_not_exist(test
.workpath(filters_file
))
84 test
.must_exist(test
.workpath('Test.sln'))
86 test
.run(arguments
='-c Test.sln')
88 test
.must_not_exist(test
.workpath(project_file
))
89 test
.must_not_exist(test
.workpath(filters_file
))
90 test
.must_not_exist(test
.workpath('Test.sln'))
92 # Test that running SCons with $PYTHON_ROOT in the environment
93 # changes the .vcxproj output as expected.
94 os
.environ
['PYTHON_ROOT'] = 'xyzzy'
95 python
= os
.path
.join('$(PYTHON_ROOT)', os
.path
.split(TestSConsMSVS
.python
)[1])
97 test
.run(arguments
=project_file
)
99 test
.must_exist(test
.workpath(project_file
))
100 vcxproj
= test
.read(project_file
, 'r')
101 expect
= test
.msvs_substitute(expected_vcprojfile
, vc_version
, None, 'SConstruct',
103 # don't compare the pickled data
104 assert vcxproj
[:len(expect
)] == expect
, test
.diff_substr(expect
, vcxproj
)
110 # indent-tabs-mode:nil
112 # vim: set expandtab tabstop=4 shiftwidth=4: