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.
30 _python_
= TestSCons
._python
_
32 test
= TestSCons
.TestSCons()
34 # Writing this to accommodate both our in-line tool chain and the
35 # MSVC command lines is too hard, and will be completely unnecessary
36 # some day when we separate our tests. Punt for now.
37 if sys
.platform
== 'win32':
38 test
.skip_test('Skipping on win32.\n')
40 test
.file_fixture('mylink.py')
41 test
.file_fixture('mygcc.py')
43 test
.write('SConstruct', """
46 LINK=r'%(_python_)s mylink.py',
48 CC=r'%(_python_)s mygcc.py cc',
49 CXX=r'%(_python_)s mygcc.py c++',
51 FORTRAN=r'%(_python_)s mygcc.py g77',
55 env.Program(target='foo', source=Split('test1.c test2.cpp test3.F'))
58 test
.write('test1.c', r
"""test1.c
63 test
.write('test2.cpp', r
"""test2.cpp
68 test
.write('test3.F', r
"""test3.F
73 test
.run(arguments
= '.', stderr
=None)
75 test
.must_match('test1.obj', "test1.c\n#link\n")
76 test
.must_match('test2.obj', "test2.cpp\n#link\n")
77 test
.must_match('test3.obj', "test3.F\n#link\n")
78 test
.must_match('foo.exe', "test1.c\ntest2.cpp\ntest3.F\n")
79 if TestSCons
.case_sensitive_suffixes('.F', '.f'):
80 test
.must_match('mygcc.out', "cc\nc++\ng77\n")
82 test
.must_match('mygcc.out', "cc\nc++\n")
84 test
.write('SConstruct', """
87 SHLINK=r'%(_python_)s mylink.py',
89 CC=r'%(_python_)s mygcc.py cc',
90 CXX=r'%(_python_)s mygcc.py c++',
92 FORTRAN=r'%(_python_)s mygcc.py g77',
98 env.SharedLibrary(target=File('foo.bar'), source=Split('test1.c test2.cpp test3.F'))
101 test
.write('test1.c', r
"""test1.c
106 test
.write('test2.cpp', r
"""test2.cpp
111 test
.write('test3.F', r
"""test3.F
116 test
.unlink('mygcc.out')
117 test
.unlink('test1.obj')
118 test
.unlink('test2.obj')
119 test
.unlink('test3.obj')
121 test
.run(arguments
= '.', stderr
= None)
123 test
.must_match('test1.shobj', "test1.c\n#link\n")
124 test
.must_match('test2.shobj', "test2.cpp\n#link\n")
125 test
.must_match('test3.shobj', "test3.F\n#link\n")
126 test
.must_match('foo.bar', "test1.c\ntest2.cpp\ntest3.F\n")
127 if TestSCons
.case_sensitive_suffixes('.F', '.f'):
128 test
.must_match('mygcc.out', "cc\nc++\ng77\n")
130 test
.must_match('mygcc.out', "cc\nc++\n")
136 # indent-tabs-mode:nil
138 # vim: set expandtab tabstop=4 shiftwidth=4: