]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/test/zlib.py
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / boost / tools / build / test / zlib.py
CommitLineData
7c673cae
FG
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
8import BoostBuild
9import MockToolset
10
11t = BoostBuild.Tester(arguments=['toolset=mock', '--ignore-site-config', '--user-config='], pass_toolset=0)
12
13MockToolset.create(t)
14
15# Build from source
16t.write("zlib/zlib.h", 'zlib')
17t.write("zlib/deflate.c", 'deflate')
18
19t.write("Jamroot.jam", """
20path-constant here : . ;
21using zlib : : <source>$(here)/zlib ;
22alias zlib : /zlib//zlib : : <link>static <link>shared ;
23""")
24
25MockToolset.set_expected(t, '''
26source_file('deflate.c', 'deflate')
27action('-c -x c -I./zlib -o $deflate.o $deflate.c')
28action('--dll $deflate.o -o $deflate.so')
29action('--archive $deflate.o -o $deflate.a')
30''')
31
32t.run_build_system()
33t.expect_addition('bin/standalone/zlib/mock/debug/z.dll')
34t.expect_addition('bin/standalone/zlib/mock/debug/link-static/z.lib')
35
36t.rm('zlib')
37
38# Generic definitions that aren't configuration specific
39common_stuff = '''
40source_file('test.cpp', 'test.cpp')
41source_file('main.cpp', 'int main() {}')
42source_file('zlib.h.cpp', '#include <zlib.h>\\n')
43action('-c -x c++ $main.cpp -o $main.o')
44'''
45t.write('test.cpp', 'test.cpp')
46
47# Default initialization - static library
48t.rm('bin')
49t.write("Jamroot.jam", """
50path-constant here : . ;
51using zlib ;
52exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
53""")
54
55MockToolset.set_expected(t, common_stuff + '''
56action('$main.o --static-lib=z -o $config.exe')
57action('-c -x c++ $zlib.h.cpp -o $zlib.h.o')
58action('-c -x c++ $test.cpp -o $test.o')
59action('$test.o --static-lib=z -o $test')
60''')
61t.run_build_system()
62t.expect_addition('bin/mock/debug/test.exe')
63t.expect_addition('bin/mock/debug/link-static/test.exe')
64
65# Default initialization - shared library
66t.rm('bin')
67t.write("Jamroot.jam", """
68path-constant here : . ;
69using zlib ;
70exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
71""")
72
73MockToolset.set_expected(t, common_stuff + '''
74action('$main.o --shared-lib=z -o $config.exe')
75action('-c -x c++ $zlib.h.cpp -o $zlib.h.o')
76action('-c -x c++ $test.cpp -o $test.o')
77action('$test.o --shared-lib=z -o $test')
78''')
79t.run_build_system()
80t.expect_addition('bin/mock/debug/test.exe')
81t.expect_addition('bin/mock/debug/link-static/test.exe')
82
83# Initialization in explicit location - static library
84t.rm('bin')
85t.write("Jamroot.jam", """
86path-constant here : . ;
87using zlib : : <name>myzlib <include>$(here)/zlib <search>$(here)/zlib ;
88exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
89""")
90
91t.write('zlib/zlib.h', 'zlib')
92
93MockToolset.set_expected(t, common_stuff + '''
94action('$main.o -L./zlib --static-lib=myzlib -o $config.exe')
95action('-c -x c++ $test.cpp -I./zlib -o $test.o')
96action('$test.o -L./zlib --static-lib=myzlib -o $test')
97''')
98t.run_build_system()
99t.expect_addition('bin/mock/debug/test.exe')
100t.expect_addition('bin/mock/debug/link-static/test.exe')
101
102# Initialization in explicit location - shared library
103t.rm('bin')
104t.write("Jamroot.jam", """
105path-constant here : . ;
106using zlib : : <name>myzlib <include>$(here)/zlib <search>$(here)/zlib ;
107exe test : test.cpp /zlib//zlib : : <link>static <link>shared ;
108""")
109
110MockToolset.set_expected(t, common_stuff + '''
111action('$main.o -L./zlib --shared-lib=myzlib -o $config.exe')
112action('-c -x c++ $test.cpp -I./zlib -o $test.o')
113action('$test.o -L./zlib --shared-lib=myzlib -o $test')
114''')
115t.run_build_system()
116t.expect_addition('bin/mock/debug/test.exe')
117t.expect_addition('bin/mock/debug/link-static/test.exe')
118
119t.cleanup()