diff options
author | Steven Knight <knight@baldmt.com> | 2001-10-12 19:31:00 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-10-12 19:31:00 (GMT) |
commit | 2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f (patch) | |
tree | e7e49a06a892c365dd30ae49b8ec4ab4b08f32ab /test | |
parent | 0b9500662af3d026632d59da69020947fe844f30 (diff) | |
download | SCons-2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f.zip SCons-2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f.tar.gz SCons-2d4ea0988d82d1134cebd5bbc8a4f7a3fcbb8f2f.tar.bz2 |
Add tests and support for and .
Diffstat (limited to 'test')
-rw-r--r-- | test/CC.py | 42 | ||||
-rw-r--r-- | test/CCFLAGS.py | 14 |
2 files changed, 47 insertions, 9 deletions
@@ -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() diff --git a/test/CCFLAGS.py b/test/CCFLAGS.py index 12c93af..cc6ad73 100644 --- a/test/CCFLAGS.py +++ b/test/CCFLAGS.py @@ -28,13 +28,13 @@ 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') +foo.Object(target = 'foo.o', source = 'prog.c') +bar.Object(target = 'bar.o', source = 'prog.c') +foo.Program(target = 'foo', source = 'foo.o') +bar.Program(target = 'bar', source = 'bar.o') """) test.write('prog.c', """ @@ -53,9 +53,9 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'progfoo progbar') +test.run(arguments = 'foo bar') -test.run(program = test.workpath('progfoo'), stdout = "prog.c: FOO\n") -test.run(program = test.workpath('progbar'), stdout = "prog.c: BAR\n") +test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n") +test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") test.pass_test() |