summaryrefslogtreecommitdiffstats
path: root/test/CCFLAGS.py
blob: 356fc84dc32f270601d321f4463e8a0041f55904 (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
#!/usr/bin/env python

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons

test = TestSCons.TestSCons()

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

test.write('SConstruct', """
foo = Environment(CCFLAGS = '-DFOO')
bar = Environment(CCFLAGS = '-DBAR')
foo.Program(target = 'progfoo', source = 'prog.c')
bar.Program(target = 'progbar', source = 'prog.c')
""")

test.write('prog.c', """
int
main(int argc, char *argv[])
{
	argv[argc++] = "--";
#ifdef FOO
	printf("prog.c:  FOO\n");
#endif
#ifdef BAR
	printf("prog.c:  BAR\n");
#endif
	exit (0);
}
""")


test.run(arguments = 'progfoo progbar')

test.run(program = test.workpath('progfoo'), stdout = "prog.c:  FOO\n")
test.run(program = test.workpath('progbar'), stdout = "prog.c:  BAR\n")

test.pass_test()