[Lldb-commits] [lldb] 239093f - [lldb] [testsuite] Fix a regression of TestCppScope.py

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Sat Apr 18 01:46:47 PDT 2020


Author: Jan Kratochvil
Date: 2020-04-18T10:46:32+02:00
New Revision: 239093f30c342bc8a3feec1536a3154e394e55ca

URL: https://github.com/llvm/llvm-project/commit/239093f30c342bc8a3feec1536a3154e394e55ca
DIFF: https://github.com/llvm/llvm-project/commit/239093f30c342bc8a3feec1536a3154e394e55ca.diff

LOG: [lldb] [testsuite] Fix a regression of TestCppScope.py

This is a regression since:
  [lldb][NFC] Modernize lang/cpp/scope test
  acb0b99c8e4f1dc65a7f1e26da9db77239a67da7
  rGacb0b99c8e4f

  File "/home/jkratoch/redhat/llvm-monorepo/lldb/test/API/lang/cpp/scope/TestCppScope.py", line 19, in test
    self.assertEqual(global_var_names, expected_var_names)
  AssertionError: Lists differ: ['C::a', 'A::a', 'B::a', '::a'... != ['A::a', 'B::a', 'C::a', '::a'...
  First differing element 0:
  C::a
  A::a
  - ['C::a', 'A::a', 'B::a', '::a']
  + ['A::a', 'B::a', 'C::a', '::a']

ManualDWARFIndex using NameToDIE does not sort alphabetically:
    // This is only for uniqueness, not lexicographical ordering, so we can
    // just compare pointers.
    return uintptr_t(lhs.GetCString()) < uintptr_t(rhs.GetCString());

Added: 
    

Modified: 
    lldb/test/API/lang/cpp/scope/TestCppScope.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/cpp/scope/TestCppScope.py b/lldb/test/API/lang/cpp/scope/TestCppScope.py
index 1320bd2185f8..a61f9488e215 100644
--- a/lldb/test/API/lang/cpp/scope/TestCppScope.py
+++ b/lldb/test/API/lang/cpp/scope/TestCppScope.py
@@ -14,8 +14,9 @@ def test(self):
 
         # Test that global variables contain the right scope operators.
         global_vars = self.frame().GetVariables(False, False, True, False)
-        global_var_names = [v.GetName() for v in global_vars]
-        expected_var_names = ["A::a", "B::a", "C::a", "::a"]
+        # ManualDWARFIndex using NameToDIE does not sort alphabetically.
+        global_var_names = sorted([v.GetName() for v in global_vars])
+        expected_var_names = ["::a", "A::a", "B::a", "C::a"]
         self.assertEqual(global_var_names, expected_var_names)
 
         # Test lookup in scopes.


        


More information about the lldb-commits mailing list