mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2024-11-27 05:40:48 +00:00
Improve test runner output for broken configurations.
Previously LIT would often fail while attempting to set up/configure the test compiler; normally when attempting to dump the builtin macros. This sort of failure provided no useful information about what went wrong with the compiler, making the actual issues hard --- if not impossible --- to debug easily. This patch changes the LIT configuration to report the failure explicitly, including the failed compile command and the stdout/stderr output. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@314735 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f17205d6a8
commit
5fe8797d57
@ -204,7 +204,7 @@ class CXXCompiler(object):
|
||||
flags = ['-dM'] + flags
|
||||
cmd, out, err, rc = self.preprocess(source_files, flags=flags, cwd=cwd)
|
||||
if rc != 0:
|
||||
return None
|
||||
return cmd, out, err, rc
|
||||
parsed_macros = {}
|
||||
lines = [l.strip() for l in out.split('\n') if l.strip()]
|
||||
for l in lines:
|
||||
|
@ -259,6 +259,16 @@ class Configuration(object):
|
||||
compile_flags=compile_flags,
|
||||
link_flags=link_flags)
|
||||
|
||||
def _dump_macros_verbose(self, *args, **kwargs):
|
||||
macros_or_error = self.cxx.dumpMacros(*args, **kwargs)
|
||||
if isinstance(macros_or_error, tuple):
|
||||
cmd, out, err, rc = macros_or_error
|
||||
report = libcxx.util.makeReport(cmd, out, err, rc)
|
||||
report += "Compiler failed unexpectedly when dumping macros!"
|
||||
self.lit_config.fatal(report)
|
||||
return None
|
||||
assert isinstance(macros_or_error, dict)
|
||||
return macros_or_error
|
||||
|
||||
def configure_src_root(self):
|
||||
self.libcxx_src_root = self.get_lit_conf(
|
||||
@ -446,7 +456,7 @@ class Configuration(object):
|
||||
if self.get_lit_bool('has_libatomic', False):
|
||||
self.config.available_features.add('libatomic')
|
||||
|
||||
macros = self.cxx.dumpMacros()
|
||||
macros = self._dump_macros_verbose()
|
||||
if '__cpp_if_constexpr' not in macros:
|
||||
self.config.available_features.add('libcpp-no-if-constexpr')
|
||||
|
||||
@ -468,7 +478,7 @@ class Configuration(object):
|
||||
|
||||
# Attempt to detect the glibc version by querying for __GLIBC__
|
||||
# in 'features.h'.
|
||||
macros = self.cxx.dumpMacros(flags=['-include', 'features.h'])
|
||||
macros = self._dump_macros_verbose(flags=['-include', 'features.h'])
|
||||
if macros is not None and '__GLIBC__' in macros:
|
||||
maj_v, min_v = (macros['__GLIBC__'], macros['__GLIBC_MINOR__'])
|
||||
self.config.available_features.add('glibc')
|
||||
@ -627,8 +637,8 @@ class Configuration(object):
|
||||
"""
|
||||
# Parse the macro contents of __config_site by dumping the macros
|
||||
# using 'c++ -dM -E' and filtering the predefines.
|
||||
predefines = self.cxx.dumpMacros()
|
||||
macros = self.cxx.dumpMacros(header)
|
||||
predefines = self._dump_macros_verbose()
|
||||
macros = self._dump_macros_verbose(header)
|
||||
feature_macros_keys = set(macros.keys()) - set(predefines.keys())
|
||||
feature_macros = {}
|
||||
for k in feature_macros_keys:
|
||||
@ -980,7 +990,7 @@ class Configuration(object):
|
||||
|
||||
def configure_coroutines(self):
|
||||
if self.cxx.hasCompileFlag('-fcoroutines-ts'):
|
||||
macros = self.cxx.dumpMacros(flags=['-fcoroutines-ts'])
|
||||
macros = self._dump_macros_verbose(flags=['-fcoroutines-ts'])
|
||||
if '__cpp_coroutines' not in macros:
|
||||
self.lit_config.warning('-fcoroutines-ts is supported but '
|
||||
'__cpp_coroutines is not defined')
|
||||
|
Loading…
Reference in New Issue
Block a user