summaryrefslogtreecommitdiffstats
path: root/test/SHF77FLAGS.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-06-15 04:53:49 (GMT)
committerSteven Knight <knight@baldmt.com>2002-06-15 04:53:49 (GMT)
commit77d43537975b406379979d599894971bf4a225f2 (patch)
tree93c8e6987a60b53f5ca0e3bc986bdcb4208893f3 /test/SHF77FLAGS.py
parentcef5b7fa735eb4e405fab5f852df8e7d53c76954 (diff)
downloadSCons-77d43537975b406379979d599894971bf4a225f2.zip
SCons-77d43537975b406379979d599894971bf4a225f2.tar.gz
SCons-77d43537975b406379979d599894971bf4a225f2.tar.bz2
Add LIBS and LIBPATH dependencies for shared libraries. (Charles Crain)
Diffstat (limited to 'test/SHF77FLAGS.py')
-rw-r--r--test/SHF77FLAGS.py82
1 files changed, 18 insertions, 64 deletions
diff --git a/test/SHF77FLAGS.py b/test/SHF77FLAGS.py
index 231fea2..3034c3e 100644
--- a/test/SHF77FLAGS.py
+++ b/test/SHF77FLAGS.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,28 +42,8 @@ test = TestSCons.TestSCons()
if sys.platform == 'win32':
- _exe = '.exe'
-
o = ' -x /c'
- 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:]
@@ -91,24 +71,8 @@ sys.exit(0)
else:
- _exe = ''
-
o = ' -x -c'
- 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
@@ -131,57 +95,51 @@ sys.exit(0)
test.write('SConstruct', """
env = Environment(LINK = r'%s mylink.py',
SHF77 = r'%s myg77.py', SHF77FLAGS = '-x')
-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)
+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, 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) != "%s\nThis is a .f file.\n" % o)
+test.fail_test(test.read('test1' + _obj) != "%s\nThis is a .f file.\n" % o)
-test.fail_test(test.read('test2' + _exe) != "%s\nThis is a .for file.\n" % o)
+test.fail_test(test.read('test2' + _obj) != "%s\nThis is a .for file.\n" % o)
-test.fail_test(test.read('test3' + _exe) != "%s\nThis is a .FOR file.\n" % o)
+test.fail_test(test.read('test3' + _obj) != "%s\nThis is a .FOR file.\n" % o)
-test.fail_test(test.read('test4' + _exe) != "%s\nThis is a .F file.\n" % o)
+test.fail_test(test.read('test4' + _obj) != "%s\nThis is a .F file.\n" % o)
-test.fail_test(test.read('test5' + _exe) != "%s\nThis is a .fpp file.\n" % o)
+test.fail_test(test.read('test5' + _obj) != "%s\nThis is a .fpp file.\n" % o)
-test.fail_test(test.read('test6' + _exe) != "%s\nThis is a .FPP file.\n" % o)
+test.fail_test(test.read('test6' + _obj) != "%s\nThis is a .FPP file.\n" % o)
@@ -201,8 +159,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, SHF77FLAGS = '-Ix')
-foo.Program(target = 'foo', source = 'foo.f', shared = 1)
-bar.Program(target = 'bar', source = 'bar.f', shared = 1)
+foo.SharedLibrary(target = 'foo/foo', source = 'foo.f')
+bar.SharedLibrary(target = 'bar/bar', source = 'bar.f')
""" % python)
test.write('foo.f', r"""
@@ -220,15 +178,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")