5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 Test that while FORTRANFLAGS is not passed to another dialect,
28 FORTRANCOMMONFLAGS is passed to both.
33 _python_
= TestSCons
._python
_
35 test
= TestSCons
.TestSCons()
38 test
.file_fixture('mylink.py')
39 test
.file_fixture(['fixture', 'myfortran_flags.py'])
41 test
.write('SConstruct', """
43 LINK=r'%(_python_)s mylink.py',
45 F90=r'%(_python_)s myfortran_flags.py g90',
47 FORTRAN=r'%(_python_)s myfortran_flags.py fortran',
49 FORTRANCOMMONFLAGS='-z',
51 env.Program(target='test01', source='test01.f')
52 env.Program(target='test02', source='test02.F')
53 env.Program(target='test03', source='test03.for')
54 env.Program(target='test04', source='test04.FOR')
55 env.Program(target='test05', source='test05.ftn')
56 env.Program(target='test06', source='test06.FTN')
57 env.Program(target='test07', source='test07.fpp')
58 env.Program(target='test08', source='test08.FPP')
59 env.Program(target='test11', source='test11.f90')
60 env.Program(target='test12', source='test12.F90')
63 test
.write('test01.f', "This is a .f file.\n#link\n#fortran\n")
64 test
.write('test02.F', "This is a .F file.\n#link\n#fortran\n")
65 test
.write('test03.for', "This is a .for file.\n#link\n#fortran\n")
66 test
.write('test04.FOR', "This is a .FOR file.\n#link\n#fortran\n")
67 test
.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n")
68 test
.write('test06.FTN', "This is a .FTN file.\n#link\n#fortran\n")
69 test
.write('test07.fpp', "This is a .fpp file.\n#link\n#fortran\n")
70 test
.write('test08.FPP', "This is a .FPP file.\n#link\n#fortran\n")
71 test
.write('test11.f90', "This is a .f90 file.\n#link\n#g90\n")
72 test
.write('test12.F90', "This is a .F90 file.\n#link\n#g90\n")
74 test
.run(arguments
= '.', stderr
= None)
76 test
.must_match('test01' + _exe
, " -c -z -y\nThis is a .f file.\n")
77 test
.must_match('test02' + _exe
, " -c -z -y\nThis is a .F file.\n")
78 test
.must_match('test03' + _exe
, " -c -z -y\nThis is a .for file.\n")
79 test
.must_match('test04' + _exe
, " -c -z -y\nThis is a .FOR file.\n")
80 test
.must_match('test05' + _exe
, " -c -z -y\nThis is a .ftn file.\n")
81 test
.must_match('test06' + _exe
, " -c -z -y\nThis is a .FTN file.\n")
82 test
.must_match('test07' + _exe
, " -c -z -y\nThis is a .fpp file.\n")
83 test
.must_match('test08' + _exe
, " -c -z -y\nThis is a .FPP file.\n")
84 test
.must_match('test11' + _exe
, " -c -z -x\nThis is a .f90 file.\n")
85 test
.must_match('test12' + _exe
, " -c -z -x\nThis is a .F90 file.\n")
89 g90
= test
.detect_tool(fc
)
91 test
.file_fixture('wrapper.py')
93 test
.write('SConstruct', """
94 foo = Environment(F90='%(fc)s')
95 f90 = foo.Dictionary('F90')
96 bar = foo.Clone(F90=r'%(_python_)s wrapper.py ' + f90)
97 foo.Program(target='foo', source='foo.f90')
98 bar.Program(target='bar', source='bar.f90')
101 test
.write('foo.f90', r
"""
107 test
.write('bar.f90', r
"""
113 test
.run(arguments
='foo' + _exe
, stderr
=None)
114 test
.run(program
=test
.workpath('foo'), stdout
=" foo.f90\n")
115 test
.must_not_exist('wrapper.out')
119 if sys
.platform
[:5] == 'sunos':
120 test
.run(arguments
='bar' + _exe
, stderr
=None)
122 test
.run(arguments
='bar' + _exe
)
123 test
.run(program
=test
.workpath('bar'), stdout
=" bar.f90\n")
124 test
.must_match('wrapper.out', "wrapper.py\n")
130 # indent-tabs-mode:nil
132 # vim: set expandtab tabstop=4 shiftwidth=4: