3 # Copyright 2002 Dave Abrahams
4 # Copyright 2003, 2004 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)
13 def check_for_existing_boost_build_jam(t):
15 This test depends on no boost-build.jam file existing in any of the
16 folders along the current folder's path. If it does exist, not only would
17 this test fail but it could point to a completely wrong Boost Build
18 installation, thus causing headaches when attempting to diagnose the
19 problem. That is why we explicitly check for this scenario.
22 problem = find_up_to_root(t.workdir, "boost-build.jam")
24 BoostBuild.annotation("misconfiguration", """\
25 This test expects to be run from a folder with no 'boost-build.jam' file in any
26 of the folders along its path.
31 Problematic boost-build.jam found at:
34 Please remove this file or change the test's working folder and rerun the test.
35 """ % (t.workdir, problem))
36 t.fail_test(1, dump_stdio=False, dump_stack=False)
39 def find_up_to_root(folder, name):
42 candidate = os.path.join(folder, name)
43 if os.path.exists(candidate):
46 folder = os.path.dirname(folder)
49 def match_re(actual, expected):
50 return re.match(expected, actual, re.DOTALL) != None
53 t = BoostBuild.Tester(match=match_re, boost_build_path="", pass_toolset=0)
55 check_for_existing_boost_build_jam(t)
57 t.run_build_system(status=1, stdout=
58 r"""Unable to load Boost\.Build: could not find "boost-build\.jam"
59 .*Attempted search from .* up to the root""")
61 t.run_build_system(status=1, subdir="no-bootstrap1",
62 stdout=r"Unable to load Boost\.Build: could not find build system\."
63 r".*attempted to load the build system by invoking"
65 r'.*but we were unable to find "bootstrap\.jam"')
67 # Descend to a subdirectory which /does not/ contain a boost-build.jam file,
68 # and try again to test the crawl-up behavior.
69 t.run_build_system(status=1, subdir=os.path.join("no-bootstrap1", "subdir"),
70 stdout=r"Unable to load Boost\.Build: could not find build system\."
71 r".*attempted to load the build system by invoking"
73 r'.*but we were unable to find "bootstrap\.jam"')
75 t.run_build_system(status=1, subdir="no-bootstrap2",
76 stdout=r"Unable to load Boost\.Build: could not find build system\."
77 r".*attempted to load the build system by invoking"
78 r".*'boost-build \. ;'"
79 r'.*but we were unable to find "bootstrap\.jam"')
81 t.run_build_system(status=1, subdir='no-bootstrap3', stdout=
82 r"""Unable to load Boost.Build
83 .*boost-build\.jam" was found.*
84 However, it failed to call the "boost-build" rule""")
86 # Test bootstrapping based on BOOST_BUILD_PATH.
87 t.run_build_system(["-sBOOST_BUILD_PATH=../boost-root/build"],
88 subdir="bootstrap-env", stdout="build system bootstrapped")
90 # Test bootstrapping based on an explicit path in boost-build.jam.
91 t.run_build_system(subdir="bootstrap-explicit",
92 stdout="build system bootstrapped")