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