From: stevenknight Date: Wed, 26 Jun 2002 01:47:54 +0000 (+0000) Subject: Win32 portability fixes for various tests. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=16839d9355b50fe937b5254c59d1687ae45d55c8;p=scons.git Win32 portability fixes for various tests. git-svn-id: http://scons.tigris.org/svn/scons/trunk@396 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 2f05b46c..5b458c05 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path +import string import SCons.Defaults import SCons.Errors diff --git a/test/F77.py b/test/F77.py index 65484988..8e53fabe 100644 --- a/test/F77.py +++ b/test/F77.py @@ -58,26 +58,6 @@ 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:] -inf = None -while args: - a = args[0] - args = args[1:] - if a[0] != '/': - if not inf: - inf = a - continue - if a[:3] == '/Fo': out = a[3:] -infile = open(inf, 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:4] != '#g77': - outfile.write(l) -sys.exit(0) """) else: @@ -96,7 +76,7 @@ for l in infile.readlines(): sys.exit(0) """) - test.write('myg77.py', r""" +test.write('myg77.py', r""" import getopt import sys opts, args = getopt.getopt(sys.argv[1:], 'co:') diff --git a/test/F77FLAGS.py b/test/F77FLAGS.py index e4d1f8cf..79469c49 100644 --- a/test/F77FLAGS.py +++ b/test/F77FLAGS.py @@ -38,8 +38,6 @@ if sys.platform == 'win32': _exe = '.exe' - o = ' -x /c' - test.write('mylink.py', r""" import string import sys @@ -56,39 +54,12 @@ 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:] -inf = None -optstring = '' -while args: - a = args[0] - args = args[1:] - if not a[0] in '/-': - if not inf: - inf = a - continue - if a[:3] == '/Fo': - out = a[3:] - continue - optstring = optstring + ' ' + a -infile = open(inf, 'rb') -outfile = open(out, 'wb') -outfile.write(optstring + "\n") -for l in infile.readlines(): - if l[:4] != '#g77': - outfile.write(l) -sys.exit(0) """) else: _exe = '' - o = ' -x -c' - test.write('mylink.py', r""" import getopt import sys @@ -103,7 +74,7 @@ for l in infile.readlines(): sys.exit(0) """) - test.write('myg77.py', r""" +test.write('myg77.py', r""" import getopt import sys opts, args = getopt.getopt(sys.argv[1:], 'co:x') @@ -165,17 +136,17 @@ test.write('test6.FPP', r"""This is a .FPP file. 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' + _exe) != " -x -c\nThis is a .f file.\n") -test.fail_test(test.read('test2' + _exe) != "%s\nThis is a .for file.\n" % o) +test.fail_test(test.read('test2' + _exe) != " -x -c\nThis is a .for file.\n") -test.fail_test(test.read('test3' + _exe) != "%s\nThis is a .FOR file.\n" % o) +test.fail_test(test.read('test3' + _exe) != " -x -c\nThis is a .FOR file.\n") -test.fail_test(test.read('test4' + _exe) != "%s\nThis is a .F file.\n" % o) +test.fail_test(test.read('test4' + _exe) != " -x -c\nThis is a .F file.\n") -test.fail_test(test.read('test5' + _exe) != "%s\nThis is a .fpp file.\n" % o) +test.fail_test(test.read('test5' + _exe) != " -x -c\nThis is a .fpp file.\n") -test.fail_test(test.read('test6' + _exe) != "%s\nThis is a .FPP file.\n" % o) +test.fail_test(test.read('test6' + _exe) != " -x -c\nThis is a .FPP file.\n") diff --git a/test/F77PATH.py b/test/F77PATH.py index e8b540f5..ad38bf1f 100644 --- a/test/F77PATH.py +++ b/test/F77PATH.py @@ -41,6 +41,11 @@ args = prog + ' ' + subdir_prog + ' ' + variant_prog test = TestSCons.TestSCons() +if not test.where_is('g77'): + print "g77 is not installed on this system." + print "Cannot test F77PATH." + test.no_result(1) + test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2') test.write('SConstruct', """ diff --git a/test/Install.py b/test/Install.py index 3a3c2bc5..cd0238bc 100644 --- a/test/Install.py +++ b/test/Install.py @@ -95,8 +95,8 @@ test.run(arguments = '.') test.fail_test(oldtime1 == os.path.getmtime(foo1)) test.fail_test(oldtime2 != os.path.getmtime(foo2)) -# Verify that scons prints an error message if a target can not be unlinked before -# building it: +# Verify that scons prints an error message +# if a target can not be unlinked before building it: test.write('f1.c', r""" #include @@ -108,7 +108,10 @@ int main(void) """) os.chmod(test.workpath('.'), 0555) +f = open(test.workpath('f1' + _obj), 'rb') test.run(arguments = foo1, stderr="scons: *** [Errno 13] Permission denied: 'f1%s'\n"%_obj, status=2) +f.close() + test.pass_test() diff --git a/test/LIBPATH.py b/test/LIBPATH.py index 0176c079..51b29989 100644 --- a/test/LIBPATH.py +++ b/test/LIBPATH.py @@ -56,7 +56,7 @@ env1.Library(target = './lib1/foo1', source = f1) env2 = Environment(LIBS = 'foo2', LIBPATH = '.') -env2.SharedLibrary(target = 'shlib', source = 'shlib.c') +env2.SharedLibrary(target = 'shlib', source = 'shlib.c', no_import_lib = 1) env2.Library(target = 'foo2', source = f1) """) @@ -127,7 +127,7 @@ env1.Library(target = './lib1/foo1', source = f1) env2 = Environment(LIBS = 'foo2', LIBPATH = Split('. ./lib2')) -env2.SharedLibrary(target = 'shlib', source = 'shlib.c') +env2.SharedLibrary(target = 'shlib', source = 'shlib.c', no_import_lib = 1) env2.Library(target = 'foo2', source = f1) """) diff --git a/test/SHF77.py b/test/SHF77.py index 86f10874..b0bde911 100644 --- a/test/SHF77.py +++ b/test/SHF77.py @@ -40,31 +40,7 @@ test = TestSCons.TestSCons() -if sys.platform == 'win32': - - test.write('myg77.py', r""" -import sys -args = sys.argv[1:] -inf = None -while args: - a = args[0] - args = args[1:] - if a[0] != '/': - if not inf: - inf = a - continue - if a[:3] == '/Fo': out = a[3:] -infile = open(inf, 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:4] != '#g77': - outfile.write(l) -sys.exit(0) -""") - -else: - - test.write('myg77.py', r""" +test.write('myg77.py', r""" import getopt import sys opts, args = getopt.getopt(sys.argv[1:], 'cf:o:') diff --git a/test/SHF77FLAGS.py b/test/SHF77FLAGS.py index 3034c3e2..f9d729f8 100644 --- a/test/SHF77FLAGS.py +++ b/test/SHF77FLAGS.py @@ -40,40 +40,7 @@ test = TestSCons.TestSCons() -if sys.platform == 'win32': - - o = ' -x /c' - - test.write('myg77.py', r""" -import sys -args = sys.argv[1:] -inf = None -optstring = '' -while args: - a = args[0] - args = args[1:] - if not a[0] in '/-': - if not inf: - inf = a - continue - if a[:3] == '/Fo': - out = a[3:] - continue - optstring = optstring + ' ' + a -infile = open(inf, 'rb') -outfile = open(out, 'wb') -outfile.write(optstring + "\n") -for l in infile.readlines(): - if l[:4] != '#g77': - outfile.write(l) -sys.exit(0) -""") - -else: - - o = ' -x -c' - - test.write('myg77.py', r""" +test.write('myg77.py', r""" import getopt import sys opts, args = getopt.getopt(sys.argv[1:], 'co:x') @@ -129,17 +96,17 @@ test.write('test6.FPP', r"""This is a .FPP file. test.run(arguments = '.', stderr = None) -test.fail_test(test.read('test1' + _obj) != "%s\nThis is a .f file.\n" % o) +test.fail_test(test.read('test1' + _obj) != " -x -c\nThis is a .f file.\n") -test.fail_test(test.read('test2' + _obj) != "%s\nThis is a .for file.\n" % o) +test.fail_test(test.read('test2' + _obj) != " -x -c\nThis is a .for file.\n") -test.fail_test(test.read('test3' + _obj) != "%s\nThis is a .FOR file.\n" % o) +test.fail_test(test.read('test3' + _obj) != " -x -c\nThis is a .FOR file.\n") -test.fail_test(test.read('test4' + _obj) != "%s\nThis is a .F file.\n" % o) +test.fail_test(test.read('test4' + _obj) != " -x -c\nThis is a .F file.\n") -test.fail_test(test.read('test5' + _obj) != "%s\nThis is a .fpp file.\n" % o) +test.fail_test(test.read('test5' + _obj) != " -x -c\nThis is a .fpp file.\n") -test.fail_test(test.read('test6' + _obj) != "%s\nThis is a .FPP file.\n" % o) +test.fail_test(test.read('test6' + _obj) != " -x -c\nThis is a .FPP file.\n") diff --git a/test/option-v.py b/test/option-v.py index f114e25a..4adcf5ea 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -34,8 +34,8 @@ test = TestSCons.TestSCons(match = TestCmd.match_re) test.write('SConstruct', "") expect = r"""SCons by Steven Knight et al.: -\tscript: v\d\.\d\d\.\S+, \d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d, by \S+ on \S+ -\tengine: v\d\.\d\d\.\S+, \d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d, by \S+ on \S+ +\tscript: v\S+, [^,]*, by \S+ on \S+ +\tengine: v\S+, [^,]*, by \S+ on \S+ Copyright 2001, 2002 Steven Knight """ diff --git a/test/win32pathmadness.py b/test/win32pathmadness.py index 7c0088c7..745e24e7 100644 --- a/test/win32pathmadness.py +++ b/test/win32pathmadness.py @@ -44,10 +44,10 @@ if sys.platform != 'win32': test.subdir('src', 'build', 'include', 'src2') test.write('src/SConstruct', """ -env=Environment(LIBS=['../build/foo'], CPPPATH=['../include'], CCCOM='$CC $CCFLAGS $CPPFLAGS $_INCFLAGS /c ${SOURCES.abspath} /Fo$TARGET') +env=Environment(LIBS=['../build/foo'], CPPPATH=['../include'], CCCOM='$CC $CCFLAGS $CPPFLAGS $_CPPINCFLAGS /c ${SOURCES.abspath} /Fo$TARGET') foo=env.Object('../build/foo', 'foo.c') Default(env.Library('../build/foo', foo)) -Default(env.Library('../build/bar', 'bar.c', shared=1)) +Default(env.SharedLibrary('../build/bar', 'bar.c')) Default(env.Program('../build/bar', ['main.c', '../src2/blat.c', '../build/bar.lib'])) """)