Merge pull request #4674 from bdbaddog/fix_2281_Aliases_ignore_pre_post_add_actions
[scons.git] / test / MSVS / vs-6.0-variant_dir.py
blobb5299a8f7cdf401dbd5a5d56aa49d39a2cedbcba
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 6 project (.dsp) and solution
29 (.dsw) files that look correct when using a variant_dir.
30 """
32 import TestSConsMSVS
34 test = TestSConsMSVS.TestSConsMSVS()
36 host_arch = test.get_vs_host_arch()
39 # Make the test infrastructure think we have this version of MSVS installed.
40 test._msvs_versions = ['6.0']
42 expected_dspfile = TestSConsMSVS.expected_dspfile_6_0
43 expected_dswfile = TestSConsMSVS.expected_dswfile_6_0
44 SConscript_contents = TestSConsMSVS.SConscript_contents_6_0
47 test.subdir('src')
49 test.write('SConstruct', """\
50 SConscript('src/SConscript', variant_dir='build')
51 """)
53 test.write(['src', 'SConscript'], SConscript_contents%{'HOST_ARCH': host_arch})
55 test.run(arguments=".")
57 dsp = test.read(['src', 'Test.dsp'], 'r')
58 expect = test.msvs_substitute(expected_dspfile, '6.0', None, 'SConstruct')
59 # don't compare the pickled data
60 assert dsp[:len(expect)] == expect, test.diff_substr(expect, dsp)
62 test.must_exist(test.workpath('src', 'Test.dsw'))
63 dsw = test.read(['src', 'Test.dsw'], 'r')
64 expect = test.msvs_substitute(expected_dswfile, '6.0', 'src')
65 assert dsw == expect, test.diff_substr(expect, dsw)
67 test.must_match(['build', 'Test.dsp'], """\
68 This is just a placeholder file.
69 The real project file is here:
71 """ % test.workpath('src', 'Test.dsp'),
72 mode='r')
74 test.must_match(['build', 'Test.dsw'], """\
75 This is just a placeholder file.
76 The real workspace file is here:
78 """ % test.workpath('src', 'Test.dsw'),
79 mode='r')
83 test.pass_test()
85 # Local Variables:
86 # tab-width:4
87 # indent-tabs-mode:nil
88 # End:
89 # vim: set expandtab tabstop=4 shiftwidth=4: