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 7.0 project (.vcproj) and
29 solution (.sln) files that contain SCC information and look correct.
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 r
"""env=Environment(tools=['msvs'],
46 CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
47 CPPPATH=['inc1', 'inc2'],
48 MSVS_SCC_CONNECTION_ROOT='.',
49 MSVS_SCC_PROVIDER='MSSCCI:Perforce SCM',
50 MSVS_SCC_PROJECT_NAME='Perforce Project',
51 MSVS_SCC_AUX_PATH='AUX',
52 HOST_ARCH='%(HOST_ARCH)s')
54 testsrc = ['test1.cpp', 'test2.cpp']
56 testlocalincs = ['test.h']
57 testresources = ['test.rc']
58 testmisc = ['readme.txt']
60 env.MSVSProject(target = 'Test.vcproj',
61 MSVS_PROJECT_GUID='%(PROJECT_GUID)s',
62 slnguid = '{SLNGUID}',
65 localincs = testlocalincs,
66 resources = testresources,
68 buildtarget = 'Test.exe',
70 """ % {'HOST_ARCH':host_arch
, 'PROJECT_GUID': TestSConsMSVS
.PROJECT_GUID
}
72 expected_sln_sccinfo
= """\
73 \tGlobalSection(SourceCodeControl) = preSolution
74 \t\tSccNumberOfProjects = 2
75 \t\tSccProjectName0 = Perforce\\u0020Project
77 \t\tSccProvider0 = MSSCCI:Perforce\\u0020SCM
78 \t\tCanCheckoutShared = true
79 \t\tSolutionUniqueID = {SLNGUID}
80 \t\tSccProjectUniqueName1 = Test.vcproj
82 \t\tCanCheckoutShared = true
83 \t\tSccProjectFilePathRelativizedFromConnection1 = .\\\\
87 expected_vcproj_sccinfo
= """\
88 \tSccProjectName="Perforce Project"
91 \tSccProvider="MSSCCI:Perforce SCM"
94 test
.write('SConstruct', SConscript_contents
)
96 test
.run(arguments
="Test.vcproj")
98 test
.must_exist(test
.workpath('Test.vcproj'))
99 vcproj
= test
.read('Test.vcproj', 'r')
100 expect
= test
.msvs_substitute(expected_vcprojfile
, '7.0', None, 'SConstruct',
101 vcproj_sccinfo
=expected_vcproj_sccinfo
)
102 # don't compare the pickled data
103 assert vcproj
[:len(expect
)] == expect
, test
.diff_substr(expect
, vcproj
)
105 test
.must_exist(test
.workpath('Test.sln'))
106 sln
= test
.read('Test.sln', 'r')
107 expect
= test
.msvs_substitute(expected_slnfile
, '7.0', None, 'SConstruct',
108 sln_sccinfo
=expected_sln_sccinfo
)
109 # don't compare the pickled data
110 assert sln
[:len(expect
)] == expect
, test
.diff_substr(expect
, sln
)
116 # indent-tabs-mode:nil
118 # vim: set expandtab tabstop=4 shiftwidth=4: