[Lldb-commits] [PATCH] D132694: [lldb] Quietly source lit-lldb-init

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 25 11:55:28 PDT 2022


kastiglione created this revision.
kastiglione added a reviewer: JDevlieghere.
Herald added a subscriber: mgorny.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Improve utility of `FileCheck` output when a shell test fails.

The conflict is from:

1. On failure, `FileCheck` prints 5 lines of context
2. Shell tests first source `lit-lldb-init`, having the effect of printing its contents

If a `FileCheck` failure happens at the beginning of the input, then the
context shown is the `lit-lldb-init`, as it's over 5 lines and is the first
thing printed. As the init contents are fairly static, and presumably
uninteresting to most test failures, it seems reasonable to not print it.

Unfortunately it's not possible to use the `--source-quietly` flag in the lldb
invocation, because it will quiet all other `--source` flags on the command
line, making many tests fail.

This fix is a level of indirection, where a new sibling file named
`lit-lldb-init-quiet` is created, and its static contents are:

  command source -C --silent-run true lit-lldb-init

This achieves the result of loading `lit-lldb-init` quietly. The `-C` flag
loads the path relatively.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132694

Files:
  lldb/test/Shell/CMakeLists.txt
  lldb/test/Shell/helper/toolchain.py


Index: lldb/test/Shell/helper/toolchain.py
===================================================================
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -11,7 +11,7 @@
 
 
 def _get_lldb_init_path(config):
-    return os.path.join(config.test_exec_root, 'lit-lldb-init')
+    return os.path.join(config.test_exec_root, 'lit-lldb-init-quiet')
 
 
 def _disallow(config, execName):
Index: lldb/test/Shell/CMakeLists.txt
===================================================================
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -14,6 +14,9 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/lit-lldb-init.in
   ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init)
 
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init-quiet
+  "command source -C --silent-run true lit-lldb-init\n")
+
 add_lit_testsuite(check-lldb-shell "Running lldb shell test suite"
   ${CMAKE_CURRENT_BINARY_DIR}
   EXCLUDE_FROM_CHECK_ALL


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132694.455678.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220825/989392b3/attachment.bin>


More information about the lldb-commits mailing list