diff options
author | Steven Knight <knight@baldmt.com> | 2002-06-15 04:53:49 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-06-15 04:53:49 (GMT) |
commit | 77d43537975b406379979d599894971bf4a225f2 (patch) | |
tree | 93c8e6987a60b53f5ca0e3bc986bdcb4208893f3 /test/SHF77.py | |
parent | cef5b7fa735eb4e405fab5f852df8e7d53c76954 (diff) | |
download | SCons-77d43537975b406379979d599894971bf4a225f2.zip SCons-77d43537975b406379979d599894971bf4a225f2.tar.gz SCons-77d43537975b406379979d599894971bf4a225f2.tar.bz2 |
Add LIBS and LIBPATH dependencies for shared libraries. (Charles Crain)
Diffstat (limited to 'test/SHF77.py')
-rw-r--r-- | test/SHF77.py | 83 |
1 files changed, 20 insertions, 63 deletions
diff --git a/test/SHF77.py b/test/SHF77.py index cffd94d..86f1087 100644 --- a/test/SHF77.py +++ b/test/SHF77.py @@ -32,9 +32,9 @@ import TestSCons python = sys.executable if sys.platform == 'win32': - _exe = '.exe' + _obj = '.obj' else: - _exe = '' + _obj = '.o' test = TestSCons.TestSCons() @@ -42,24 +42,6 @@ test = TestSCons.TestSCons() if sys.platform == 'win32': - test.write('mylink.py', r""" -import string -import sys -args = sys.argv[1:] -while args: - a = args[0] - if a[0] != '/': - break - args = args[1:] - if string.lower(a[:5]) == '/out:': out = a[5:] -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != '#link': - outfile.write(l) -sys.exit(0) -""") - test.write('myg77.py', r""" import sys args = sys.argv[1:] @@ -82,20 +64,6 @@ sys.exit(0) else: - test.write('mylink.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'o:') -for opt, arg in opts: - if opt == '-o': out = arg -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != '#link': - outfile.write(l) -sys.exit(0) -""") - test.write('myg77.py', r""" import getopt import sys @@ -113,59 +81,52 @@ sys.exit(0) test.write('SConstruct', """ -env = Environment(LINK = r'%s mylink.py', - SHF77 = r'%s myg77.py') -env.Program(target = 'test1', source = 'test1.f', shared = 1) -env.Program(target = 'test2', source = 'test2.for', shared = 1) -env.Program(target = 'test3', source = 'test3.FOR', shared = 1) -env.Program(target = 'test4', source = 'test4.F', shared = 1) -env.Program(target = 'test5', source = 'test5.fpp', shared = 1) -env.Program(target = 'test6', source = 'test6.FPP', shared = 1) -""" % (python, python)) +env = Environment(SHF77 = r'%s myg77.py') +env.SharedObject(target = 'test1', source = 'test1.f') +env.SharedObject(target = 'test2', source = 'test2.for') +env.SharedObject(target = 'test3', source = 'test3.FOR') +env.SharedObject(target = 'test4', source = 'test4.F') +env.SharedObject(target = 'test5', source = 'test5.fpp') +env.SharedObject(target = 'test6', source = 'test6.FPP') +""" % python) test.write('test1.f', r"""This is a .f file. #g77 -#link """) test.write('test2.for', r"""This is a .for file. #g77 -#link """) test.write('test3.FOR', r"""This is a .FOR file. #g77 -#link """) test.write('test4.F', r"""This is a .F file. #g77 -#link """) test.write('test5.fpp', r"""This is a .fpp file. #g77 -#link """) test.write('test6.FPP', r"""This is a .FPP file. #g77 -#link """) test.run(arguments = '.', stderr = None) -test.fail_test(test.read('test1' + _exe) != "This is a .f file.\n") +test.fail_test(test.read('test1' + _obj) != "This is a .f file.\n") -test.fail_test(test.read('test2' + _exe) != "This is a .for file.\n") +test.fail_test(test.read('test2' + _obj) != "This is a .for file.\n") -test.fail_test(test.read('test3' + _exe) != "This is a .FOR file.\n") +test.fail_test(test.read('test3' + _obj) != "This is a .FOR file.\n") -test.fail_test(test.read('test4' + _exe) != "This is a .F file.\n") +test.fail_test(test.read('test4' + _obj) != "This is a .F file.\n") -test.fail_test(test.read('test5' + _exe) != "This is a .fpp file.\n") +test.fail_test(test.read('test5' + _obj) != "This is a .fpp file.\n") -test.fail_test(test.read('test6' + _exe) != "This is a .FPP file.\n") +test.fail_test(test.read('test6' + _obj) != "This is a .FPP file.\n") @@ -185,8 +146,8 @@ os.system(string.join(sys.argv[1:], " ")) foo = Environment(LIBS = 'g2c') shf77 = foo.Dictionary('SHF77') bar = foo.Copy(SHF77 = r'%s wrapper.py ' + shf77) -foo.Program(target = 'foo', source = 'foo.f', shared = 1) -bar.Program(target = 'bar', source = 'bar.f', shared = 1) +foo.SharedObject(target = 'foo/foo', source = 'foo.f') +bar.SharedObject(target = 'bar/bar', source = 'bar.f') """ % python) test.write('foo.f', r""" @@ -204,15 +165,11 @@ bar.Program(target = 'bar', source = 'bar.f', shared = 1) """) - test.run(arguments = 'foo' + _exe, stderr = None) - - test.run(program = test.workpath('foo'), stdout = " foo.f\n") + test.run(arguments = 'foo', stderr = None) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) - test.run(arguments = 'bar' + _exe) - - test.run(program = test.workpath('bar'), stdout = " bar.f\n") + test.run(arguments = 'bar') test.fail_test(test.read('wrapper.out') != "wrapper.py\n") |