[Lldb-commits] [lldb] 8f121a3 - [lldb] Update regex to be less fragile in TestDataFormatterGenericUnordered

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 11 11:43:08 PST 2022


Author: Dave Lee
Date: 2022-11-11T11:42:56-08:00
New Revision: 8f121a3f18f7cc9dac08b7fb43ed7deec6adf583

URL: https://github.com/llvm/llvm-project/commit/8f121a3f18f7cc9dac08b7fb43ed7deec6adf583
DIFF: https://github.com/llvm/llvm-project/commit/8f121a3f18f7cc9dac08b7fb43ed7deec6adf583.diff

LOG: [lldb] Update regex to be less fragile in TestDataFormatterGenericUnordered

Follow up to D129386 where libc++ naming conventions were made consistent.

This changes the pattern to not rely on the internal name (`__cc` or `__cc_`),
and instead uses a pattern to check that the child has the form:

```
[0] = {
  first = ...
```

Thanks to @rupprecht for pointing out this issue: https://reviews.llvm.org/D133259#3773120

Reviewed By: rupprecht

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

Added: 
    

Modified: 
    lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py
index 7730e780bd478..0f6ea01282407 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py
@@ -36,6 +36,9 @@ def cleanup():
             self.runCmd(
                 "settings set target.max-children-count 256",
                 check=False)
+            self.runCmd(
+                'settings set auto-one-line-summaries true',
+                check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
@@ -47,16 +50,19 @@ def cleanup():
             "corrupt_map", ['%s::unordered_map' %
                     ns, 'size=0 {}'])
 
-        must_not_contain__cc = r'(?s)^(?!.*\b__cc = )'
+        # Ensure key/value children, not wrapped in a layer.
+        # This regex depends on auto-one-line-summaries.
+        self.runCmd('settings set auto-one-line-summaries false')
+        children_are_key_value = r'\[0\] = \{\s*first = '
 
         self.look_for_content_and_continue(
             "map", ['%s::unordered_map' % ns,
-                    must_not_contain__cc,
+                    children_are_key_value,
                     'size=5 {', 'hello', 'world', 'this', 'is', 'me'])
 
         self.look_for_content_and_continue(
             "mmap", ['%s::unordered_multimap' % ns,
-                     must_not_contain__cc,
+                     children_are_key_value,
                      'size=6 {', 'first = 3', 'second = "this"',
                      'first = 2', 'second = "hello"'])
 


        


More information about the lldb-commits mailing list