diff options
Diffstat (limited to 'test/Fortran/SHFORTRAN.py')
-rw-r--r-- | test/Fortran/SHFORTRAN.py | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/test/Fortran/SHFORTRAN.py b/test/Fortran/SHFORTRAN.py index 5b9cfc6..ad575dd 100644 --- a/test/Fortran/SHFORTRAN.py +++ b/test/Fortran/SHFORTRAN.py @@ -31,6 +31,7 @@ import TestSCons _python_ = TestSCons._python_ _obj = TestSCons._shobj +obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() @@ -39,7 +40,7 @@ test = TestSCons.TestSCons() test.write('myfortran.py', r""" import getopt import sys -opts, args = getopt.getopt(sys.argv[1:], 'cf:o:') +opts, args = getopt.getopt(sys.argv[1:], 'cf:o:K:') for opt, arg in opts: if opt == '-o': out = arg infile = open(args[0], 'rb') @@ -62,12 +63,6 @@ env.SharedObject(target = 'test05', source = 'test05.ftn') env.SharedObject(target = 'test06', source = 'test06.FTN') 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') """ % locals()) test.write('test01.f', "This is a .f file.\n#fortran\n") @@ -78,33 +73,22 @@ test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") test.write('test06.FTN', "This is a .FTN file.\n#fortran\n") 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#fortran\n") -test.write('test10.F77', "This is a .F77 file.\n#fortran\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.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") -fortran = test.detect('FORTRAN', 'g77') +fc = 'f77' +fortran = test.detect_tool(fc) if fortran: @@ -117,7 +101,7 @@ os.system(string.join(sys.argv[1:], " ")) """ % string.replace(test.workpath('wrapper.out'), '\\', '\\\\')) test.write('SConstruct', """ -foo = Environment(LIBS = 'g2c') +foo = Environment(SHFORTRAN = '%(fc)s') shfortran = foo.Dictionary('SHFORTRAN') bar = foo.Clone(SHFORTRAN = r'%(_python_)s wrapper.py ' + shfortran) foo.SharedObject(target = 'foo/foo', source = 'foo.f') @@ -141,9 +125,13 @@ bar.SharedObject(target = 'bar/bar', source = 'bar.f') test.run(arguments = 'foo', stderr = None) - test.must_exist('wrapper.out') + 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") |