diff options
author | William Blevins <wblevins001@gmail.com> | 2016-10-03 06:08:04 (GMT) |
---|---|---|
committer | William Blevins <wblevins001@gmail.com> | 2016-10-03 06:08:04 (GMT) |
commit | 5587089a661a520a32c353ea886939cd63a0636a (patch) | |
tree | 22bf17e710505ff6f6bcf5cc4aa7badfc958d5f2 /test/Fortran | |
parent | 6dd3fd8b838d18d65edd6e7adabf3a363437f8a9 (diff) | |
download | SCons-5587089a661a520a32c353ea886939cd63a0636a.zip SCons-5587089a661a520a32c353ea886939cd63a0636a.tar.gz SCons-5587089a661a520a32c353ea886939cd63a0636a.tar.bz2 |
Moved common my<xxx>.py functions to global fixture and resolve byte/str.
Diffstat (limited to 'test/Fortran')
-rw-r--r-- | test/Fortran/F03COM.py | 48 | ||||
-rw-r--r-- | test/Fortran/F03COMSTR.py | 20 | ||||
-rw-r--r-- | test/Fortran/F08COM.py | 40 | ||||
-rw-r--r-- | test/Fortran/F08COMSTR.py | 20 | ||||
-rw-r--r-- | test/Fortran/F77COM.py | 40 | ||||
-rw-r--r-- | test/Fortran/F77COMSTR.py | 20 | ||||
-rw-r--r-- | test/Fortran/F90COM.py | 48 | ||||
-rw-r--r-- | test/Fortran/F90COMSTR.py | 20 | ||||
-rw-r--r-- | test/Fortran/F95COM.py | 52 | ||||
-rw-r--r-- | test/Fortran/F95COMSTR.py | 20 | ||||
-rw-r--r-- | test/Fortran/FORTRANCOM.py | 34 | ||||
-rw-r--r-- | test/Fortran/FORTRANCOMSTR.py | 32 | ||||
-rw-r--r-- | test/Fortran/SHF77COM.py | 43 | ||||
-rw-r--r-- | test/Fortran/SHF77COMSTR.py | 36 | ||||
-rw-r--r-- | test/Fortran/SHF90COM.py | 53 | ||||
-rw-r--r-- | test/Fortran/SHF90COMSTR.py | 21 | ||||
-rw-r--r-- | test/Fortran/SHF95COM.py | 53 | ||||
-rw-r--r-- | test/Fortran/SHF95COMSTR.py | 20 | ||||
-rw-r--r-- | test/Fortran/SHFORTRANCOM.py | 35 | ||||
-rw-r--r-- | test/Fortran/SHFORTRANCOMSTR.py | 32 |
20 files changed, 235 insertions, 452 deletions
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 |