summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2018-05-01 22:49:01 +0000
committerJason Molenda <jmolenda@apple.com>2018-05-01 22:49:01 +0000
commitb81afd6598fbd50e0bc09c6825db5f3fd3b3c9da (patch)
treed1af88a51c59508f8a6e9dad9fe7432388a56123 /lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
parente2dfe8a8539bd457f517eaa3bb859c0f9ff21b31 (diff)
downloadbcm5719-llvm-b81afd6598fbd50e0bc09c6825db5f3fd3b3c9da.tar.gz
bcm5719-llvm-b81afd6598fbd50e0bc09c6825db5f3fd3b3c9da.zip
Fix the .experimental. settings feature so that we don't return an error
if an experimental setting has been removed/is missing. Add tests for the .experimental. settings behaviors -- that they correctly forward through to the real setting if it has become a real setting, that they don't generate errors when a settig has been removed. As Pavel notes in https://reviews.llvm.org/D45348, the way I'm suppressing errors in the setting is not completely correct - if any of the setting path components include "experimental", a missing setting would be declared a non-error. So settings set target.experimental.setting-that-does-not-exist true would not generate an error, which is correct. But as Pavel notes, settings set setting-does-not-exist.experimental.run-stopped true should generate an error because the unknown name occurs before the "experimental". The amount of change to do this correctly hasn't thrilled me, so I'm leaving this as-is for now. <rdar://problem/39223054> Differential Revision: https://reviews.llvm.org/D45348 llvm-svn: 331315
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/settings/TestSettings.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/settings/TestSettings.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py b/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
index 715cbab7c2a..6b8ac7c3d5d 100644
--- a/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
+++ b/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
@@ -524,3 +524,41 @@ class SettingsCommandTestCase(TestBase):
"target.process.extra-startup-command",
"target.process.thread.step-avoid-regexp",
"target.process.thread.trace-thread"])
+
+ # settings under an ".experimental" domain should have two properties:
+ # 1. If the name does not exist with "experimental" in the name path,
+ # the name lookup should try to find it without "experimental". So
+ # a previously-experimental setting that has been promoted to a
+ # "real" setting will still be set by the original name.
+ # 2. Changing a setting with .experimental., name, where the setting
+ # does not exist either with ".experimental." or without, should
+ # not generate an error. So if an experimental setting is removed,
+ # people who may have that in their ~/.lldbinit files should not see
+ # any errors.
+ def test_experimental_settings(self):
+ cmdinterp = self.dbg.GetCommandInterpreter()
+ result = lldb.SBCommandReturnObject()
+
+ # Set target.arg0 to a known value, check that we can retrieve it via
+ # the actual name and via .experimental.
+ self.expect('settings set target.arg0 first-value')
+ self.expect('settings show target.arg0', substrs=['first-value'])
+ self.expect('settings show target.experimental.arg0', substrs=['first-value'], error=False)
+
+ # Set target.arg0 to a new value via a target.experimental.arg0 name,
+ # verify that we can read it back via both .experimental., and not.
+ self.expect('settings set target.experimental.arg0 second-value', error=False)
+ self.expect('settings show target.arg0', substrs=['second-value'])
+ self.expect('settings show target.experimental.arg0', substrs=['second-value'], error=False)
+
+ # showing & setting an undefined .experimental. setting should generate no errors.
+ self.expect('settings show target.experimental.setting-which-does-not-exist', patterns=['^\s$'], error=False)
+ self.expect('settings set target.experimental.setting-which-does-not-exist true', error=False)
+
+ # A domain component before .experimental. which does not exist should give an error
+ # But the code does not yet do that.
+ # self.expect('settings set target.setting-which-does-not-exist.experimental.arg0 true', error=True)
+
+ # finally, confirm that trying to set a setting that does not exist still fails.
+ # (SHOWING a setting that does not exist does not currently yield an error.)
+ self.expect('settings set target.setting-which-does-not-exist true', error=True)
OpenPOWER on IntegriCloud