summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-09-22 21:19:50 (GMT)
committerWilliam Blevins <wblevins001@gmail.com>2016-09-22 21:19:50 (GMT)
commit0f0725d9215ca35e9b9995a9421ef83e35a338d8 (patch)
treeda169366f448026e53f19b21c854a9c53be79644 /test
parentefb7469bf68d57b590fa477f0ea2224d339f679f (diff)
downloadSCons-0f0725d9215ca35e9b9995a9421ef83e35a338d8.zip
SCons-0f0725d9215ca35e9b9995a9421ef83e35a338d8.tar.gz
SCons-0f0725d9215ca35e9b9995a9421ef83e35a338d8.tar.bz2
Yet another batch of test fixes.
Diffstat (limited to 'test')
-rw-r--r--test/LEX/LEX.py2
-rw-r--r--test/LEX/LEXCOM.py2
-rw-r--r--test/LEX/LEXCOMSTR.py2
-rw-r--r--test/LEX/LEXFLAGS.py6
-rw-r--r--test/LEX/live.py2
-rw-r--r--test/LINK/LINK.py6
-rw-r--r--test/LINK/LINKCOM.py5
-rw-r--r--test/LINK/LINKCOMSTR.py4
-rw-r--r--test/LINK/LINKFLAGS.py4
-rw-r--r--test/LINK/SHLINK.py6
-rw-r--r--test/LINK/SHLINKCOM.py4
-rw-r--r--test/LINK/SHLINKCOMSTR.py4
-rw-r--r--test/LINK/SHLINKFLAGS.py4
-rw-r--r--test/M4/M4.py10
-rw-r--r--test/M4/M4COM.py2
-rw-r--r--test/M4/M4COMSTR.py2
-rw-r--r--test/YACC/live.py2
17 files changed, 32 insertions, 35 deletions
diff --git a/test/LEX/LEX.py b/test/LEX/LEX.py
index 975d4e9..1239c6b 100644
--- a/test/LEX/LEX.py
+++ b/test/LEX/LEX.py
@@ -41,7 +41,7 @@ import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 't', [])
for a in args:
contents = open(a, 'rb').read()
- sys.stdout.write(contents.replace('LEX', 'mylex.py'))
+ sys.stdout.write(contents.replace(b'LEX', b'mylex.py').decode())
sys.exit(0)
""")
diff --git a/test/LEX/LEXCOM.py b/test/LEX/LEXCOM.py
index 5fb82fe..6a32388 100644
--- a/test/LEX/LEXCOM.py
+++ b/test/LEX/LEXCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*lex*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*lex*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LEX/LEXCOMSTR.py b/test/LEX/LEXCOMSTR.py
index 83b2f9c..07e693c 100644
--- a/test/LEX/LEXCOMSTR.py
+++ b/test/LEX/LEXCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*lex*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*lex*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LEX/LEXFLAGS.py b/test/LEX/LEXFLAGS.py
index 82ae586..54df161 100644
--- a/test/LEX/LEXFLAGS.py
+++ b/test/LEX/LEXFLAGS.py
@@ -48,9 +48,9 @@ for opt, arg in cmd_opts:
else: opt_string = opt_string + ' ' + opt
for a in args:
contents = open(a, 'rb').read()
- contents = contents.replace('LEXFLAGS', opt_string)
- contents = contents.replace('I_ARGS', i_arguments)
- sys.stdout.write(contents)
+ contents = contents.replace(b'LEXFLAGS', opt_string.encode())
+ contents = contents.replace(b'I_ARGS', i_arguments.encode())
+ sys.stdout.write(contents.decode())
sys.exit(0)
""")
diff --git a/test/LEX/live.py b/test/LEX/live.py
index e4b4dfb..2abb8ce 100644
--- a/test/LEX/live.py
+++ b/test/LEX/live.py
@@ -44,7 +44,7 @@ if not lex:
test.write("wrapper.py", """import os
import sys
-open('%s', 'wb').write("wrapper.py\\n")
+open('%s', 'wb').write(b"wrapper.py\\n")
os.system(" ".join(sys.argv[1:]))
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
diff --git a/test/LINK/LINK.py b/test/LINK/LINK.py
index 25d9efb..54c75fa 100644
--- a/test/LINK/LINK.py
+++ b/test/LINK/LINK.py
@@ -36,7 +36,7 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
import sys
-open('%s', 'wb').write("wrapper.py\\n")
+open('%s', 'wb').write(("wrapper.py\\n").encode())
os.system(" ".join(sys.argv[1:]))
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
@@ -75,11 +75,11 @@ main(int argc, char *argv[])
test.run(arguments = 'foo' + _exe)
-test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+test.must_not_exist(test.workpath('wrapper.out'))
test.run(arguments = 'bar' + _exe)
-test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+test.must_match('wrapper.out', "wrapper.py\n")
test.pass_test()
diff --git a/test/LINK/LINKCOM.py b/test/LINK/LINKCOM.py
index f09e8f8..996e727 100644
--- a/test/LINK/LINKCOM.py
+++ b/test/LINK/LINKCOM.py
@@ -31,18 +31,15 @@ Test the ability to configure the $LINKCOM construction variable.
import TestSCons
_python_ = TestSCons._python_
-_exe = TestSCons._exe
test = TestSCons.TestSCons()
-
-
test.write('mylink.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*link*/\n']:
+ for l in [l for l in infile.readlines() if l != b'/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LINK/LINKCOMSTR.py b/test/LINK/LINKCOMSTR.py
index 8fd8adc..8163016 100644
--- a/test/LINK/LINKCOMSTR.py
+++ b/test/LINK/LINKCOMSTR.py
@@ -32,7 +32,6 @@ the displayed linker string.
import TestSCons
_python_ = TestSCons._python_
-_exe = TestSCons._exe
test = TestSCons.TestSCons()
@@ -43,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*link*/\n']:
+ for l in [l for l in infile.readlines() if l != b'/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
@@ -80,6 +79,7 @@ env = Environment(CXXCOMSTR = 'Compiling $TARGET ...',
LINKCOMSTR = 'Linking $TARGET ...')
env.Program('test', 'test.cpp')
""")
+
test.write('test.cpp', """
int main(int argc, char **argv) {}
""")
diff --git a/test/LINK/LINKFLAGS.py b/test/LINK/LINKFLAGS.py
index 442baf7..f0c7518 100644
--- a/test/LINK/LINKFLAGS.py
+++ b/test/LINK/LINKFLAGS.py
@@ -36,7 +36,7 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
import sys
-open('%s', 'wb').write("wrapper.py\\n")
+open('%s', 'wb').write(("wrapper.py\\n").encode())
args = [s for s in sys.argv[1:] if s != 'fake_link_flag']
os.system(" ".join(args))
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
@@ -80,7 +80,7 @@ test.must_not_exist(test.workpath('wrapper.out'))
test.run(arguments = 'bar' + _exe)
-test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+test.must_match('wrapper.out', "wrapper.py\n")
test.pass_test()
diff --git a/test/LINK/SHLINK.py b/test/LINK/SHLINK.py
index bc1239b..7353996 100644
--- a/test/LINK/SHLINK.py
+++ b/test/LINK/SHLINK.py
@@ -37,7 +37,7 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
import sys
-open('%s', 'wb').write("wrapper.py\\n")
+open('%s', 'wb').write(b"wrapper.py\\n")
os.system(" ".join(sys.argv[1:]))
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
@@ -73,11 +73,11 @@ test()
test.run(arguments = dll_ + 'foo' + _shlib)
-test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+test.must_not_exist(test.workpath('wrapper.out'))
test.run(arguments = dll_ + 'bar' + _shlib)
-test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+test.must_match('wrapper.out', "wrapper.py\n")
test.pass_test()
diff --git a/test/LINK/SHLINKCOM.py b/test/LINK/SHLINKCOM.py
index 8bdb9b5..1204ed1 100644
--- a/test/LINK/SHLINKCOM.py
+++ b/test/LINK/SHLINKCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*cc*/\n']:
+ for l in [l for l in infile.readlines() if l != b'/*cc*/\n']:
outfile.write(l)
sys.exit(0)
@@ -51,7 +51,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*link*/\n']:
+ for l in [l for l in infile.readlines() if l != b'/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LINK/SHLINKCOMSTR.py b/test/LINK/SHLINKCOMSTR.py
index db40732..5663a1e 100644
--- a/test/LINK/SHLINKCOMSTR.py
+++ b/test/LINK/SHLINKCOMSTR.py
@@ -43,7 +43,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*cc*/\n']:
+ for l in [l for l in infile.readlines() if l != b'/*cc*/\n']:
outfile.write(l)
sys.exit(0)
@@ -53,7 +53,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*link*/\n']:
+ for l in [l for l in infile.readlines() if l != b'/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LINK/SHLINKFLAGS.py b/test/LINK/SHLINKFLAGS.py
index 57766de..51b6e22 100644
--- a/test/LINK/SHLINKFLAGS.py
+++ b/test/LINK/SHLINKFLAGS.py
@@ -37,7 +37,7 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
import sys
-open('%s', 'wb').write("wrapper.py\\n")
+open('%s', 'wb').write(("wrapper.py\\n").encode())
args = [s for s in sys.argv[1:] if s != 'fake_shlink_flag']
os.system(" ".join(args))
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
@@ -78,7 +78,7 @@ test.must_not_exist(test.workpath('wrapper.out'))
test.run(arguments = lib_ + 'bar' + _shlib)
-test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+test.must_match('wrapper.out', "wrapper.py\n")
test.pass_test()
diff --git a/test/M4/M4.py b/test/M4/M4.py
index 6c2de9c..d2b8365 100644
--- a/test/M4/M4.py
+++ b/test/M4/M4.py
@@ -59,7 +59,7 @@ line 3
test.run()
-test.fail_test(test.read(test.workpath('aaa.x'), 'r') != "line 1\nmym4.py\nline 3\n")
+test.must_match(test.workpath('aaa.x'), "line 1\nmym4.py\nline 3\n")
@@ -70,7 +70,7 @@ if m4:
test.write("wrapper.py",
"""import os
import sys
-open('%s', 'wb').write("wrapper.py\\n")
+open('%s', 'wb').write(b"wrapper.py\\n")
os.system(" ".join(sys.argv[1:]))
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
@@ -96,11 +96,11 @@ bar.M4(target = 'bar', source = 'bar.m4')
test.up_to_date(arguments = '.')
- test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+ test.must_match('wrapper.out', "wrapper.py\n")
- test.fail_test(test.read('foo.x', 'r') != "line 1\nfff\nline 3\n")
+ test.must_match('foo.x', "line 1\nfff\nline 3\n")
- test.fail_test(test.read('bar', 'r') != "line 1\nbbb\nline 3\n")
+ test.must_match('bar', "line 1\nbbb\nline 3\n")
test.pass_test()
diff --git a/test/M4/M4COM.py b/test/M4/M4COM.py
index ad15172..5a2f076 100644
--- a/test/M4/M4COM.py
+++ b/test/M4/M4COM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*m4*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*m4*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/M4/M4COMSTR.py b/test/M4/M4COMSTR.py
index 1b5bd35..da01e6c 100644
--- a/test/M4/M4COMSTR.py
+++ b/test/M4/M4COMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*m4*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*m4*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/YACC/live.py b/test/YACC/live.py
index f6733da..e125daa 100644
--- a/test/YACC/live.py
+++ b/test/YACC/live.py
@@ -43,7 +43,7 @@ if not yacc:
test.write("wrapper.py",
"""import os
import sys
-open('%s', 'wb').write("wrapper.py\\n")
+open('%s', 'wb').write(b"wrapper.py\\n")
os.system(" ".join(sys.argv[1:]))
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))