added release.txt blurb. Fixed spelling typo in Defaults.xml
[scons.git] / test / Fortran / SHF77FLAGS.py
blob3a7e6b2d9ac7eb2837eea4b1592dba214233ece0
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 _obj = TestSCons._shobj
32 obj_ = TestSCons.shobj_
34 test = TestSCons.TestSCons()
35 test.file_fixture(['fixture', 'myfortran_flags.py'])
37 test.write('SConstruct', """
38 env = Environment(SHF77 = r'%(_python_)s myfortran_flags.py g77')
39 env.Append(SHF77FLAGS = '-x')
40 env.SharedObject(target = 'test09', source = 'test09.f77')
41 env.SharedObject(target = 'test10', source = 'test10.F77')
42 """ % locals())
44 test.write('test09.f77', "This is a .f77 file.\n#g77\n")
45 test.write('test10.F77', "This is a .F77 file.\n#g77\n")
47 test.run(arguments = '.', stderr = None)
49 test.must_match(obj_ + 'test09' + _obj, " -c -x\nThis is a .f77 file.\n")
50 test.must_match(obj_ + 'test10' + _obj, " -c -x\nThis is a .F77 file.\n")
53 fc = 'f77'
54 g77 = test.detect_tool(fc)
56 if g77:
58 directory = 'x'
59 test.subdir(directory)
61 test.file_fixture('wrapper.py')
63 test.write('SConstruct', """
64 foo = Environment(SHF77 = '%(fc)s')
65 shf77 = foo.Dictionary('SHF77')
66 bar = foo.Clone(SHF77 = r'%(_python_)s wrapper.py ' + shf77,
67 tools = ["default", 'f77'], F77FILESUFFIXES = [".f"])
68 bar.Append(SHF77FLAGS = '-I%(directory)s')
69 foo.SharedLibrary(target = 'foo/foo', source = 'foo.f')
70 bar.SharedLibrary(target = 'bar/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', stderr = None)
90 test.must_not_exist('wrapper.out')
92 import sys
93 if sys.platform[:5] == 'sunos':
94 test.run(arguments = 'bar', stderr = None)
95 else:
96 test.run(arguments = 'bar')
98 test.must_match('wrapper.out', "wrapper.py\n")
100 test.pass_test()
102 # Local Variables:
103 # tab-width:4
104 # indent-tabs-mode:nil
105 # End:
106 # vim: set expandtab tabstop=4 shiftwidth=4: