added release.txt blurb. Fixed spelling typo in Defaults.xml
[scons.git] / test / Fortran / F77FLAGS.py
blob01bf33b66c310c665ec936b1cc6f44237be74738
1 #!/usr/bin/env python
3 # __COPYRIGHT__
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
27 import TestSCons
29 _python_ = TestSCons._python_
31 test = TestSCons.TestSCons()
32 _exe = TestSCons._exe
34 test.file_fixture('mylink.py')
35 test.file_fixture(['fixture', 'myfortran_flags.py'])
37 test.write('SConstruct', """
38 env = Environment(LINK = r'%(_python_)s mylink.py',
39 LINKFLAGS = [],
40 F77 = r'%(_python_)s myfortran_flags.py g77',
41 F77FLAGS = '-x')
42 env.Program(target = 'test09', source = 'test09.f77')
43 env.Program(target = 'test10', source = 'test10.F77')
44 """ % locals())
46 test.write('test09.f77', "This is a .f77 file.\n#link\n#g77\n")
47 test.write('test10.F77', "This is a .F77 file.\n#link\n#g77\n")
49 test.run(arguments = '.', stderr = None)
51 test.must_match('test09' + _exe, " -c -x\nThis is a .f77 file.\n")
52 test.must_match('test10' + _exe, " -c -x\nThis is a .F77 file.\n")
55 fc = 'f77'
56 g77 = test.detect_tool(fc)
58 if g77:
60 directory = 'x'
61 test.subdir(directory)
63 test.file_fixture('wrapper.py')
65 test.write('SConstruct', """
66 foo = Environment(F77 = '%(fc)s', tools = ['default', 'f77'], F77FILESUFFIXES = [".f"])
67 f77 = foo.Dictionary('F77')
68 bar = foo.Clone(F77 = r'%(_python_)s wrapper.py ' + f77, F77FLAGS = '-I%(directory)s')
69 foo.Program(target = 'foo', source = 'foo.f')
70 bar.Program(target = 'bar', source = 'bar.f')
71 """ % locals())
73 test.write('foo.f', r"""
74 PROGRAM FOO
75 PRINT *,'foo.f'
76 STOP
77 END
78 """)
80 test.write('bar.f', r"""
81 PROGRAM BAR
82 PRINT *,'bar.f'
83 STOP
84 END
85 """)
88 test.run(arguments = 'foo' + _exe, stderr = None)
90 test.run(program = test.workpath('foo'), stdout = " foo.f\n")
92 test.must_not_exist('wrapper.out')
94 import sys
95 if sys.platform[:5] == 'sunos':
96 test.run(arguments = 'bar' + _exe, stderr = None)
97 else:
98 test.run(arguments = 'bar' + _exe)
100 test.run(program = test.workpath('bar'), stdout = " bar.f\n")
102 test.must_match('wrapper.out', "wrapper.py\n")
104 test.pass_test()
106 # Local Variables:
107 # tab-width:4
108 # indent-tabs-mode:nil
109 # End:
110 # vim: set expandtab tabstop=4 shiftwidth=4: