[libcxx-commits] [PATCH] D150444: [libcxx] [test] Improve error reporting around invoked commands

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 12 06:23:12 PDT 2023


mstorsjo created this revision.
mstorsjo added a reviewer: ldionne.
Herald added a subscriber: arichardson.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

This was requested in the review of D145807 <https://reviews.llvm.org/D145807>, but I had missed to
apply it before landing the patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150444

Files:
  libcxx/utils/libcxx/test/dsl.py


Index: libcxx/utils/libcxx/test/dsl.py
===================================================================
--- libcxx/utils/libcxx/test/dsl.py
+++ libcxx/utils/libcxx/test/dsl.py
@@ -228,9 +228,9 @@
   could appear on the right-hand-side of a `RUN:` keyword.
   """
   with _makeConfigTest(config) as test:
-    out, _, exitCode, _, _ = _executeScriptInternal(test, command)
+    out, err, exitCode, _, cmd = _executeScriptInternal(test, command)
     if exitCode != 0:
-     raise ConfigurationRuntimeError()
+     raise ConfigurationRuntimeError("Failed to run command: {}\nstderr is:\n{}".format(cmd, err))
     return out
 
 @_memoizeExpensiveOperation(lambda c, l: (c.substitutions, c.environment, l))
@@ -281,11 +281,11 @@
       #  include <__config_site>
       #endif
       """)
-    unparsedOutput, err, exitCode, _, _ = _executeScriptInternal(test, [
+    unparsedOutput, err, exitCode, _, cmd = _executeScriptInternal(test, [
       "%{{cxx}} %s -dM -E %{{flags}} %{{compile_flags}} {}".format(flags)
     ])
     if exitCode != 0:
-      raise ConfigurationCompilationError("Failed to retrieve compiler macros, stderr is:\n{}".format(err))
+      raise ConfigurationCompilationError("Failed to retrieve compiler macros, compiler invocation is:\n{}\nstderr is:\n{}".format(cmd, err))
     parsedMacros = dict()
     defines = (l.strip() for l in unparsedOutput.split('\n') if l.startswith('#define '))
     for line in defines:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150444.521628.patch
Type: text/x-patch
Size: 1441 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230512/76304713/attachment.bin>


More information about the libcxx-commits mailing list