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.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
31 _python_ = TestSCons._python_
33 test = TestSCons.TestSCons()
35 test.write('succeed.py', r"""
37 file = open(sys.argv[1], 'wb')
38 file.write("succeed.py: %s\n" % sys.argv[1])
43 test.write('fail.py', r"""
48 test.write('SConstruct', """
49 Succeed = Builder(action = r'%(_python_)s succeed.py $TARGETS')
50 Fail = Builder(action = r'%(_python_)s fail.py $TARGETS')
51 env = Environment(BUILDERS = { 'Succeed' : Succeed, 'Fail' : Fail })
52 env.Fail(target = 'aaa.1', source = 'aaa.in')
53 env.Succeed(target = 'aaa.out', source = 'aaa.1')
54 env.Fail(target = 'bbb.1', source = 'bbb.in')
55 env.Succeed(target = 'bbb.out', source = 'bbb.1')
58 test.write('aaa.in', "aaa.in\n")
59 test.write('bbb.in', "bbb.in\n")
61 test.run(arguments = 'aaa.1 aaa.out bbb.1 bbb.out',
62 stderr = 'scons: *** [aaa.1] Error 1\n',
65 test.fail_test(os.path.exists(test.workpath('aaa.1')))
66 test.fail_test(os.path.exists(test.workpath('aaa.out')))
67 test.fail_test(os.path.exists(test.workpath('bbb.1')))
68 test.fail_test(os.path.exists(test.workpath('bbb.out')))
70 test.run(arguments = '-i aaa.1 aaa.out bbb.1 bbb.out',
72 'scons: *** [aaa.1] Error 1\n'
73 'scons: *** [bbb.1] Error 1\n')
75 test.fail_test(os.path.exists(test.workpath('aaa.1')))
76 test.fail_test(test.read('aaa.out') != "succeed.py: aaa.out\n")
77 test.fail_test(os.path.exists(test.workpath('bbb.1')))
78 test.fail_test(test.read('bbb.out') != "succeed.py: bbb.out\n")
80 test.unlink("aaa.out")
81 test.unlink("bbb.out")
83 test.run(arguments = '--ignore-errors aaa.1 aaa.out bbb.1 bbb.out',
85 'scons: *** [aaa.1] Error 1\n'
86 'scons: *** [bbb.1] Error 1\n')
88 test.fail_test(os.path.exists(test.workpath('aaa.1')))
89 test.fail_test(test.read('aaa.out') != "succeed.py: aaa.out\n")
90 test.fail_test(os.path.exists(test.workpath('bbb.1')))
91 test.fail_test(test.read('bbb.out') != "succeed.py: bbb.out\n")
98 # indent-tabs-mode:nil
100 # vim: set expandtab tabstop=4 shiftwidth=4: