[ci skip] Add note that this change may break SetOption() + ninja usage with fix
[scons.git] / test / Interactive / option-k.py
blob2a3251817f179c2e954a171265ded6ec951bc862
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 Verify that the -k option, specified on the build command, causes
28 us to keep going and build additional targets.
29 """
31 import TestSCons
33 test = TestSCons.TestSCons()
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 """)
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")
55 scons = test.start(arguments = '-Q --interactive', combine=1)
57 scons.send("build f1.out f2.out\n")
59 scons.send("build 1\n")
61 test.wait_for(test.workpath('1'), popen=scons)
63 test.must_not_exist(test.workpath('f1.out'))
64 test.must_not_exist(test.workpath('f2.out'))
68 scons.send("build -k f1.out f2.out\n")
70 scons.send("build 2\n")
72 test.wait_for(test.workpath('2'), popen=scons)
74 test.must_not_exist(test.workpath('f1.out'))
75 test.must_match(test.workpath('f2.out'), "f2.in\n")
79 scons.send("build f1.out f3.out\n")
81 scons.send("build 3\n")
83 test.wait_for(test.workpath('3'), popen=scons)
85 test.must_not_exist(test.workpath('f1.out'))
86 test.must_not_exist(test.workpath('f3.out'))
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>>>
104 test.finish(scons, stdout = expect_stdout)
108 test.pass_test()
110 # Local Variables:
111 # tab-width:4
112 # indent-tabs-mode:nil
113 # End:
114 # vim: set expandtab tabstop=4 shiftwidth=4: