summaryrefslogtreecommitdiffstats
path: root/test/CC.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-10-12 19:31:00 (GMT)
committerSteven Knight <knight@baldmt.com>2001-10-12 19:31:00 (GMT)
commit2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f (patch)
treee7e49a06a892c365dd30ae49b8ec4ab4b08f32ab /test/CC.py
parent0b9500662af3d026632d59da69020947fe844f30 (diff)
downloadSCons-2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f.zip
SCons-2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f.tar.gz
SCons-2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f.tar.bz2
Add tests and support for and .
Diffstat (limited to 'test/CC.py')
-rw-r--r--test/CC.py42
1 files changed, 40 insertions, 2 deletions
diff --git a/test/CC.py b/test/CC.py
index dec523d..ce18047 100644
--- a/test/CC.py
+++ b/test/CC.py
@@ -24,15 +24,53 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
test = TestSCons.TestSCons()
-test.pass_test() #XXX Short-circuit until this is implemented.
+test.write("ccwrapper.py",
+"""import os
+import string
+import sys
+open('%s', 'w').write("ccwrapper.py\\n")
+os.system(string.join(["cc"] + sys.argv[1:], " "))
+""" % test.workpath('ccwrapper.out'))
test.write('SConstruct', """
+foo = Environment()
+bar = Environment(CC = 'python ccwrapper.py')
+foo.Program(target = 'foo', source = 'foo.c')
+bar.Program(target = 'bar', source = 'bar.c')
""")
-test.run(arguments = '.')
+test.write('foo.c', """
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+test.write('bar.c', """
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+
+test.run(arguments = 'foo')
+
+test.fail_test(os.path.exists(test.workpath('ccwrapper.out')))
+
+test.run(arguments = 'bar')
+
+test.fail_test(test.read('ccwrapper.out') != "ccwrapper.py\n")
test.pass_test()