From 5587089a661a520a32c353ea886939cd63a0636a Mon Sep 17 00:00:00 2001 From: William Blevins Date: Mon, 3 Oct 2016 02:08:04 -0400 Subject: Moved common my.py functions to global fixture and resolve byte/str. --- test/AR/ARCOM.py | 26 ++++----------- test/AR/ARCOMSTR.py | 26 ++++----------- test/AS/ASCOM.py | 31 ++++++------------ test/AS/ASCOMSTR.py | 23 ++++---------- test/AS/ASPPCOM.py | 23 ++++---------- test/AS/ASPPCOMSTR.py | 19 +++-------- test/CC/CCCOM.py | 9 +++--- test/CC/CCCOMSTR.py | 9 +++--- test/CC/SHCCCOM.py | 8 ++--- test/CC/SHCCCOMSTR.py | 7 ++-- test/CC/shared-fixture/.exclude_tests | 1 - test/CC/shared-fixture/mycc.py | 6 ---- test/CC/shared-fixture/test1.c | 2 -- test/CXX/CXXCOM.py | 16 ++-------- test/CXX/CXXCOMSTR.py | 14 ++------ test/CXX/SHCXXCOM.py | 15 ++------- test/CXX/SHCXXCOMSTR.py | 16 ++-------- test/DVIPDF/DVIPDFCOM.py | 16 ++-------- test/DVIPDF/DVIPDFCOMSTR.py | 16 ++-------- test/DVIPS/PSCOM.py | 16 ++-------- test/DVIPS/PSCOMSTR.py | 16 ++-------- test/Fortran/F03COM.py | 48 +++++++++++----------------- test/Fortran/F03COMSTR.py | 20 +++--------- test/Fortran/F08COM.py | 40 +++++++++-------------- test/Fortran/F08COMSTR.py | 20 +++--------- test/Fortran/F77COM.py | 40 +++++++++-------------- test/Fortran/F77COMSTR.py | 20 +++--------- test/Fortran/F90COM.py | 48 +++++++++++----------------- test/Fortran/F90COMSTR.py | 20 +++--------- test/Fortran/F95COM.py | 52 ++++++++++++------------------ test/Fortran/F95COMSTR.py | 20 +++--------- test/Fortran/FORTRANCOM.py | 34 +++++++------------- test/Fortran/FORTRANCOMSTR.py | 32 +++++++------------ test/Fortran/SHF77COM.py | 43 +++++++++---------------- test/Fortran/SHF77COMSTR.py | 36 ++++++++------------- test/Fortran/SHF90COM.py | 53 ++++++++++++------------------- test/Fortran/SHF90COMSTR.py | 21 +++--------- test/Fortran/SHF95COM.py | 53 ++++++++++++------------------- test/Fortran/SHF95COMSTR.py | 20 +++--------- test/Fortran/SHFORTRANCOM.py | 35 +++++++------------- test/Fortran/SHFORTRANCOMSTR.py | 32 +++++++------------ test/Ghostscript/GSCOM.py | 16 ++-------- test/Ghostscript/GSCOMSTR.py | 16 ++-------- test/IDL/MIDLCOMSTR.py | 16 ++-------- test/Java/JARCOM.py | 15 ++------- test/Java/JARCOMSTR.py | 16 ++-------- test/Java/JAVACCOM.py | 16 ++-------- test/Java/JAVACCOMSTR.py | 16 ++-------- test/Java/JAVAHCOM.py | 16 ++-------- test/Java/JAVAHCOMSTR.py | 18 ++--------- test/Java/RMICCOM.py | 18 ++--------- test/Java/RMICCOMSTR.py | 18 ++--------- test/LEX/LEXCOM.py | 16 ++-------- test/LEX/LEXCOMSTR.py | 16 ++-------- test/LINK/LINKCOM.py | 14 ++------ test/LINK/LINKCOMSTR.py | 14 ++------ test/LINK/SHLINKCOM.py | 29 ++--------------- test/LINK/SHLINKCOMSTR.py | 30 +++-------------- test/MSVC/PCHCOM.py | 16 ++-------- test/MSVC/PCHCOMSTR.py | 16 ++-------- test/MSVC/RCCOM.py | 16 ++-------- test/MSVC/RCCOMSTR.py | 16 ++-------- test/MinGW/RCCOM.py | 14 ++------ test/MinGW/RCCOMSTR.py | 14 ++------ test/RANLIB/RANLIBCOM.py | 28 +++------------- test/RANLIB/RANLIBCOMSTR.py | 28 +++------------- test/SWIG/SWIGCOM.py | 16 ++-------- test/SWIG/SWIGCOMSTR.py | 16 ++-------- test/TAR/TARCOM.py | 15 ++------- test/TAR/TARCOMSTR.py | 16 ++-------- test/TEX/LATEXCOM.py | 16 ++-------- test/TEX/LATEXCOMSTR.py | 16 ++-------- test/TEX/PDFLATEXCOM.py | 16 ++-------- test/TEX/PDFLATEXCOMSTR.py | 16 ++-------- test/TEX/PDFTEXCOM.py | 16 ++-------- test/TEX/PDFTEXCOMSTR.py | 16 ++-------- test/TEX/TEXCOM.py | 16 ++-------- test/TEX/TEXCOMSTR.py | 16 ++-------- test/YACC/YACCCOM-fixture/.exclude_tests | 1 - test/YACC/YACCCOM-fixture/myyacc.py | 7 ---- test/YACC/YACCCOM.py | 10 +++--- test/YACC/YACCCOMSTR.py | 10 +++--- test/YACC/shared-fixture/.exclude_tests | 1 - test/YACC/shared-fixture/aaa.y | 2 -- test/YACC/shared-fixture/bbb.yacc | 2 -- test/ZIP/ZIPCOM-fixture/.exclude_tests | 1 - test/ZIP/ZIPCOM-fixture/myzip.py | 6 ---- test/ZIP/ZIPCOM-fixture/test1.in | 2 -- test/ZIP/ZIPCOM.py | 6 ++-- test/ZIP/ZIPCOMSTR-fixture/.exclude_tests | 1 - test/ZIP/ZIPCOMSTR-fixture/aaa.in | 2 -- test/ZIP/ZIPCOMSTR-fixture/myzip.py | 7 ---- test/ZIP/ZIPCOMSTR.py | 6 ++-- test/fixture/mycompile.py | 8 +++++ test/fixture/myrewrite.py | 7 ++++ 95 files changed, 421 insertions(+), 1299 deletions(-) delete mode 100644 test/CC/shared-fixture/.exclude_tests delete mode 100644 test/CC/shared-fixture/mycc.py delete mode 100644 test/CC/shared-fixture/test1.c delete mode 100644 test/YACC/YACCCOM-fixture/.exclude_tests delete mode 100644 test/YACC/YACCCOM-fixture/myyacc.py delete mode 100644 test/YACC/shared-fixture/.exclude_tests delete mode 100644 test/YACC/shared-fixture/aaa.y delete mode 100644 test/YACC/shared-fixture/bbb.yacc delete mode 100644 test/ZIP/ZIPCOM-fixture/.exclude_tests delete mode 100644 test/ZIP/ZIPCOM-fixture/myzip.py delete mode 100644 test/ZIP/ZIPCOM-fixture/test1.in delete mode 100644 test/ZIP/ZIPCOMSTR-fixture/.exclude_tests delete mode 100644 test/ZIP/ZIPCOMSTR-fixture/aaa.in delete mode 100644 test/ZIP/ZIPCOMSTR-fixture/myzip.py create mode 100644 test/fixture/mycompile.py create mode 100644 test/fixture/myrewrite.py diff --git a/test/AR/ARCOM.py b/test/AR/ARCOM.py index bf2830e..f9d0038 100644 --- a/test/AR/ARCOM.py +++ b/test/AR/ARCOM.py @@ -34,39 +34,25 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myar.py', """ -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'/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') env.Library(target = 'output', source = ['file.1', 'file.2']) """ % locals()) -test.write('file.1', "file.1\n/*ar*/\n") -test.write('file.2', "file.2\n/*ar*/\n") +test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n") +test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n") test.run(arguments = '.') test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/AR/ARCOMSTR.py b/test/AR/ARCOMSTR.py index 1b1a9fb..3235f12 100644 --- a/test/AR/ARCOMSTR.py +++ b/test/AR/ARCOMSTR.py @@ -35,33 +35,21 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myar.py', """ -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'/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', ARCOMSTR = 'Archiving $TARGET from $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') env.Library(target = 'output', source = ['file.1', 'file.2']) """ % locals()) -test.write('file.1', "file.1\n/*ar*/\n") -test.write('file.2', "file.2\n/*ar*/\n") +test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n") +test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n") test.run() @@ -69,8 +57,6 @@ expect = 'Archiving output.lib from file.1 file.2' test.must_contain_all_lines(test.stdout(), [expect]) test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/AS/ASCOM.py b/test/AS/ASCOM.py index 8f91404..ab77586 100644 --- a/test/AS/ASCOM.py +++ b/test/AS/ASCOM.py @@ -36,16 +36,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -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 != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if os.path.normcase('.s') == os.path.normcase('.S'): alt_s_suffix = '.S' @@ -55,7 +46,7 @@ else: alt_asm_suffix = '.asm' test.write('SConstruct', """ -env = Environment(ASCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', OBJSUFFIX = '.obj', SHOBJPREFIX = '', SHOBJSUFFIX = '.shobj') @@ -69,14 +60,14 @@ env.SharedObject(target = 'test7', source = 'test7.asm') env.SharedObject(target = 'test8', source = 'test8%(alt_asm_suffix)s') """ % locals()) -test.write('test1.s', "test1.s\n#as\n") -test.write('test2'+alt_s_suffix, "test2.S\n#as\n") -test.write('test3.asm', "test3.asm\n#as\n") -test.write('test4'+alt_asm_suffix, "test4.ASM\n#as\n") -test.write('test5.s', "test5.s\n#as\n") -test.write('test6'+alt_s_suffix, "test6.S\n#as\n") -test.write('test7.asm', "test7.asm\n#as\n") -test.write('test8'+alt_asm_suffix, "test8.ASM\n#as\n") +test.write('test1.s', "test1.s\n/*as*/\n") +test.write('test2'+alt_s_suffix, "test2.S\n/*as*/\n") +test.write('test3.asm', "test3.asm\n/*as*/\n") +test.write('test4'+alt_asm_suffix, "test4.ASM\n/*as*/\n") +test.write('test5.s', "test5.s\n/*as*/\n") +test.write('test6'+alt_s_suffix, "test6.S\n/*as*/\n") +test.write('test7.asm', "test7.asm\n/*as*/\n") +test.write('test8'+alt_asm_suffix, "test8.ASM\n/*as*/\n") test.run(arguments = '.') @@ -89,8 +80,6 @@ test.must_match('test6.shobj', "test6.S\n") test.must_match('test7.shobj', "test7.asm\n") test.must_match('test8.shobj', "test8.ASM\n") - - test.pass_test() # Local Variables: diff --git a/test/AS/ASCOMSTR.py b/test/AS/ASCOMSTR.py index 39b963f..2aab94c 100644 --- a/test/AS/ASCOMSTR.py +++ b/test/AS/ASCOMSTR.py @@ -37,16 +37,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -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 != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if os.path.normcase('.s') == os.path.normcase('.S'): alt_s_suffix = '.S' @@ -56,7 +47,7 @@ else: alt_asm_suffix = '.asm' test.write('SConstruct', """ -env = Environment(ASCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', ASCOMSTR = 'Assembling $TARGET from $SOURCE', OBJSUFFIX = '.obj') env.Object(target = 'test1', source = 'test1.s') @@ -65,10 +56,10 @@ env.Object(target = 'test3', source = 'test3.asm') env.Object(target = 'test4', source = 'test4%(alt_asm_suffix)s') """ % locals()) -test.write('test1.s', "test1.s\n#as\n") -test.write('test2'+alt_s_suffix, "test2.S\n#as\n") -test.write('test3.asm', "test3.asm\n#as\n") -test.write('test4'+alt_asm_suffix, "test4.ASM\n#as\n") +test.write('test1.s', "test1.s\n/*as*/\n") +test.write('test2'+alt_s_suffix, "test2.S\n/*as*/\n") +test.write('test3.asm', "test3.asm\n/*as*/\n") +test.write('test4'+alt_asm_suffix, "test4.ASM\n/*as*/\n") test.run(stdout = test.wrap_stdout("""\ Assembling test1.obj from test1.s @@ -82,8 +73,6 @@ 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.pass_test() # Local Variables: diff --git a/test/AS/ASPPCOM.py b/test/AS/ASPPCOM.py index 62f859a..ce938bb 100644 --- a/test/AS/ASPPCOM.py +++ b/test/AS/ASPPCOM.py @@ -34,19 +34,10 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -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 != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(ASPPCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASPPCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', OBJSUFFIX = '.obj', SHOBJPREFIX = '', SHOBJSUFFIX = '.shobj') @@ -56,10 +47,10 @@ env.SharedObject(target = 'test3', source = 'test3.spp') env.SharedObject(target = 'test4', source = 'test4.SPP') """ % locals()) -test.write('test1.spp', "test1.spp\n#as\n") -test.write('test2.SPP', "test2.SPP\n#as\n") -test.write('test3.spp', "test3.spp\n#as\n") -test.write('test4.SPP', "test4.SPP\n#as\n") +test.write('test1.spp', "test1.spp\n/*as*/\n") +test.write('test2.SPP', "test2.SPP\n/*as*/\n") +test.write('test3.spp', "test3.spp\n/*as*/\n") +test.write('test4.SPP', "test4.SPP\n/*as*/\n") test.run(arguments = '.') @@ -68,8 +59,6 @@ test.must_match('test2.obj', "test2.SPP\n") test.must_match('test3.shobj', "test3.spp\n") test.must_match('test4.shobj', "test4.SPP\n") - - test.pass_test() # Local Variables: diff --git a/test/AS/ASPPCOMSTR.py b/test/AS/ASPPCOMSTR.py index 0497470..0ee18f5 100644 --- a/test/AS/ASPPCOMSTR.py +++ b/test/AS/ASPPCOMSTR.py @@ -35,27 +35,18 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -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 != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(ASPPCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASPPCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', ASPPCOMSTR = 'Assembling $TARGET from $SOURCE', OBJSUFFIX = '.obj') env.Object(target = 'test1', source = 'test1.spp') env.Object(target = 'test2', source = 'test2.SPP') """ % locals()) -test.write('test1.spp', "test1.spp\n#as\n") -test.write('test2.SPP', "test2.SPP\n#as\n") +test.write('test1.spp', "test1.spp\n/*as*/\n") +test.write('test2.SPP', "test2.SPP\n/*as*/\n") test.run(stdout = test.wrap_stdout("""\ Assembling test1.obj from test1.spp @@ -65,8 +56,6 @@ Assembling test2.obj from test2.SPP test.must_match('test1.obj', "test1.spp\n") test.must_match('test2.obj', "test2.SPP\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/CCCOM.py b/test/CC/CCCOM.py index f930ecd..291dad8 100644 --- a/test/CC/CCCOM.py +++ b/test/CC/CCCOM.py @@ -33,11 +33,10 @@ import os import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -45,12 +44,14 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(CCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.c') env.Object(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + test.write('test2'+alt_c_suffix, """\ test2.C /*cc*/ @@ -61,8 +62,6 @@ test.run() test.must_match('test1.obj', "test1.c\n") test.must_match('test2.obj', "test2.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/CCCOMSTR.py b/test/CC/CCCOMSTR.py index 0be9971..9977243 100644 --- a/test/CC/CCCOMSTR.py +++ b/test/CC/CCCOMSTR.py @@ -34,11 +34,10 @@ import os import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -46,13 +45,15 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(CCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', CCCOMSTR = 'Building $TARGET from $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.c') env.Object(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + test.write('test2'+alt_c_suffix, """\ test2.C /*cc*/ @@ -66,8 +67,6 @@ Building test2.obj from test2%(alt_c_suffix)s test.must_match('test1.obj', "test1.c\n") test.must_match('test2.obj', "test2.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/SHCCCOM.py b/test/CC/SHCCCOM.py index 689b6e7..5326c01 100644 --- a/test/CC/SHCCCOM.py +++ b/test/CC/SHCCCOM.py @@ -36,7 +36,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -44,13 +44,15 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') env.SharedObject(target = 'test1', source = 'test1.c') env.SharedObject(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + test.write('test2'+alt_c_suffix, """\ test2.C /*cc*/ @@ -61,8 +63,6 @@ test.run() test.must_match('test1.obj', "test1.c\n") test.must_match('test2.obj', "test2.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/SHCCCOMSTR.py b/test/CC/SHCCCOMSTR.py index 0983a67..75f3aad 100644 --- a/test/CC/SHCCCOMSTR.py +++ b/test/CC/SHCCCOMSTR.py @@ -34,11 +34,10 @@ import os import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -46,7 +45,7 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', SHCCCOMSTR = 'Building $TARGET from $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') @@ -54,6 +53,8 @@ env.SharedObject(target = 'test1', source = 'test1.c') env.SharedObject(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + 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 deleted file mode 100644 index 3f2bc0f..0000000 --- a/test/CC/shared-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -mycc.py diff --git a/test/CC/shared-fixture/mycc.py b/test/CC/shared-fixture/mycc.py deleted file mode 100644 index b96c31c..0000000 --- a/test/CC/shared-fixture/mycc.py +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 9c281d7..0000000 --- a/test/CC/shared-fixture/test1.c +++ /dev/null @@ -1,2 +0,0 @@ -test1.c -/*cc*/ diff --git a/test/CXX/CXXCOM.py b/test/CXX/CXXCOM.py index a3da81a..307ab13 100644 --- a/test/CXX/CXXCOM.py +++ b/test/CXX/CXXCOM.py @@ -31,25 +31,15 @@ Test the ability to configure the $CXXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_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[:7] != '/*c++*/']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.cpp') env.Object(target = 'test2', source = 'test2.cc') @@ -75,8 +65,6 @@ test.must_match('test4.obj', "test4.c++\n") test.must_match('test5.obj', "test5.C++\n") test.must_match('test6.obj', "test6.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CXX/CXXCOMSTR.py b/test/CXX/CXXCOMSTR.py index 9d54e91..f7494ca 100644 --- a/test/CXX/CXXCOMSTR.py +++ b/test/CXX/CXXCOMSTR.py @@ -32,25 +32,15 @@ the C++ compilation output. import TestSCons _python_ = TestSCons._python_ -_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 != '/*c++*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', CXXCOMSTR = 'Building $TARGET from $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.cpp') diff --git a/test/CXX/SHCXXCOM.py b/test/CXX/SHCXXCOM.py index 7f151ed..72e247a 100644 --- a/test/CXX/SHCXXCOM.py +++ b/test/CXX/SHCXXCOM.py @@ -31,25 +31,15 @@ Test the ability to configure the $SHCXXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_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[:7] != '/*c++*/']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') env.SharedObject(target = 'test1', source = 'test1.cpp') @@ -76,7 +66,6 @@ test.must_match('test4.obj', "test4.c++\n") test.must_match('test5.obj', "test5.C++\n") test.must_match('test6.obj', "test6.C\n") - test.pass_test() # Local Variables: diff --git a/test/CXX/SHCXXCOMSTR.py b/test/CXX/SHCXXCOMSTR.py index 716c9ad..77075e4 100644 --- a/test/CXX/SHCXXCOMSTR.py +++ b/test/CXX/SHCXXCOMSTR.py @@ -32,25 +32,15 @@ the shared object C++ compilation output. import TestSCons _python_ = TestSCons._python_ -_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 != '/*c++*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', SHCXXCOMSTR = 'Building shared object $TARGET from $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') env.SharedObject(target = 'test1', source = 'test1.cpp') @@ -84,8 +74,6 @@ test.must_match('test4.obj', "test4.c++\n") test.must_match('test5.obj', "test5.C++\n") test.must_match('test6.obj', "test6.C\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPDF/DVIPDFCOM.py b/test/DVIPDF/DVIPDFCOM.py index 362279e..ddc42b6 100644 --- a/test/DVIPDF/DVIPDFCOM.py +++ b/test/DVIPDF/DVIPDFCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypdf.py', """ -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 != '/*pdf*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvipdf'], - DVIPDFCOM = r'%(_python_)s mypdf.py $TARGET $SOURCES') + DVIPDFCOM = r'%(_python_)s mycompile.py pdf $TARGET $SOURCES') env.PDF(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -58,8 +48,6 @@ test.run() test.must_match('aaa.pdf', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPDF/DVIPDFCOMSTR.py b/test/DVIPDF/DVIPDFCOMSTR.py index 0063e84..7cf221c 100644 --- a/test/DVIPDF/DVIPDFCOMSTR.py +++ b/test/DVIPDF/DVIPDFCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypdf.py', """ -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 != '/*pdf*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvipdf'], - DVIPDFCOM = r'%(_python_)s mypdf.py $TARGET $SOURCES', + DVIPDFCOM = r'%(_python_)s mycompile.py pdf $TARGET $SOURCES', DVIPDFCOMSTR = 'DVIPDFing $TARGET from $SOURCE') env.PDF(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -62,8 +52,6 @@ DVIPDFing aaa.pdf from aaa.dvi test.must_match('aaa.pdf', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPS/PSCOM.py b/test/DVIPS/PSCOM.py index fe4832b..1b90736 100644 --- a/test/DVIPS/PSCOM.py +++ b/test/DVIPS/PSCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myps.py', """ -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 != '/*ps*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvips'], - PSCOM = r'%(_python_)s myps.py $TARGET $SOURCES') + PSCOM = r'%(_python_)s mycompile.py ps $TARGET $SOURCES') env.PostScript(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -58,8 +48,6 @@ test.run() test.must_match('aaa.ps', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPS/PSCOMSTR.py b/test/DVIPS/PSCOMSTR.py index 7c57ded..0d754d2 100644 --- a/test/DVIPS/PSCOMSTR.py +++ b/test/DVIPS/PSCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myps.py', """ -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 != '/*ps*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvips'], - PSCOM = r'%(_python_)s myps.py $TARGET $SOURCES', + PSCOM = r'%(_python_)s mycompile.py ps $TARGET $SOURCES', PSCOMSTR = 'PostScripting $TARGET from $SOURCE') env.PostScript(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -62,8 +52,6 @@ PostScripting aaa.ps from aaa.dvi test.must_match('aaa.ps', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/Fortran/F03COM.py b/test/Fortran/F03COM.py index dc1523e..4a42d22 100644 --- a/test/Fortran/F03COM.py +++ b/test/Fortran/F03COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F03COM = r'%(_python_)s myfortran.py f03 $TARGET $SOURCES', - F03PPCOM = r'%(_python_)s myfortran.py f03pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F03COM = r'%(_python_)s mycompile.py f03 $TARGET $SOURCES', + F03PPCOM = r'%(_python_)s mycompile.py f03pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,25 +53,25 @@ env.Program(target = 'test13', source = 'test13.f03') env.Program(target = 'test14', source = 'test14.F03') env2 = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F03COM = r'%(_python_)s myfortran.py f03 $TARGET $SOURCES', - F03PPCOM = r'%(_python_)s myfortran.py f03pp $TARGET $SOURCES') + F03COM = r'%(_python_)s mycompile.py f03 $TARGET $SOURCES', + F03PPCOM = r'%(_python_)s mycompile.py f03pp $TARGET $SOURCES') env2.Program(target = 'test21', source = 'test21.f03') env2.Program(target = 'test22', source = 'test22.F03') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test13.f03', "This is a .f03 file.\n#link\n#f03\n") -test.write('test14.F03', "This is a .F03 file.\n#link\n#f03pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test13.f03', "This is a .f03 file.\n#link\n/*f03*/\n") +test.write('test14.F03', "This is a .F03 file.\n#link\n/*f03pp*/\n") -test.write('test21.f03', "This is a .f03 file.\n#link\n#f03\n") -test.write('test22.F03', "This is a .F03 file.\n#link\n#f03pp\n") +test.write('test21.f03', "This is a .f03 file.\n#link\n/*f03*/\n") +test.write('test22.F03', "This is a .F03 file.\n#link\n/*f03pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F03COMSTR.py b/test/Fortran/F03COMSTR.py index 327c1cd..a3f4e38 100644 --- a/test/Fortran/F03COMSTR.py +++ b/test/Fortran/F03COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f03pp = 'f03' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F03COM = r'%(_python_)s myfc.py f03 $TARGET $SOURCES', +env = Environment(F03COM = r'%(_python_)s mycompile.py f03 $TARGET $SOURCES', F03COMSTR = 'Building f03 $TARGET from $SOURCES', - F03PPCOM = r'%(_python_)s myfc.py f03pp $TARGET $SOURCES', + F03PPCOM = r'%(_python_)s mycompile.py f03pp $TARGET $SOURCES', F03PPCOMSTR = 'Building f03pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f03') env.Object(source = 'test02.F03') """ % locals()) -test.write('test01.f03', "A .f03 file.\n#f03\n") -test.write('test02.F03', "A .F03 file.\n#%s\n" % f03pp) +test.write('test01.f03', "A .f03 file.\n/*f03*/\n") +test.write('test02.F03', "A .F03 file.\n/*%s*/\n" % f03pp) test.run(stdout = test.wrap_stdout("""\ Building f03 test01.obj from test01.f03 diff --git a/test/Fortran/F08COM.py b/test/Fortran/F08COM.py index 363c2d0..ba7d64e 100644 --- a/test/Fortran/F08COM.py +++ b/test/Fortran/F08COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F08COM = r'%(_python_)s myfortran.py f08 $TARGET $SOURCES', - F08PPCOM = r'%(_python_)s myfortran.py f08pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F08COM = r'%(_python_)s mycompile.py f08 $TARGET $SOURCES', + F08PPCOM = r'%(_python_)s mycompile.py f08pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,16 +53,16 @@ env.Program(target = 'test09', source = 'test09.f08') env.Program(target = 'test10', source = 'test10.F08') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test09.f08', "This is a .f08 file.\n#link\n#f08\n") -test.write('test10.F08', "This is a .F08 file.\n#link\n#f08pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test09.f08', "This is a .f08 file.\n#link\n/*f08*/\n") +test.write('test10.F08', "This is a .F08 file.\n#link\n/*f08pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F08COMSTR.py b/test/Fortran/F08COMSTR.py index 65bf32c..ba0b506 100644 --- a/test/Fortran/F08COMSTR.py +++ b/test/Fortran/F08COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f08pp = 'f08' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F08COM = r'%(_python_)s myfc.py f08 $TARGET $SOURCES', +env = Environment(F08COM = r'%(_python_)s mycompile.py f08 $TARGET $SOURCES', F08COMSTR = 'Building f08 $TARGET from $SOURCES', - F08PPCOM = r'%(_python_)s myfc.py f08pp $TARGET $SOURCES', + F08PPCOM = r'%(_python_)s mycompile.py f08pp $TARGET $SOURCES', F08PPCOMSTR = 'Building f08pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f08') env.Object(source = 'test02.F08') """ % locals()) -test.write('test01.f08', "A .f08 file.\n#f08\n") -test.write('test02.F08', "A .F08 file.\n#%s\n" % f08pp) +test.write('test01.f08', "A .f08 file.\n/*f08*/\n") +test.write('test02.F08', "A .F08 file.\n/*%s*/\n" % f08pp) test.run(stdout = test.wrap_stdout("""\ Building f08 test01.obj from test01.f08 diff --git a/test/Fortran/F77COM.py b/test/Fortran/F77COM.py index 4e15eea..e7a3cca 100644 --- a/test/Fortran/F77COM.py +++ b/test/Fortran/F77COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F77COM = r'%(_python_)s myfortran.py f77 $TARGET $SOURCES', - F77PPCOM = r'%(_python_)s myfortran.py f77pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', + F77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,16 +53,16 @@ env.Program(target = 'test09', source = 'test09.f77') env.Program(target = 'test10', source = 'test10.F77') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test09.f77', "This is a .f77 file.\n#link\n#f77\n") -test.write('test10.F77', "This is a .F77 file.\n#link\n#f77pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test09.f77', "This is a .f77 file.\n#link\n/*f77*/\n") +test.write('test10.F77', "This is a .F77 file.\n#link\n/*f77pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F77COMSTR.py b/test/Fortran/F77COMSTR.py index 6c89833..2bedf73 100644 --- a/test/Fortran/F77COMSTR.py +++ b/test/Fortran/F77COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f77pp = 'f77' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F77COM = r'%(_python_)s myfc.py f77 $TARGET $SOURCES', +env = Environment(F77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', F77COMSTR = 'Building f77 $TARGET from $SOURCES', - F77PPCOM = r'%(_python_)s myfc.py f77pp $TARGET $SOURCES', + F77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', F77PPCOMSTR = 'Building f77pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test09.f77') env.Object(source = 'test10.F77') """ % locals()) -test.write('test09.f77', "A .f77 file.\n#f77\n") -test.write('test10.F77', "A .F77 file.\n#%s\n" % f77pp) +test.write('test09.f77', "A .f77 file.\n/*f77*/\n") +test.write('test10.F77', "A .F77 file.\n/*%s*/\n" % f77pp) test.run(stdout = test.wrap_stdout("""\ Building f77 test09.obj from test09.f77 diff --git a/test/Fortran/F90COM.py b/test/Fortran/F90COM.py index e3be2a1..a4f37c2 100644 --- a/test/Fortran/F90COM.py +++ b/test/Fortran/F90COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - F90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + F90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,25 +53,25 @@ env.Program(target = 'test11', source = 'test11.f90') env.Program(target = 'test12', source = 'test12.F90') env2 = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - F90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES') + F90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + F90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES') env2.Program(target = 'test21', source = 'test21.f90') env2.Program(target = 'test22', source = 'test22.F90') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test11.f90', "This is a .f90 file.\n#link\n#f90\n") -test.write('test12.F90', "This is a .F90 file.\n#link\n#f90pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test11.f90', "This is a .f90 file.\n#link\n/*f90*/\n") +test.write('test12.F90', "This is a .F90 file.\n#link\n/*f90pp*/\n") -test.write('test21.f90', "This is a .f90 file.\n#link\n#f90\n") -test.write('test22.F90', "This is a .F90 file.\n#link\n#f90pp\n") +test.write('test21.f90', "This is a .f90 file.\n#link\n/*f90*/\n") +test.write('test22.F90', "This is a .F90 file.\n#link\n/*f90pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F90COMSTR.py b/test/Fortran/F90COMSTR.py index 117a5a9..4a0ab75 100644 --- a/test/Fortran/F90COMSTR.py +++ b/test/Fortran/F90COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f90pp = 'f90' @@ -48,17 +38,17 @@ else: f90pp = 'f90pp' test.write('SConstruct', """ -env = Environment(F90COM = r'%(_python_)s myfc.py f90 $TARGET $SOURCES', +env = Environment(F90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', F90COMSTR = 'Building f90 $TARGET from $SOURCES', - F90PPCOM = r'%(_python_)s myfc.py f90pp $TARGET $SOURCES', + F90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', F90PPCOMSTR = 'Building f90pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f90') env.Object(source = 'test02.F90') """ % locals()) -test.write('test01.f90', "A .f90 file.\n#f90\n") -test.write('test02.F90', "A .F90 file.\n#%s\n" % f90pp) +test.write('test01.f90', "A .f90 file.\n/*f90*/\n") +test.write('test02.F90', "A .F90 file.\n/*%s*/\n" % f90pp) test.run(stdout = test.wrap_stdout("""\ Building f90 test01.obj from test01.f90 diff --git a/test/Fortran/F95COM.py b/test/Fortran/F95COM.py index 4761635..32ae594 100644 --- a/test/Fortran/F95COM.py +++ b/test/Fortran/F95COM.py @@ -26,33 +26,21 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons - - _python_ = TestSCons._python_ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - F95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + F95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -65,25 +53,25 @@ env.Program(target = 'test13', source = 'test13.f95') env.Program(target = 'test14', source = 'test14.F95') env2 = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - F95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES') + F95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + F95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES') env2.Program(target = 'test21', source = 'test21.f95') env2.Program(target = 'test22', source = 'test22.F95') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test13.f95', "This is a .f95 file.\n#link\n#f95\n") -test.write('test14.F95', "This is a .F95 file.\n#link\n#f95pp\n") - -test.write('test21.f95', "This is a .f95 file.\n#link\n#f95\n") -test.write('test22.F95', "This is a .F95 file.\n#link\n#f95pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test13.f95', "This is a .f95 file.\n#link\n/*f95*/\n") +test.write('test14.F95', "This is a .F95 file.\n#link\n/*f95pp*/\n") + +test.write('test21.f95', "This is a .f95 file.\n#link\n/*f95*/\n") +test.write('test22.F95', "This is a .F95 file.\n#link\n/*f95pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F95COMSTR.py b/test/Fortran/F95COMSTR.py index 5d162f9..e3bc3ac 100644 --- a/test/Fortran/F95COMSTR.py +++ b/test/Fortran/F95COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f95pp = 'f95' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F95COM = r'%(_python_)s myfc.py f95 $TARGET $SOURCES', +env = Environment(F95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', F95COMSTR = 'Building f95 $TARGET from $SOURCES', - F95PPCOM = r'%(_python_)s myfc.py f95pp $TARGET $SOURCES', + F95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', F95PPCOMSTR = 'Building f95pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f95') env.Object(source = 'test02.F95') """ % locals()) -test.write('test01.f95', "A .f95 file.\n#f95\n") -test.write('test02.F95', "A .F95 file.\n#%s\n" % f95pp) +test.write('test01.f95', "A .f95 file.\n/*f95*/\n") +test.write('test02.F95', "A .F95 file.\n/*%s*/\n" % f95pp) test.run(stdout = test.wrap_stdout("""\ Building f95 test01.obj from test01.f95 diff --git a/test/Fortran/FORTRANCOM.py b/test/Fortran/FORTRANCOM.py index bf84d26..a07d427 100644 --- a/test/Fortran/FORTRANCOM.py +++ b/test/Fortran/FORTRANCOM.py @@ -26,31 +26,19 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons - - _python_ = TestSCons._python_ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -61,14 +49,14 @@ env.Program(target = 'test07', source = 'test07.fpp') env.Program(target = 'test08', source = 'test08.FPP') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/FORTRANCOMSTR.py b/test/Fortran/FORTRANCOMSTR.py index 5efa820..10f7d3f 100644 --- a/test/Fortran/FORTRANCOMSTR.py +++ b/test/Fortran/FORTRANCOMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): fortranpp = 'fortran' @@ -49,9 +39,9 @@ else: test.write('SConstruct', """ -env = Environment(FORTRANCOM = r'%(_python_)s myfc.py fortran $TARGET $SOURCES', +env = Environment(FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', FORTRANCOMSTR = 'Building fortran $TARGET from $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfc.py fortranpp $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES', FORTRANPPCOMSTR = 'Building fortranpp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f') @@ -64,14 +54,14 @@ env.Object(source = 'test07.fpp') env.Object(source = 'test08.FPP') """ % locals()) -test.write('test01.f', "A .f file.\n#fortran\n") -test.write('test02.F', "A .F file.\n#%s\n" % fortranpp) -test.write('test03.for', "A .for file.\n#fortran\n") -test.write('test04.FOR', "A .FOR file.\n#%s\n" % fortranpp) -test.write('test05.ftn', "A .ftn file.\n#fortran\n") -test.write('test06.FTN', "A .FTN file.\n#%s\n" % fortranpp) -test.write('test07.fpp', "A .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "A .FPP file.\n#fortranpp\n") +test.write('test01.f', "A .f file.\n/*fortran*/\n") +test.write('test02.F', "A .F file.\n/*%s*/\n" % fortranpp) +test.write('test03.for', "A .for file.\n/*fortran*/\n") +test.write('test04.FOR', "A .FOR file.\n/*%s*/\n" % fortranpp) +test.write('test05.ftn', "A .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "A .FTN file.\n/*%s*/\n" % fortranpp) +test.write('test07.fpp', "A .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "A .FPP file.\n/*fortranpp*/\n") test.run(stdout = test.wrap_stdout("""\ Building fortran test01.obj from test01.f diff --git a/test/Fortran/SHF77COM.py b/test/Fortran/SHF77COM.py index c99207f..9289fa3 100644 --- a/test/Fortran/SHF77COM.py +++ b/test/Fortran/SHF77COM.py @@ -32,26 +32,13 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHF77COM = r'%(_python_)s myfortran.py f77 $TARGET $SOURCES', - SHF77PPCOM = r'%(_python_)s myfortran.py f77pp $TARGET $SOURCES', - SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHF77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', + SHF77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', + SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -64,16 +51,16 @@ env.SharedObject(target = 'test09', source = 'test09.f77') env.SharedObject(target = 'test10', source = 'test10.F77') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") -test.write('test09.f77', "This is a .f77 file.\n#f77\n") -test.write('test10.F77', "This is a .F77 file.\n#f77pp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") +test.write('test09.f77', "This is a .f77 file.\n/*f77*/\n") +test.write('test10.F77', "This is a .F77 file.\n/*f77pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHF77COMSTR.py b/test/Fortran/SHF77COMSTR.py index 7a43a4a..37d2edf 100644 --- a/test/Fortran/SHF77COMSTR.py +++ b/test/Fortran/SHF77COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f77pp = 'f77' @@ -49,25 +39,25 @@ else: test.write('SConstruct', """ -env = Environment(SHF77COM = r'%(_python_)s myfc.py f77 $TARGET $SOURCES', +env = Environment(SHF77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', SHF77COMSTR = 'Building f77 $TARGET from $SOURCES', - SHF77PPCOM = r'%(_python_)s myfc.py f77pp $TARGET $SOURCES', + SHF77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', SHF77PPCOMSTR = 'Building f77pp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test09.f77') env.SharedObject(source = 'test10.F77') """ % locals()) -test.write('test01.f', "A .f file.\n#f77\n") -test.write('test02.F', "A .F file.\n#%s\n" % f77pp) -test.write('test03.for', "A .for file.\n#f77\n") -test.write('test04.FOR', "A .FOR file.\n#%s\n" % f77pp) -test.write('test05.ftn', "A .ftn file.\n#f77\n") -test.write('test06.FTN', "A .FTN file.\n#%s\n" % f77pp) -test.write('test07.fpp', "A .fpp file.\n#f77pp\n") -test.write('test08.FPP', "A .FPP file.\n#f77pp\n") -test.write('test09.f77', "A .f77 file.\n#f77\n") -test.write('test10.F77', "A .F77 file.\n#%s\n" % f77pp) +test.write('test01.f', "A .f file.\n/*f77*/\n") +test.write('test02.F', "A .F file.\n/*%s*/\n" % f77pp) +test.write('test03.for', "A .for file.\n/*f77*/\n") +test.write('test04.FOR', "A .FOR file.\n/*%s*/\n" % f77pp) +test.write('test05.ftn', "A .ftn file.\n/*f77*/\n") +test.write('test06.FTN', "A .FTN file.\n/*%s*/\n" % f77pp) +test.write('test07.fpp', "A .fpp file.\n/*f77pp*/\n") +test.write('test08.FPP', "A .FPP file.\n/*f77pp*/\n") +test.write('test09.f77', "A .f77 file.\n/*f77*/\n") +test.write('test10.F77', "A .F77 file.\n/*%s*/\n" % f77pp) test.run(stdout = test.wrap_stdout("""\ Building f77 test09.shobj from test09.f77 diff --git a/test/Fortran/SHF90COM.py b/test/Fortran/SHF90COM.py index 415cb9b..9eef8b6 100644 --- a/test/Fortran/SHF90COM.py +++ b/test/Fortran/SHF90COM.py @@ -32,26 +32,13 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHF90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - SHF90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES', - SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', + SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -62,25 +49,25 @@ env.SharedObject(target = 'test07', source = 'test07.fpp') env.SharedObject(target = 'test08', source = 'test08.FPP') env.SharedObject(target = 'test11', source = 'test11.f90') env.SharedObject(target = 'test12', source = 'test12.F90') -env2 = Environment(SHF90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - SHF90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES') +env2 = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES') env2.SharedObject(target = 'test21', source = 'test21.f90') env2.SharedObject(target = 'test22', source = 'test22.F90') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") -test.write('test11.f90', "This is a .f90 file.\n#f90\n") -test.write('test12.F90', "This is a .F90 file.\n#f90pp\n") - -test.write('test21.f90', "This is a .f90 file.\n#f90\n") -test.write('test22.F90', "This is a .F90 file.\n#f90pp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") +test.write('test11.f90', "This is a .f90 file.\n/*f90*/\n") +test.write('test12.F90', "This is a .F90 file.\n/*f90pp*/\n") + +test.write('test21.f90', "This is a .f90 file.\n/*f90*/\n") +test.write('test22.F90', "This is a .F90 file.\n/*f90pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHF90COMSTR.py b/test/Fortran/SHF90COMSTR.py index a3353fa..4ea8ca6 100644 --- a/test/Fortran/SHF90COMSTR.py +++ b/test/Fortran/SHF90COMSTR.py @@ -30,36 +30,25 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f90pp = 'f90' else: f90pp = 'f90pp' - test.write('SConstruct', """ -env = Environment(SHF90COM = r'%(_python_)s myfc.py f90 $TARGET $SOURCES', +env = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', SHF90COMSTR = 'Building f90 $TARGET from $SOURCES', - SHF90PPCOM = r'%(_python_)s myfc.py f90pp $TARGET $SOURCES', + SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', SHF90PPCOMSTR = 'Building f90pp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test01.f90') env.SharedObject(source = 'test02.F90') """ % locals()) -test.write('test01.f90', "A .f90 file.\n#f90\n") -test.write('test02.F90', "A .F90 file.\n#%s\n" % f90pp) +test.write('test01.f90', "A .f90 file.\n/*f90*/\n") +test.write('test02.F90', "A .F90 file.\n/*%s*/\n" % f90pp) test.run(stdout = test.wrap_stdout("""\ Building f90 test01.shobj from test01.f90 diff --git a/test/Fortran/SHF95COM.py b/test/Fortran/SHF95COM.py index 0984b20..e31cf45 100644 --- a/test/Fortran/SHF95COM.py +++ b/test/Fortran/SHF95COM.py @@ -32,26 +32,13 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHF95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - SHF95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES', - SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHF95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + SHF95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', + SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -62,25 +49,25 @@ env.SharedObject(target = 'test07', source = 'test07.fpp') env.SharedObject(target = 'test08', source = 'test08.FPP') env.SharedObject(target = 'test13', source = 'test13.f95') env.SharedObject(target = 'test14', source = 'test14.F95') -env2 = Environment(SHF95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - SHF95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES') +env2 = Environment(SHF95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + SHF95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES') env2.SharedObject(target = 'test21', source = 'test21.f95') env2.SharedObject(target = 'test22', source = 'test22.F95') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") -test.write('test13.f95', "This is a .f95 file.\n#f95\n") -test.write('test14.F95', "This is a .F95 file.\n#f95pp\n") - -test.write('test21.f95', "This is a .f95 file.\n#f95\n") -test.write('test22.F95', "This is a .F95 file.\n#f95pp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") +test.write('test13.f95', "This is a .f95 file.\n/*f95*/\n") +test.write('test14.F95', "This is a .F95 file.\n/*f95pp*/\n") + +test.write('test21.f95', "This is a .f95 file.\n/*f95*/\n") +test.write('test22.F95', "This is a .F95 file.\n/*f95pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHF95COMSTR.py b/test/Fortran/SHF95COMSTR.py index 5aec6b0..2c1282f 100644 --- a/test/Fortran/SHF95COMSTR.py +++ b/test/Fortran/SHF95COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f95pp = 'f95' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(SHF95COM = r'%(_python_)s myfc.py f95 $TARGET $SOURCES', +env = Environment(SHF95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', SHF95COMSTR = 'Building f95 $TARGET from $SOURCES', - SHF95PPCOM = r'%(_python_)s myfc.py f95pp $TARGET $SOURCES', + SHF95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', SHF95PPCOMSTR = 'Building f95pp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test01.f95') env.SharedObject(source = 'test02.F95') """ % locals()) -test.write('test01.f95', "A .f95 file.\n#f95\n") -test.write('test02.F95', "A .F95 file.\n#%s\n" % f95pp) +test.write('test01.f95', "A .f95 file.\n/*f95*/\n") +test.write('test02.F95', "A .F95 file.\n/*%s*/\n" % f95pp) test.run(stdout = test.wrap_stdout("""\ Building f95 test01.shobj from test01.f95 diff --git a/test/Fortran/SHFORTRANCOM.py b/test/Fortran/SHFORTRANCOM.py index f89358d..56958b2 100644 --- a/test/Fortran/SHFORTRANCOM.py +++ b/test/Fortran/SHFORTRANCOM.py @@ -32,24 +32,11 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -60,14 +47,14 @@ env.SharedObject(target = 'test07', source = 'test07.fpp') env.SharedObject(target = 'test08', source = 'test08.FPP') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHFORTRANCOMSTR.py b/test/Fortran/SHFORTRANCOMSTR.py index 3b801db..c58920e 100644 --- a/test/Fortran/SHFORTRANCOMSTR.py +++ b/test/Fortran/SHFORTRANCOMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): fortranpp = 'fortran' @@ -49,9 +39,9 @@ else: test.write('SConstruct', """ -env = Environment(SHFORTRANCOM = r'%(_python_)s myfc.py fortran $TARGET $SOURCES', +env = Environment(SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', SHFORTRANCOMSTR = 'Building fortran $TARGET from $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfc.py fortranpp $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES', SHFORTRANPPCOMSTR = 'Building fortranpp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test01.f') @@ -64,14 +54,14 @@ env.SharedObject(source = 'test07.fpp') env.SharedObject(source = 'test08.FPP') """ % locals()) -test.write('test01.f', "A .f file.\n#fortran\n") -test.write('test02.F', "A .F file.\n#%s\n" % fortranpp) -test.write('test03.for', "A .for file.\n#fortran\n") -test.write('test04.FOR', "A .FOR file.\n#%s\n" % fortranpp) -test.write('test05.ftn', "A .ftn file.\n#fortran\n") -test.write('test06.FTN', "A .FTN file.\n#%s\n" % fortranpp) -test.write('test07.fpp', "A .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "A .FPP file.\n#fortranpp\n") +test.write('test01.f', "A .f file.\n/*fortran*/\n") +test.write('test02.F', "A .F file.\n/*%s*/\n" % fortranpp) +test.write('test03.for', "A .for file.\n/*fortran*/\n") +test.write('test04.FOR', "A .FOR file.\n/*%s*/\n" % fortranpp) +test.write('test05.ftn', "A .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "A .FTN file.\n/*%s*/\n" % fortranpp) +test.write('test07.fpp', "A .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "A .FPP file.\n/*fortranpp*/\n") test.run(stdout = test.wrap_stdout("""\ Building fortran test01.shobj from test01.f diff --git a/test/Ghostscript/GSCOM.py b/test/Ghostscript/GSCOM.py index c86f8b6..fd14ad8 100644 --- a/test/Ghostscript/GSCOM.py +++ b/test/Ghostscript/GSCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mygs.py', """ -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 != '/*gs*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'gs'], - GSCOM = r'%(_python_)s mygs.py $TARGET $SOURCES') + GSCOM = r'%(_python_)s mycompile.py gs $TARGET $SOURCES') env.PDF(target = 'aaa', source = 'aaa.ps') """ % locals()) @@ -58,8 +48,6 @@ test.run(arguments = '.') test.must_match('aaa.pdf', "aaa.ps\n") - - test.pass_test() # Local Variables: diff --git a/test/Ghostscript/GSCOMSTR.py b/test/Ghostscript/GSCOMSTR.py index b39cf4f..fd82bff 100644 --- a/test/Ghostscript/GSCOMSTR.py +++ b/test/Ghostscript/GSCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mygs.py', """ -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 != '/*gs*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'gs'], - GSCOM = r'%(_python_)s mygs.py $TARGET $SOURCES', + GSCOM = r'%(_python_)s mycompile.py gs $TARGET $SOURCES', GSCOMSTR = 'GSing $TARGET from $SOURCE') env.PDF(target = 'aaa', source = 'aaa.ps') """ % locals()) @@ -62,8 +52,6 @@ GSing aaa.pdf from aaa.ps test.must_match('aaa.pdf', "aaa.ps\n") - - test.pass_test() # Local Variables: diff --git a/test/IDL/MIDLCOMSTR.py b/test/IDL/MIDLCOMSTR.py index 56f8c40..9e01aa0 100644 --- a/test/IDL/MIDLCOMSTR.py +++ b/test/IDL/MIDLCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mymidl.py', """ -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 != '/*midl*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'midl'], - MIDLCOM = r'%(_python_)s mymidl.py $TARGET $SOURCES', + MIDLCOM = r'%(_python_)s mycompile.py midl $TARGET $SOURCES', MIDLCOMSTR = 'MIDLing $TARGET from $SOURCE') env.TypeLibrary(target = 'aaa', source = 'aaa.idl') """ % locals()) @@ -62,8 +52,6 @@ MIDLing aaa.tlb from aaa.idl test.must_match('aaa.tlb', "aaa.idl\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JARCOM.py b/test/Java/JARCOM.py index 9d93ba5..9146445 100644 --- a/test/Java/JARCOM.py +++ b/test/Java/JARCOM.py @@ -35,20 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - -test.write('myjar.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 != '/*jar*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'jar'], - JARCOM = r'%(_python_)s myjar.py $TARGET $SOURCES') + JARCOM = r'%(_python_)s mycompile.py jar $TARGET $SOURCES') env.Jar(target = 'test1', source = ['file1.in', 'file2.in', 'file3.in']) """ % locals()) @@ -60,8 +51,6 @@ test.run() test.must_match('test1.jar', "file1.in\nfile2.in\nfile3.in\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JARCOMSTR.py b/test/Java/JARCOMSTR.py index 069587f..4bdc45b 100644 --- a/test/Java/JARCOMSTR.py +++ b/test/Java/JARCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myjar.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 != '/*jar*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'jar'], - JARCOM = r'%(_python_)s myjar.py $TARGET $SOURCES', + JARCOM = r'%(_python_)s mycompile.py jar $TARGET $SOURCES', JARCOMSTR = "Jar'ing up $TARGET from $SOURCES") env.Jar(target = 'test1', source = ['file1.in', 'file2.in', 'file3.in']) """ % locals()) @@ -64,8 +54,6 @@ Jar'ing up test1.jar from file1.in file2.in file3.in test.must_match('test1.jar', "file1.in\nfile2.in\nfile3.in\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVACCOM.py b/test/Java/JAVACCOM.py index 064feed..0de173d 100644 --- a/test/Java/JAVACCOM.py +++ b/test/Java/JAVACCOM.py @@ -36,21 +36,11 @@ test = TestSCons.TestSCons() test.subdir('src') - - -test.write('myjavac.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 != '/*javac*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javac'], - JAVACCOM = r'%(_python_)s myjavac.py $TARGET $SOURCES') + JAVACCOM = r'%(_python_)s mycompile.py javac $TARGET $SOURCES') env.Java(target = 'classes', source = 'src') """ % locals()) @@ -63,8 +53,6 @@ test.run() test.must_match(['classes', 'file1.class'], "file1.java\nfile2.java\nfile3.java\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVACCOMSTR.py b/test/Java/JAVACCOMSTR.py index 6440283..8540e13 100644 --- a/test/Java/JAVACCOMSTR.py +++ b/test/Java/JAVACCOMSTR.py @@ -39,21 +39,11 @@ test = TestSCons.TestSCons() test.subdir('src') - - -test.write('myjavac.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 != '/*javac*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javac'], - JAVACCOM = r'%(_python_)s myjavac.py $TARGET $SOURCES', + JAVACCOM = r'%(_python_)s mycompile.py javac $TARGET $SOURCES', JAVACCOMSTR = "Compiling class(es) $TARGET from $SOURCES") env.Java(target = 'classes', source = 'src') """ % locals()) @@ -74,8 +64,6 @@ Compiling class(es) %(classes_file1_class)s from %(src_file1_java)s %(src_file2_ test.must_match(['classes', 'file1.class'], "file1.java\nfile2.java\nfile3.java\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVAHCOM.py b/test/Java/JAVAHCOM.py index 9db897a..801707e 100644 --- a/test/Java/JAVAHCOM.py +++ b/test/Java/JAVAHCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myjavah.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 != '/*javah*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javah'], - JAVAHCOM = r'%(_python_)s myjavah.py $TARGET $SOURCES') + JAVAHCOM = r'%(_python_)s mycompile.py javah $TARGET $SOURCES') env.JavaH(target = 'out', source = 'file1.class') env.JavaH(target = 'out', source = 'file2.class') env.JavaH(target = 'out', source = 'file3.class') @@ -64,8 +54,6 @@ test.must_match(['out', 'file1.h'], "file1.class\n") test.must_match(['out', 'file2.h'], "file2.class\n") test.must_match(['out', 'file3.h'], "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVAHCOMSTR.py b/test/Java/JAVAHCOMSTR.py index f8120d6..c205890 100644 --- a/test/Java/JAVAHCOMSTR.py +++ b/test/Java/JAVAHCOMSTR.py @@ -39,27 +39,15 @@ test = TestSCons.TestSCons() test.subdir('src') - - out_file1_h = os.path.join('out', 'file1.h') out_file2_h = os.path.join('out', 'file2.h') out_file3_h = os.path.join('out', 'file3.h') - - -test.write('myjavah.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 != '/*javah*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javah'], - JAVAHCOM = r'%(_python_)s myjavah.py $TARGET $SOURCES', + JAVAHCOM = r'%(_python_)s mycompile.py javah $TARGET $SOURCES', JAVAHCOMSTR = 'Building javah $TARGET from $SOURCES') env.JavaH(target = 'out', source = 'file1.class') env.JavaH(target = 'out', source = 'file2.class') @@ -80,8 +68,6 @@ test.must_match(['out', 'file1.h'], "file1.class\n") test.must_match(['out', 'file2.h'], "file2.class\n") test.must_match(['out', 'file3.h'], "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/RMICCOM.py b/test/Java/RMICCOM.py index ba7f965..9f6595d 100644 --- a/test/Java/RMICCOM.py +++ b/test/Java/RMICCOM.py @@ -38,27 +38,15 @@ test = TestSCons.TestSCons() test.subdir('src') - - out_file1 = os.path.join('out', 'file1', 'class_Stub.class') out_file2 = os.path.join('out', 'file2', 'class_Stub.class') out_file3 = os.path.join('out', 'file3', 'class_Stub.class') - - -test.write('myrmic.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 != '/*rmic*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'rmic'], - RMICCOM = r'%(_python_)s myrmic.py $TARGET $SOURCES') + RMICCOM = r'%(_python_)s mycompile.py rmic $TARGET $SOURCES') env.RMIC(target = 'out', source = 'file1.class') env.RMIC(target = 'out', source = 'file2.class') env.RMIC(target = 'out', source = 'file3.class') @@ -74,8 +62,6 @@ test.must_match(out_file1, "file1.class\n") test.must_match(out_file2, "file2.class\n") test.must_match(out_file3, "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/RMICCOMSTR.py b/test/Java/RMICCOMSTR.py index 8fe535a..d4d1904 100644 --- a/test/Java/RMICCOMSTR.py +++ b/test/Java/RMICCOMSTR.py @@ -39,27 +39,15 @@ test = TestSCons.TestSCons() test.subdir('src') - - out_file1 = os.path.join('out', 'file1', 'class_Stub.class') out_file2 = os.path.join('out', 'file2', 'class_Stub.class') out_file3 = os.path.join('out', 'file3', 'class_Stub.class') - - -test.write('myrmic.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 != '/*rmic*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'rmic'], - RMICCOM = r'%(_python_)s myrmic.py $TARGET $SOURCES', + RMICCOM = r'%(_python_)s mycompile.py rmic $TARGET $SOURCES', RMICCOMSTR = 'Building rmic $TARGET from $SOURCES') env.RMIC(target = 'out', source = 'file1.class') env.RMIC(target = 'out', source = 'file2.class') @@ -80,8 +68,6 @@ test.must_match(out_file1, "file1.class\n") test.must_match(out_file2, "file2.class\n") test.must_match(out_file3, "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/LEX/LEXCOM.py b/test/LEX/LEXCOM.py index 6a32388..75f21b7 100644 --- a/test/LEX/LEXCOM.py +++ b/test/LEX/LEXCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mylex.py', """ -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'/*lex*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'lex'], - LEXCOM = r'%(_python_)s mylex.py $TARGET $SOURCES') + LEXCOM = r'%(_python_)s mycompile.py lex $TARGET $SOURCES') env.CFile(target = 'aaa', source = 'aaa.l') env.CFile(target = 'bbb', source = 'bbb.lex') """ % locals()) @@ -61,8 +51,6 @@ test.run(arguments = '.') test.must_match('aaa.c', "aaa.l\n") test.must_match('bbb.c', "bbb.lex\n") - - test.pass_test() # Local Variables: diff --git a/test/LEX/LEXCOMSTR.py b/test/LEX/LEXCOMSTR.py index 07e693c..2130d60 100644 --- a/test/LEX/LEXCOMSTR.py +++ b/test/LEX/LEXCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mylex.py', """ -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'/*lex*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'lex'], - LEXCOM = r'%(_python_)s mylex.py $TARGET $SOURCES', + LEXCOM = r'%(_python_)s mycompile.py lex $TARGET $SOURCES', LEXCOMSTR = 'Lexing $TARGET from $SOURCE') env.CFile(target = 'aaa', source = 'aaa.l') env.CFile(target = 'bbb', source = 'bbb.lex') @@ -66,8 +56,6 @@ Lexing bbb.c from bbb.lex test.must_match('aaa.c', "aaa.l\n") test.must_match('bbb.c', "bbb.lex\n") - - test.pass_test() # Local Variables: 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())) diff --git a/test/MSVC/PCHCOM.py b/test/MSVC/PCHCOM.py index ff27e10..fefab92 100644 --- a/test/MSVC/PCHCOM.py +++ b/test/MSVC/PCHCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypch.py', """ -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 != '/*pch*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - PCHCOM = r'%(_python_)s mypch.py $TARGET $SOURCES') + PCHCOM = r'%(_python_)s mycompile.py pch $TARGET $SOURCES') env.PCH(target = 'aaa', source = 'aaa.h') """ % locals()) @@ -58,8 +48,6 @@ test.run(arguments = ".") test.must_match('aaa.pch', "aaa.h\n") - - test.pass_test() # Local Variables: diff --git a/test/MSVC/PCHCOMSTR.py b/test/MSVC/PCHCOMSTR.py index 51f56fb..beea488 100644 --- a/test/MSVC/PCHCOMSTR.py +++ b/test/MSVC/PCHCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypch.py', """ -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 != '/*pch*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - PCHCOM = r'%(_python_)s mypch.py $TARGET $SOURCES', + PCHCOM = r'%(_python_)s mycompile.py pch $TARGET $SOURCES', PCHCOMSTR = 'PCHing $TARGET from $SOURCE') env.PCH(target = 'aaa', source = 'aaa.h') """ % locals()) @@ -62,8 +52,6 @@ PCHing aaa.pch from aaa.h test.must_match('aaa.pch', "aaa.h\n") - - test.pass_test() # Local Variables: diff --git a/test/MSVC/RCCOM.py b/test/MSVC/RCCOM.py index 05382b8..04f8fff 100644 --- a/test/MSVC/RCCOM.py +++ b/test/MSVC/RCCOM.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myrc.py', """ -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 != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES') + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -59,8 +49,6 @@ test.run(arguments = ".") test.must_match('aaa.res', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/MSVC/RCCOMSTR.py b/test/MSVC/RCCOMSTR.py index 8425d73..2630651 100644 --- a/test/MSVC/RCCOMSTR.py +++ b/test/MSVC/RCCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myrc.py', """ -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 != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES', + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES', RCCOMSTR = 'RCing $TARGET from $SOURCE') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -62,8 +52,6 @@ RCing aaa.res from aaa.rc test.must_match('aaa.res', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/MinGW/RCCOM.py b/test/MinGW/RCCOM.py index dadfea5..a4d9147 100644 --- a/test/MinGW/RCCOM.py +++ b/test/MinGW/RCCOM.py @@ -39,19 +39,11 @@ test = TestSCons.TestSCons() if sys.platform in ('irix6',): test.skip_test("Skipping mingw test on non-Windows %s platform."%sys.platform) -test.write('myrc.py', """ -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 != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'mingw'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES') + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -61,8 +53,6 @@ test.run(arguments = ".") test.must_match('aaa.o', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/MinGW/RCCOMSTR.py b/test/MinGW/RCCOMSTR.py index 501a57d..0ed84c2 100644 --- a/test/MinGW/RCCOMSTR.py +++ b/test/MinGW/RCCOMSTR.py @@ -39,19 +39,11 @@ test = TestSCons.TestSCons() if sys.platform in ('irix6',): test.skip_test("Skipping mingw test on non-Windows %s platform."%sys.platform) -test.write('myrc.py', """ -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 != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'mingw'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES', + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES', RCCOMSTR = 'RCing $TARGET from $SOURCE') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -64,8 +56,6 @@ RCing aaa.o from aaa.rc test.must_match('aaa.o', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/RANLIB/RANLIBCOM.py b/test/RANLIB/RANLIBCOM.py index 486a91f..6a3ea0f 100644 --- a/test/RANLIB/RANLIBCOM.py +++ b/test/RANLIB/RANLIBCOM.py @@ -39,31 +39,13 @@ ranlib = test.detect('RANLIB', 'ranlib') if not ranlib: test.skip_test("Could not find 'ranlib', skipping test.\n") - - -test.write('myar.py', """ -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 != '/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -import sys -lines = open(sys.argv[1], 'rb').readlines() -outfile = open(sys.argv[1], 'wb') -for l in [l for l in lines if l != '/*ranlib*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') env.Library(target = 'output', source = ['file.1', 'file.2']) @@ -76,8 +58,6 @@ test.run(arguments = '.') test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/RANLIB/RANLIBCOMSTR.py b/test/RANLIB/RANLIBCOMSTR.py index 6e76cbf..2b8fc83 100644 --- a/test/RANLIB/RANLIBCOMSTR.py +++ b/test/RANLIB/RANLIBCOMSTR.py @@ -42,29 +42,13 @@ if not ranlib: -test.write('myar.py', """ -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 != '/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -import sys -lines = open(sys.argv[1], 'rb').readlines() -outfile = open(sys.argv[1], 'wb') -for l in [l for l in lines if l != '/*ranlib*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', RANLIBCOMSTR = 'Indexing $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') @@ -75,7 +59,7 @@ test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n") test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n") expect = test.wrap_stdout("""\ -%(_python_)s myar.py output.lib file.1 file.2 +%(_python_)s mycompile.py ar output.lib file.1 file.2 Indexing output.lib """ % locals()) @@ -83,8 +67,6 @@ test.run(stdout = expect) test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/SWIG/SWIGCOM.py b/test/SWIG/SWIGCOM.py index ee3ff64..b2d8da2 100644 --- a/test/SWIG/SWIGCOM.py +++ b/test/SWIG/SWIGCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myswig.py', """ -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'/*swig*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'swig'], - SWIGCOM = r'%(_python_)s myswig.py $TARGET $SOURCES') + SWIGCOM = r'%(_python_)s mycompile.py swig $TARGET $SOURCES') env.CFile(target = 'aaa', source = 'aaa.i') env.CXXFile(target = 'bbb', source = 'bbb.i', SWIGFLAGS='-c++') """ % locals()) @@ -61,8 +51,6 @@ test.run(arguments = '.') test.must_match('aaa_wrap.c', "aaa.i\n") test.must_match('bbb_wrap.cc', "bbb.i\n") - - test.pass_test() # Local Variables: diff --git a/test/SWIG/SWIGCOMSTR.py b/test/SWIG/SWIGCOMSTR.py index 24db13e..c2c3df3 100644 --- a/test/SWIG/SWIGCOMSTR.py +++ b/test/SWIG/SWIGCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myswig.py', """ -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'/*swig*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'swig'], - SWIGCOM = r'%(_python_)s myswig.py $TARGET $SOURCES', + SWIGCOM = r'%(_python_)s mycompile.py swig $TARGET $SOURCES', SWIGCOMSTR = 'Swigging $TARGET from $SOURCE') env.CFile(target = 'aaa', source = 'aaa.i') env.CXXFile(target = 'bbb', source = 'bbb.i', SWIGFLAGS='-c++') @@ -66,8 +56,6 @@ Swigging bbb_wrap.cc from bbb.i test.must_match('aaa_wrap.c', "aaa.i\n") test.must_match('bbb_wrap.cc', "bbb.i\n") - - test.pass_test() # Local Variables: diff --git a/test/TAR/TARCOM.py b/test/TAR/TARCOM.py index d1b3662..aaf7b60 100644 --- a/test/TAR/TARCOM.py +++ b/test/TAR/TARCOM.py @@ -34,20 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mytar.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 != '/*tar*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['tar'], - TARCOM = r'%(_python_)s mytar.py $TARGET $SOURCE') + TARCOM = r'%(_python_)s mycompile.py tar $TARGET $SOURCE') env.Tar('test1.tar', 'test1.in') """ % locals()) @@ -60,8 +51,6 @@ test.run() test.must_match('test1.tar', "test1.in\n") - - test.pass_test() # Local Variables: diff --git a/test/TAR/TARCOMSTR.py b/test/TAR/TARCOMSTR.py index 339f0ca..817dc59 100644 --- a/test/TAR/TARCOMSTR.py +++ b/test/TAR/TARCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mytar.py', """ -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 != '/*tar*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['tar'], - TARCOM = r'%(_python_)s mytar.py $TARGET $SOURCES', + TARCOM = r'%(_python_)s mycompile.py tar $TARGET $SOURCES', TARCOMSTR = 'Taring $TARGET from $SOURCE') env.Tar('aaa.tar', 'aaa.in') """ % locals()) @@ -62,8 +52,6 @@ Taring aaa.tar from aaa.in test.must_match('aaa.tar', "aaa.in\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/LATEXCOM.py b/test/TEX/LATEXCOM.py index 2c63864..878d4cf 100644 --- a/test/TEX/LATEXCOM.py +++ b/test/TEX/LATEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $LATEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mylatex.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 != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['latex'], - LATEXCOM = r'%(_python_)s mylatex.py $TARGET $SOURCE') + LATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE') env.DVI('test1', 'test1.latex') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.dvi', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/LATEXCOMSTR.py b/test/TEX/LATEXCOMSTR.py index 4e1b93c..f8a377d 100644 --- a/test/TEX/LATEXCOMSTR.py +++ b/test/TEX/LATEXCOMSTR.py @@ -32,24 +32,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mylatex.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 != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['latex'], - LATEXCOM = r'%(_python_)s mylatex.py $TARGET $SOURCE', + LATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE', LATEXCOMSTR = 'Building $TARGET from $SOURCE') env.DVI('test1', 'test1.latex') """ % locals()) @@ -65,8 +55,6 @@ Building test1.dvi from test1.latex test.must_match('test1.dvi', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFLATEXCOM.py b/test/TEX/PDFLATEXCOM.py index 09283f3..c2b54ce 100644 --- a/test/TEX/PDFLATEXCOM.py +++ b/test/TEX/PDFLATEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $PDFLATEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdflatex.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 != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdflatex'], - PDFLATEXCOM = r'%(_python_)s mypdflatex.py $TARGET $SOURCE') + PDFLATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE') env.PDF('test1', 'test1.latex') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.pdf', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFLATEXCOMSTR.py b/test/TEX/PDFLATEXCOMSTR.py index c751e8e..1d911bd 100644 --- a/test/TEX/PDFLATEXCOMSTR.py +++ b/test/TEX/PDFLATEXCOMSTR.py @@ -33,24 +33,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdflatex.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 != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdflatex'], - PDFLATEXCOM = r'%(_python_)s mypdflatex.py $TARGET $SOURCE', + PDFLATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE', PDFLATEXCOMSTR = 'Building $TARGET from $SOURCE') env.PDF('test1', 'test1.latex') """ % locals()) @@ -66,8 +56,6 @@ Building test1.pdf from test1.latex test.must_match('test1.pdf', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFTEXCOM.py b/test/TEX/PDFTEXCOM.py index 8c31da3..6e915a4 100644 --- a/test/TEX/PDFTEXCOM.py +++ b/test/TEX/PDFTEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $PDFTEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdftex.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 != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdftex'], - PDFTEXCOM = r'%(_python_)s mypdftex.py $TARGET $SOURCE') + PDFTEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE') env.PDF('test1') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.pdf', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFTEXCOMSTR.py b/test/TEX/PDFTEXCOMSTR.py index 13abe7a..7ee5b41 100644 --- a/test/TEX/PDFTEXCOMSTR.py +++ b/test/TEX/PDFTEXCOMSTR.py @@ -33,24 +33,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdftex.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 != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdftex'], - PDFTEXCOM = r'%(_python_)s mypdftex.py $TARGET $SOURCE', + PDFTEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE', PDFTEXCOMSTR = 'Building $TARGET from $SOURCE') env.PDF('test1') """ % locals()) @@ -66,8 +56,6 @@ Building test1.pdf from test1.tex test.must_match('test1.pdf', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/TEXCOM.py b/test/TEX/TEXCOM.py index 1cadd63..9d820bc 100644 --- a/test/TEX/TEXCOM.py +++ b/test/TEX/TEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $TEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mytex.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 != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['tex'], - TEXCOM = r'%(_python_)s mytex.py $TARGET $SOURCE') + TEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE') env.DVI('test1') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.dvi', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/TEXCOMSTR.py b/test/TEX/TEXCOMSTR.py index f1ead7f..0facc6f 100644 --- a/test/TEX/TEXCOMSTR.py +++ b/test/TEX/TEXCOMSTR.py @@ -32,24 +32,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mytex.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 != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['tex'], - TEXCOM = r'%(_python_)s mytex.py $TARGET $SOURCE', + TEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE', TEXCOMSTR = 'Building $TARGET from $SOURCE') env.DVI('test1') """ % locals()) @@ -65,8 +55,6 @@ Building test1.dvi from test1.tex test.must_match('test1.dvi', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/YACC/YACCCOM-fixture/.exclude_tests b/test/YACC/YACCCOM-fixture/.exclude_tests deleted file mode 100644 index f12c4d0..0000000 --- a/test/YACC/YACCCOM-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myyacc.py diff --git a/test/YACC/YACCCOM-fixture/myyacc.py b/test/YACC/YACCCOM-fixture/myyacc.py deleted file mode 100644 index 1502800..0000000 --- a/test/YACC/YACCCOM-fixture/myyacc.py +++ /dev/null @@ -1,7 +0,0 @@ -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'/*yacc*/\n']: - outfile.write(l) -sys.exit(0) diff --git a/test/YACC/YACCCOM.py b/test/YACC/YACCCOM.py index 70ffa72..e9fb47f 100644 --- a/test/YACC/YACCCOM.py +++ b/test/YACC/YACCCOM.py @@ -34,23 +34,23 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') -test.dir_fixture('YACCCOM-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'yacc'], - YACCCOM = r'%(_python_)s myyacc.py $TARGET $SOURCES') + YACCCOM = r'%(_python_)s mycompile.py yacc $TARGET $SOURCES') env.CFile(target = 'aaa', source = 'aaa.y') env.CFile(target = 'bbb', source = 'bbb.yacc') """ % locals()) +test.write('aaa.y', 'aaa.y\n/*yacc*/\n') +test.write('bbb.yacc', 'bbb.yacc\n/*yacc*/\n') + test.run(arguments = '.') test.must_match('aaa.c', "aaa.y\n") test.must_match('bbb.c', "bbb.yacc\n") - - test.pass_test() # Local Variables: diff --git a/test/YACC/YACCCOMSTR.py b/test/YACC/YACCCOMSTR.py index 344b715..bded560 100644 --- a/test/YACC/YACCCOMSTR.py +++ b/test/YACC/YACCCOMSTR.py @@ -35,17 +35,19 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') -test.dir_fixture('YACCCOM-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'yacc'], - YACCCOM = r'%(_python_)s myyacc.py $TARGET $SOURCES', + YACCCOM = r'%(_python_)s mycompile.py yacc $TARGET $SOURCES', YACCCOMSTR = 'Yaccing $TARGET from $SOURCE') env.CFile(target = 'aaa', source = 'aaa.y') env.CFile(target = 'bbb', source = 'bbb.yacc') """ % locals()) +test.write('aaa.y', 'aaa.y\n/*yacc*/\n') +test.write('bbb.yacc', 'bbb.yacc\n/*yacc*/\n') + test.run(stdout = test.wrap_stdout("""\ Yaccing aaa.c from aaa.y Yaccing bbb.c from bbb.yacc @@ -54,8 +56,6 @@ Yaccing bbb.c from bbb.yacc test.must_match('aaa.c', "aaa.y\n") test.must_match('bbb.c', "bbb.yacc\n") - - test.pass_test() # Local Variables: diff --git a/test/YACC/shared-fixture/.exclude_tests b/test/YACC/shared-fixture/.exclude_tests deleted file mode 100644 index f12c4d0..0000000 --- a/test/YACC/shared-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myyacc.py diff --git a/test/YACC/shared-fixture/aaa.y b/test/YACC/shared-fixture/aaa.y deleted file mode 100644 index f7f4cc7..0000000 --- a/test/YACC/shared-fixture/aaa.y +++ /dev/null @@ -1,2 +0,0 @@ -aaa.y -/*yacc*/ diff --git a/test/YACC/shared-fixture/bbb.yacc b/test/YACC/shared-fixture/bbb.yacc deleted file mode 100644 index b3c856f..0000000 --- a/test/YACC/shared-fixture/bbb.yacc +++ /dev/null @@ -1,2 +0,0 @@ -bbb.yacc -/*yacc*/ diff --git a/test/ZIP/ZIPCOM-fixture/.exclude_tests b/test/ZIP/ZIPCOM-fixture/.exclude_tests deleted file mode 100644 index dae6f60..0000000 --- a/test/ZIP/ZIPCOM-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myzip.py diff --git a/test/ZIP/ZIPCOM-fixture/myzip.py b/test/ZIP/ZIPCOM-fixture/myzip.py deleted file mode 100644 index adbc6ac..0000000 --- a/test/ZIP/ZIPCOM-fixture/myzip.py +++ /dev/null @@ -1,6 +0,0 @@ -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 != b'/*zip*/\n']: - outfile.write(l) -sys.exit(0) diff --git a/test/ZIP/ZIPCOM-fixture/test1.in b/test/ZIP/ZIPCOM-fixture/test1.in deleted file mode 100644 index 0546626..0000000 --- a/test/ZIP/ZIPCOM-fixture/test1.in +++ /dev/null @@ -1,2 +0,0 @@ -test1.in -/*zip*/ diff --git a/test/ZIP/ZIPCOM.py b/test/ZIP/ZIPCOM.py index 4d84ccf..c6c1412 100644 --- a/test/ZIP/ZIPCOM.py +++ b/test/ZIP/ZIPCOM.py @@ -34,14 +34,16 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('ZIPCOM-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['zip'], - ZIPCOM = r'%(_python_)s myzip.py $TARGET $SOURCE') + ZIPCOM = r'%(_python_)s mycompile.py zip $TARGET $SOURCE') env.Zip('test1.zip', 'test1.in') """ % locals()) +test.write('test1.in', 'test1.in\n/*zip*/\n') + test.run() test.must_match('test1.zip', "test1.in\n") diff --git a/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests b/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests deleted file mode 100644 index dae6f60..0000000 --- a/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myzip.py diff --git a/test/ZIP/ZIPCOMSTR-fixture/aaa.in b/test/ZIP/ZIPCOMSTR-fixture/aaa.in deleted file mode 100644 index 8474a29..0000000 --- a/test/ZIP/ZIPCOMSTR-fixture/aaa.in +++ /dev/null @@ -1,2 +0,0 @@ -aaa.in -/*zip*/ diff --git a/test/ZIP/ZIPCOMSTR-fixture/myzip.py b/test/ZIP/ZIPCOMSTR-fixture/myzip.py deleted file mode 100644 index f0fcc51..0000000 --- a/test/ZIP/ZIPCOMSTR-fixture/myzip.py +++ /dev/null @@ -1,7 +0,0 @@ -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'/*zip*/\n']: - outfile.write(l) -sys.exit(0) diff --git a/test/ZIP/ZIPCOMSTR.py b/test/ZIP/ZIPCOMSTR.py index a26ed49..af9ba57 100644 --- a/test/ZIP/ZIPCOMSTR.py +++ b/test/ZIP/ZIPCOMSTR.py @@ -35,15 +35,17 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('ZIPCOMSTR-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['zip'], - ZIPCOM = r'%(_python_)s myzip.py $TARGET $SOURCES', + ZIPCOM = r'%(_python_)s mycompile.py zip $TARGET $SOURCES', ZIPCOMSTR = 'Zipping $TARGET from $SOURCE') env.Zip('aaa.zip', 'aaa.in') """ % locals()) +test.write('aaa.in', 'aaa.in\n/*zip*/\n') + test.run(stdout = test.wrap_stdout("""\ Zipping aaa.zip from aaa.in """)) diff --git a/test/fixture/mycompile.py b/test/fixture/mycompile.py new file mode 100644 index 0000000..555c2c8 --- /dev/null +++ b/test/fixture/mycompile.py @@ -0,0 +1,8 @@ +import sys +line = ('/*' + sys.argv[1] + '*/\n').encode() +outfile = open(sys.argv[2], 'wb') +for f in sys.argv[3:]: + infile = open(f, 'rb') + for l in [l for l in infile.readlines() if l != line]: + outfile.write(l) +sys.exit(0) diff --git a/test/fixture/myrewrite.py b/test/fixture/myrewrite.py new file mode 100644 index 0000000..40bf830 --- /dev/null +++ b/test/fixture/myrewrite.py @@ -0,0 +1,7 @@ +import sys +line = ('/*' + sys.argv[1] + '*/\n').encode() +lines = open(sys.argv[2], 'rb').readlines() +outfile = open(sys.argv[2], 'wb') +for l in [l for l in lines if l != line]: + outfile.write(l) +sys.exit(0) -- cgit v0.12