[lldb] Remove prefer-dynamic-value test override
authorDave Lee <davelee.com@gmail.com>
Mon, 22 Aug 2022 04:48:14 +0000 (21:48 -0700)
committerDave Lee <davelee.com@gmail.com>
Mon, 22 Aug 2022 22:46:03 +0000 (15:46 -0700)
Remove the test override of `target.prefer-dynamic-value`.

Previously, the lldb default was `no-dynamic-values`. In rG9aa7e8e9ffbe (in
2015), the default was changed to `no-run-target`, but at that time the tests
were changed to be run with `no-dynamic-value`. I don't know the reasons for
not changing the tests, perhaps to avoid determining which tests to change, and
what about them to change.

Because `no-run-target` is the lldb default, I think it makes sense to make it
the test default too. It puts the test config closer to what's used in
practice.

This change removes the `target.prefer-dynamic-value` override, and for those
tests that failed, they have been updated to explicitly use
`no-dynamic-values`. Future changes could update these tests to use dynamic
values too, or they can be left as is to exercise non-dynamic typing.

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

21 files changed:
lldb/packages/Python/lldbsuite/test/configuration.py
lldb/test/API/commands/expression/po_verbosity/TestPoVerbosity.py
lldb/test/API/commands/expression/two-files/TestObjCTypeQueryFromOtherCompileUnit.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCExpr.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCKVO.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSData.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSNumber.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
lldb/test/API/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py
lldb/test/API/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py
lldb/test/API/lang/cpp/diamond/TestCppDiamond.py
lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
lldb/test/API/lang/objc/exceptions/TestObjCExceptions.py
lldb/test/API/lang/objc/foundation/TestObjCMethods.py
lldb/test/API/lang/objc/foundation/TestObjCMethodsString.py
lldb/test/API/lang/objc/foundation/TestRuntimeTypes.py
lldb/test/API/lang/objc/objc-new-syntax/TestObjCNewSyntaxLiteral.py
lldb/test/API/lang/objc/real-definition/TestRealDefinition.py
lldb/test/API/sanity/TestSettingSkipping.py

index 5133ded..2a8d125 100644 (file)
@@ -51,8 +51,7 @@ sdkroot = None
 dwarf_version = 0
 
 # Any overridden settings.
-# Always disable default dynamic types for testing purposes.
-settings = [('target.prefer-dynamic-value', 'no-dynamic-values')]
+settings = []
 
 # Path to the FileCheck testing tool. Not optional.
 filecheck = None
index a913136..9d143ec 100644 (file)
@@ -41,6 +41,8 @@ class PoVerbosityTestCase(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         self.expect("expr -O -v -- foo",
                     substrs=['(id) $', ' = 0x', '1 = 2', '2 = 3;'])
         self.expect("expr -O -vfull -- foo",
index a40eb12..044c532 100644 (file)
@@ -32,6 +32,8 @@ class ObjCTypeQueryTestCase(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         # Now do a NSArry type query from the 'main.m' compile uint.
         self.expect("expression (NSArray*)array_token",
                     substrs=['(NSArray *) $0 = 0x'])
index 63ba598..44b313e 100644 (file)
@@ -27,6 +27,8 @@ class ObjCDataFormatterCF(ObjCDataFormatterTestCase):
             STOPPED_DUE_TO_BREAKPOINT,
             substrs=['stopped', 'stop reason = breakpoint'])
 
+        self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
         # check formatters for common Objective-C types
         expect_strings = [
             '(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
index 91a4567..70da09e 100644 (file)
@@ -27,6 +27,8 @@ class ObjCDataFormatterExpr(ObjCDataFormatterTestCase):
             STOPPED_DUE_TO_BREAKPOINT,
             substrs=['stopped', 'stop reason = breakpoint'])
 
+        self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
         # This is the function to remove the custom formats in order to have a
         # clean slate for the next test case.
         def cleanup():
index f0b1716..0768534 100644 (file)
@@ -21,6 +21,8 @@ class ObjCDataFormatterKVO(ObjCDataFormatterTestCase):
             self, '// Set break point at this line.',
             lldb.SBFileSpec('main.m', False))
 
+        self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
         # The stop reason of the thread should be breakpoint.
         self.expect(
             "thread list",
index 375aefe..20f464a 100644 (file)
@@ -19,6 +19,8 @@ class ObjCDataFormatterNSContainer(ObjCDataFormatterTestCase):
         self.appkit_tester_impl(self.nscontainers_data_formatter_commands, False)
 
     def nscontainers_data_formatter_commands(self):
+        self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
         self.expect(
             'frame variable newArray nsDictionary newDictionary nscfDictionary cfDictionaryRef newMutableDictionary copyDictionary newMutableDictionaryRef cfarray_ref mutable_array_ref',
             substrs=[
index 846e1d9..cf3ffea 100644 (file)
@@ -24,6 +24,8 @@ class ObjCDataFormatterNSData(ObjCDataFormatterTestCase):
         self.appkit_tester_impl(self.nsdata_data_formatter_commands, False)
 
     def nsdata_data_formatter_commands(self):
+        self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
         self.expect(
             'frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref concreteData concreteMutableData',
             substrs=[
index beabb23..4d90020 100644 (file)
@@ -24,6 +24,8 @@ class ObjCDataFormatterNSNumber(ObjCDataFormatterTestCase):
         self.appkit_tester_impl(self.nscontainers_data_formatter_commands, False)
 
     def nscontainers_data_formatter_commands(self):
+        self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
         self.expect(
             'frame variable newArray nsDictionary newDictionary nscfDictionary cfDictionaryRef newMutableDictionary cfarray_ref mutable_array_ref',
             substrs=[
index 64ba72c..8a5bfee 100644 (file)
@@ -22,6 +22,8 @@ class NSStringDataFormatterTestCase(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
                     substrs=['stopped',
index 15ad88f..41c1d1a 100644 (file)
@@ -74,7 +74,7 @@ class NSArraySyntheticTestCase(TestBase):
             substrs=[
                 '@"0 elements"'])
         self.expect(
-            'frame variable arr --ptr-depth 1 -d no-run-target',
+            'frame variable arr --ptr-depth 1',
             substrs=[
                 '@"6 elements"',
                 '@"hello"',
@@ -84,14 +84,14 @@ class NSArraySyntheticTestCase(TestBase):
                 '@"me"',
                 '@"http://www.apple.com'])
         self.expect(
-            'frame variable other_arr --ptr-depth 1 -d no-run-target',
+            'frame variable other_arr --ptr-depth 1',
             substrs=[
                 '@"4 elements"',
                 '(int)5',
                 '@"a string"',
                 '@"6 elements"'])
         self.expect(
-            'frame variable other_arr --ptr-depth 2 -d no-run-target',
+            'frame variable other_arr --ptr-depth 2',
             substrs=[
                 '@"4 elements"',
                 '@"6 elements" {',
index fc6755f..9e60772 100644 (file)
@@ -86,7 +86,7 @@ class NSDictionarySyntheticTestCase(TestBase):
                 '[2] = ',
                 '[3] = '])
         self.expect(
-            'frame variable dictionary --ptr-depth 1 --dynamic-type no-run-target',
+            'frame variable dictionary --ptr-depth 1',
             substrs=[
                 '3 key/value pairs',
                 '@"bar"',
@@ -94,7 +94,7 @@ class NSDictionarySyntheticTestCase(TestBase):
                 '@"baz"',
                 '2 key/value pairs'])
         self.expect(
-            'frame variable mutabledict --ptr-depth 1 --dynamic-type no-run-target',
+            'frame variable mutabledict --ptr-depth 1',
             substrs=[
                 '4 key/value pairs',
                 '(int)23',
@@ -103,7 +103,7 @@ class NSDictionarySyntheticTestCase(TestBase):
                 '@"sourceofstuff"',
                 '3 key/value pairs'])
         self.expect(
-            'frame variable mutabledict --ptr-depth 2 --dynamic-type no-run-target',
+            'frame variable mutabledict --ptr-depth 2',
             substrs=[
                 '4 key/value pairs',
                 '(int)23',
@@ -114,7 +114,7 @@ class NSDictionarySyntheticTestCase(TestBase):
                 '@"bar"',
                 '@"2 elements"'])
         self.expect(
-            'frame variable mutabledict --ptr-depth 3 --dynamic-type no-run-target',
+            'frame variable mutabledict --ptr-depth 3',
             substrs=[
                 '4 key/value pairs',
                 '(int)23',
index 811612b..18933aa 100644 (file)
@@ -19,6 +19,8 @@ class TestCase(TestBase):
         self.build()
         lldbutil.run_to_source_breakpoint(self, "// breakpoint 1", lldb.SBFileSpec("main.cpp"))
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         j1 = self.frame().FindVariable("j1")
         j1_Derived1 = j1.GetChildAtIndex(0)
         j1_Derived2 = j1.GetChildAtIndex(1)
index 2c1ea72..7a46138 100644 (file)
@@ -44,6 +44,8 @@ class TestObjCIvarsInBlocks(TestBase):
             process.GetState(), lldb.eStateStopped,
             "Stopped it too.")
 
+        self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
         thread_list = lldbutil.get_threads_stopped_at_breakpoint(
             process, breakpoint)
         self.assertEqual(len(thread_list), 1)
index 54473e0..663ab11 100644 (file)
@@ -64,7 +64,7 @@ class ObjCExceptionsTestCase(TestBase):
             ])
 
         self.expect(
-            'frame variable --dynamic-type no-run-target *e1',
+            'frame variable *e1',
             substrs=[
                 '(NSException) *e1 = ',
                 'name = ', '"ExceptionName"',
@@ -93,7 +93,7 @@ class ObjCExceptionsTestCase(TestBase):
             ])
 
         self.expect(
-            'frame variable --dynamic-type no-run-target *e2',
+            'frame variable *e2',
             substrs=[
                 '(NSException) *e2 = ',
                 'name = ', '"ThrownException"',
index 3a61c7d..556efc5 100644 (file)
@@ -124,6 +124,8 @@ class FoundationTestCase(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         # The backtrace should show we stop at -[MyString description].
         self.expect("thread backtrace", "Stop at -[MyString description]",
                     substrs=["a.out`-[MyString description]"])
index 9760d6a..2f3ffda 100644 (file)
@@ -19,6 +19,8 @@ class FoundationTestCaseString(TestBase):
                 self, '// Break here for NSString tests',
                 lldb.SBFileSpec('main.m', False))
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         # Test_NSString:
         self.runCmd("thread backtrace")
         self.expect("expression (int)[str length]",
index c2e9c6b..00bd44a 100644 (file)
@@ -31,6 +31,8 @@ class RuntimeTypesTestCase(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         # The backtrace should show we stop at -[MyString description].
         self.expect("thread backtrace", "Stop at -[MyString description]",
                     substrs=["a.out`-[MyString description]"])
index c67239d..5732730 100644 (file)
@@ -54,6 +54,8 @@ class ObjCNewSyntaxTestCaseLiteral(ObjCNewSyntaxTest):
     def test_float_literal(self):
         self.runToBreakpoint()
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         self.expect("expr -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
                     substrs=["NSNumber", "123.45"])
 
@@ -62,6 +64,8 @@ class ObjCNewSyntaxTestCaseLiteral(ObjCNewSyntaxTest):
     def test_expressions_in_literals(self):
         self.runToBreakpoint()
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         self.expect(
             "expr --object-description -- @( 1 + 3 )",
             VARIABLES_DISPLAYED_CORRECTLY,
index c182bc1..5f094e8 100644 (file)
@@ -28,6 +28,8 @@ class TestRealDefinition(TestBase):
         # Run at stop at main
         lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         # This should display correctly.
         self.expect(
             "frame variable foo->_bar->_hidden_ivar",
@@ -53,6 +55,8 @@ class TestRealDefinition(TestBase):
         # Run at stop at main
         lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
+        self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
         # This should display correctly.
         self.expect(
             "frame variable foo->_bar->_hidden_ivar",
index 4e05446..0b44cc3 100644 (file)
@@ -12,12 +12,12 @@ class SettingSkipSanityTestCase(TestBase):
 
   NO_DEBUG_INFO_TESTCASE = True
 
-  @skipIf(setting=('target.prefer-dynamic-value', 'no-dynamic-values'))
+  @skipIf(py_version=('>=', (3, 0)))
   def testSkip(self):
     """This setting is on by default"""
     self.assertTrue(False, "This test should not run!")
 
-  @skipIf(setting=('target.prefer-dynamic-value', 'run-target'))
+  @skipIf(py_version=('<', (3, 0)))
   def testNoMatch(self):
     self.assertTrue(True, "This test should run!")
 
@@ -25,11 +25,11 @@ class SettingSkipSanityTestCase(TestBase):
   def testNotExisting(self):
     self.assertTrue(True, "This test should run!")
 
-  @expectedFailureAll(setting=('target.prefer-dynamic-value', 'no-dynamic-values'))
+  @expectedFailureAll(py_version=('>=', (3, 0)))
   def testXFAIL(self):
     self.assertTrue(False, "This test should run and fail!")
 
-  @expectedFailureAll(setting=('target.prefer-dynamic-value', 'run-target'))
+  @expectedFailureAll(py_version=('<', (3, 0)))
   def testNotXFAIL(self):
     self.assertTrue(True, "This test should run and succeed!")