mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 13:22:11 +00:00
The problem with the previous implementation is that it would iterate over all elements in a dir even if 'pattern' had no metacharacters. First, that was slow -- if you handed /cygdrive/w/My Documents/boost/test/a.cpp to it, it would crawl all the way to the top, listing each directory and checking each file. Second, it would fail, because Cygwin is broken and does not show 'cygdrive' is the list of directory elements of '/'. Now we check if a pattern has metacharacters, and if not, just do a simple 'timestamp' call. The new glob is implemented as new 'GLOB-RECURSIVELY' builtin. I've decided to use builtin since otherwise, we'd need 'does this name exist' builtin, and if we need new builtin, why don't implement all globbing in core. [SVN r29163]
95 lines
2.6 KiB
Python
95 lines
2.6 KiB
Python
#!/usr/bin/python
|
|
|
|
from BoostBuild import Tester
|
|
import os
|
|
import re
|
|
|
|
def expect_substring(actual,expected):
|
|
return actual.find(expected) != -1
|
|
|
|
def match_re(actual,expected):
|
|
return re.match(expected,actual,re.DOTALL) != None
|
|
|
|
# Test the v1 startup behavior
|
|
t = Tester(
|
|
executable='bjam'
|
|
, match=match_re
|
|
, boost_build_path=''
|
|
, pass_toolset=0
|
|
)
|
|
|
|
t.set_tree('startup')
|
|
|
|
#if os.name == 'nt':
|
|
# t.run_build_system(
|
|
# status=1, stdout="You didn't set BOOST_ROOT", match = expect_substring)
|
|
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=.', status=1
|
|
, stdout=r'''Unable to load Boost\.Build: could not find "boost-build\.jam".'''
|
|
)
|
|
|
|
os.chdir('no-bootstrap1')
|
|
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=.', status=1
|
|
, stdout=r'''Unable to load Boost\.Build: could not find build system\.'''
|
|
+ r'''.*attempted to load the build system by invoking'''
|
|
+ r'''.*'boost-build ;'.*'''
|
|
+ r'''but we were unable to find "bootstrap\.jam"'''
|
|
)
|
|
|
|
# Descend to a subdirectory which /doesn't/ contain a boost-build.jam
|
|
# file, and try again to test the crawl-up behavior.
|
|
os.chdir('subdir')
|
|
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=.', status=1
|
|
, stdout=r'''Unable to load Boost\.Build: could not find build system\.'''
|
|
+ r'''.*attempted to load the build system by invoking'''
|
|
+ r'''.*'boost-build ;'.*'''
|
|
+ r'''but we were unable to find "bootstrap\.jam"'''
|
|
)
|
|
|
|
os.chdir('../../no-bootstrap2')
|
|
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=.', status=1
|
|
, stdout=r'''Unable to load Boost\.Build: could not find build system\.'''
|
|
+ r'''.*attempted to load the build system by invoking'''
|
|
+ r'''.*'boost-build \. ;'.*'''
|
|
+ r'''but we were unable to find "bootstrap\.jam"'''
|
|
)
|
|
|
|
os.chdir('../no-bootstrap3')
|
|
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=.', status=1
|
|
, stdout=r'''Unable to load Boost.Build
|
|
.*boost-build.jam" was found.*
|
|
However, it failed to call the "boost-build" rule'''
|
|
)
|
|
|
|
# test bootstrapping based on BOOST_BUILD_PATH
|
|
os.chdir('../bootstrap-env')
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=../boost-root -sBOOST_BUILD_PATH=../boost-root/build'
|
|
, stdout = 'build system bootstrapped'
|
|
)
|
|
|
|
# test bootstrapping based on an explicit path in boost-build.jam
|
|
os.chdir('../bootstrap-explicit')
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=../boost-root'
|
|
, stdout = 'build system bootstrapped'
|
|
)
|
|
|
|
# test bootstrapping based on BOOST_ROOT
|
|
os.chdir('../bootstrap-implicit')
|
|
t.run_build_system(
|
|
extra_args = '-sBOOST_ROOT=../boost-root'
|
|
, stdout = 'build system bootstrapped'
|
|
)
|
|
|
|
t.cleanup()
|