summaryrefslogtreecommitdiff
path: root/test/CC
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-09-21 12:57:57 -0400
committerWilliam Blevins <wblevins001@gmail.com>2016-09-21 12:57:57 -0400
commitb9d9cf51e4518f5a286634f6afd734400b640238 (patch)
tree804b1383be0b30f3118d5df81db4315bcea1d32e /test/CC
parent3aa07da96b32d1b062ff9cc150fd662f3ef1fa2c (diff)
downloadscons-b9d9cf51e4518f5a286634f6afd734400b640238.tar.gz
More test fixes.
Diffstat (limited to 'test/CC')
-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
8 files changed, 16 insertions, 63 deletions
diff --git a/test/CC/CCCOM.py b/test/CC/CCCOM.py
index 8d06942e..f930ecda 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 6874406f..0be9971b 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 b624bf26..5f121fc7 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 006a80e7..689b6e77 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 15bfa858..0983a67d 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 00000000..3f2bc0f0
--- /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 00000000..b96c31c6
--- /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 00000000..9c281d7a
--- /dev/null
+++ b/test/CC/shared-fixture/test1.c
@@ -0,0 +1,2 @@
+test1.c
+/*cc*/