Small docstring update for vars.Add
[scons.git] / test / Libs / LIBS-LIBPREFIX-exists.py
blob814eda9de317dfc796fabaf9efb8fbe34c6bc68d
1 #!/usr/bin/env python
3 # __COPYRIGHT__
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__"
27 """
28 Verify that we don't add $LIBPREFIX to library names in $LIBS that
29 already have the prefix on them.
30 """
32 import TestSCons
34 _exe = TestSCons._exe
36 test = TestSCons.TestSCons()
38 blender_exe = test.workpath('blender' + _exe)
40 test.subdir('src', ['src', 'component1'], ['src', 'component2'])
42 test.write('SConstruct', """\
43 SConscript(['src/SConscript'])
45 libpath = (['lib'])
46 libraries = (['libtest_component2',
47 'libtest_component1'])
49 # To remove the dependency problem, you should rename blender to mlender.
50 Program(source='main.c',
51 target='blender',
52 LIBS=libraries,
53 LIBPREFIX='lib',
54 LIBPATH=libpath,
55 CPPPATH=['src/component2'])
56 """)
58 test.write('main.c', """\
59 #include <stdlib.h>
60 #include "message2.h"
62 int main (void)
64 DisplayMessage2();
65 exit (0);
67 """)
69 test.write(['src', 'SConscript'], """\
70 SConscript(['component1/SConscript',
71 'component2/SConscript'])
72 """)
74 test.write(['src', 'component1', 'SConscript'], """\
75 source_files = ['message1.c']
76 Library(target='../../lib/libtest_component1',
77 source=source_files,
78 LINKFLAGS='')
79 """)
81 test.write(['src', 'component1', 'message1.c'], """\
82 #include <stdio.h>
84 void DisplayMessage1 (void)
86 printf ("src/component1/message.c\\n");
88 """)
90 test.write(['src', 'component1', 'message1.h'], """\
91 void DisplayMessage1 (void);
92 """)
94 test.write(['src', 'component2', 'SConscript'], """\
95 source_files = ['message2.c']
96 include_paths = ['../component1']
97 Library(target='../../lib/libtest_component2',
98 source=source_files,
99 CPPPATH=include_paths)
100 """)
102 test.write(['src', 'component2', 'message2.h'], """\
103 void DisplayMessage2 (void);
104 """)
106 test.write(['src', 'component2', 'message2.c'], """\
107 #include <stdio.h>
108 #include "message1.h"
110 void DisplayMessage2 (void)
112 DisplayMessage1();
113 printf ("src/component2/hello.c\\n");
115 """)
117 test.run(arguments = '.',
118 stderr=TestSCons.noisy_ar,
119 match=TestSCons.match_re_dotall)
121 test.run(program=blender_exe,
122 stdout='src/component1/message.c\nsrc/component2/hello.c\n')
124 test.pass_test()
126 # Local Variables:
127 # tab-width:4
128 # indent-tabs-mode:nil
129 # End:
130 # vim: set expandtab tabstop=4 shiftwidth=4: