diff options
| author | Eric Fiselier <eric@efcs.ca> | 2017-10-02 22:52:51 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2017-10-02 22:52:51 +0000 |
| commit | 8f1a5d39debcbfe63d686f1f258c6ce165923374 (patch) | |
| tree | 823a8bc1a0aabe0e30e94199db8e0425fad053cc /libcxx | |
| parent | 4d825bcf094b4180056da8bae67ae20557339245 (diff) | |
| download | bcm5719-llvm-8f1a5d39debcbfe63d686f1f258c6ce165923374.tar.gz bcm5719-llvm-8f1a5d39debcbfe63d686f1f258c6ce165923374.zip | |
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.
llvm-svn: 314735
Diffstat (limited to 'libcxx')
| -rw-r--r-- | libcxx/utils/libcxx/compiler.py | 2 | ||||
| -rw-r--r-- | libcxx/utils/libcxx/test/config.py | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/libcxx/utils/libcxx/compiler.py b/libcxx/utils/libcxx/compiler.py index e908e26089b..70022d7a43a 100644 --- a/libcxx/utils/libcxx/compiler.py +++ b/libcxx/utils/libcxx/compiler.py @@ -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: diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py index 2ee41924fe1..8d4179337fc 100644 --- a/libcxx/utils/libcxx/test/config.py +++ b/libcxx/utils/libcxx/test/config.py @@ -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') |

