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__"
30 is_windows
= ( sys
.platform
=='win32')
33 _python_
= TestSCons
._python
_
34 _obj
= TestSCons
._shobj
35 obj_
= TestSCons
.shobj_
37 test
= TestSCons
.TestSCons()
39 test
.file_fixture('mycompile.py')
41 test
.write('SConstruct', """
42 env = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES',
43 SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES',
44 SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES',
45 SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES')
46 env.SharedObject(target = 'test01', source = 'test01.f')
47 env.SharedObject(target = 'test02', source = 'test02.F')
48 env.SharedObject(target = 'test03', source = 'test03.for')
49 env.SharedObject(target = 'test04', source = 'test04.FOR')
50 env.SharedObject(target = 'test05', source = 'test05.ftn')
51 env.SharedObject(target = 'test06', source = 'test06.FTN')
52 env.SharedObject(target = 'test07', source = 'test07.fpp')
53 env.SharedObject(target = 'test08', source = 'test08.FPP')
54 env.SharedObject(target = 'test11', source = 'test11.f90')
55 env.SharedObject(target = 'test12', source = 'test12.F90')
56 env2 = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES',
57 SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES')
58 env2.SharedObject(target = 'test21', source = 'test21.f90')
59 env2.SharedObject(target = 'test22', source = 'test22.F90')
62 test
.write('test01.f', "This is a .f file.\n/*fortran*/\n")
63 test
.write('test02.F', "This is a .F file.\n/*fortranpp*/\n")
64 test
.write('test03.for', "This is a .for file.\n/*fortran*/\n")
65 test
.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n")
66 test
.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n")
67 test
.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n")
68 test
.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n")
69 test
.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n")
70 test
.write('test11.f90', "This is a .f90 file.\n/*f90*/\n")
71 test
.write('test12.F90', "This is a .F90 file.\n/*f90pp*/\n")
73 test
.write('test21.f90', "This is a .f90 file.\n/*f90*/\n")
74 test
.write('test22.F90', "This is a .F90 file.\n/*f90pp*/\n")
76 test
.run(arguments
= '.', stderr
= None)
78 test
.must_match(obj_
+ 'test01' + _obj
, "This is a .f file.\n")
79 test
.must_match(obj_
+ 'test03' + _obj
, "This is a .for file.\n")
80 test
.must_match(obj_
+ 'test05' + _obj
, "This is a .ftn file.\n")
81 test
.must_match(obj_
+ 'test07' + _obj
, "This is a .fpp file.\n")
82 test
.must_match(obj_
+ 'test11' + _obj
, "This is a .f90 file.\n")
84 test
.must_match(obj_
+ 'test21' + _obj
, "This is a .f90 file.\n")
86 # Skip checking files we expect to differ in behavior
87 # based on file extension case
88 test
.must_match(obj_
+ 'test02' + _obj
, "This is a .F file.\n")
89 test
.must_match(obj_
+ 'test04' + _obj
, "This is a .FOR file.\n")
90 test
.must_match(obj_
+ 'test06' + _obj
, "This is a .FTN file.\n")
91 test
.must_match(obj_
+ 'test08' + _obj
, "This is a .FPP file.\n")
92 test
.must_match(obj_
+ 'test12' + _obj
, "This is a .F90 file.\n")
93 test
.must_match(obj_
+ 'test22' + _obj
, "This is a .F90 file.\n")
99 # indent-tabs-mode:nil
101 # vim: set expandtab tabstop=4 shiftwidth=4: