mirror of
https://github.com/boostorg/predef.git
synced 2025-07-30 03:47:14 +02:00
Rebase from hash-predef source.
This commit is contained in:
@ -36,39 +36,12 @@ class script(script_common):
|
||||
set_arg(kargs, 'variant', os.getenv("VARIANT","debug"))
|
||||
set_arg(kargs, 'cxxflags', os.getenv("CXXFLAGS",None))
|
||||
return kargs
|
||||
|
||||
|
||||
def start(self):
|
||||
script_common.start(self)
|
||||
# Some setup we need to redo for each invocation.
|
||||
self.boost_root = os.path.join(self.ci.work_dir,'boostorg','boost')
|
||||
|
||||
@property
|
||||
def repo_path(self):
|
||||
if not hasattr(self,'_repo_path'):
|
||||
# Find the path for the submodule of the repo we are testing.
|
||||
if self.repo != 'boost':
|
||||
self._repo_path = None
|
||||
with open(os.path.join(self.boost_root,'.gitmodules'),"rU") as f:
|
||||
path = None
|
||||
url = None
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line.startswith("[submodule"):
|
||||
path = None
|
||||
url = None
|
||||
else:
|
||||
name = line.split("=")[0].strip()
|
||||
value = line.split("=")[1].strip()
|
||||
if name == "path":
|
||||
path = value
|
||||
elif name == "url":
|
||||
url = value
|
||||
if name and url and url.endswith("/%s.git"%(self.repo)):
|
||||
self._repo_path = path
|
||||
if not self._repo_path:
|
||||
self._repo_path = "libs/%s"%(self.repo)
|
||||
return self._repo_path
|
||||
|
||||
self.b2_dir = os.path.join(self.build_dir, 'b2')
|
||||
|
||||
def command_install(self):
|
||||
script_common.command_install(self)
|
||||
# Fetch & install toolset..
|
||||
@ -79,38 +52,16 @@ class script(script_common):
|
||||
def command_before_build(self):
|
||||
script_common.command_before_build(self)
|
||||
|
||||
# Clone boost super-project.
|
||||
if self.repo != 'boost':
|
||||
utils.git_clone('boost',self.branch,cwd=self.ci.work_dir,no_submodules=True)
|
||||
utils.check_call("git","submodule","update","--quiet","--init","tools/build")
|
||||
utils.check_call("git","submodule","update","--quiet","--init","tools/boostdep")
|
||||
# The global jamfiles require config as they trigger build config checks.
|
||||
utils.check_call("git","submodule","update","--quiet","--init","libs/config")
|
||||
# Fetch dependencies.
|
||||
utils.git_clone('boostorg','build','develop',repo_dir=self.b2_dir)
|
||||
|
||||
# Find the path for the submodule of the repo we are testing.
|
||||
if self.repo != 'boost':
|
||||
self.repo_dir = os.path.join(self.boost_root,self.repo_path)
|
||||
|
||||
if self.repo != 'boost':
|
||||
# Copy in the existing library tree checkout.
|
||||
shutil.rmtree(self.repo_path)
|
||||
shutil.copytree(self.root_dir, self.repo_path)
|
||||
|
||||
# Fetch the dependencies for the library we are testing.
|
||||
if self.repo != 'boost':
|
||||
os.chdir(self.boost_root)
|
||||
utils.check_call(
|
||||
sys.executable,
|
||||
'tools/boostdep/depinst/depinst.py',
|
||||
self.repo)
|
||||
|
||||
# Create config file for toolset.
|
||||
# Create config file for b2 toolset.
|
||||
if not isinstance(self.ci, ci_cli):
|
||||
cxxflags = None
|
||||
if self.cxxflags:
|
||||
cxxflags = self.cxxflags.split()
|
||||
cxxflags = " <cxxflags>".join(cxxflags)
|
||||
utils.make_file(os.path.join(self.boost_root, 'project-config.jam'),
|
||||
utils.make_file(os.path.join(self.repo_dir, 'project-config.jam'),
|
||||
"""
|
||||
using %(toolset)s : %(version)s : %(command)s : %(cxxflags)s ;
|
||||
using python : %(pyversion)s : "%(python)s" ;
|
||||
@ -127,72 +78,60 @@ using python : %(pyversion)s : "%(python)s" ;
|
||||
script_common.command_build(self)
|
||||
|
||||
# Set up tools.
|
||||
utils.makedirs(os.path.join(self.build_dir,'dist','bin'))
|
||||
if not isinstance(self.ci, ci_cli) and toolset_info[self.toolset]['command']:
|
||||
os.environ['PATH'] = os.pathsep.join([
|
||||
os.path.dirname(toolset_info[self.toolset]['command']),
|
||||
os.path.join(self.build_dir,'dist','bin'),
|
||||
os.environ['PATH']])
|
||||
else:
|
||||
os.environ['PATH'] = os.pathsep.join([
|
||||
os.path.join(self.build_dir,'dist','bin'),
|
||||
os.environ['PATH']])
|
||||
os.environ['BOOST_BUILD_PATH'] = self.build_dir
|
||||
|
||||
# Bootstrap Boost Build engine.
|
||||
os.chdir(os.path.join(self.boost_root,"tools","build"))
|
||||
os.chdir(self.b2_dir)
|
||||
if sys.platform == 'win32':
|
||||
utils.check_call(".\\bootstrap.bat")
|
||||
shutil.copy2("b2.exe", os.path.join(self.build_dir,"dist","bin","b2.exe"))
|
||||
else:
|
||||
utils.check_call("./bootstrap.sh")
|
||||
shutil.copy2("b2", os.path.join(self.build_dir,"dist","bin","b2"))
|
||||
utils.check_call("git","clean","-dfqx")
|
||||
os.environ['PATH'] = os.pathsep.join([self.b2_dir, os.environ['PATH']])
|
||||
os.environ['BOOST_BUILD_PATH'] = self.b2_dir
|
||||
|
||||
# Run the limited tests.
|
||||
if self.repo != 'boost':
|
||||
print("--- Testing %s ---"%(self.repo_path))
|
||||
os.chdir(os.path.join(self.boost_root,'status'))
|
||||
to_test = self.repo_path.split("/")
|
||||
del to_test[0]
|
||||
toolset_to_test = ""
|
||||
if self.toolset:
|
||||
if not isinstance(self.ci, ci_cli):
|
||||
toolset_to_test = toolset_info[self.toolset]['toolset']
|
||||
else:
|
||||
toolset_to_test = self.toolset
|
||||
self.b2(
|
||||
'-d1',
|
||||
'-p0',
|
||||
'--include-tests=%s'%("/".join(to_test)),
|
||||
'preserve-test-targets=off',
|
||||
'--dump-tests',
|
||||
'--build-dir=%s'%(self.build_dir),
|
||||
'--out-xml=%s'%(os.path.join(self.build_dir,'regression.xml')),
|
||||
'' if not toolset_to_test else 'toolset=%s'%(toolset_to_test),
|
||||
'' if not self.address_model else 'address-model=%s'%(self.address_model),
|
||||
'variant=%s'%(self.variant),
|
||||
'--test-type=%s'%(self.target),
|
||||
'--verbose-test'
|
||||
)
|
||||
|
||||
# Generate a readable test report.
|
||||
import build_log
|
||||
log_main = build_log.Main([
|
||||
'--output=console',
|
||||
os.path.join(self.build_dir,'regression.xml')])
|
||||
# And exit with an error if the report contains failures.
|
||||
# This lets the CI notice the error and report a failed build.
|
||||
# And hence trigger the failure machinery, like sending emails.
|
||||
if log_main.failed:
|
||||
self.ci.finish(-1)
|
||||
print("--- Testing %s ---"%(self.repo_dir))
|
||||
os.chdir(os.path.join(self.repo_dir,'test'))
|
||||
toolset_to_test = ""
|
||||
if self.toolset:
|
||||
if not isinstance(self.ci, ci_cli):
|
||||
toolset_to_test = toolset_info[self.toolset]['toolset']
|
||||
else:
|
||||
toolset_to_test = self.toolset
|
||||
self.b2(
|
||||
'-d1',
|
||||
'-p0',
|
||||
'preserve-test-targets=off',
|
||||
'--dump-tests',
|
||||
'--verbose-test',
|
||||
'--build-dir=%s'%(self.build_dir),
|
||||
'--out-xml=%s'%(os.path.join(self.build_dir,'regression.xml')),
|
||||
'' if not toolset_to_test else 'toolset=%s'%(toolset_to_test),
|
||||
'' if not self.address_model else 'address-model=%s'%(self.address_model),
|
||||
'variant=%s'%(self.variant),
|
||||
self.target
|
||||
)
|
||||
|
||||
# Generate a readable test report.
|
||||
import build_log
|
||||
log_main = build_log.Main([
|
||||
'--output=console',
|
||||
os.path.join(self.build_dir,'regression.xml')])
|
||||
# And exit with an error if the report contains failures.
|
||||
# This lets the CI notice the error and report a failed build.
|
||||
# And hence trigger the failure machinery, like sending emails.
|
||||
if log_main.failed:
|
||||
self.ci.finish(-1)
|
||||
|
||||
def command_before_cache(self):
|
||||
script_common.command_before_cache(self)
|
||||
os.chdir(self.boost_root)
|
||||
os.chdir(self.b2_dir)
|
||||
utils.check_call("git","clean","-dfqx")
|
||||
utils.check_call("git","submodule","--quiet","foreach","git","clean","-dfqx")
|
||||
utils.check_call("git","status","-bs")
|
||||
utils.check_call("git","submodule","foreach","git","status","-bs")
|
||||
# utils.check_call("git","submodule","--quiet","foreach","git","clean","-dfqx")
|
||||
# utils.check_call("git","submodule","foreach","git","status","-bs")
|
||||
|
||||
main(script)
|
||||
|
Reference in New Issue
Block a user