Add emacs and vim editing settings to the bottom of *.py files.
[scons.git] / test / Interactive / option-k.py
1 #!/usr/bin/env python
2 #
3 # __COPYRIGHT__
4 #
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:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
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.
23 #
24 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
25
26 """
27 Verify that the -k option, specified on the build command, causes
28 us to keep going and build additional targets.
29 """
30
31 import TestSCons
32
33 test = TestSCons.TestSCons()
34
35 test.write('SConstruct', """\
36 def error(target, source, env):
37     return 1
38 e1 = Command('e1.out', 'e1.in', Action(error))
39 f1 = Command('f1.out', 'f1.in', Copy('$TARGET', '$SOURCE'))
40 Command('f2.out', 'f2.in', Copy('$TARGET', '$SOURCE'))
41 Command('f3.out', 'f3.in', Copy('$TARGET', '$SOURCE'))
42 Depends(f1, e1)
43 Command('1', [], Touch('$TARGET'))
44 Command('2', [], Touch('$TARGET'))
45 Command('3', [], Touch('$TARGET'))
46 """)
47
48 test.write('e1.in', "e1.in\n")
49 test.write('e2.in', "e2.in\n")
50 test.write('f1.in', "f1.in\n")
51 test.write('f2.in', "f2.in\n")
52
53
54
55 scons = test.start(arguments = '-Q --interactive', combine=1)
56
57 scons.send("build f1.out f2.out\n")
58
59 scons.send("build 1\n")
60
61 test.wait_for(test.workpath('1'), popen=scons)
62
63 test.must_not_exist(test.workpath('f1.out'))
64 test.must_not_exist(test.workpath('f2.out'))
65
66
67
68 scons.send("build -k f1.out f2.out\n")
69
70 scons.send("build 2\n")
71
72 test.wait_for(test.workpath('2'), popen=scons)
73
74 test.must_not_exist(test.workpath('f1.out'))
75 test.must_match(test.workpath('f2.out'), "f2.in\n")
76
77
78
79 scons.send("build f1.out f3.out\n")
80
81 scons.send("build 3\n")
82
83 test.wait_for(test.workpath('3'), popen=scons)
84
85 test.must_not_exist(test.workpath('f1.out'))
86 test.must_not_exist(test.workpath('f3.out'))
87
88
89
90 expect_stdout = """\
91 scons>>> error(["e1.out"], ["e1.in"])
92 scons: *** [e1.out] Error 1
93 scons>>> Touch("1")
94 scons>>> error(["e1.out"], ["e1.in"])
95 scons: *** [e1.out] Error 1
96 Copy("f2.out", "f2.in")
97 scons>>> Touch("2")
98 scons>>> error(["e1.out"], ["e1.in"])
99 scons: *** [e1.out] Error 1
100 scons>>> Touch("3")
101 scons>>> 
102 """
103
104 test.finish(scons, stdout = expect_stdout)
105
106
107
108 test.pass_test()
109
110 # Local Variables:
111 # tab-width:4
112 # indent-tabs-mode:nil
113 # End:
114 # vim: set expandtab tabstop=4 shiftwidth=4: