Add additional tests to provide more examples.
[scons.git] / test / option-i.py
1 #!/usr/bin/env python
2
3 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
4
5 import os.path
6 import TestSCons
7
8 test = TestSCons.TestSCons()
9
10 test.pass_test()        #XXX Short-circuit until this is supported.
11
12 test.write('succeed.py', r"""
13 import sys
14 file = open(sys.argv[1], 'w')
15 file.write("succeed.py: %s\n" % sys.argv[1])
16 file.close()
17 sys.exit(0)
18 """)
19
20 test.write('fail.py', r"""
21 import sys
22 sys.exit(1)
23 """)
24
25 test.write('SConstruct', """
26 Succeed = Builder(name = "Succeed", action = "python succeed.py %(target)s")
27 Fail = Builder(name = "Fail", action = "python fail.py %(target)s")
28 env = Environment(BUILDERS = [Succeed, Fail])
29 env.Fail(target = 'aaa.1', source = 'aaa.in')
30 env.Succeed(target = 'aaa.out', source = 'aaa.1')
31 env.Fail(target = 'bbb.1', source = 'bbb.in')
32 env.Succeed(target = 'bbb.out', source = 'bbb.1')
33 """)
34
35 test.run(arguments = '.')
36
37 test.fail_test(os.path.exists(test.workpath('aaa.1')))
38 test.fail_test(os.path.exists(test.workpath('aaa.out')))
39 test.fail_test(os.path.exists(test.workpath('bbb.1')))
40 test.fail_test(os.path.exists(test.workpath('bbb.out')))
41
42 test.run(arguments = '-i .')
43
44 test.fail_test(os.path.exists(test.workpath('aaa.1')))
45 test.fail_test(test.read('aaa.out') != "aaa.out\n")
46 test.fail_test(os.path.exists(test.workpath('bbb.1')))
47 test.fail_test(test.read('bbb.out') != "bbb.out\n")
48
49 test.unlink("aaa.out")
50 test.unlink("bbb.out")
51
52 test.run(arguments = '--ignore-errors .')
53
54 test.fail_test(os.path.exists(test.workpath('aaa.1')))
55 test.fail_test(test.read('aaa.out') != "aaa.out\n")
56 test.fail_test(os.path.exists(test.workpath('bbb.1')))
57 test.fail_test(test.read('bbb.out') != "bbb.out\n")
58
59 test.pass_test()
60