summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-09-21 16:57:57 (GMT)
committerWilliam Blevins <wblevins001@gmail.com>2016-09-21 16:57:57 (GMT)
commitf5035c6a61ad10f440a22c14ce22bbb1d6796f62 (patch)
tree804b1383be0b30f3118d5df81db4315bcea1d32e /test
parent5f4aa5312e2d37a271233d864573772ae2b512fe (diff)
downloadSCons-f5035c6a61ad10f440a22c14ce22bbb1d6796f62.zip
SCons-f5035c6a61ad10f440a22c14ce22bbb1d6796f62.tar.gz
SCons-f5035c6a61ad10f440a22c14ce22bbb1d6796f62.tar.bz2
More test fixes.
Diffstat (limited to 'test')
-rw-r--r--test/ARGUMENTS.py4
-rw-r--r--test/AS/AS.py8
-rw-r--r--test/AS/ASCOM.py18
-rw-r--r--test/AS/ASCOMSTR.py10
-rw-r--r--test/AS/ASPPCOM.py10
-rw-r--r--test/AS/ASPPCOMSTR.py6
-rw-r--r--test/AS/as-live.py2
-rw-r--r--test/AS/ml.py2
-rw-r--r--test/CC/CCCOM.py16
-rw-r--r--test/CC/CCCOMSTR.py16
-rw-r--r--test/CC/SHCC.py6
-rw-r--r--test/CC/SHCCCOM.py16
-rw-r--r--test/CC/SHCCCOMSTR.py16
-rw-r--r--test/CC/shared-fixture/.exclude_tests1
-rw-r--r--test/CC/shared-fixture/mycc.py6
-rw-r--r--test/CC/shared-fixture/test1.c2
-rw-r--r--test/CFILESUFFIX.py2
-rw-r--r--test/SWIG/SWIGCOM.py2
-rw-r--r--test/SWIG/SWIGCOMSTR.py2
-rw-r--r--test/file-names.py6
20 files changed, 52 insertions, 99 deletions
diff --git a/test/ARGUMENTS.py b/test/ARGUMENTS.py
index 4bd2f78..97c97c8 100644
--- a/test/ARGUMENTS.py
+++ b/test/ARGUMENTS.py
@@ -31,13 +31,13 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
foo = open('foo.out', 'wb')
for k in sorted(ARGUMENTS.keys()):
- foo.write(k + " = " + ARGUMENTS[k] + "\\n")
+ foo.write((k + " = " + ARGUMENTS[k] + "\\n").encode())
foo.close()
""")
test.run(arguments='a=1 bz=3 xx=sd zzz=foo=bar .')
-test.fail_test(test.read('foo.out') != """a = 1
+test.must_match('foo.out', """a = 1
bz = 3
xx = sd
zzz = foo=bar
diff --git a/test/AS/AS.py b/test/AS/AS.py
index e0ffbf4..6ccf0cb 100644
--- a/test/AS/AS.py
+++ b/test/AS/AS.py
@@ -58,7 +58,7 @@ while args:
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
- if l[:5] != '#link':
+ if l[:5] != b'#link':
outfile.write(l)
sys.exit(0)
""")
@@ -82,7 +82,7 @@ while args:
infile = open(inf, 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
- if l[:3] != '#as':
+ if l[:3] != b'#as':
outfile.write(l)
sys.exit(0)
""")
@@ -98,7 +98,7 @@ for opt, arg in opts:
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
- if l[:5] != '#link':
+ if l[:5] != b'#link':
outfile.write(l)
sys.exit(0)
""")
@@ -112,7 +112,7 @@ for opt, arg in opts:
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
- if l[:3] != '#as':
+ if l[:3] != b'#as':
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/AS/ASCOM.py b/test/AS/ASCOM.py
index 568bd00..8f91404 100644
--- a/test/AS/ASCOM.py
+++ b/test/AS/ASCOM.py
@@ -42,7 +42,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in [l for l in infile.readlines() if l != "#as\n"]:
+for l in [l for l in infile.readlines() if l != b"#as\n"]:
outfile.write(l)
sys.exit(0)
""")
@@ -80,14 +80,14 @@ test.write('test8'+alt_asm_suffix, "test8.ASM\n#as\n")
test.run(arguments = '.')
-test.fail_test(test.read('test1.obj') != "test1.s\n")
-test.fail_test(test.read('test2.obj') != "test2.S\n")
-test.fail_test(test.read('test3.obj') != "test3.asm\n")
-test.fail_test(test.read('test4.obj') != "test4.ASM\n")
-test.fail_test(test.read('test5.shobj') != "test5.s\n")
-test.fail_test(test.read('test6.shobj') != "test6.S\n")
-test.fail_test(test.read('test7.shobj') != "test7.asm\n")
-test.fail_test(test.read('test8.shobj') != "test8.ASM\n")
+test.must_match('test1.obj', "test1.s\n")
+test.must_match('test2.obj', "test2.S\n")
+test.must_match('test3.obj', "test3.asm\n")
+test.must_match('test4.obj', "test4.ASM\n")
+test.must_match('test5.shobj', "test5.s\n")
+test.must_match('test6.shobj', "test6.S\n")
+test.must_match('test7.shobj', "test7.asm\n")
+test.must_match('test8.shobj', "test8.ASM\n")
diff --git a/test/AS/ASCOMSTR.py b/test/AS/ASCOMSTR.py
index f7cc34e..39b963f 100644
--- a/test/AS/ASCOMSTR.py
+++ b/test/AS/ASCOMSTR.py
@@ -43,7 +43,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in [l for l in infile.readlines() if l != "#as\n"]:
+for l in [l for l in infile.readlines() if l != b"#as\n"]:
outfile.write(l)
sys.exit(0)
""")
@@ -77,10 +77,10 @@ Assembling test3.obj from test3.asm
Assembling test4.obj from test4%(alt_asm_suffix)s
""" % locals()))
-test.fail_test(test.read('test1.obj') != "test1.s\n")
-test.fail_test(test.read('test2.obj') != "test2.S\n")
-test.fail_test(test.read('test3.obj') != "test3.asm\n")
-test.fail_test(test.read('test4.obj') != "test4.ASM\n")
+test.must_match('test1.obj', "test1.s\n")
+test.must_match('test2.obj', "test2.S\n")
+test.must_match('test3.obj', "test3.asm\n")
+test.must_match('test4.obj', "test4.ASM\n")
diff --git a/test/AS/ASPPCOM.py b/test/AS/ASPPCOM.py
index f89306e..62f859a 100644
--- a/test/AS/ASPPCOM.py
+++ b/test/AS/ASPPCOM.py
@@ -40,7 +40,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in [l for l in infile.readlines() if l != "#as\n"]:
+for l in [l for l in infile.readlines() if l != b"#as\n"]:
outfile.write(l)
sys.exit(0)
""")
@@ -63,10 +63,10 @@ test.write('test4.SPP', "test4.SPP\n#as\n")
test.run(arguments = '.')
-test.fail_test(test.read('test1.obj') != "test1.spp\n")
-test.fail_test(test.read('test2.obj') != "test2.SPP\n")
-test.fail_test(test.read('test3.shobj') != "test3.spp\n")
-test.fail_test(test.read('test4.shobj') != "test4.SPP\n")
+test.must_match('test1.obj', "test1.spp\n")
+test.must_match('test2.obj', "test2.SPP\n")
+test.must_match('test3.shobj', "test3.spp\n")
+test.must_match('test4.shobj', "test4.SPP\n")
diff --git a/test/AS/ASPPCOMSTR.py b/test/AS/ASPPCOMSTR.py
index 7de3b12..0497470 100644
--- a/test/AS/ASPPCOMSTR.py
+++ b/test/AS/ASPPCOMSTR.py
@@ -41,7 +41,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in [l for l in infile.readlines() if l != "#as\n"]:
+for l in [l for l in infile.readlines() if l != b"#as\n"]:
outfile.write(l)
sys.exit(0)
""")
@@ -62,8 +62,8 @@ Assembling test1.obj from test1.spp
Assembling test2.obj from test2.SPP
"""))
-test.fail_test(test.read('test1.obj') != "test1.spp\n")
-test.fail_test(test.read('test2.obj') != "test2.SPP\n")
+test.must_match('test1.obj', "test1.spp\n")
+test.must_match('test2.obj', "test2.SPP\n")
diff --git a/test/AS/as-live.py b/test/AS/as-live.py
index 801eeca..879e7b2 100644
--- a/test/AS/as-live.py
+++ b/test/AS/as-live.py
@@ -58,7 +58,7 @@ if sys.platform == "win32":
test.write("wrapper.py", """\
import os
import sys
-open('%s', 'wb').write("wrapper.py: %%s\\n" %% sys.argv[-1])
+open('%s', 'wb').write(("wrapper.py: %%s\\n" %% sys.argv[-1]).encode())
cmd = " ".join(sys.argv[1:])
os.system(cmd)
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
diff --git a/test/AS/ml.py b/test/AS/ml.py
index 9491e36..c377172 100644
--- a/test/AS/ml.py
+++ b/test/AS/ml.py
@@ -48,7 +48,7 @@ if not ml:
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/CC/CCCOM.py b/test/CC/CCCOM.py
index 8d06942..f930ecd 100644
--- a/test/CC/CCCOM.py
+++ b/test/CC/CCCOM.py
@@ -37,16 +37,7 @@ _exe = TestSCons._exe
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[:6] != '/*cc*/']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('shared-fixture')
if os.path.normcase('.c') == os.path.normcase('.C'):
alt_c_suffix = '.C'
@@ -60,11 +51,6 @@ env.Object(target = 'test1', source = 'test1.c')
env.Object(target = 'test2', source = 'test2%(alt_c_suffix)s')
""" % locals())
-test.write('test1.c', """\
-test1.c
-/*cc*/
-""")
-
test.write('test2'+alt_c_suffix, """\
test2.C
/*cc*/
diff --git a/test/CC/CCCOMSTR.py b/test/CC/CCCOMSTR.py
index 6874406..0be9971 100644
--- a/test/CC/CCCOMSTR.py
+++ b/test/CC/CCCOMSTR.py
@@ -38,16 +38,7 @@ _exe = TestSCons._exe
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[:6] != '/*cc*/']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('shared-fixture')
if os.path.normcase('.c') == os.path.normcase('.C'):
alt_c_suffix = '.C'
@@ -62,11 +53,6 @@ env.Object(target = 'test1', source = 'test1.c')
env.Object(target = 'test2', source = 'test2%(alt_c_suffix)s')
""" % locals())
-test.write('test1.c', """\
-test1.c
-/*cc*/
-""")
-
test.write('test2'+alt_c_suffix, """\
test2.C
/*cc*/
diff --git a/test/CC/SHCC.py b/test/CC/SHCC.py
index b624bf2..5f121fc 100644
--- a/test/CC/SHCC.py
+++ b/test/CC/SHCC.py
@@ -35,7 +35,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('\\', '\\\\'))
@@ -76,11 +76,11 @@ main(int argc, char *argv[])
test.run(arguments = 'foo')
-test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+test.must_not_exist(test.workpath('wrapper.out'))
test.run(arguments = 'bar')
-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/CC/SHCCCOM.py b/test/CC/SHCCCOM.py
index 006a80e..689b6e7 100644
--- a/test/CC/SHCCCOM.py
+++ b/test/CC/SHCCCOM.py
@@ -36,16 +36,7 @@ _python_ = TestSCons._python_
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[:6] != '/*cc*/']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('shared-fixture')
if os.path.normcase('.c') == os.path.normcase('.C'):
alt_c_suffix = '.C'
@@ -60,11 +51,6 @@ env.SharedObject(target = 'test1', source = 'test1.c')
env.SharedObject(target = 'test2', source = 'test2%(alt_c_suffix)s')
""" % locals())
-test.write('test1.c', """\
-test1.c
-/*cc*/
-""")
-
test.write('test2'+alt_c_suffix, """\
test2.C
/*cc*/
diff --git a/test/CC/SHCCCOMSTR.py b/test/CC/SHCCCOMSTR.py
index 15bfa85..0983a67 100644
--- a/test/CC/SHCCCOMSTR.py
+++ b/test/CC/SHCCCOMSTR.py
@@ -38,16 +38,7 @@ _exe = TestSCons._exe
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[:6] != '/*cc*/']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('shared-fixture')
if os.path.normcase('.c') == os.path.normcase('.C'):
alt_c_suffix = '.C'
@@ -63,11 +54,6 @@ env.SharedObject(target = 'test1', source = 'test1.c')
env.SharedObject(target = 'test2', source = 'test2%(alt_c_suffix)s')
""" % locals())
-test.write('test1.c', """\
-test1.c
-/*cc*/
-""")
-
test.write('test2'+alt_c_suffix, """\
test2.C
/*cc*/
diff --git a/test/CC/shared-fixture/.exclude_tests b/test/CC/shared-fixture/.exclude_tests
new file mode 100644
index 0000000..3f2bc0f
--- /dev/null
+++ b/test/CC/shared-fixture/.exclude_tests
@@ -0,0 +1 @@
+mycc.py
diff --git a/test/CC/shared-fixture/mycc.py b/test/CC/shared-fixture/mycc.py
new file mode 100644
index 0000000..b96c31c
--- /dev/null
+++ b/test/CC/shared-fixture/mycc.py
@@ -0,0 +1,6 @@
+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[:6] != b'/*cc*/']:
+ outfile.write(l)
+sys.exit(0)
diff --git a/test/CC/shared-fixture/test1.c b/test/CC/shared-fixture/test1.c
new file mode 100644
index 0000000..9c281d7
--- /dev/null
+++ b/test/CC/shared-fixture/test1.c
@@ -0,0 +1,2 @@
+test1.c
+/*cc*/
diff --git a/test/CFILESUFFIX.py b/test/CFILESUFFIX.py
index 1a81240..0a3a81a 100644
--- a/test/CFILESUFFIX.py
+++ b/test/CFILESUFFIX.py
@@ -42,7 +42,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/SWIG/SWIGCOM.py b/test/SWIG/SWIGCOM.py
index 44602fd..ee3ff64 100644
--- a/test/SWIG/SWIGCOM.py
+++ b/test/SWIG/SWIGCOM.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 != '/*swig*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*swig*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/SWIG/SWIGCOMSTR.py b/test/SWIG/SWIGCOMSTR.py
index 1df3499..24db13e 100644
--- a/test/SWIG/SWIGCOMSTR.py
+++ b/test/SWIG/SWIGCOMSTR.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 != '/*swig*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*swig*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/file-names.py b/test/file-names.py
index d9f9c63..4b89126 100644
--- a/test/file-names.py
+++ b/test/file-names.py
@@ -119,10 +119,10 @@ for c in goodChars:
c_str = ("%d"%ord(c[-1]))+c
if not invalid_leading_char(c):
- test.fail_test(test.read(c_str + "out") != contents(c))
- test.fail_test(test.read("out" + c_str + "out") != contents(c))
+ test.must_match(c_str + "out", contents(c))
+ test.must_match("out" + c_str + "out", contents(c))
if not invalid_trailing_char(c):
- test.fail_test(test.read("out" + c_str) != contents(c))
+ test.must_match("out" + c_str, contents(c))
test.pass_test()