Author: Ilya Bukonkin
Date: 2020-10-29T18:28:57-07:00
New Revision: 56282cf7e271092a81aced9cb1e8998f2d395f70

URL: 
https://github.com/llvm/llvm-project/commit/56282cf7e271092a81aced9cb1e8998f2d395f70
DIFF: 
https://github.com/llvm/llvm-project/commit/56282cf7e271092a81aced9cb1e8998f2d395f70.diff

LOG: [lldb] Update TestTypeGetModule.py

Differential revision: https://reviews.llvm.org/D88483

Added: 
    lldb/test/API/functionalities/type_get_module/type_definitions.h

Modified: 
    lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
    lldb/test/API/functionalities/type_get_module/compile_unit1.c
    lldb/test/API/functionalities/type_get_module/compile_unit2.c
    lldb/test/API/functionalities/type_get_module/main.c

Removed: 
    


################################################################################
diff  --git 
a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py 
b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
index ccab396455ea..14edc0a14675 100644
--- a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -17,78 +17,78 @@ def find_module(self, target, name):
         num_modules = target.GetNumModules()
         index = 0
         result = lldb.SBModule()
-        
+
         while index < num_modules:
             module = target.GetModuleAtIndex(index)
             if module.GetFileSpec().GetFilename() == name:
                 result = module
                 break
-                
+
             index += 1
-            
+
         return result
 
     def find_comp_unit(self, exe_module, name):
         num_comp_units = exe_module.GetNumCompileUnits()
         index = 0
         result = lldb.SBCompileUnit()
-        
+
         while index < num_comp_units:
             comp_unit = exe_module.GetCompileUnitAtIndex(index)
             if comp_unit.GetFileSpec().GetFilename() == name:
                 result = comp_unit
                 break
-                
+
             index += 1
-            
+
         return result
-        
+
     def find_type(self, type_list, name):
         num_types = type_list.GetSize()
         index = 0
         result = lldb.SBType()
-        
+
         while index < num_types:
             type = type_list.GetTypeAtIndex(index)
             if type.GetName() == name:
                 result = type
                 break
-                
+
             index += 1
-        
+
         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)
-        
+
         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())

diff  --git a/lldb/test/API/functionalities/type_get_module/compile_unit1.c 
b/lldb/test/API/functionalities/type_get_module/compile_unit1.c
index 0f967ef66810..2d1a31ccbf0c 100644
--- a/lldb/test/API/functionalities/type_get_module/compile_unit1.c
+++ b/lldb/test/API/functionalities/type_get_module/compile_unit1.c
@@ -1,6 +1,3 @@
-struct compile_unit1_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit1_type compile_unit1_var = {1, 1};

diff  --git a/lldb/test/API/functionalities/type_get_module/compile_unit2.c 
b/lldb/test/API/functionalities/type_get_module/compile_unit2.c
index ca7735e27042..2d93d1fb8758 100644
--- a/lldb/test/API/functionalities/type_get_module/compile_unit2.c
+++ b/lldb/test/API/functionalities/type_get_module/compile_unit2.c
@@ -1,6 +1,3 @@
-struct compile_unit2_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit2_type compile_unit2_var = {2, 2};

diff  --git a/lldb/test/API/functionalities/type_get_module/main.c 
b/lldb/test/API/functionalities/type_get_module/main.c
index 76e8197013aa..8f038c2bacaf 100644
--- a/lldb/test/API/functionalities/type_get_module/main.c
+++ b/lldb/test/API/functionalities/type_get_module/main.c
@@ -1 +1,11 @@
-int main() { return 0; }
+#include "type_definitions.h"
+
+extern struct compile_unit1_type compile_unit1_var;
+extern struct compile_unit2_type compile_unit2_var;
+
+int main() {
+  compile_unit1_var.x = 5;
+  compile_unit2_var.y = 10;
+
+  return 0;
+}

diff  --git a/lldb/test/API/functionalities/type_get_module/type_definitions.h 
b/lldb/test/API/functionalities/type_get_module/type_definitions.h
new file mode 100644
index 000000000000..0c7da70a94d1
--- /dev/null
+++ b/lldb/test/API/functionalities/type_get_module/type_definitions.h
@@ -0,0 +1,9 @@
+struct compile_unit1_type {
+  int x;
+  int y;
+};
+
+struct compile_unit2_type {
+  int x;
+  int y;
+};


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to