[Lldb-commits] [lldb] 1267bb2 - [lldb] TestTypeGetModule.py review improvements
Ilya Bukonkin via lldb-commits
lldb-commits at lists.llvm.org
Sun Nov 1 03:02:47 PST 2020
Author: Ilya Bukonkin
Date: 2020-11-01T13:55:57+03:00
New Revision: 1267bb2e416e42f9c3bbfa7b6cbf4975fa7aa546
URL: https://github.com/llvm/llvm-project/commit/1267bb2e416e42f9c3bbfa7b6cbf4975fa7aa546
DIFF: https://github.com/llvm/llvm-project/commit/1267bb2e416e42f9c3bbfa7b6cbf4975fa7aa546.diff
LOG: [lldb] TestTypeGetModule.py review improvements
Added:
Modified:
lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
Removed:
################################################################################
diff --git a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
index 14edc0a14675..5a166e3b38aa 100644
--- a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -26,6 +26,7 @@ def find_module(self, target, name):
index += 1
+ self.assertTrue(result.IsValid())
return result
def find_comp_unit(self, exe_module, name):
@@ -41,6 +42,7 @@ def find_comp_unit(self, exe_module, name):
index += 1
+ self.assertTrue(result.IsValid())
return result
def find_type(self, type_list, name):
@@ -56,39 +58,21 @@ def find_type(self, type_list, name):
index += 1
+ self.assertTrue(result.IsValid())
return result
def test(self):
self.build()
target = lldbutil.run_to_breakpoint_make_target(self)
exe_module = self.find_module(target, 'a.out')
- self.assertTrue(exe_module.IsValid())
-
- type1_name = 'compile_unit1_type'
- type2_name = 'compile_unit2_type'
num_comp_units = exe_module.GetNumCompileUnits()
self.assertEqual(num_comp_units, 3)
comp_unit = self.find_comp_unit(exe_module, 'compile_unit1.c')
- self.assertTrue(comp_unit.IsValid())
-
- cu_type = self.find_type(comp_unit.GetTypes(), type1_name)
- self.assertTrue(cu_type.IsValid())
- self.assertEqual(cu_type.GetName(), type1_name)
-
+ cu_type = self.find_type(comp_unit.GetTypes(), 'compile_unit1_type')
+ self.assertTrue(exe_module == cu_type.GetModule())
+
comp_unit = self.find_comp_unit(exe_module, 'compile_unit2.c')
- self.assertTrue(comp_unit.IsValid())
-
- cu_type = self.find_type(comp_unit.GetTypes(), type2_name)
- self.assertTrue(cu_type.IsValid())
- self.assertEqual(cu_type.GetName(), type2_name)
-
- type1 = target.FindFirstType(type1_name)
- self.assertTrue(type1.IsValid())
-
- type2 = target.FindFirstType(type2_name)
- self.assertTrue(type2.IsValid())
-
- self.assertTrue(exe_module == type1.GetModule() and
- exe_module == type2.GetModule())
+ cu_type = self.find_type(comp_unit.GetTypes(), 'compile_unit2_type')
+ self.assertTrue(exe_module == cu_type.GetModule())
More information about the lldb-commits
mailing list