[ci skip] add test framework reformat to .git-blame-ignore-revs
[scons.git] / test / MSVS / vs-7.0-scc-legacy-files.py
blob00ce397d45441bf2d7ee825c2e2f9d138ce9ed68
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 contain SCC information and look correct.
30 """
33 import TestSConsMSVS
35 test = TestSConsMSVS.TestSConsMSVS()
36 host_arch = test.get_vs_host_arch()
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 = """\
44 env=Environment(tools=['msvs'],
45 MSVS_VERSION='7.0',
46 CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
47 CPPPATH=['inc1', 'inc2'],
48 MSVS_SCC_LOCAL_PATH=r'C:\\MyMsVsProjects',
49 MSVS_SCC_PROJECT_NAME='Perforce Project',
50 HOST_ARCH='%(HOST_ARCH)s')
52 testsrc = ['test1.cpp', 'test2.cpp']
53 testincs = ['sdk.h']
54 testlocalincs = ['test.h']
55 testresources = ['test.rc']
56 testmisc = ['readme.txt']
58 env.MSVSProject(target = 'Test.vcproj',
59 MSVS_PROJECT_GUID='%(PROJECT_GUID)s',
60 slnguid = '{SLNGUID}',
61 srcs = testsrc,
62 incs = testincs,
63 localincs = testlocalincs,
64 resources = testresources,
65 misc = testmisc,
66 buildtarget = 'Test.exe',
67 variant = 'Release')
68 """ % {'HOST_ARCH':host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID}
70 expected_vcproj_sccinfo = """\
71 \tSccProjectName="Perforce Project"
72 \tSccLocalPath="C:\\MyMsVsProjects"
73 """
75 test.write('SConstruct', SConscript_contents)
77 test.run(arguments="Test.vcproj")
79 test.must_exist(test.workpath('Test.vcproj'))
80 vcproj = test.read('Test.vcproj', 'r')
81 expect = test.msvs_substitute(expected_vcprojfile, '7.0', None, 'SConstruct',
82 vcproj_sccinfo=expected_vcproj_sccinfo)
83 # don't compare the pickled data
84 assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
86 test.must_exist(test.workpath('Test.sln'))
87 sln = test.read('Test.sln', 'r')
88 expect = test.msvs_substitute(expected_slnfile, '7.0', None, 'SConstruct')
89 # don't compare the pickled data
90 assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
92 test.pass_test()
94 # Local Variables:
95 # tab-width:4
96 # indent-tabs-mode:nil
97 # End:
98 # vim: set expandtab tabstop=4 shiftwidth=4: