Issue 2265: Add additional --taskmastertrace= messages in the Task class.
[scons.git] / test / option / d.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 """
28 Verify that the -d option is ignored.
29 """
30
31 import TestSCons
32
33 test = TestSCons.TestSCons()
34
35 test.write('SConstruct', "")
36
37 test.run(arguments = '-d .',
38          stderr = "Warning:  ignoring -d option\n")
39
40 test.pass_test()
41
42 #
43
44 test.subdir('subdir')
45
46 test.write('SConstruct', """
47 env = Environment()
48 env.Program(target = 'aaa', source = 'aaa.c')
49 env.Program(target = 'bbb', source = 'bbb.c')
50 SConscript('subdir/SConscript')
51 """)
52
53 test.write(['subdir', 'SConscript'], """
54 env = Environment()
55 env.Program(target = 'ccc', source = 'ccc.c')
56 env.Program(target = 'ddd', source = 'ddd.c')
57 """)
58
59 test.write('aaa.c', """
60 int
61 main(int argc, char *argv)
62 {
63         argv[argc++] = "--";
64         printf("aaa.c\n");
65         exit (0);
66 }
67 """)
68
69 test.write('bbb.c', """
70 int
71 main(int argc, char *argv)
72 {
73         argv[argc++] = "--";
74         printf("bbb.c\n");
75         exit (0);
76 }
77 """)
78
79 test.write(['subdir', 'ccc.c'], """
80 int
81 main(int argc, char *argv)
82 {
83         argv[argc++] = "--";
84         printf("subdir/ccc.c\n");
85         exit (0);
86 }
87 """)
88
89 test.write(['subdir', 'ddd.c'], """
90 int
91 main(int argc, char *argv)
92 {
93         argv[argc++] = "--";
94         printf("subdir/ddd.c\n");
95         exit (0);
96 }
97 """)
98
99 test.run(arguments = '-d .', stdout = """
100 Target aaa: aaa.o
101 Checking aaa
102   Checking aaa.o
103     Checking aaa.c
104   Rebuilding aaa.o: out of date.
105 cc -c -o aaa.o aaa.c
106 Rebuilding aaa: out of date.
107 cc -o aaa aaa.o
108 Target aaa.o: aaa.c
109 Target bbb: bbb.o
110 Checking bbb
111   Checking bbb.o
112     Checking bbb.c
113   Rebuilding bbb.o: out of date.
114 cc -c -o bbb.o bbb.c
115 Rebuilding bbb: out of date.
116 cc -o bbb bbb.o
117 Target bbb.o: bbb.c
118 Target subdir/ccc/g: subdir/ccc.o
119 Checking subdir/ccc/g
120   Checking subdir/ccc/g.o
121     Checking subdir/ccc/g.c
122   Rebuilding subdir/ccc/g.o: out of date.
123 cc -c -o subdir/ccc/g.o subdir/ccc.c
124 Rebuilding subdir/ccc/g: out of date.
125 cc -o subdir/ccc/g subdir/ccc.o
126 Target subdir/ccc/g.o: subdir/ccc.c
127 Target subdir/ddd/g: subdir/ddd.o
128 Checking subdir/ddd/g
129   Checking subdir/ddd/g.o
130     Checking subdir/ddd/g.c
131   Rebuilding subdir/ddd/g.o: out of date.
132 cc -c -o subdir/ddd/g.o subdir/ddd.c
133 Rebuilding subdir/ddd/g: out of date.
134 cc -o subdir/ddd/g subdir/ddd.o
135 Target subdir/ddd/g.o: subdir/ddd.c
136 """)
137
138 test.run(program = test.workpath('aaa'), stdout = "aaa.c\n")
139 test.run(program = test.workpath('bbb'), stdout = "bbb.c\n")
140 test.run(program = test.workpath('subdir/ccc'), stdout = "subdir/ccc.c\n")
141 test.run(program = test.workpath('subdir/ddd'), stdout = "subdir/ddd.c\n")
142
143 test.pass_test()
144