[libcxx-commits] [libcxx] 391b51b - [libcxx] [test] Improve error reporting around invoked commands

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 16 11:30:56 PDT 2023


Author: Martin Storsjö
Date: 2023-05-16T21:27:54+03:00
New Revision: 391b51b18f37dd2a130de12167f8b4416eb3210e

URL: https://github.com/llvm/llvm-project/commit/391b51b18f37dd2a130de12167f8b4416eb3210e
DIFF: https://github.com/llvm/llvm-project/commit/391b51b18f37dd2a130de12167f8b4416eb3210e.diff

LOG: [libcxx] [test] Improve error reporting around invoked commands

This was requested in the review of D145807, but I had missed to
apply it before landing the patch.

Differential Revision: https://reviews.llvm.org/D150444

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 9f59d3b447e68..5410d25d16b89 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -228,9 +228,9 @@ def commandOutput(config, command):
   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 @@ def compilerMacros(config, flags=''):
       #  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:


        


More information about the libcxx-commits mailing list