While we are at it, let's also exercise the similar SBModule.FindGlobalVariables() API within
the find_global_variables() test method.

Skipping test_find_global_variables_with_dwarf(self) due to segmentation fault.

llvm-svn: 134118
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py
index b916cb5..3cfe011 100644
--- a/lldb/test/python_api/target/TestTargetAPI.py
+++ b/lldb/test/python_api/target/TestTargetAPI.py
@@ -16,14 +16,20 @@
     @python_api_test
     def test_find_global_variables_with_dsym(self):
         """Exercise SBTaget.FindGlobalVariables() API."""
-        self.buildDsym()
-        self.find_global_variables()
+        d = {'EXE': 'a.out'}
+        self.buildDsym(dictionary=d)
+        self.setTearDownCleanup(dictionary=d)
+        self.find_global_variables('a.out')
 
+    #rdar://problem/9700873
+    @unittest2.skip("segmentation fault -- skipping")
     @python_api_test
     def test_find_global_variables_with_dwarf(self):
         """Exercise SBTarget.FindGlobalVariables() API."""
-        self.buildDwarf()
-        self.find_global_variables()
+        d = {'EXE': 'b.out'}
+        self.buildDwarf(dictionary=d)
+        self.setTearDownCleanup(dictionary=d)
+        self.find_global_variables('b.out')
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
@@ -71,15 +77,15 @@
         self.line1 = line_number('main.c', '// Find the line number for breakpoint 1 here.')
         self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
 
-    def find_global_variables(self):
+    def find_global_variables(self, exe_name):
         """Exercise SBTaget.FindGlobalVariables() API."""
-        exe = os.path.join(os.getcwd(), "a.out")
+        exe = os.path.join(os.getcwd(), exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
 
-        value_list = target.FindGlobalVariables('my_global_var_of_char_type', 1)
+        value_list = target.FindGlobalVariables('my_global_var_of_char_type', 3)
         self.assertTrue(value_list.GetSize() == 1)
         my_global_var = value_list.GetValueAtIndex(0)
         self.expect(my_global_var.GetName(), exe=False,
@@ -89,6 +95,14 @@
         self.expect(my_global_var.GetValue(), exe=False,
             startstr = "'X'")
 
+        # While we are at it, let's also exercise the similar SBModule.FindGlobalVariables() API.
+        for m in target.module_iter():
+            if m.GetFileSpec().GetDirectory() == os.getcwd() and m.GetFileSpec().GetFilename() == exe_name:
+                value_list = m.FindGlobalVariables(target, 'my_global_var_of_char_type', 3)
+                self.assertTrue(value_list.GetSize() == 1)
+                self.assertTrue(value_list.GetValueAtIndex(0).GetValue() == "'X'")
+                break
+
     def get_description(self):
         """Exercise SBTaget.GetDescription() API."""
         exe = os.path.join(os.getcwd(), "a.out")