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