5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 Verify that setting exitstatfunc on an Action works as advertised.
32 test
= TestSCons
.TestSCons()
34 test
.write('SConstruct', """\
35 DefaultEnvironment(tools=[])
36 def always_succeed(s):
37 # Always return 0, which indicates success.
40 def copy_fail(target, source, env):
41 with open(str(source[0]), 'rb') as infp, open(str(target[0]), 'wb') as f:
45 a = Action(copy_fail, exitstatfunc=always_succeed)
46 Alias('test1', Command('test1.out', 'test1.in', a))
48 def fail(target, source, env):
51 t2 = Command('test2.out', 'test2.in', Copy('$TARGET', '$SOURCE'))
52 AddPostAction(t2, Action(fail, exitstatfunc=always_succeed))
56 test
.write('test1.in', "test1.in\n")
57 test
.write('test2.in', "test2.in\n")
59 test
.run(arguments
= 'test1')
61 test
.must_match('test1.out', "test1.in\n")
63 test
.run(arguments
= 'test2')
65 test
.must_match('test2.out', "test2.in\n")
71 # indent-tabs-mode:nil
73 # vim: set expandtab tabstop=4 shiftwidth=4: