1 | #!/usr/bin/python |
---|
2 | |
---|
3 | # Copyright 2002 Dave Abrahams |
---|
4 | # Copyright 2003, 2004, 2005 Vladimir Prus |
---|
5 | # Distributed under the Boost Software License, Version 1.0. |
---|
6 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
---|
7 | |
---|
8 | from BoostBuild import Tester |
---|
9 | import os |
---|
10 | import re |
---|
11 | |
---|
12 | def expect_substring(actual,expected): |
---|
13 | return actual.find(expected) != -1 |
---|
14 | |
---|
15 | def match_re(actual,expected): |
---|
16 | return re.match(expected,actual,re.DOTALL) != None |
---|
17 | |
---|
18 | # Test the v1 startup behavior |
---|
19 | t = Tester( |
---|
20 | executable='bjam' |
---|
21 | , match=match_re |
---|
22 | , boost_build_path='' |
---|
23 | , pass_toolset=0 |
---|
24 | ) |
---|
25 | |
---|
26 | t.set_tree('startup') |
---|
27 | |
---|
28 | #if os.name == 'nt': |
---|
29 | # t.run_build_system( |
---|
30 | # status=1, stdout="You didn't set BOOST_ROOT", match = expect_substring) |
---|
31 | |
---|
32 | t.run_build_system( |
---|
33 | extra_args = '-sBOOST_ROOT=.', status=1 |
---|
34 | , stdout=r'''Unable to load Boost\.Build: could not find "boost-build\.jam".''' |
---|
35 | ) |
---|
36 | |
---|
37 | os.chdir('no-bootstrap1') |
---|
38 | |
---|
39 | t.run_build_system( |
---|
40 | extra_args = '-sBOOST_ROOT=.', status=1 |
---|
41 | , stdout=r'''Unable to load Boost\.Build: could not find build system\.''' |
---|
42 | + r'''.*attempted to load the build system by invoking''' |
---|
43 | + r'''.*'boost-build ;'.*''' |
---|
44 | + r'''but we were unable to find "bootstrap\.jam"''' |
---|
45 | ) |
---|
46 | |
---|
47 | # Descend to a subdirectory which /doesn't/ contain a boost-build.jam |
---|
48 | # file, and try again to test the crawl-up behavior. |
---|
49 | os.chdir('subdir') |
---|
50 | |
---|
51 | t.run_build_system( |
---|
52 | extra_args = '-sBOOST_ROOT=.', status=1 |
---|
53 | , stdout=r'''Unable to load Boost\.Build: could not find build system\.''' |
---|
54 | + r'''.*attempted to load the build system by invoking''' |
---|
55 | + r'''.*'boost-build ;'.*''' |
---|
56 | + r'''but we were unable to find "bootstrap\.jam"''' |
---|
57 | ) |
---|
58 | |
---|
59 | os.chdir('../../no-bootstrap2') |
---|
60 | |
---|
61 | t.run_build_system( |
---|
62 | extra_args = '-sBOOST_ROOT=.', status=1 |
---|
63 | , stdout=r'''Unable to load Boost\.Build: could not find build system\.''' |
---|
64 | + r'''.*attempted to load the build system by invoking''' |
---|
65 | + r'''.*'boost-build \. ;'.*''' |
---|
66 | + r'''but we were unable to find "bootstrap\.jam"''' |
---|
67 | ) |
---|
68 | |
---|
69 | os.chdir('../no-bootstrap3') |
---|
70 | |
---|
71 | t.run_build_system( |
---|
72 | extra_args = '-sBOOST_ROOT=.', status=1 |
---|
73 | , stdout=r'''Unable to load Boost.Build |
---|
74 | .*boost-build.jam" was found.* |
---|
75 | However, it failed to call the "boost-build" rule''' |
---|
76 | ) |
---|
77 | |
---|
78 | # test bootstrapping based on BOOST_BUILD_PATH |
---|
79 | os.chdir('../bootstrap-env') |
---|
80 | t.run_build_system( |
---|
81 | extra_args = '-sBOOST_ROOT=../boost-root -sBOOST_BUILD_PATH=../boost-root/build' |
---|
82 | , stdout = 'build system bootstrapped' |
---|
83 | ) |
---|
84 | |
---|
85 | # test bootstrapping based on an explicit path in boost-build.jam |
---|
86 | os.chdir('../bootstrap-explicit') |
---|
87 | t.run_build_system( |
---|
88 | extra_args = '-sBOOST_ROOT=../boost-root' |
---|
89 | , stdout = 'build system bootstrapped' |
---|
90 | ) |
---|
91 | |
---|
92 | # test bootstrapping based on BOOST_ROOT |
---|
93 | os.chdir('../bootstrap-implicit') |
---|
94 | t.run_build_system( |
---|
95 | extra_args = '-sBOOST_ROOT=../boost-root' |
---|
96 | , stdout = 'build system bootstrapped' |
---|
97 | ) |
---|
98 | |
---|
99 | t.cleanup() |
---|