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