[Lldb-commits] [PATCH] D75537: Clear all settings during a test's setUp

Tatyana Krasnukha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 3 09:39:56 PST 2020


tatyana-krasnukha created this revision.
tatyana-krasnukha added a reviewer: labath.
tatyana-krasnukha added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere.
tatyana-krasnukha added a parent revision: D74903: [lldb][testsuite] Create a SBDebugger instance for each test.

Moved from D74903 <https://reviews.llvm.org/D74903>


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D75537

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Commands/CommandObjectSettings.cpp


Index: lldb/source/Commands/CommandObjectSettings.cpp
===================================================================
--- lldb/source/Commands/CommandObjectSettings.cpp
+++ lldb/source/Commands/CommandObjectSettings.cpp
@@ -1049,7 +1049,8 @@
   CommandObjectSettingsClear(CommandInterpreter &interpreter)
       : CommandObjectParsed(
             interpreter, "settings clear",
-            "Clear a debugger setting array, dictionary, or string.", nullptr) {
+            "Clear a debugger setting array, dictionary, or string. "
+            "Clear all settings if no arguments were specified.", nullptr) {
     CommandArgumentEntry arg;
     CommandArgumentData var_name_arg;
 
@@ -1082,8 +1083,13 @@
     result.SetStatus(eReturnStatusSuccessFinishNoResult);
     const size_t argc = command.GetArgumentCount();
 
+    if (argc == 0)  {
+      GetDebugger().GetValueProperties()->Clear();
+      return result.Succeeded();
+    }
+
     if (argc != 1) {
-      result.AppendError("'settings clear' takes exactly one argument");
+      result.AppendError("'settings clear' takes at most one argument");
       result.SetStatus(eReturnStatusFailed);
       return false;
     }
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -687,6 +687,9 @@
     @classmethod
     def setUpCommands(cls):
         commands = [
+            # First of all, clear all settings to have clean state of global properties.
+            "settings clear",
+
             # Disable Spotlight lookup. The testsuite creates
             # different binaries with the same UUID, because they only
             # differ in the debug info, which is not being hashed.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75537.247925.patch
Type: text/x-patch
Size: 1827 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200303/9bcddab3/attachment.bin>


More information about the lldb-commits mailing list