From: stevenknight Date: Wed, 18 Feb 2009 16:27:18 +0000 (+0000) Subject: Split an embedded sub-test from test/Libs/LIBS.py X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ebeb2d8897ebe128974ab7482044bdc0b5f3e7f5;p=scons.git Split an embedded sub-test from test/Libs/LIBS.py into its own test script. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4004 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/test/Libs/LIBS-LIBPREFIX-exists.py b/test/Libs/LIBS-LIBPREFIX-exists.py new file mode 100644 index 00000000..3cb2aba0 --- /dev/null +++ b/test/Libs/LIBS-LIBPREFIX-exists.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify that we don't add $LIBPREFIX to library names in $LIBS that +already have the prefix on them. +""" + +import TestSCons + +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + +blender_exe = test.workpath('blender' + _exe) + +test.subdir('src', ['src', 'component1'], ['src', 'component2']) + +test.write('SConstruct', """\ +SConscript(['src/SConscript']) + +libpath = (['lib']) +libraries = (['libtest_component2', + 'libtest_component1']) + +# To remove the dependency problem, you should rename blender to mlender. +Program(source='main.c', + target='blender', + LIBS=libraries, + LIBPREFIX='lib', + LIBPATH=libpath, + CPPPATH=['src/component2']) +""") + +test.write('main.c', """\ +#include +#include "message2.h" + +int main (void) +{ + DisplayMessage2(); + exit (0); +} +""") + +test.write(['src', 'SConscript'], """\ +SConscript(['component1/SConscript', + 'component2/SConscript']) +""") + +test.write(['src', 'component1', 'SConscript'], """\ +source_files = ['message1.c'] +Library(target='../../lib/libtest_component1', + source=source_files, + LINKFLAGS='') +""") + +test.write(['src', 'component1', 'message1.c'], """\ +#include + +void DisplayMessage1 (void) +{ + printf ("src/component1/message.c\\n"); +} +""") + +test.write(['src', 'component1', 'message1.h'], """\ +void DisplayMessage1 (void); +""") + +test.write(['src', 'component2', 'SConscript'], """\ +source_files = ['message2.c'] +include_paths = ['../component1'] +Library(target='../../lib/libtest_component2', + source=source_files, + CPPPATH=include_paths) +""") + +test.write(['src', 'component2', 'message2.h'], """\ +void DisplayMessage2 (void); +""") + +test.write(['src', 'component2', 'message2.c'], """\ +#include +#include "message1.h" + +void DisplayMessage2 (void) +{ + DisplayMessage1(); + printf ("src/component2/hello.c\\n"); +} +""") + +test.run(arguments = '.', + stderr=TestSCons.noisy_ar, + match=TestSCons.match_re_dotall) + +test.run(program=blender_exe, + stdout='src/component1/message.c\nsrc/component2/hello.c\n') + +test.pass_test() diff --git a/test/Libs/LIBS.py b/test/Libs/LIBS.py index fa6295a5..3d00a8a4 100644 --- a/test/Libs/LIBS.py +++ b/test/Libs/LIBS.py @@ -207,85 +207,6 @@ test.run(arguments = '.', test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c 2\n') -# Make sure we don't add $LIBPREFIX to library names that -# already have the prefix on them. -blender_exe = test.workpath('blender' + _exe) - -test.subdir('src', ['src', 'component1'], ['src', 'component2']) - -test.write('SConstruct', """\ -SConscript(['src/SConscript']) - -libpath = (['lib']) -libraries = (['libtest_component2', - 'libtest_component1']) - -# To remove the dependency problem, you should rename blender to mlender. -Program (source='main.c', target='blender', LIBS=libraries, LIBPREFIX='lib', LIBPATH=libpath, CPPPATH=['src/component2']) -""") - -test.write('main.c', """\ -#include -#include "message2.h" - -int main (void) -{ - DisplayMessage2(); - exit (0); -} -""") - -test.write(['src', 'SConscript'], """\ -SConscript(['component1/SConscript', - 'component2/SConscript']) -""") - -test.write(['src', 'component1', 'SConscript'], """\ -source_files = ['message1.c'] -Library (target='../../lib/libtest_component1', source=source_files, LINKFLAGS='') -""") - -test.write(['src', 'component1', 'message1.c'], """\ -#include - -void DisplayMessage1 (void) -{ - printf ("src/component1/message.c\\n"); -} -""") - -test.write(['src', 'component1', 'message1.h'], """\ -void DisplayMessage1 (void); -""") - -test.write(['src', 'component2', 'SConscript'], """\ -source_files = ['message2.c'] -include_paths = ['../component1'] -Library (target='../../lib/libtest_component2', source=source_files, CPPPATH=include_paths) -""") - -test.write(['src', 'component2', 'message2.h'], """\ -void DisplayMessage2 (void); -""") - -test.write(['src', 'component2', 'message2.c'], """\ -#include -#include "message1.h" - -void DisplayMessage2 (void) -{ - DisplayMessage1(); - printf ("src/component2/hello.c\\n"); -} -""") - -test.run(arguments = '.', - stderr=TestSCons.noisy_ar, - match=TestSCons.match_re_dotall) - -test.run(program=blender_exe, - stdout='src/component1/message.c\nsrc/component2/hello.c\n') - test.pass_test() # Local Variables: