[ci skip] add test framework reformat to .git-blame-ignore-revs
[scons.git] / test / MSVS / vs-6.0-clean.py
blob3f99d650d3143891b393f5a3942e7a466040725b
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 Verify the -c option's ability to clean generated Visual Studio 6
29 project (.dsp) and solution (.dsw) files.
30 """
32 import TestSConsMSVS
34 test = TestSConsMSVS.TestSConsMSVS()
35 host_arch = test.get_vs_host_arch()
37 # Make the test infrastructure think we have this version of MSVS installed.
38 test._msvs_versions = ['6.0']
40 expected_dspfile = TestSConsMSVS.expected_dspfile_6_0
41 expected_dswfile = TestSConsMSVS.expected_dswfile_6_0
43 test.write('SConstruct', """\
44 env=Environment(tools=['msvs'],
45 MSVS_VERSION='6.0',
46 HOST_ARCH='%(HOST_ARCH)s')
48 testsrc = ['test.c']
49 testincs = ['sdk.h']
50 testlocalincs = ['test.h']
51 testresources = ['test.rc']
52 testmisc = ['readme.txt']
54 p = env.MSVSProject(target = 'Test.dsp',
55 srcs = testsrc,
56 incs = testincs,
57 localincs = testlocalincs,
58 resources = testresources,
59 misc = testmisc,
60 buildtarget = 'Test.exe',
61 variant = 'Release',
62 auto_build_solution = 0)
64 env.MSVSSolution(target = 'Test.dsw',
65 slnguid = '{SLNGUID}',
66 projects = [p],
67 variant = 'Release')
68 """%{'HOST_ARCH':host_arch})
70 test.run()
72 test.must_exist(test.workpath('Test.dsp'))
73 dsp = test.read('Test.dsp', 'r')
74 expect = test.msvs_substitute(expected_dspfile, '6.0', None, 'SConstruct')
75 # don't compare the pickled data
76 assert dsp[:len(expect)] == expect, test.diff_substr(expect, dsp)
78 test.must_exist(test.workpath('Test.dsw'))
79 dsw = test.read('Test.dsw', 'r')
80 expect = test.msvs_substitute(expected_dswfile, '6.0', None, 'SConstruct')
81 assert dsw == expect, test.diff_substr(expect, dsw)
83 test.run(arguments='-c .')
85 test.must_not_exist(test.workpath('Test.dsp'))
86 test.must_not_exist(test.workpath('Test.dsw'))
88 test.run(arguments='.')
90 test.must_exist(test.workpath('Test.dsp'))
91 test.must_exist(test.workpath('Test.dsw'))
93 test.run(arguments='-c Test.dsp')
95 test.must_not_exist(test.workpath('Test.dsp'))
96 test.must_exist(test.workpath('Test.dsw'))
98 test.run(arguments='-c Test.dsw')
100 test.must_not_exist(test.workpath('Test.dsw'))
102 test.pass_test()
104 # Local Variables:
105 # tab-width:4
106 # indent-tabs-mode:nil
107 # End:
108 # vim: set expandtab tabstop=4 shiftwidth=4: