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
|
#!/usr/bin/env python
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
import TestSCons
test = TestSCons.TestSCons()
test.pass_test() #XXX Short-circuit until this is implemented.
test.write('SConstruct', """
env = Environment()
Program(target = 'foo1', source = 'foo1.c')
Program(target = 'foo2', source = 'foo2.c')
Program(target = 'foo3', source = 'foo3.c')
""")
test.write('foo1.c', """
int
main(int argc, char *argv[])
{
argv[argc++] = "--";
printf("foo1.c\n");
exit (0);
}
""")
test.write('foo2.c', """
int
main(int argc, char *argv[])
{
argv[argc++] = "--";
printf("foo2.c\n");
exit (0);
}
""")
test.write('foo3.c', """
int
main(int argc, char *argv[])
{
argv[argc++] = "--";
printf("foo3.c\n");
exit (0);
}
""")
test.run(arguments = 'foo1 foo2 foo3')
test.run(program = test.workpath('foo1'), stdout = "foo1.c\n")
test.run(program = test.workpath('foo2'), stdout = "foo2.c\n")
test.run(program = test.workpath('foo3'), stdout = "foo3.c\n")
test.run(arguments = '-c foo1')
test.fail_test(os.path.exists(test.workpath('foo1')))
test.fail_test(not os.path.exists(test.workpath('foo2')))
test.fail_test(not os.path.exists(test.workpath('foo3')))
test.run(arguments = '--clean foo2')
test.fail_test(os.path.exists(test.workpath('foo1')))
test.fail_test(os.path.exists(test.workpath('foo2')))
test.fail_test(not os.path.exists(test.workpath('foo3')))
test.run(arguments = '--remove foo3')
test.fail_test(os.path.exists(test.workpath('foo1')))
test.fail_test(os.path.exists(test.workpath('foo2')))
test.fail_test(os.path.exists(test.workpath('foo3')))
test.run(arguments = 'foo1 foo2 foo3')
test.run(program = test.workpath('foo1'), stdout = "foo1.c\n")
test.run(program = test.workpath('foo2'), stdout = "foo2.c\n")
test.run(program = test.workpath('foo3'), stdout = "foo3.c\n")
test.run(arguments = '-c .')
test.fail_test(os.path.exists(test.workpath('foo1')))
test.fail_test(os.path.exists(test.workpath('foo2')))
test.fail_test(os.path.exists(test.workpath('foo3')))
test.pass_test()
|