diff options
Diffstat (limited to 'test/Fortran/SHF77.py')
-rw-r--r-- | test/Fortran/SHF77.py | 78 |
1 files changed, 21 insertions, 57 deletions
diff --git a/test/Fortran/SHF77.py b/test/Fortran/SHF77.py index 3f1f7e7..3671449 100644 --- a/test/Fortran/SHF77.py +++ b/test/Fortran/SHF77.py @@ -31,6 +31,7 @@ import TestSCons _python_ = TestSCons._python_ _obj = TestSCons._shobj +obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() @@ -40,7 +41,7 @@ test.write('myfortran.py', r""" import getopt import sys comment = '#' + sys.argv[1] -opts, args = getopt.getopt(sys.argv[2:], 'cf:o:') +opts, args = getopt.getopt(sys.argv[2:], 'cf:o:K:') for opt, arg in opts: if opt == '-o': out = arg infile = open(args[0], 'rb') @@ -66,19 +67,6 @@ env.SharedObject(target = 'test07', source = 'test07.fpp') env.SharedObject(target = 'test08', source = 'test08.FPP') env.SharedObject(target = 'test09', source = 'test09.f77') env.SharedObject(target = 'test10', source = 'test10.F77') -env.SharedObject(target = 'test11', source = 'test11.f90') -env.SharedObject(target = 'test12', source = 'test12.F90') -env.SharedObject(target = 'test13', source = 'test13.f95') -env.SharedObject(target = 'test14', source = 'test14.F95') -env2 = Environment(SHF77 = r'%(_python_)s myfortran.py g77') -env2.SharedObject(target = 'test21', source = 'test21.f') -env2.SharedObject(target = 'test22', source = 'test22.F') -env2.SharedObject(target = 'test23', source = 'test23.for') -env2.SharedObject(target = 'test24', source = 'test24.FOR') -env2.SharedObject(target = 'test25', source = 'test25.ftn') -env2.SharedObject(target = 'test26', source = 'test26.FTN') -env2.SharedObject(target = 'test27', source = 'test27.fpp') -env2.SharedObject(target = 'test28', source = 'test28.FPP') """ % locals()) test.write('test01.f', "This is a .f file.\n#fortran\n") @@ -91,51 +79,23 @@ test.write('test07.fpp', "This is a .fpp file.\n#fortran\n") test.write('test08.FPP', "This is a .FPP file.\n#fortran\n") test.write('test09.f77', "This is a .f77 file.\n#g77\n") test.write('test10.F77', "This is a .F77 file.\n#g77\n") -test.write('test11.f90', "This is a .f90 file.\n#fortran\n") -test.write('test12.F90', "This is a .F90 file.\n#fortran\n") -test.write('test13.f95', "This is a .f95 file.\n#fortran\n") -test.write('test14.F95', "This is a .F95 file.\n#fortran\n") - -test.write('test21.f', "This is a .f file.\n#g77\n") -test.write('test22.F', "This is a .F file.\n#g77\n") -test.write('test23.for', "This is a .for file.\n#g77\n") -test.write('test24.FOR', "This is a .FOR file.\n#g77\n") -test.write('test25.ftn', "This is a .ftn file.\n#g77\n") -test.write('test26.FTN', "This is a .FTN file.\n#g77\n") -test.write('test27.fpp', "This is a .fpp file.\n#g77\n") -test.write('test28.FPP', "This is a .FPP file.\n#g77\n") test.run(arguments = '.', stderr = None) -test.must_match('test01' + _obj, "This is a .f file.\n") -test.must_match('test02' + _obj, "This is a .F file.\n") -test.must_match('test03' + _obj, "This is a .for file.\n") -test.must_match('test04' + _obj, "This is a .FOR file.\n") -test.must_match('test05' + _obj, "This is a .ftn file.\n") -test.must_match('test06' + _obj, "This is a .FTN file.\n") -test.must_match('test07' + _obj, "This is a .fpp file.\n") -test.must_match('test08' + _obj, "This is a .FPP file.\n") -test.must_match('test09' + _obj, "This is a .f77 file.\n") -test.must_match('test10' + _obj, "This is a .F77 file.\n") -test.must_match('test11' + _obj, "This is a .f90 file.\n") -test.must_match('test12' + _obj, "This is a .F90 file.\n") -test.must_match('test13' + _obj, "This is a .f95 file.\n") -test.must_match('test14' + _obj, "This is a .F95 file.\n") +test.must_match(obj_ + 'test01' + _obj, "This is a .f file.\n") +test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n") +test.must_match(obj_ + 'test03' + _obj, "This is a .for file.\n") +test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n") +test.must_match(obj_ + 'test05' + _obj, "This is a .ftn file.\n") +test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n") +test.must_match(obj_ + 'test07' + _obj, "This is a .fpp file.\n") +test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n") +test.must_match(obj_ + 'test09' + _obj, "This is a .f77 file.\n") -test.must_match('test21' + _obj, "This is a .f file.\n") -test.must_match('test22' + _obj, "This is a .F file.\n") -test.must_match('test23' + _obj, "This is a .for file.\n") -test.must_match('test24' + _obj, "This is a .FOR file.\n") -test.must_match('test25' + _obj, "This is a .ftn file.\n") -test.must_match('test26' + _obj, "This is a .FTN file.\n") -test.must_match('test27' + _obj, "This is a .fpp file.\n") -test.must_match('test28' + _obj, "This is a .FPP file.\n") +fc = 'f77' +f77 = test.detect_tool(fc) - - -g77 = test.detect('F77', 'g77') - -if g77: +if f77: test.write("wrapper.py", """import os @@ -146,9 +106,9 @@ os.system(string.join(sys.argv[1:], " ")) """ % string.replace(test.workpath('wrapper.out'), '\\', '\\\\')) test.write('SConstruct', """ -foo = Environment(LIBS = 'g2c') +foo = Environment(SHF77 = '%(fc)s') shf77 = foo.Dictionary('SHF77') -bar = foo.Clone(SHF77 = r'%(_python_)s wrapper.py ' + shf77) +bar = foo.Clone(SHF77 = r'%(_python_)s wrapper.py ' + shf77, tools = ['default', 'f77'], F77FILESUFFIXES = ['.f']) foo.SharedObject(target = 'foo/foo', source = 'foo.f') bar.SharedObject(target = 'bar/bar', source = 'bar.f') """ % locals()) @@ -172,7 +132,11 @@ bar.SharedObject(target = 'bar/bar', source = 'bar.f') test.must_not_exist('wrapper.out') - test.run(arguments = 'bar') + import sys + if sys.platform[:5] == 'sunos': + test.run(arguments = 'bar', stderr = None) + else: + test.run(arguments = 'bar') test.must_match('wrapper.out', "wrapper.py\n") |