diff options
author | Steven Knight <knight@baldmt.com> | 2002-07-10 22:39:00 +0000 |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-07-10 22:39:00 +0000 |
commit | f98a2dabc8603592c74f02674a8dc551533382b6 (patch) | |
tree | 343c9712c76d4e3d5de04ae50a92d65abe2be90e /test/CPPFLAGS.py | |
parent | 3de3284918acb0add37b818400c1a7309a3316ff (diff) | |
download | scons-f98a2dabc8603592c74f02674a8dc551533382b6.tar.gz |
Allow build directories outside the SConstruct tree; add a FindFile() function to search for files with a specified name; add to the shared-object g++ and gcc command lines. (Charles Crain)
Diffstat (limited to 'test/CPPFLAGS.py')
-rw-r--r-- | test/CPPFLAGS.py | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/test/CPPFLAGS.py b/test/CPPFLAGS.py index 9c0295c4..7b272331 100644 --- a/test/CPPFLAGS.py +++ b/test/CPPFLAGS.py @@ -74,7 +74,7 @@ else: import getopt import os import sys -opts, args = getopt.getopt(sys.argv[1:], 'o:') +opts, args = getopt.getopt(sys.argv[1:], 'o:s:') for opt, arg in opts: if opt == '-o': out = arg outfile = open(out, 'wb') @@ -92,7 +92,7 @@ import os import sys compiler = sys.argv[1] clen = len(compiler) + 1 -opts, args = getopt.getopt(sys.argv[2:], 'co:x') +opts, args = getopt.getopt(sys.argv[2:], 'co:xf:') for opt, arg in opts: if opt == '-o': out = arg elif opt == '-x': open('mygcc.out', 'ab').write(compiler + "\n") @@ -140,4 +140,43 @@ test.fail_test(test.read('foo' + _exe) != "test1.c\ntest2.cpp\ntest3.F\n") test.fail_test(test.read('mygcc.out') != "cc\nc++\ng77\n") +test.write('SConstruct', """ +env = Environment(CPPFLAGS = '-x', + SHLINK = r'%s mylink.py', + CC = r'%s mygcc.py cc', + CXX = r'%s mygcc.py c++', + F77 = r'%s mygcc.py g77') +env.SharedLibrary(target = File('foo.bar'), + source = Split('test1.c test2.cpp test3.F')) +""" % (python, python, python, python)) + +test.write('test1.c', r"""test1.c +#cc +#link +""") + +test.write('test2.cpp', r"""test2.cpp +#c++ +#link +""") + +test.write('test3.F', r"""test3.F +#g77 +#link +""") + +test.unlink('mygcc.out') + +test.run(arguments = '.', stderr = None) + +test.fail_test(test.read('test1' + _obj) != "test1.c\n#link\n") + +test.fail_test(test.read('test2' + _obj) != "test2.cpp\n#link\n") + +test.fail_test(test.read('test3' + _obj) != "test3.F\n#link\n") + +test.fail_test(test.read('foo.bar') != "test1.c\ntest2.cpp\ntest3.F\n") + +test.fail_test(test.read('mygcc.out') != "cc\nc++\ng77\n") + test.pass_test() |