summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-04-26 15:30:26 (GMT)
committerGitHub <noreply@github.com>2019-04-26 15:30:26 (GMT)
commit3d8089814431c4048c50e1c66e79aa601e29c483 (patch)
treebf4a0b84c906b6ef098bde6411c41acabaa77339 /test
parent4af18c70308e70cf60fdb3843ce9234415857c4e (diff)
parentd642ba8c6ee147daa8155b6a354ce66a13bb9188 (diff)
downloadSCons-3d8089814431c4048c50e1c66e79aa601e29c483.zip
SCons-3d8089814431c4048c50e1c66e79aa601e29c483.tar.gz
SCons-3d8089814431c4048c50e1c66e79aa601e29c483.tar.bz2
Merge branch 'master' into fix_mongo_bug_33111_multiple_targets_via_emitter_spurious_rebuilds
Diffstat (limited to 'test')
-rw-r--r--test/GetBuildFailures/serial.py12
-rw-r--r--test/Interactive/configure.py7
-rw-r--r--test/Interactive/option-j.py16
-rw-r--r--test/Java/RMIC.py4
-rw-r--r--test/LEX/live_mingw.py2
-rw-r--r--test/Parallel/duplicate-children.py8
-rw-r--r--test/Parallel/duplicate-target.py9
-rw-r--r--test/Parallel/failed-build.py3
-rw-r--r--test/Parallel/multiple-parents.py4
-rw-r--r--test/Parallel/ref_count.py10
-rw-r--r--test/Repository/RMIC.py8
-rw-r--r--test/packaging/multiple-subdirs.py2
-rw-r--r--test/packaging/option--package-type.py2
-rw-r--r--test/packaging/place-files-in-subdirectory.py6
-rw-r--r--test/packaging/strip-install-dir.py2
-rw-r--r--test/packaging/tar/bz2_packaging.py2
-rw-r--r--test/packaging/tar/gz.py2
-rw-r--r--test/packaging/tar/xz_packaging.py2
-rw-r--r--test/packaging/use-builddir.py4
-rw-r--r--test/packaging/zip.py2
20 files changed, 58 insertions, 49 deletions
diff --git a/test/GetBuildFailures/serial.py b/test/GetBuildFailures/serial.py
index 144d8bc..4d1b7cd 100644
--- a/test/GetBuildFailures/serial.py
+++ b/test/GetBuildFailures/serial.py
@@ -83,8 +83,8 @@ Command('f08', 'f08.in', raiseExcAction(SCons.Errors.UserError("My User Error"))
Command('f09', 'f09.in', returnExcAction(SCons.Errors.UserError("My User Error")))
Command('f10', 'f10.in', raiseExcAction(MyBuildError(errstr="My Build Error", status=7)))
Command('f11', 'f11.in', returnExcAction(MyBuildError(errstr="My Build Error", status=7)))
-Command('f12', 'f12.in', raiseExcAction(OSError(123, "My EnvironmentError", "f12")))
-Command('f13', 'f13.in', returnExcAction(OSError(123, "My EnvironmentError", "f13")))
+Command('f12', 'f12.in', raiseExcAction(OSError(123, "My SConsEnvironmentError", "f12")))
+Command('f13', 'f13.in', returnExcAction(OSError(123, "My SConsEnvironmentError", "f13")))
Command('f14', 'f14.in', raiseExcAction(SCons.Errors.InternalError("My InternalError")))
Command('f15', 'f15.in', returnExcAction(SCons.Errors.InternalError("My InternalError")))
@@ -173,9 +173,9 @@ BF: f10 failed (7): My Build Error
BF: action(["f10"], ["f10.in"])
BF: f11 failed (7): My Build Error
BF: action(["f11"], ["f11.in"])
-BF: f12 failed (123): My EnvironmentError
+BF: f12 failed (123): My SConsEnvironmentError
BF: action(["f12"], ["f12.in"])
-BF: f13 failed (123): My EnvironmentError
+BF: f13 failed (123): My SConsEnvironmentError
BF: action(["f13"], ["f13.in"])
BF: f14 failed (2): InternalError : My InternalError
BF: action(["f14"], ["f14.in"])
@@ -191,8 +191,8 @@ scons: *** [f08] My User Error
scons: *** [f09] My User Error
scons: *** [f10] My Build Error
scons: *** [f11] My Build Error
-scons: *** [f12] f12: My EnvironmentError
-scons: *** [f13] f13: My EnvironmentError
+scons: *** [f12] f12: My SConsEnvironmentError
+scons: *** [f13] f13: My SConsEnvironmentError
scons: *** [f14] InternalError : My InternalError
""") + \
"""\
diff --git a/test/Interactive/configure.py b/test/Interactive/configure.py
index 906a7e9..a7f0735 100644
--- a/test/Interactive/configure.py
+++ b/test/Interactive/configure.py
@@ -38,10 +38,9 @@ test = TestSCons.TestSCons()
test.write('mycc.py', r"""
import sys
-outfile = open(sys.argv[1], 'wb')
-infile = open(sys.argv[2], 'rb')
-for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']:
- outfile.write(l)
+with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp:
+ for l in [l for l in ifp.readlines() if l[:7] != '/*c++*/']:
+ ofp.write(l)
sys.exit(0)
""")
diff --git a/test/Interactive/option-j.py b/test/Interactive/option-j.py
index 279fc51..356a067 100644
--- a/test/Interactive/option-j.py
+++ b/test/Interactive/option-j.py
@@ -39,10 +39,10 @@ from SCons.Script import *
def cat(target, source, env):
t = str(target[0])
os.mkdir(t + '.started')
- fp = open(t, 'wb')
- for s in source:
- fp.write(open(str(s), 'rb').read())
- fp.close()
+ with open(t, 'wb') as ofp:
+ for s in source:
+ with open(str(s), 'rb') as ifp:
+ ofp.write(ifp.read())
os.mkdir(t + '.finished')
def must_be_finished(target, source, env, dir):
@@ -63,10 +63,10 @@ def must_wait_for_f2_b_out(target, source, env):
f2_b_started = 'f2-b.out.started'
while not os.path.exists(f2_b_started):
time.sleep(1)
- fp = open(t, 'wb')
- for s in source:
- fp.write(open(str(s), 'rb').read())
- fp.close()
+ with open(t, 'wb') as ofp:
+ for s in source:
+ with open(str(s), 'rb') as ifp:
+ ofp.write(ifp.read())
os.mkdir(t + '.finished')
def _f2_a_out_must_not_be_finished(target, source, env):
diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py
index 021f666..c8848e9 100644
--- a/test/Java/RMIC.py
+++ b/test/Java/RMIC.py
@@ -102,13 +102,13 @@ if java_version.count('.') == 1:
major, minor = java_version.split('.')
try:
curver = (int(major), int(minor))
- except:
+ except ValueError:
pass
elif java_version.count('.') == 0:
# java 11?
try:
curver = (int(java_version), 0)
- except:
+ except ValueError:
pass
# Check the version of the found Java compiler.
diff --git a/test/LEX/live_mingw.py b/test/LEX/live_mingw.py
index 13e2342..d535065 100644
--- a/test/LEX/live_mingw.py
+++ b/test/LEX/live_mingw.py
@@ -41,7 +41,7 @@ if sys.platform != 'win32':
test.skip_test('Not windows environment; skipping test.\n')
if not test.where_is('gcc'):
- test.skip_test('No mingw or cygwin on windows; skipping test.\n')
+ test.skip_test('No mingw or cygwin build environment found; skipping test.\n')
lex = test.where_is('lex') or test.where_is('flex')
diff --git a/test/Parallel/duplicate-children.py b/test/Parallel/duplicate-children.py
index 8b8f4cd..fab1e58 100644
--- a/test/Parallel/duplicate-children.py
+++ b/test/Parallel/duplicate-children.py
@@ -37,10 +37,10 @@ test = TestSCons.TestSCons()
test.write('cat.py', """\
import sys
-fp = open(sys.argv[1], 'wb')
-for fname in sys.argv[2:]:
- fp.write(open(fname, 'rb').read())
-fp.close()
+with open(sys.argv[1], 'wb') as ofp:
+ for fname in sys.argv[2:]:
+ with open(fname, 'rb') as ifp:
+ ofp.write(ifp.read())
""")
test.write('sleep.py', """\
diff --git a/test/Parallel/duplicate-target.py b/test/Parallel/duplicate-target.py
index efe20d9..e947edc 100644
--- a/test/Parallel/duplicate-target.py
+++ b/test/Parallel/duplicate-target.py
@@ -49,14 +49,15 @@ test.write(['work', 'mycopy.py'], """\
import sys
import time
time.sleep(int(sys.argv[1]))
-open(sys.argv[2], 'wb').write(open(sys.argv[3], 'rb').read())
+with open(sys.argv[2], 'wb') as ofp, open(sys.argv[3], 'rb') as ifp:
+ ofp.write(ifp.read())
""")
test.write(['work', 'mytar.py'], """\
import sys
import os.path
-fp = open(sys.argv[1], 'wb')
+ofp = open(sys.argv[1], 'wb')
def visit(dirname):
names = os.listdir(dirname)
@@ -66,10 +67,12 @@ def visit(dirname):
if os.path.isdir(p):
visit(p)
elif os.path.isfile(p):
- fp.write(open(p, 'rb').read())
+ with open(p, 'rb') as ifp:
+ ofp.write(ifp.read())
for s in sys.argv[2:]:
visit(s)
+ofp.close()
""")
test.write(['work', 'SConstruct'], """\
diff --git a/test/Parallel/failed-build.py b/test/Parallel/failed-build.py
index 2360679..bfdc01d 100644
--- a/test/Parallel/failed-build.py
+++ b/test/Parallel/failed-build.py
@@ -78,7 +78,8 @@ import os
import sys
import time
os.mkdir('mycopy.started')
-open(sys.argv[1], 'wb').write(open(sys.argv[2], 'rb').read())
+with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp:
+ ofp.write(ifp.read())
for i in [1, 2, 3, 4, 5]:
time.sleep(2)
if os.path.exists('myfail.exiting'):
diff --git a/test/Parallel/multiple-parents.py b/test/Parallel/multiple-parents.py
index 7fbcb00..5a52f28 100644
--- a/test/Parallel/multiple-parents.py
+++ b/test/Parallel/multiple-parents.py
@@ -147,8 +147,8 @@ Default(all)
re_error = """\
(scons: \\*\\*\\* \\[failed\\d+] Error 2\\n)|\
(scons: \\*\\*\\* \\[missing\\d+] Source `MissingSrc' not found, needed by target `missing\\d+'\\.( Stop\\.)?\\n)|\
-(scons: \\*\\*\\* \\[\\w+] Build interrupted\.\\n)|\
-(scons: Build interrupted\.\\n)\
+(scons: \\*\\*\\* \\[\\w+] Build interrupted\\.\\n)|\
+(scons: Build interrupted\\.\\n)\
"""
re_errors = "(" + re_error + ")+"
diff --git a/test/Parallel/ref_count.py b/test/Parallel/ref_count.py
index 7ce5910..8a31bf3 100644
--- a/test/Parallel/ref_count.py
+++ b/test/Parallel/ref_count.py
@@ -74,12 +74,12 @@ while args:
time.sleep(int(args.pop(0)))
contents = ''
for ifile in args:
- contents = contents + open(ifile, 'r').read()
+ with open(ifile, 'r') as ifp:
+ contents = contents + ifp.read()
for ofile in outputs:
- ofp = open(ofile, 'w')
- ofp.write('%s: building from %s\\n' % (ofile, " ".join(args)))
- ofp.write(contents)
- ofp.close()
+ with open(ofile, 'w') as ofp:
+ ofp.write('%s: building from %s\\n' % (ofile, " ".join(args)))
+ ofp.write(contents)
""")
#
diff --git a/test/Repository/RMIC.py b/test/Repository/RMIC.py
index 433890f..aa4a57e 100644
--- a/test/Repository/RMIC.py
+++ b/test/Repository/RMIC.py
@@ -44,7 +44,13 @@ if java_version.count('.') == 1:
major, minor = java_version.split('.')
try:
curver = (int(major), int(minor))
- except:
+ except ValueError:
+ pass
+elif java_version.count('.') == 0:
+ # java 11?
+ try:
+ curver = (int(java_version), 0)
+ except ValueError:
pass
# Check the version of the found Java compiler.
diff --git a/test/packaging/multiple-subdirs.py b/test/packaging/multiple-subdirs.py
index 66b81a3..27b81a2 100644
--- a/test/packaging/multiple-subdirs.py
+++ b/test/packaging/multiple-subdirs.py
@@ -42,7 +42,7 @@ if not tar:
test.subdir('one', 'two', 'three')
test.write('SConstruct', """\
-env = Environment(tools=['default', 'packaging'])
+env = Environment(tools=['packaging', 'filesystem', 'tar'])
Export('env')
SConscript(dirs = ['one', 'two', 'three'])
""")
diff --git a/test/packaging/option--package-type.py b/test/packaging/option--package-type.py
index 7ff8535..b9ed05e 100644
--- a/test/packaging/option--package-type.py
+++ b/test/packaging/option--package-type.py
@@ -53,7 +53,7 @@ test.write( 'main', '' )
test.write('SConstruct', """
# -*- coding: iso-8859-15 -*-
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'tar', 'rpm'])
env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
prog=env.Install( '/bin', 'main' )
diff --git a/test/packaging/place-files-in-subdirectory.py b/test/packaging/place-files-in-subdirectory.py
index f7224ba..0eb791f 100644
--- a/test/packaging/place-files-in-subdirectory.py
+++ b/test/packaging/place-files-in-subdirectory.py
@@ -48,7 +48,7 @@ test.subdir('src')
test.write('src/main.c', '')
test.write('SConstruct', """
-env = Environment(tools=['default', 'packaging'])
+env = Environment(tools=['packaging', 'filesystem', 'zip'])
env.Package( NAME = 'libfoo',
PACKAGEROOT = 'libfoo',
PACKAGETYPE = 'src_zip',
@@ -70,7 +70,7 @@ test.subdir('src')
test.write('src/main.c', '')
test.write('SConstruct', """
-env = Environment(tools=['default', 'packaging'])
+env = Environment(tools=['packaging', 'filesystem', 'zip'])
env.Package( NAME = 'libfoo',
VERSION = '1.2.3',
PACKAGETYPE = 'src_zip',
@@ -93,7 +93,7 @@ test.subdir('temp')
test.write('src/main.c', '')
test.write('SConstruct', """
-env = Environment(tools=['default', 'packaging'])
+env = Environment(tools=['packaging', 'filesystem', 'tar'])
env.Package( NAME = 'libfoo',
VERSION = '1.2.3',
PACKAGETYPE = 'src_targz',
diff --git a/test/packaging/strip-install-dir.py b/test/packaging/strip-install-dir.py
index b81a6b4..7f41c20 100644
--- a/test/packaging/strip-install-dir.py
+++ b/test/packaging/strip-install-dir.py
@@ -43,7 +43,7 @@ if not tar:
test.write( 'main.c', '' )
test.write('SConstruct', """
prog = Install( '/bin', 'main.c' )
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'tar'])
env.Package( NAME = 'foo',
VERSION = '1.2.3',
source = [ prog ],
diff --git a/test/packaging/tar/bz2_packaging.py b/test/packaging/tar/bz2_packaging.py
index 2a8b506..875f1c9 100644
--- a/test/packaging/tar/bz2_packaging.py
+++ b/test/packaging/tar/bz2_packaging.py
@@ -54,7 +54,7 @@ int main( int argc, char* argv[] )
test.write('SConstruct', """
Program( 'src/main.c' )
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'tar'])
env.Package( PACKAGETYPE = 'src_tarbz2',
target = 'src.tar.bz2',
PACKAGEROOT = 'test',
diff --git a/test/packaging/tar/gz.py b/test/packaging/tar/gz.py
index 05661b7..07d5b52 100644
--- a/test/packaging/tar/gz.py
+++ b/test/packaging/tar/gz.py
@@ -50,7 +50,7 @@ int main( int argc, char* argv[] )
test.write('SConstruct', """
Program( 'src/main.c' )
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'tar'])
env.Package( PACKAGETYPE = 'src_targz',
target = 'src.tar.gz',
PACKAGEROOT = 'test',
diff --git a/test/packaging/tar/xz_packaging.py b/test/packaging/tar/xz_packaging.py
index 194b110..f12292e 100644
--- a/test/packaging/tar/xz_packaging.py
+++ b/test/packaging/tar/xz_packaging.py
@@ -54,7 +54,7 @@ int main( int argc, char* argv[] )
test.write('SConstruct', """
Program( 'src/main.c' )
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'tar'])
env.Package( PACKAGETYPE = 'src_tarxz',
target = 'src.tar.xz',
PACKAGEROOT = 'test',
diff --git a/test/packaging/use-builddir.py b/test/packaging/use-builddir.py
index 9ad7aa4..812f2d6 100644
--- a/test/packaging/use-builddir.py
+++ b/test/packaging/use-builddir.py
@@ -50,7 +50,7 @@ test.write('src/main.c', '')
test.write('SConstruct', """
VariantDir('build', 'src')
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'zip'])
env.Package( NAME = 'libfoo',
PACKAGEROOT = 'build/libfoo',
VERSION = '1.2.3',
@@ -74,7 +74,7 @@ test.write('src/main.c', '')
test.write('SConstruct', """
VariantDir('build', 'src')
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'tar'])
env.Package( NAME = 'libfoo',
VERSION = '1.2.3',
PAKCAGETYPE = 'src_targz',
diff --git a/test/packaging/zip.py b/test/packaging/zip.py
index 89f3074..527ad00 100644
--- a/test/packaging/zip.py
+++ b/test/packaging/zip.py
@@ -51,7 +51,7 @@ int main( int argc, char* argv[] )
test.write('SConstruct', """
Program( 'src/main.c' )
-env=Environment(tools=['default', 'packaging'])
+env=Environment(tools=['packaging', 'filesystem', 'zip'])
env.Package( PACKAGETYPE = 'src_zip',
target = 'src.zip',
PACKAGEROOT = 'test',