summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-06-26 01:47:54 (GMT)
committerSteven Knight <knight@baldmt.com>2002-06-26 01:47:54 (GMT)
commit5dd473bc401492d93a372b03965f2718b05426b8 (patch)
treecef954000dc721951f583f9d1367610cb1a54823
parent651972979462ebc48aac362dd53119ef79291cf5 (diff)
downloadSCons-5dd473bc401492d93a372b03965f2718b05426b8.zip
SCons-5dd473bc401492d93a372b03965f2718b05426b8.tar.gz
SCons-5dd473bc401492d93a372b03965f2718b05426b8.tar.bz2
Win32 portability fixes for various tests.
-rw-r--r--src/engine/SCons/Tool/mslink.py1
-rw-r--r--test/F77.py22
-rw-r--r--test/F77FLAGS.py43
-rw-r--r--test/F77PATH.py5
-rw-r--r--test/Install.py7
-rw-r--r--test/LIBPATH.py4
-rw-r--r--test/SHF77.py26
-rw-r--r--test/SHF77FLAGS.py47
-rw-r--r--test/option-v.py4
-rw-r--r--test/win32pathmadness.py4
10 files changed, 33 insertions, 130 deletions
diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py
index 2f05b46..5b458c0 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 6548498..8e53fab 100644
--- a/test/F77.py
+++ b/test/F77.py
@@ -60,26 +60,6 @@ for l in infile.readlines():
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:
test.write('mylink.py', r"""
@@ -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 e4d1f8c..79469c4 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
@@ -58,37 +56,10 @@ for l in infile.readlines():
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 e8b540f..ad38bf1 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 3a3c2bc..cd0238b 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 <stdio.h>
@@ -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 0176c07..51b2998 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 86f1087..b0bde91 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 3034c3e..f9d729f 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 f114e25..4adcf5e 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 7c0088c..745e24e 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']))
""")