Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83774 - trunk/tools/build/v2/test
From: steven_at_[hidden]
Date: 2013-04-05 22:11:30


Author: steven_watanabe
Date: 2013-04-05 22:11:29 EDT (Fri, 05 Apr 2013)
New Revision: 83774
URL: http://svn.boost.org/trac/boost/changeset/83774

Log:
Add test with explicit name/search/include.
Text files modified:
   trunk/tools/build/v2/test/MockToolset.py | 17 ++++++----
   trunk/tools/build/v2/test/zlib.py | 63 +++++++++++++++++++++++++++++++--------
   2 files changed, 59 insertions(+), 21 deletions(-)

Modified: trunk/tools/build/v2/test/MockToolset.py
==============================================================================
--- trunk/tools/build/v2/test/MockToolset.py (original)
+++ trunk/tools/build/v2/test/MockToolset.py 2013-04-05 22:11:29 EDT (Fri, 05 Apr 2013)
@@ -18,6 +18,7 @@
 parser.add_option('-x', dest="language")
 parser.add_option('-c', dest="compile", action="store_true")
 parser.add_option('-I', dest="includes", action="append")
+parser.add_option('-L', dest="library_path", action="append")
 parser.add_option('--dll', dest="dll", action="store_true")
 parser.add_option('--archive', dest="archive", action="store_true")
 parser.add_option('--static-lib', dest="static_libraries", action="append")
@@ -77,6 +78,14 @@
         map(os.path.abspath, expected_options.includes):
       return False
 
+ if options.library_path is None:
+ options.library_path = []
+ if expected_options.library_path is None:
+ expected_options.library_path = []
+ if map(os.path.abspath, options.library_path) != \
+ map(os.path.abspath, expected_options.library_path):
+ return False
+
     if options.static_libraries != expected_options.static_libraries:
       return False
 
@@ -108,12 +117,6 @@
 
     # if we've gotten here, then everything matched
     return True
-
-_instance = MockInfo()
-
-def instance():
- return _instance
-
 ''')
 
   t.write('mock.py', '''
@@ -157,7 +160,7 @@
 
 actions compile.c++
 {
- $(python-cmd) mock.py -c -x c++ $(>) -o $(<)
+ $(python-cmd) mock.py -c -x c++ -I$(INCLUDES) $(>) -o $(<)
 }
 
 toolset.flags mock.link USER_OPTIONS <linkflags> ;

Modified: trunk/tools/build/v2/test/zlib.py
==============================================================================
--- trunk/tools/build/v2/test/zlib.py (original)
+++ trunk/tools/build/v2/test/zlib.py 2013-04-05 22:11:29 EDT (Fri, 05 Apr 2013)
@@ -33,6 +33,17 @@
 t.expect_addition('bin/standalone/zlib/mock/debug/libz.so')
 t.expect_addition('bin/standalone/zlib/mock/debug/link-static/libz.a')
 
+t.rm('zlib')
+
+# Generic definitions that aren't configuration specific
+common_stuff = '''
+source_file('test.cpp', 'test.cpp')
+source_file('main.cpp', 'int main() {}')
+source_file('zlib.h.cpp', '#include <zlib.h>')
+action('-c -x c++ $main.cpp -o $main.o')
+'''
+t.write('test.cpp', 'test.cpp')
+
 # Default initialization - static library
 t.rm('bin')
 t.write("Jamroot.jam", """
@@ -41,13 +52,7 @@
 exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
 """)
 
-t.write('test.cpp', 'test.cpp')
-
-MockToolset.set_expected(t, '''
-source_file('test.cpp', 'test.cpp')
-source_file('main.cpp', 'int main() {}')
-source_file('zlib.h.cpp', '#include <zlib.h>')
-action('-c -x c++ $main.cpp -o $main.o')
+MockToolset.set_expected(t, common_stuff + '''
 action('$main.o --static-lib=z -o $config.exe')
 action('-c -x c++ $zlib.h.cpp -o $zlib.h.o')
 action('-c -x c++ $test.cpp -o $test.o')
@@ -65,13 +70,7 @@
 exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
 """)
 
-t.write('test.cpp', 'test.cpp')
-
-MockToolset.set_expected(t, '''
-source_file('test.cpp', 'test.cpp')
-source_file('main.cpp', 'int main() {}')
-source_file('zlib.h.cpp', '#include <zlib.h>')
-action('-c -x c++ $main.cpp -o $main.o')
+MockToolset.set_expected(t, common_stuff + '''
 action('$main.o --shared-lib=z -o $config.exe')
 action('-c -x c++ $zlib.h.cpp -o $zlib.h.o')
 action('-c -x c++ $test.cpp -o $test.o')
@@ -81,4 +80,40 @@
 t.expect_addition('bin/mock/debug/test')
 t.expect_addition('bin/mock/debug/link-static/test')
 
+# Initialization in explicit location - static library
+t.rm('bin')
+t.write("Jamroot.jam", """
+path-constant here : . ;
+using zlib : : <name>myzlib <include>$(here)/zlib <search>$(here)/zlib ;
+exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
+""")
+
+t.write('zlib/zlib.h', 'zlib')
+
+MockToolset.set_expected(t, common_stuff + '''
+action('$main.o -L./zlib --static-lib=myzlib -o $config.exe')
+action('-c -x c++ $test.cpp -I./zlib -o $test.o')
+action('$test.o -L./zlib --static-lib=myzlib -o $test')
+''')
+t.run_build_system()
+t.expect_addition('bin/mock/debug/test')
+t.expect_addition('bin/mock/debug/link-static/test')
+
+# Initialization in explicit location - shared library
+t.rm('bin')
+t.write("Jamroot.jam", """
+path-constant here : . ;
+using zlib : : <name>myzlib <include>$(here)/zlib <search>$(here)/zlib ;
+exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
+""")
+
+MockToolset.set_expected(t, common_stuff + '''
+action('$main.o -L./zlib --shared-lib=myzlib -o $config.exe')
+action('-c -x c++ $test.cpp -I./zlib -o $test.o')
+action('$test.o -L./zlib --shared-lib=myzlib -o $test')
+''')
+t.run_build_system()
+t.expect_addition('bin/mock/debug/test')
+t.expect_addition('bin/mock/debug/link-static/test')
+
 t.cleanup()


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk