[ci skip] update generated files
[scons.git] / test / MSVS / vs-7.0-variant_dir.py
blobf83d0abe5e21458dab5e7db1e49dd1d92dd1bbbf
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.0 project (.vcproj) and
29 solution (.sln) files that look correct when using a variant_dir.
30 """
32 import TestSConsMSVS
34 test = TestSConsMSVS.TestSConsMSVS()
35 host_arch = test.get_vs_host_arch()
36 sconscript_dict = {'HOST_ARCH': host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID}
38 # Make the test infrastructure think we have this version of MSVS installed.
39 test._msvs_versions = ['7.0']
41 expected_slnfile = TestSConsMSVS.expected_slnfile_7_0
42 expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_0
43 SConscript_contents = TestSConsMSVS.SConscript_contents_7_0
45 test.subdir('src')
47 test.write('SConstruct', """\
48 SConscript('src/SConscript', variant_dir='build')
49 """)
51 test.write(['src', 'SConscript'], SConscript_contents % sconscript_dict)
53 test.run(arguments=".")
55 vcproj = test.read(['src', 'Test.vcproj'], 'r')
56 expect = test.msvs_substitute(expected_vcprojfile, '7.0', None, 'SConstruct')
57 # don't compare the pickled data
58 assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
60 test.must_exist(test.workpath('src', 'Test.sln'))
61 sln = test.read(['src', 'Test.sln'], 'r')
62 expect = test.msvs_substitute(expected_slnfile, '7.0', 'src')
63 # don't compare the pickled data
64 assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
66 test.must_match(['build', 'Test.vcproj'], """\
67 This is just a placeholder file.
68 The real project file is here:
70 """ % test.workpath('src', 'Test.vcproj'),
71 mode='r')
73 test.must_match(['build', 'Test.sln'], """\
74 This is just a placeholder file.
75 The real workspace file is here:
77 """ % test.workpath('src', 'Test.sln'),
78 mode='r')
80 test.pass_test()
82 # Local Variables:
83 # tab-width:4
84 # indent-tabs-mode:nil
85 # End:
86 # vim: set expandtab tabstop=4 shiftwidth=4: