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 | |
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')
-rw-r--r-- | test/LIBPATH.py | 32 | ||||
-rw-r--r-- | test/SHCC.py | 13 | ||||
-rw-r--r-- | test/SHCCFLAGS.py | 81 | ||||
-rw-r--r-- | test/SHCXX.py | 13 | ||||
-rw-r--r-- | test/SHCXXFLAGS.py | 88 | ||||
-rw-r--r-- | test/SHF77.py | 83 | ||||
-rw-r--r-- | test/SHF77FLAGS.py | 82 | ||||
-rw-r--r-- | test/SHLIBPREFIX.py | 2 | ||||
-rw-r--r-- | test/SHLIBSUFFIX.py | 2 | ||||
-rw-r--r-- | test/SHLINK.py | 4 | ||||
-rw-r--r-- | test/SHLINKFLAGS.py | 4 | ||||
-rw-r--r-- | test/SharedLibrary.py | 24 | ||||
-rw-r--r-- | test/long-lines.py | 4 |
13 files changed, 217 insertions, 215 deletions
diff --git a/test/LIBPATH.py b/test/LIBPATH.py index d0bb065..0176c07 100644 --- a/test/LIBPATH.py +++ b/test/LIBPATH.py @@ -31,29 +31,32 @@ import time if sys.platform == 'win32': _exe = '.exe' + _dll = '.dll' + lib_ = '' else: _exe = '' + _dll = '.so' + lib_ = 'lib' test = TestSCons.TestSCons() test.subdir('lib1', 'lib2') prog1 = test.workpath('prog') + _exe -prog2 = test.workpath('prog2') + _exe +prog2 = test.workpath(lib_ + 'shlib') + _dll test.write('SConstruct', """ env1 = Environment(LIBS = [ 'foo1' ], LIBPATH = [ './lib1' ]) -prog = env1.Object('prog', 'prog.c') f1 = env1.Object('f1', 'f1.c') -env1.Program(target = 'prog', source = prog) +env1.Program(target = 'prog', source = 'prog.c') env1.Library(target = './lib1/foo1', source = f1) env2 = Environment(LIBS = 'foo2', LIBPATH = '.') -env2.Program(target = 'prog2', source = prog) +env2.SharedLibrary(target = 'shlib', source = 'shlib.c') env2.Library(target = 'foo2', source = f1) """) @@ -65,6 +68,15 @@ f1(void) } """) +test.write('shlib.c', r""" +void f1(void); +int +test() +{ + f1(); +} +""") + test.write('prog.c', r""" void f1(void); int @@ -81,8 +93,6 @@ test.run(arguments = '.') test.run(program = prog1, stdout = "f1.c\nprog.c\n") -test.run(program = prog2, - stdout = "f1.c\nprog.c\n") oldtime1 = os.path.getmtime(prog1) oldtime2 = os.path.getmtime(prog2) @@ -103,23 +113,21 @@ f1(void) test.run(arguments = '.') test.run(program = prog1, stdout = "f1.c 1\nprog.c\n") -test.run(program = prog2, - stdout = "f1.c 1\nprog.c\n") +test.fail_test(oldtime2 == os.path.getmtime(prog2)) #test.up_to_date(arguments = '.') # Change LIBPATH and make sure we don't rebuild because of it. test.write('SConstruct', """ env1 = Environment(LIBS = [ 'foo1' ], LIBPATH = [ './lib1', './lib2' ]) -prog = env1.Object('prog', 'prog.c') f1 = env1.Object('f1', 'f1.c') -env1.Program(target = 'prog', source = prog) +env1.Program(target = 'prog', source = 'prog.c') env1.Library(target = './lib1/foo1', source = f1) env2 = Environment(LIBS = 'foo2', LIBPATH = Split('. ./lib2')) -env2.Program(target = 'prog2', source = prog) +env2.SharedLibrary(target = 'shlib', source = 'shlib.c') env2.Library(target = 'foo2', source = f1) """) @@ -136,8 +144,6 @@ f1(void) test.run(arguments = '.') test.run(program = prog1, stdout = "f1.c 2\nprog.c\n") -test.run(program = prog2, - stdout = "f1.c 2\nprog.c\n") test.up_to_date(arguments = '.') diff --git a/test/SHCC.py b/test/SHCC.py index 1313272..1d01663 100644 --- a/test/SHCC.py +++ b/test/SHCC.py @@ -31,11 +31,6 @@ import TestSCons python = sys.executable -if sys.platform == 'win32': - _exe = '.exe' -else: - _exe = '' - test = TestSCons.TestSCons() test.write("wrapper.py", @@ -50,8 +45,8 @@ test.write('SConstruct', """ foo = Environment() shcc = foo.Dictionary('SHCC') bar = Environment(SHCC = r'%s wrapper.py ' + shcc) -foo.Program(target = 'foo', source = 'foo.c', shared = 1) -bar.Program(target = 'bar', source = 'bar.c', shared = 1) +foo.SharedObject(target = 'foo/foo', source = 'foo.c') +bar.SharedObject(target = 'bar/bar', source = 'bar.c') """ % python) test.write('foo.c', r""" @@ -75,11 +70,11 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'foo' + _exe) +test.run(arguments = 'foo') test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'bar' + _exe) +test.run(arguments = 'bar') test.fail_test(test.read('wrapper.out') != "wrapper.py\n") diff --git a/test/SHCCFLAGS.py b/test/SHCCFLAGS.py index fc881a3..8b5a984 100644 --- a/test/SHCCFLAGS.py +++ b/test/SHCCFLAGS.py @@ -26,6 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import sys import TestSCons +import os if sys.platform == 'win32': _obj = '.obj' @@ -35,50 +36,92 @@ else: _obj = '.o' fooflags = '-DFOO' barflags = '-DBAR' + +if os.name == 'posix': + os.environ['LD_LIBRARY_PATH'] = '.' test = TestSCons.TestSCons() test.write('SConstruct', """ -foo = Environment(SHCCFLAGS = '%s') -bar = Environment(SHCCFLAGS = '%s') -foo.Object(target = 'foo%s', source = 'prog.c', shared = 1) -bar.Object(target = 'bar%s', source = 'prog.c', shared = 1) -foo.Program(target = 'foo', source = 'foo%s', shared = 1) -bar.Program(target = 'bar', source = 'bar%s', shared = 1) +foo = Environment(SHCCFLAGS = '%s', WIN32_INSERT_DEF=1) +bar = Environment(SHCCFLAGS = '%s', WIN32_INSERT_DEF=1) +foo.SharedObject(target = 'foo%s', source = 'prog.c') +bar.SharedObject(target = 'bar%s', source = 'prog.c') +foo.SharedLibrary(target = 'foo', source = 'foo%s') +bar.SharedLibrary(target = 'bar', source = 'bar%s') + +fooMain = foo.Copy(LIBS='foo', LIBPATH='.') +foo_obj = fooMain.Object(target='foomain', source='main.c') +fooMain.Program(target='fooprog', source=foo_obj) + +barMain = bar.Copy(LIBS='bar', LIBPATH='.') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=bar_obj) """ % (fooflags, barflags, _obj, _obj, _obj, _obj)) +test.write('foo.def', r""" +LIBRARY "foo" +DESCRIPTION "Foo Shared Library" + +EXPORTS + doIt +""") + +test.write('bar.def', r""" +LIBRARY "foo" +DESCRIPTION "Foo Shared Library" + +EXPORTS + doIt +""") + test.write('prog.c', r""" -int -main(int argc, char *argv[]) +void +doIt() { - argv[argc++] = "--"; #ifdef FOO printf("prog.c: FOO\n"); #endif #ifdef BAR printf("prog.c: BAR\n"); #endif - exit (0); } """) +test.write('main.c', r""" + +void doIt(); + +int +main(int argc, char* argv[]) +{ + doIt(); + return 0; +} +""") test.run(arguments = '.') -test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n") -test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") +test.run(program = test.workpath('fooprog'), stdout = "prog.c: FOO\n") +test.run(program = test.workpath('barprog'), stdout = "prog.c: BAR\n") test.write('SConstruct', """ -bar = Environment(SHCCFLAGS = '%s') -bar.Object(target = 'foo%s', source = 'prog.c', shared = 1) -bar.Object(target = 'bar%s', source = 'prog.c', shared = 1) -bar.Program(target = 'foo', source = 'foo%s', shared = 1) -bar.Program(target = 'bar', source = 'bar%s', shared = 1) +bar = Environment(SHCCFLAGS = '%s', WIN32_INSERT_DEF=1) +bar.SharedObject(target = 'foo%s', source = 'prog.c') +bar.SharedObject(target = 'bar%s', source = 'prog.c') +bar.SharedLibrary(target = 'foo', source = 'foo%s') +bar.SharedLibrary(target = 'bar', source = 'bar%s') + +barMain = bar.Copy(LIBS='bar', LIBPATH='.') +foo_obj = barMain.Object(target='foomain', source='main.c') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=foo_obj) +barMain.Program(target='fooprog', source=bar_obj) """ % (barflags, _obj, _obj, _obj, _obj)) test.run(arguments = '.') -test.run(program = test.workpath('foo'), stdout = "prog.c: BAR\n") -test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") +test.run(program = test.workpath('fooprog'), stdout = "prog.c: BAR\n") +test.run(program = test.workpath('barprog'), stdout = "prog.c: BAR\n") test.pass_test() diff --git a/test/SHCXX.py b/test/SHCXX.py index 5825491..e8fb2b3 100644 --- a/test/SHCXX.py +++ b/test/SHCXX.py @@ -31,11 +31,6 @@ import TestSCons python = sys.executable -if sys.platform == 'win32': - _exe = '.exe' -else: - _exe = '' - test = TestSCons.TestSCons() test.write("wrapper.py", @@ -50,8 +45,8 @@ test.write('SConstruct', """ foo = Environment() shcxx = foo.Dictionary('SHCXX') bar = Environment(SHCXX = r'%s wrapper.py ' + shcxx) -foo.Program(target = 'foo', source = 'foo.cpp', shared = 1) -bar.Program(target = 'bar', source = 'bar.cpp', shared = 1) +foo.SharedObject(target = 'foo/foo', source = 'foo.cpp') +bar.SharedObject(target = 'bar/bar', source = 'bar.cpp') """ % python) test.write('foo.cpp', r""" @@ -79,11 +74,11 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'foo' + _exe) +test.run(arguments = 'foo') test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'bar' + _exe) +test.run(arguments = 'bar') test.fail_test(test.read('wrapper.out') != "wrapper.py\n") diff --git a/test/SHCXXFLAGS.py b/test/SHCXXFLAGS.py index 5623795..def3391 100644 --- a/test/SHCXXFLAGS.py +++ b/test/SHCXXFLAGS.py @@ -1,4 +1,3 @@ - #!/usr/bin/env python # # Copyright (c) 2001, 2002 Steven Knight @@ -27,6 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import sys import TestSCons +import os if sys.platform == 'win32': _obj = '.obj' @@ -36,52 +36,94 @@ else: _obj = '.o' fooflags = '-DFOO' barflags = '-DBAR' + +if os.name == 'posix': + os.environ['LD_LIBRARY_PATH'] = '.' test = TestSCons.TestSCons() test.write('SConstruct', """ -foo = Environment(SHCXXFLAGS = '%s') -bar = Environment(SHCXXFLAGS = '%s') -foo.Object(target = 'foo%s', source = 'prog.cpp', shared = 1) -bar.Object(target = 'bar%s', source = 'prog.cpp', shared = 1) -foo.Program(target = 'foo', source = 'foo%s', shared = 1) -bar.Program(target = 'bar', source = 'bar%s', shared = 1) +foo = Environment(SHCXXFLAGS = '%s', WIN32_INSERT_DEF=1) +bar = Environment(SHCXXFLAGS = '%s', WIN32_INSERT_DEF=1) +foo.SharedObject(target = 'foo%s', source = 'prog.cpp') +bar.SharedObject(target = 'bar%s', source = 'prog.cpp') +foo.SharedLibrary(target = 'foo', source = 'foo%s') +bar.SharedLibrary(target = 'bar', source = 'bar%s') + +fooMain = foo.Copy(LIBS='foo', LIBPATH='.') +foo_obj = fooMain.Object(target='foomain', source='main.c') +fooMain.Program(target='fooprog', source=foo_obj) + +barMain = bar.Copy(LIBS='bar', LIBPATH='.') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=bar_obj) """ % (fooflags, barflags, _obj, _obj, _obj, _obj)) +test.write('foo.def', r""" +LIBRARY "foo" +DESCRIPTION "Foo Shared Library" + +EXPORTS + doIt +""") + +test.write('bar.def', r""" +LIBRARY "foo" +DESCRIPTION "Foo Shared Library" + +EXPORTS + doIt +""") + test.write('prog.cpp', r""" #include <stdio.h> -#include <stdlib.h> -int -main(int argc, char *argv[]) + +extern "C" void +doIt() { - argv[argc++] = "--"; #ifdef FOO - printf("prog.c: FOO\n"); + printf("prog.cpp: FOO\n"); #endif #ifdef BAR - printf("prog.c: BAR\n"); + printf("prog.cpp: BAR\n"); #endif - exit (0); } """) +test.write('main.c', r""" + +void doIt(); + +int +main(int argc, char* argv[]) +{ + doIt(); + return 0; +} +""") test.run(arguments = '.') -test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n") -test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") +test.run(program = test.workpath('fooprog'), stdout = "prog.cpp: FOO\n") +test.run(program = test.workpath('barprog'), stdout = "prog.cpp: BAR\n") test.write('SConstruct', """ -bar = Environment(SHCXXFLAGS = '%s') -bar.Object(target = 'foo%s', source = 'prog.cpp', shared = 1) -bar.Object(target = 'bar%s', source = 'prog.cpp', shared = 1) -bar.Program(target = 'foo', source = 'foo%s', shared = 1) -bar.Program(target = 'bar', source = 'bar%s', shared = 1) +bar = Environment(SHCXXFLAGS = '%s', WIN32_INSERT_DEF=1) +bar.SharedObject(target = 'foo%s', source = 'prog.cpp') +bar.SharedObject(target = 'bar%s', source = 'prog.cpp') +bar.SharedLibrary(target = 'foo', source = 'foo%s') +bar.SharedLibrary(target = 'bar', source = 'bar%s') + +barMain = bar.Copy(LIBS='bar', LIBPATH='.') +foo_obj = barMain.Object(target='foomain', source='main.c') +bar_obj = barMain.Object(target='barmain', source='main.c') +barMain.Program(target='barprog', source=foo_obj) +barMain.Program(target='fooprog', source=bar_obj) """ % (barflags, _obj, _obj, _obj, _obj)) test.run(arguments = '.') -test.run(program = test.workpath('foo'), stdout = "prog.c: BAR\n") -test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") +test.run(program = test.workpath('fooprog'), stdout = "prog.cpp: BAR\n") +test.run(program = test.workpath('barprog'), stdout = "prog.cpp: BAR\n") test.pass_test() 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") 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") diff --git a/test/SHLIBPREFIX.py b/test/SHLIBPREFIX.py index 30b422e..5325846 100644 --- a/test/SHLIBPREFIX.py +++ b/test/SHLIBPREFIX.py @@ -37,7 +37,7 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ env = Environment(SHLIBPREFIX = 'shlib-') -env.Library(target = 'foo', source = 'foo.c', shared = 1) +env.SharedLibrary(target = 'foo', source = 'foo.c') """) test.write('foo.c', r""" diff --git a/test/SHLIBSUFFIX.py b/test/SHLIBSUFFIX.py index e626e7c..abb92b0 100644 --- a/test/SHLIBSUFFIX.py +++ b/test/SHLIBSUFFIX.py @@ -37,7 +37,7 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ env = Environment(SHLIBSUFFIX = '.shlib') -env.Library (target = 'foo', source = 'foo.c', shared = 1) +env.SharedLibrary(target = 'foo', source = 'foo.c') """) test.write('foo.c', r""" diff --git a/test/SHLINK.py b/test/SHLINK.py index 4d28e04..2812afd 100644 --- a/test/SHLINK.py +++ b/test/SHLINK.py @@ -52,8 +52,8 @@ test.write('SConstruct', """ foo = Environment() shlink = foo.Dictionary('SHLINK') bar = Environment(SHLINK = r'%s wrapper.py ' + shlink) -foo.Library(target = 'foo', source = 'foo.c', shared = 1) -bar.Library(target = 'bar', source = 'bar.c', shared = 1) +foo.SharedLibrary(target = 'foo', source = 'foo.c') +bar.SharedLibrary(target = 'bar', source = 'bar.c') """ % python) test.write('foo.c', r""" diff --git a/test/SHLINKFLAGS.py b/test/SHLINKFLAGS.py index 6494ad5..2b4d60a 100644 --- a/test/SHLINKFLAGS.py +++ b/test/SHLINKFLAGS.py @@ -54,8 +54,8 @@ shlink = foo.Dictionary('SHLINK') shlinkflags = foo.Dictionary('SHLINKFLAGS') bar = Environment(SHLINK = '', SHLINKFLAGS = r'%s wrapper.py ' + shlink + ' ' + shlinkflags) -foo.Library(target = 'foo', source = 'foo.c', shared = 1) -bar.Library(target = 'bar', source = 'bar.c', shared = 1) +foo.SharedLibrary(target = 'foo', source = 'foo.c') +bar.SharedLibrary(target = 'bar', source = 'bar.c') """ % python) test.write('foo.c', r""" diff --git a/test/SharedLibrary.py b/test/SharedLibrary.py index dfe05af..56738c7 100644 --- a/test/SharedLibrary.py +++ b/test/SharedLibrary.py @@ -34,16 +34,22 @@ test.write('SConstruct', """ env=Environment(WIN32_INSERT_DEF=1) env2 = Environment(LIBS = [ 'foo1', 'foo2', 'foo3' ], LIBPATH = [ '.' ]) -env.Library(target = 'foo1', source = 'f1.c', shared=1) -env.Library(target = 'foo2', source = Split('f2a.c f2b.c f2c.c'), shared=1) -env.Library(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'], shared=1) +env.SharedLibrary(target = 'foo1', source = 'f1.c') +env.SharedLibrary(target = 'foo2', source = Split('f2a.c f2b.c f2c.c')) +env.SharedLibrary(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c']) env2.Program(target = 'prog', source = 'prog.c') """) test.write('SConstructFoo', """ env=Environment() -obj = env.Object('foo', 'foo.c', shared=0) -Default(env.Library(target = 'foo', source = obj, shared=1)) +obj = env.Object('foo', 'foo.c') +Default(env.SharedLibrary(target = 'foo', source = obj)) +""") + +test.write('SConstructFoo2', """ +env=Environment() +obj = env.SharedObject('foo', 'foo.c') +Default(env.Library(target = 'foo', source = obj)) """) test.write('foo.c', r""" @@ -182,8 +188,12 @@ test.run(program = test.workpath('prog'), stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.c\nprog.c\n") test.run(arguments = '-f SConstructFoo', status=2, stderr=''' -SCons error: Source file: foo\..* must be built with shared=1 in order to be compatible with target: .* -File ".*", line .*, in .* +SCons error: Source file: foo\..* is static and is not compatible with shared target: .* +''' +) + +test.run(arguments = '-f SConstructFoo2', status=2, stderr=''' +SCons error: Source file: foo\..* is shared and is not compatible with static target: .* ''' ) diff --git a/test/long-lines.py b/test/long-lines.py index d42b570..f2dc9fc 100644 --- a/test/long-lines.py +++ b/test/long-lines.py @@ -47,8 +47,8 @@ while len(linkflags) <= 8100: linkflags = linkflags + r' %s' env = Environment(LINKFLAGS = '$LINKXXX', LINKXXX = linkflags) env.Program(target = 'foo', source = 'foo.c') -# Library(shared=1) uses $LINKFLAGS by default. -env.Library(target = 'bar', source = 'bar.c', shared=1, no_import_lib=1) +# SharedLibrary() uses $LINKFLAGS by default. +env.SharedLibrary(target = 'bar', source = 'bar.c', no_import_lib=1) """ % (linkflag, linkflag)) test.write('foo.c', r""" |