]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/liblzma.py
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / test / liblzma.py
1 #!/usr/bin/python
2
3 # Copy-paste-modify from zlib.py
4 # Copyright (C) 2013 Steven Watanabe
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or copy at
7 # http://www.boost.org/LICENSE_1_0.txt)
8
9 import BoostBuild
10 import MockToolset
11
12 t = BoostBuild.Tester(arguments=['toolset=mock', '--ignore-site-config', '--user-config='], pass_toolset=0)
13
14 MockToolset.create(t)
15
16 # Generic definitions that aren't configuration specific
17 common_stuff = '''
18 source_file('test.cpp', 'test.cpp')
19 source_file('main.cpp', 'int main() {}')
20 source_file('lzma.h.cpp', '#include <lzma.h>\\n')
21 action('-c -x c++ $main.cpp -o $main.o')
22 '''
23 t.write('test.cpp', 'test.cpp')
24
25 # Default initialization - static library
26 t.rm('bin')
27 t.write("Jamroot.jam", """
28 path-constant here : . ;
29 using lzma ;
30 exe test : test.cpp /lzma//lzma : : <link>static <link>shared ;
31 """)
32
33 MockToolset.set_expected(t, common_stuff + '''
34 action('$main.o --static-lib=lzma -o $config.exe')
35 action('-c -x c++ $lzma.h.cpp -o $lzma.h.o')
36 action('-c -x c++ $test.cpp -o $test.o')
37 action('$test.o --static-lib=lzma -o $test')
38 ''')
39 t.run_build_system()
40 t.expect_addition('bin/mock/debug/test.exe')
41 t.expect_addition('bin/mock/debug/link-static/test.exe')
42
43 # Default initialization - shared library
44 t.rm('bin')
45 t.write("Jamroot.jam", """
46 path-constant here : . ;
47 using lzma ;
48 exe test : test.cpp /lzma//lzma : : <link>static <link>shared ;
49 """)
50
51 MockToolset.set_expected(t, common_stuff + '''
52 action('$main.o --shared-lib=lzma -o $config.exe')
53 action('-c -x c++ $lzma.h.cpp -o $lzma.h.o')
54 action('-c -x c++ $test.cpp -o $test.o')
55 action('$test.o --shared-lib=lzma -o $test')
56 ''')
57 t.run_build_system()
58 t.expect_addition('bin/mock/debug/test.exe')
59 t.expect_addition('bin/mock/debug/link-static/test.exe')
60
61 # Initialization in explicit location - static library
62 t.rm('bin')
63 t.write("Jamroot.jam", """
64 path-constant here : . ;
65 using lzma : : <name>mylzma <include>$(here)/lzma <search>$(here)/lzma ;
66 exe test : test.cpp /lzma//lzma : : <link>static <link>shared ;
67 """)
68
69 t.write('lzma/lzma.h', 'lzma')
70
71 MockToolset.set_expected(t, common_stuff + '''
72 action('$main.o -L./lzma --static-lib=mylzma -o $config.exe')
73 action('-c -x c++ $test.cpp -I./lzma -o $test.o')
74 action('$test.o -L./lzma --static-lib=mylzma -o $test')
75 ''')
76 t.run_build_system()
77 t.expect_addition('bin/mock/debug/test.exe')
78 t.expect_addition('bin/mock/debug/link-static/test.exe')
79
80 # Initialization in explicit location - shared library
81 t.rm('bin')
82 t.write("Jamroot.jam", """
83 path-constant here : . ;
84 using lzma : : <name>mylzma <include>$(here)/lzma <search>$(here)/lzma ;
85 exe test : test.cpp /lzma//lzma : : <link>static <link>shared ;
86 """)
87
88 MockToolset.set_expected(t, common_stuff + '''
89 action('$main.o -L./lzma --shared-lib=mylzma -o $config.exe')
90 action('-c -x c++ $test.cpp -I./lzma -o $test.o')
91 action('$test.o -L./lzma --shared-lib=mylzma -o $test')
92 ''')
93 t.run_build_system()
94 t.expect_addition('bin/mock/debug/test.exe')
95 t.expect_addition('bin/mock/debug/link-static/test.exe')
96
97 # Initialization in explicit location - both static and shared libraries
98 t.rm('bin')
99 t.write("Jamroot.jam", """
100 path-constant here : . ;
101 using lzma : : <name>mylzma <include>$(here)/lzma <search>$(here)/lzma ;
102 exe test : test.cpp /lzma//lzma
103 : <link>shared:<define>SHARED : <link>static <link>shared ;
104 """)
105
106 MockToolset.set_expected(t, common_stuff + '''
107 action('$main.o -L./lzma --static-lib=mylzma -o $config.exe')
108 action('$main.o -L./lzma --shared-lib=mylzma -o $config.exe')
109 action('-c -x c++ $test.cpp -I./lzma -o $test-static.o')
110 action('-c -x c++ $test.cpp -I./lzma -DSHARED -o $test-shared.o')
111 action('$test-static.o -L./lzma --static-lib=mylzma -o $test')
112 action('$test-shared.o -L./lzma --shared-lib=mylzma -o $test')
113 ''')
114 t.run_build_system()
115 t.expect_addition('bin/mock/debug/test.exe')
116 t.expect_addition('bin/mock/debug/link-static/test.exe')
117
118 t.cleanup()