summaryrefslogtreecommitdiffstats
path: root/test/option-d.py
blob: e5efcbc072430c728158a377899e37a2ede7b5fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env python

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons

test = TestSCons.TestSCons()

test.pass_test()	#XXX Short-circuit until this is supported.

test.subdir('subdir')

test.write('SConstruct', """
env = Environment()
env.Program(target = 'aaa', source = 'aaa.c')
env.Program(target = 'bbb', source = 'bbb.c')
SConscript('subdir/SConscript')
""")

test.write(['subdir', 'SConscript'], """
env = Environment()
env.Program(target = 'ccc', source = 'ccc.c')
env.Program(target = 'ddd', source = 'ddd.c')
""")

test.write('aaa.c', """
int
main(int argc, char *argv)
{
	argv[argc++] = "--";
	printf("aaa.c\n");
	exit (0);
}
""")

test.write('bbb.c', """
int
main(int argc, char *argv)
{
	argv[argc++] = "--";
	printf("bbb.c\n");
	exit (0);
}
""")

test.write(['subdir', 'ccc.c'], """
int
main(int argc, char *argv)
{
	argv[argc++] = "--";
	printf("subdir/ccc.c\n");
	exit (0);
}
""")

test.write(['subdir', 'ddd.c'], """
int
main(int argc, char *argv)
{
	argv[argc++] = "--";
	printf("subdir/ddd.c\n");
	exit (0);
}
""")

test.run(arguments = '-d .', stdout = """
Target aaa: aaa.o
Checking aaa
  Checking aaa.o
    Checking aaa.c
  Rebuilding aaa.o: out of date.
cc -c -o aaa.o aaa.c
Rebuilding aaa: out of date.
cc -o aaa aaa.o
Target aaa.o: aaa.c
Target bbb: bbb.o
Checking bbb
  Checking bbb.o
    Checking bbb.c
  Rebuilding bbb.o: out of date.
cc -c -o bbb.o bbb.c
Rebuilding bbb: out of date.
cc -o bbb bbb.o
Target bbb.o: bbb.c
Target subdir/ccc/g: subdir/ccc.o
Checking subdir/ccc/g
  Checking subdir/ccc/g.o
    Checking subdir/ccc/g.c
  Rebuilding subdir/ccc/g.o: out of date.
cc -c -o subdir/ccc/g.o subdir/ccc.c
Rebuilding subdir/ccc/g: out of date.
cc -o subdir/ccc/g subdir/ccc.o
Target subdir/ccc/g.o: subdir/ccc.c
Target subdir/ddd/g: subdir/ddd.o
Checking subdir/ddd/g
  Checking subdir/ddd/g.o
    Checking subdir/ddd/g.c
  Rebuilding subdir/ddd/g.o: out of date.
cc -c -o subdir/ddd/g.o subdir/ddd.c
Rebuilding subdir/ddd/g: out of date.
cc -o subdir/ddd/g subdir/ddd.o
Target subdir/ddd/g.o: subdir/ddd.c
""")

test.run(program = test.workpath('aaa'), stdout = "aaa.c\n")
test.run(program = test.workpath('bbb'), stdout = "bbb.c\n")
test.run(program = test.workpath('subdir/ccc'), stdout = "subdir/ccc.c\n")
test.run(program = test.workpath('subdir/ddd'), stdout = "subdir/ddd.c\n")

test.pass_test()