summaryrefslogtreecommitdiff
path: root/test/LINK
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-10-03 02:08:04 -0400
committerWilliam Blevins <wblevins001@gmail.com>2016-10-03 02:08:04 -0400
commit5587089a661a520a32c353ea886939cd63a0636a (patch)
tree22bf17e710505ff6f6bcf5cc4aa7badfc958d5f2 /test/LINK
parent6dd3fd8b838d18d65edd6e7adabf3a363437f8a9 (diff)
downloadscons-git-5587089a661a520a32c353ea886939cd63a0636a.tar.gz
Moved common my<xxx>.py functions to global fixture and resolve byte/str.
Diffstat (limited to 'test/LINK')
-rw-r--r--test/LINK/LINKCOM.py14
-rw-r--r--test/LINK/LINKCOMSTR.py14
-rw-r--r--test/LINK/SHLINKCOM.py29
-rw-r--r--test/LINK/SHLINKCOMSTR.py30
4 files changed, 12 insertions, 75 deletions
diff --git a/test/LINK/LINKCOM.py b/test/LINK/LINKCOM.py
index 996e727d4..da12b10f2 100644
--- a/test/LINK/LINKCOM.py
+++ b/test/LINK/LINKCOM.py
@@ -34,18 +34,10 @@ _python_ = TestSCons._python_
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 != b'/*link*/\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture('mycompile.py')
test.write('SConstruct', """
-env = Environment(LINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES',
+env = Environment(LINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES',
OBJSUFFIX = '.obj',
PROGSUFFIX = '.exe')
env.Program(target = 'test1', source = ['test1.obj', 'test2.obj'])
@@ -65,8 +57,6 @@ test.run()
test.must_match('test1.exe', "test1.obj\ntest2.obj\n")
-
-
test.pass_test()
# Local Variables:
diff --git a/test/LINK/LINKCOMSTR.py b/test/LINK/LINKCOMSTR.py
index 8163016f2..df070fb7b 100644
--- a/test/LINK/LINKCOMSTR.py
+++ b/test/LINK/LINKCOMSTR.py
@@ -35,20 +35,10 @@ _python_ = TestSCons._python_
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 != b'/*link*/\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture('mycompile.py')
test.write('SConstruct', """
-env = Environment(LINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES',
+env = Environment(LINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES',
LINKCOMSTR = 'Linking $TARGET from $SOURCES',
OBJSUFFIX = '.obj',
PROGSUFFIX = '.exe')
diff --git a/test/LINK/SHLINKCOM.py b/test/LINK/SHLINKCOM.py
index 1204ed1da..9907db5e4 100644
--- a/test/LINK/SHLINKCOM.py
+++ b/test/LINK/SHLINKCOM.py
@@ -34,31 +34,11 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('mycc.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 != b'/*cc*/\n']:
- outfile.write(l)
-sys.exit(0)
-
-""")
-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 != b'/*link*/\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture('mycompile.py')
test.write('SConstruct', """
-env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCES',
- SHLINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES',
+env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCES',
+ SHLINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES',
SHOBJSUFFIX = '.obj',
SHLIBPREFIX = '',
SHLIBSUFFIX = '.dll')
@@ -83,9 +63,6 @@ test.run()
test.must_match('test3.dll', "test1.c\ntest2.c\n")
-
-
-
test.pass_test()
# Local Variables:
diff --git a/test/LINK/SHLINKCOMSTR.py b/test/LINK/SHLINKCOMSTR.py
index 5663a1e43..4dd5c7c13 100644
--- a/test/LINK/SHLINKCOMSTR.py
+++ b/test/LINK/SHLINKCOMSTR.py
@@ -36,31 +36,11 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('mycc.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 != b'/*cc*/\n']:
- outfile.write(l)
-sys.exit(0)
-
-""")
-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 != b'/*link*/\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture('mycompile.py')
test.write('SConstruct', """
-env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCES',
- SHLINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES',
+env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCES',
+ SHLINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES',
SHLINKCOMSTR = 'Linking shared $TARGET from $SOURCES',
SHOBJPREFIX = '',
SHOBJSUFFIX = '.obj',
@@ -84,8 +64,8 @@ test2.c
""")
test.run(stdout = test.wrap_stdout("""\
-%(_python_)s mycc.py test1.obj test1.c
-%(_python_)s mycc.py test2.obj test2.c
+%(_python_)s mycompile.py cc test1.obj test1.c
+%(_python_)s mycompile.py cc test2.obj test2.c
Linking shared test3.dll from test1.obj test2.obj
""" % locals()))