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 Ensure that SharedLibrary builder works with SHLIBVERSION and -j2.
28 This is regression test for:
29 https://article.gmane.org/gmane.comp.programming.tools.scons.user/27049
30 (historical - dead link)
40 test
= TestSCons
.TestSCons()
42 test
.write('foo.c', """
46 int foo() { return 0; }
50 test
.write('main.c', """
55 int main(void) { return foo(); }
58 test
.write('SConstruct', """
60 env.AppendUnique(LIBPATH = ['.'])
61 env.Program('main.c', LIBS = ['foo'])
62 env.SharedLibrary('foo', 'foo.c', SHLIBVERSION = '0.1.2')
65 test
.run(arguments
= ['-j 2', '--tree=all'])
67 env
= SCons
.Defaults
.DefaultEnvironment()
68 platform
= SCons
.Platform
.platform_default()
69 tool_list
= SCons
.Platform
.DefaultToolList(platform
, env
)
71 if platform
== 'cygwin':
72 # PATH is used to search for *.dll librarier (cygfoo-0-2-1.dll in our case)
73 path
= os
.environ
.get('PATH','')
74 if path
: path
= path
+ os
.pathsep
75 path
= path
+ test
.workpath('.')
76 os
.environ
['PATH'] = path
78 if os
.name
== 'posix':
79 os
.environ
['LD_LIBRARY_PATH'] = test
.workpath('.')
80 if sys
.platform
.find('irix') != -1:
81 os
.environ
['LD_LIBRARYN32_PATH'] = test
.workpath('.')
83 test
.run(program
= test
.workpath('main'))
85 test
.run(arguments
= ['-c'])
87 platform
= SCons
.Platform
.platform_default()
89 if 'gnulink' in tool_list
:
90 # All (?) the files we expect will get created in the current directory
97 elif 'applelink' in tool_list
:
98 # All (?) the files we expect will get created in the current directory
101 'libfoo.0.1.2.dylib',
104 elif 'cyglink' in tool_list
:
105 # All (?) the files we expect will get created in the current directory
108 'libfoo-0-1-2.dll.a',
112 elif 'mslink' in tool_list
:
113 # All (?) the files we expect will get created in the current directory
119 elif 'sunlink' in tool_list
:
120 # All (?) the files we expect will get created in the current directory
128 # All (?) the files we expect will get created in the current directory
134 test
.must_not_exist([ f
])
136 test
.must_exist(['main.c'])
137 test
.must_exist(['foo.c'])
138 test
.must_exist(['SConstruct'])
144 # indent-tabs-mode:nil
146 # vim: set expandtab tabstop=4 shiftwidth=4: