[ci skip] update generated files
[scons.git] / test / Interactive / option-i.py
blob2ea1f04bfb865408c9d8b8b107ecf7e34754340f
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 -i option, specified on the build command, causes
28 build errors to be ignored, just for that command.
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 e2 = Command('e2.out', 'e2.in', Action(error))
40 f1 = Command('f1.out', 'f1.in', Copy('$TARGET', '$SOURCE'))
41 f2 = Command('f2.out', 'f2.in', Copy('$TARGET', '$SOURCE'))
42 Depends(f1, e1)
43 Depends(f2, e2)
44 Command('1', [], Touch('$TARGET'))
45 Command('2', [], Touch('$TARGET'))
46 Command('3', [], Touch('$TARGET'))
47 """)
49 test.write('e1.in', "e1.in\n")
50 test.write('e2.in', "e2.in\n")
51 test.write('f1.in', "f1.in\n")
52 test.write('f2.in', "f2.in\n")
56 scons = test.start(arguments = '-Q --interactive', combine=1)
58 scons.send("build f1.out\n")
60 scons.send("build 1\n")
62 test.wait_for(test.workpath('1'), popen=scons)
64 test.must_not_exist(test.workpath('f1.out'))
68 scons.send("build -i e1.out f1.out\n")
70 scons.send("build 2\n")
72 test.wait_for(test.workpath('2'), popen=scons)
74 test.must_match(test.workpath('f1.out'), "f1.in\n")
78 scons.send("build f2.out\n")
80 scons.send("build 3\n")
82 test.wait_for(test.workpath('3'), popen=scons)
84 test.must_not_exist(test.workpath('f2.out'))
88 expect_stdout = """\
89 scons>>> error(["e1.out"], ["e1.in"])
90 scons: *** [e1.out] Error 1
91 scons>>> Touch("1")
92 scons>>> error(["e1.out"], ["e1.in"])
93 scons: *** [e1.out] Error 1
94 Copy("f1.out", "f1.in")
95 scons>>> Touch("2")
96 scons>>> error(["e2.out"], ["e2.in"])
97 scons: *** [e2.out] Error 1
98 scons>>> Touch("3")
99 scons>>>
102 test.finish(scons, stdout = expect_stdout)
106 test.pass_test()
108 # Local Variables:
109 # tab-width:4
110 # indent-tabs-mode:nil
111 # End:
112 # vim: set expandtab tabstop=4 shiftwidth=4: