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__"
29 _python_
= TestSCons
._python
_
30 _obj
= TestSCons
._shobj
31 obj_
= TestSCons
.shobj_
33 test
= TestSCons
.TestSCons()
34 test
.file_fixture(['fixture', 'myfortran_flags.py'])
36 test
.write('SConstruct', """
37 env = Environment(SHFORTRAN = r'%(_python_)s myfortran_flags.py fortran')
38 env.Append(SHFORTRANFLAGS = '-x')
39 env.SharedObject(target = 'test01', source = 'test01.f')
40 env.SharedObject(target = 'test02', source = 'test02.F')
41 env.SharedObject(target = 'test03', source = 'test03.for')
42 env.SharedObject(target = 'test04', source = 'test04.FOR')
43 env.SharedObject(target = 'test05', source = 'test05.ftn')
44 env.SharedObject(target = 'test06', source = 'test06.FTN')
45 env.SharedObject(target = 'test07', source = 'test07.fpp')
46 env.SharedObject(target = 'test08', source = 'test08.FPP')
49 test
.write('test01.f', "This is a .f file.\n#fortran\n")
50 test
.write('test02.F', "This is a .F file.\n#fortran\n")
51 test
.write('test03.for', "This is a .for file.\n#fortran\n")
52 test
.write('test04.FOR', "This is a .FOR file.\n#fortran\n")
53 test
.write('test05.ftn', "This is a .ftn file.\n#fortran\n")
54 test
.write('test06.FTN', "This is a .FTN file.\n#fortran\n")
55 test
.write('test07.fpp', "This is a .fpp file.\n#fortran\n")
56 test
.write('test08.FPP', "This is a .FPP file.\n#fortran\n")
58 test
.run(arguments
= '.', stderr
= None)
60 test
.must_match(obj_
+ 'test01' + _obj
, " -c -x\nThis is a .f file.\n")
61 test
.must_match(obj_
+ 'test02' + _obj
, " -c -x\nThis is a .F file.\n")
62 test
.must_match(obj_
+ 'test03' + _obj
, " -c -x\nThis is a .for file.\n")
63 test
.must_match(obj_
+ 'test04' + _obj
, " -c -x\nThis is a .FOR file.\n")
64 test
.must_match(obj_
+ 'test05' + _obj
, " -c -x\nThis is a .ftn file.\n")
65 test
.must_match(obj_
+ 'test06' + _obj
, " -c -x\nThis is a .FTN file.\n")
66 test
.must_match(obj_
+ 'test07' + _obj
, " -c -x\nThis is a .fpp file.\n")
67 test
.must_match(obj_
+ 'test08' + _obj
, " -c -x\nThis is a .FPP file.\n")
70 fortran
= test
.detect_tool(fc
)
75 test
.subdir(directory
)
77 test
.file_fixture('wrapper.py')
79 test
.write('SConstruct', """
80 foo = Environment(SHFORTRAN = '%(fc)s')
81 shfortran = foo.Dictionary('SHFORTRAN')
82 bar = foo.Clone(SHFORTRAN = r'%(_python_)s wrapper.py ' + shfortran)
83 bar.Append(SHFORTRANFLAGS = '-I%(directory)s')
84 foo.SharedLibrary(target = 'foo/foo', source = 'foo.f')
85 bar.SharedLibrary(target = 'bar/bar', source = 'bar.f')
88 test
.write('foo.f', r
"""
95 test
.write('bar.f', r
"""
103 test
.run(arguments
= 'foo', stderr
= None)
105 test
.must_not_exist('wrapper.out')
108 if sys
.platform
[:5] == 'sunos':
109 test
.run(arguments
= 'bar', stderr
= None)
111 test
.run(arguments
= 'bar')
113 test
.must_match('wrapper.out', "wrapper.py\n")
119 # indent-tabs-mode:nil
121 # vim: set expandtab tabstop=4 shiftwidth=4: