diff options
author | William Blevins <wblevins001@gmail.com> | 2016-10-03 06:08:04 (GMT) |
---|---|---|
committer | William Blevins <wblevins001@gmail.com> | 2016-10-03 06:08:04 (GMT) |
commit | 5587089a661a520a32c353ea886939cd63a0636a (patch) | |
tree | 22bf17e710505ff6f6bcf5cc4aa7badfc958d5f2 /test/LINK | |
parent | 6dd3fd8b838d18d65edd6e7adabf3a363437f8a9 (diff) | |
download | SCons-5587089a661a520a32c353ea886939cd63a0636a.zip SCons-5587089a661a520a32c353ea886939cd63a0636a.tar.gz SCons-5587089a661a520a32c353ea886939cd63a0636a.tar.bz2 |
Moved common my<xxx>.py functions to global fixture and resolve byte/str.
Diffstat (limited to 'test/LINK')
-rw-r--r-- | test/LINK/LINKCOM.py | 14 | ||||
-rw-r--r-- | test/LINK/LINKCOMSTR.py | 14 | ||||
-rw-r--r-- | test/LINK/SHLINKCOM.py | 29 | ||||
-rw-r--r-- | test/LINK/SHLINKCOMSTR.py | 30 |
4 files changed, 12 insertions, 75 deletions
diff --git a/test/LINK/LINKCOM.py b/test/LINK/LINKCOM.py index 996e727..da12b10 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 8163016..df070fb 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 1204ed1..9907db5 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 5663a1e..4dd5c7c 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())) |