[libcxx-commits] [PATCH] D145807: [libcxx] [test] Print the failing commands in Configuration{Compilation, Runtime}Error

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 10 09:13:32 PST 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 allows for easier debugging of the test environment when something
fails.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145807

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
@@ -105,7 +105,7 @@
     out = out[:-len(conflatedErrorOutput)]
     err += conflatedErrorOutput
 
-  return (out, err, exitCode, timeoutInfo)
+  return (out, err, exitCode, timeoutInfo, parsedCommands)
 
 def _makeConfigTest(config):
   # Make sure the support directories exist, which is needed to create
@@ -146,7 +146,7 @@
   with _makeConfigTest(config) as test:
     with open(test.getSourcePath(), 'w') as sourceFile:
       sourceFile.write(source)
-    _, _, exitCode, _ = _executeScriptInternal(test, ['%{{build}} {}'.format(' '.join(additionalFlags))])
+    _, _, exitCode, _, _ = _executeScriptInternal(test, ['%{{build}} {}'.format(' '.join(additionalFlags))])
     return exitCode == 0
 
 @_memoizeExpensiveOperation(lambda c, p, args=None: (c.substitutions, c.environment, p, args))
@@ -164,13 +164,13 @@
   with _makeConfigTest(config) as test:
     with open(test.getSourcePath(), 'w') as source:
       source.write(program)
-    _, err, exitCode, _ = _executeScriptInternal(test, ['%{build}'])
+    _, err, exitCode, _, buildcmd = _executeScriptInternal(test, ['%{build}'])
     if exitCode != 0:
-      raise ConfigurationCompilationError("Failed to build program, stderr is:\n{}".format(err))
+      raise ConfigurationCompilationError("Failed to build program, cmd:\n{}\nstderr is:\n{}".format(buildcmd, err))
 
-    out, err, exitCode, _ = _executeScriptInternal(test, ["%{{run}} {}".format(' '.join(args))])
+    out, err, exitCode, _, runcmd = _executeScriptInternal(test, ["%{{run}} {}".format(' '.join(args))])
     if exitCode != 0:
-      raise ConfigurationRuntimeError("Failed to run program, stderr is:\n{}".format(err))
+      raise ConfigurationRuntimeError("Failed to run program, cmd:\n{}\nstderr is:\n{}".format(runcmd, err))
 
     actualOut = re.search("# command output:\n(.+)\n$", out, flags=re.DOTALL)
     actualOut = actualOut.group(1) if actualOut else ""
@@ -201,7 +201,7 @@
   checking whether that succeeds.
   """
   with _makeConfigTest(config) as test:
-    out, err, exitCode, timeoutInfo = _executeScriptInternal(test, [
+    out, err, exitCode, timeoutInfo, _ = _executeScriptInternal(test, [
       "%{{cxx}} -xc++ {} -Werror -fsyntax-only %{{flags}} %{{compile_flags}} {}".format(os.devnull, flag)
     ])
     return exitCode == 0
@@ -215,7 +215,7 @@
   could appear on the right-hand-side of a `RUN:` keyword.
   """
   with _makeConfigTest(config) as test:
-    _, _, exitCode, _ = _executeScriptInternal(test, script)
+    _, _, exitCode, _, _ = _executeScriptInternal(test, script)
     return exitCode
 
 @_memoizeExpensiveOperation(lambda c, s: (c.substitutions, c.environment, s))
@@ -228,7 +228,7 @@
   could appear on the right-hand-side of a `RUN:` keyword.
   """
   with _makeConfigTest(config) as test:
-    out, _, exitCode, _ = _executeScriptInternal(test, command)
+    out, _, exitCode, _, _ = _executeScriptInternal(test, command)
     if exitCode != 0:
      raise ConfigurationRuntimeError()
     return out
@@ -281,7 +281,7 @@
       #  include <__config_site>
       #endif
       """)
-    unparsedOutput, err, exitCode, _ = _executeScriptInternal(test, [
+    unparsedOutput, err, exitCode, _, _ = _executeScriptInternal(test, [
       "%{{cxx}} %s -dM -E %{{flags}} %{{compile_flags}} {}".format(flags)
     ])
     if exitCode != 0:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145807.504176.patch
Type: text/x-patch
Size: 3495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230310/2e28d60a/attachment.bin>


More information about the libcxx-commits mailing list