Updates to PR 4374 from mwichmann to correct config file hash changes
[scons.git] / test / Interactive / clean.py
blobb2a7bb70a2de9a768f57799be7328f4758bf525e
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.
24 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26 """
27 Verifies operation of the --interactive command line option
28 "clean" subcommand.
29 """
31 import TestSCons
33 test = TestSCons.TestSCons()
35 test.write('SConstruct', """\
36 Command('f1.out', 'f1.in', Copy('$TARGET', '$SOURCE'))
37 Command('f2.out', 'f2.in', Copy('$TARGET', '$SOURCE'))
38 Command('f3.out', 'f3.in', Copy('$TARGET', '$SOURCE'))
39 Command('1', [], Touch('$TARGET'))
40 Command('2', [], Touch('$TARGET'))
41 Command('3', [], Touch('$TARGET'))
42 """)
44 test.write('f1.in', "f1.in\n")
45 test.write('f2.in', "f2.in\n")
46 test.write('f3.in', "f3.in\n")
50 scons = test.start(arguments = '-Q --interactive')
52 scons.send("build f1.out f2.out f3.out\n")
54 scons.send("build 1\n")
56 test.wait_for(test.workpath('1'))
58 test.must_match(test.workpath('f1.out'), "f1.in\n")
59 test.must_match(test.workpath('f2.out'), "f2.in\n")
60 test.must_match(test.workpath('f3.out'), "f3.in\n")
64 scons.send("clean f1.out\n")
66 scons.send("build 2\n")
68 test.wait_for(test.workpath('2'), popen=scons)
70 test.must_not_exist('f1.out')
71 test.must_exist('f2.out')
72 test.must_exist('f3.out')
76 scons.send("build -c\n")
78 scons.send("build 3\n")
80 test.wait_for(test.workpath('3'))
82 test.must_not_exist('f1.out')
83 test.must_not_exist('f2.out')
84 test.must_not_exist('f3.out')
86 expect_stdout = """\
87 scons>>> Copy("f1.out", "f1.in")
88 Copy("f2.out", "f2.in")
89 Copy("f3.out", "f3.in")
90 scons>>> Touch("1")
91 scons>>> Removed f1.out
92 scons>>> Touch("2")
93 scons>>> Removed 1
94 Removed 2
95 Removed f2.out
96 Removed f3.out
97 scons>>> Touch("3")
98 scons>>>
99 """
101 test.finish(scons, stdout = expect_stdout)
105 test.pass_test()
107 # Local Variables:
108 # tab-width:4
109 # indent-tabs-mode:nil
110 # End:
111 # vim: set expandtab tabstop=4 shiftwidth=4: