Remove the recently-removed _scons_sets15.py from MANIFEST.in.
[scons.git] / test / option-i.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
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26
27 import os.path
28
29 import TestSCons
30
31 _python_ = TestSCons._python_
32
33 test = TestSCons.TestSCons()
34
35 test.write('succeed.py', r"""
36 import sys
37 file = open(sys.argv[1], 'wb')
38 file.write("succeed.py: %s\n" % sys.argv[1])
39 file.close()
40 sys.exit(0)
41 """)
42
43 test.write('fail.py', r"""
44 import sys
45 sys.exit(1)
46 """)
47
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')
56 """ % locals())
57
58 test.write('aaa.in', "aaa.in\n")
59 test.write('bbb.in', "bbb.in\n")
60
61 test.run(arguments = 'aaa.1 aaa.out bbb.1 bbb.out',
62          stderr = 'scons: *** [aaa.1] Error 1\n',
63          status = 2)
64
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')))
69
70 test.run(arguments = '-i aaa.1 aaa.out bbb.1 bbb.out',
71          stderr =
72          'scons: *** [aaa.1] Error 1\n'
73          'scons: *** [bbb.1] Error 1\n')
74          
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")
79
80 test.unlink("aaa.out")
81 test.unlink("bbb.out")
82
83 test.run(arguments = '--ignore-errors aaa.1 aaa.out bbb.1 bbb.out',
84          stderr =
85          'scons: *** [aaa.1] Error 1\n'
86          'scons: *** [bbb.1] Error 1\n')
87
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")
92
93 test.pass_test()
94  
95
96 # Local Variables:
97 # tab-width:4
98 # indent-tabs-mode:nil
99 # End:
100 # vim: set expandtab tabstop=4 shiftwidth=4: