Merge dwarf and dsym tests

Currently most of the test files have a separate dwarf and a separate
dsym test with almost identical content (only the build step is
different). With adding dwo symbol file handling to the test suit it
would increase this to a 3-way duplication. The purpose of this change
is to eliminate this redundancy with generating 2 test case (one dwarf
and one dsym) for each test function specified (dwo handling will be
added at a later commit).

Main design goals:
* There should be no boilerplate code in each test file to support the
  multiple debug info in most of the tests (custom scenarios are
  acceptable in special cases) so adding a new test case is easier and
  we can't miss one of the debug info type.
* In case of a test failure, the debug symbols used during the test run
  have to be cleanly visible from the output of dotest.py to make
  debugging easier both from build bot logs and from local test runs
* Each test case should have a unique, fully qualified name so we can
  run exactly 1 test with "-f <test-case>.<test-function>" syntax
* Test output should be grouped based on test files the same way as it
  happens now (displaying dwarf/dsym results separately isn't
  preferable)

Proposed solution (main logic in lldbtest.py, rest of them are test
cases fixed up for the new style):
* Have only 1 test fuction in the test files what will run for all
  debug info separately and this test function should call just
  "self.build(...)" to build an inferior with the right debug info
* When a class is created by python (the class object, not the class
  instance), we will generate a new test method for each debug info
  format in the test class with the name "<test-function>_<debug-info>"
  and remove the original test method. This way unittest2 see multiple
  test methods (1 for each debug info, pretty much as of now) and will
  handle the test selection and the failure reporting correctly (the
  debug info will be visible from the end of the test name)
* Add new annotation @no_debug_info_test to disable the generation of
  multiple tests for each debug info format when the test don't have an
  inferior

Differential revision: http://reviews.llvm.org/D13028

llvm-svn: 248883
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 80bf487..d6a9f70 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -18,19 +18,10 @@
         cls.RemoveTempFile("output.txt")
         cls.RemoveTempFile("output2.txt")
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym(self):
-        """Test a sequence of breakpoint command add, list, and delete."""
-        self.buildDsym()
-        self.breakpoint_command_sequence()
-        self.breakpoint_command_script_parameters ()
-
-    @dwarf_test
     @expectedFailureWindows("llvm.org/pr24528")
-    def test_with_dwarf(self):
+    def test(self):
         """Test a sequence of breakpoint command add, list, and delete."""
-        self.buildDwarf()
+        self.build()
         self.breakpoint_command_sequence()
         self.breakpoint_command_script_parameters ()
 
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
index 7fab045..c7bc773 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
@@ -14,19 +14,10 @@
     mydir = TestBase.compute_mydir(__file__)
     my_var = 10
 
-    @skipUnlessDarwin
     @python_api_test
-    @dsym_test
-    def test_step_out_with_dsym_python(self):
+    def test_step_out_python(self):
         """Test stepping out using avoid-no-debug with dsyms."""
-        self.buildDsym()
-        self.do_set_python_command_from_python()
-
-    @python_api_test
-    @dwarf_test
-    def test_step_out_with_dwarf_python(self):
-        """Test stepping out using avoid-no-debug with dsyms."""
-        self.buildDwarf()
+        self.build()
         self.do_set_python_command_from_python ()
 
     def setUp (self):
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
index ca95f36..e5fda67 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
@@ -12,17 +12,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym(self):
+    def test(self):
         """Test _regexp-break command."""
-        self.buildDsym()
-        self.regexp_break_command()
-
-    @dwarf_test
-    def test_with_dwarf(self):
-        """Test _regexp-break command."""
-        self.buildDwarf()
+        self.build()
         self.regexp_break_command()
 
     def setUp(self):
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
index a60a917..1aa0154 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -12,48 +12,23 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_breakpoint_condition_with_dsym_and_run_command(self):
+    @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+    def test_breakpoint_condition_and_run_command(self):
         """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
-        self.buildDsym()
+        self.build()
         self.breakpoint_conditions()
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_breakpoint_condition_inline_with_dsym_and_run_command(self):
+    @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+    def test_breakpoint_condition_inline_and_run_command(self):
         """Exercise breakpoint condition inline with 'breakpoint set'."""
-        self.buildDsym()
+        self.build()
         self.breakpoint_conditions(inline=True)
 
-    @skipUnlessDarwin
+    @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
     @python_api_test
-    @dsym_test
-    def test_breakpoint_condition_with_dsym_and_python_api(self):
+    def test_breakpoint_condition_and_python_api(self):
         """Use Python APIs to set breakpoint conditions."""
-        self.buildDsym()
-        self.breakpoint_conditions_python()
-
-    @dwarf_test
-    @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-    def test_breakpoint_condition_with_dwarf_and_run_command(self):
-        """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
-        self.buildDwarf()
-        self.breakpoint_conditions()
-
-    @dwarf_test
-    @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-    def test_breakpoint_condition_inline_with_dwarf_and_run_command(self):
-        """Exercise breakpoint condition inline with 'breakpoint set'."""
-        self.buildDwarf()
-        self.breakpoint_conditions(inline=True)
-
-    @python_api_test
-    @dwarf_test
-    @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-    def test_breakpoint_condition_with_dwarf_and_python_api(self):
-        """Use Python APIs to set breakpoint conditions."""
-        self.buildDwarf()
+        self.build()
         self.breakpoint_conditions_python()
 
     def setUp(self):
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py b/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
index 23d7e8a..efab6fb 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
@@ -12,18 +12,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym (self):
-        self.buildDsym ()
-        self.breakpoint_id_tests ()
+    def test (self):
+        self.build()
 
-    @dwarf_test
-    def test_with_dwarf (self):
-        self.buildDwarf ()
-        self.breakpoint_id_tests ()
-
-    def breakpoint_id_tests (self):
         exe = os.path.join (os.getcwd(), "a.out")
         self.expect("file " + exe,
                     patterns = [ "Current executable set to .*a.out" ])
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
index 7655af3..6daa68d 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
@@ -12,32 +12,15 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym_and_run_command(self):
+    def test_with_run_command(self):
         """Exercise breakpoint ignore count with 'breakpoint set -i <count>'."""
-        self.buildDsym()
-        self.breakpoint_ignore_count()
-
-    @skipUnlessDarwin
-    @python_api_test
-    @dsym_test
-    def test_with_dsym_and_python_api(self):
-        """Use Python APIs to set breakpoint ignore count."""
-        self.buildDsym()
-        self.breakpoint_ignore_count_python()
-
-    @dwarf_test
-    def test_with_dwarf_and_run_command(self):
-        """Exercise breakpoint ignore count with 'breakpoint set -i <count>'."""
-        self.buildDwarf()
+        self.build()
         self.breakpoint_ignore_count()
 
     @python_api_test
-    @dwarf_test
-    def test_with_dwarf_and_python_api(self):
+    def test_with_python_api(self):
         """Use Python APIs to set breakpoint ignore count."""
-        self.buildDwarf()
+        self.build()
         self.breakpoint_ignore_count_python()
 
     def setUp(self):
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index 27d91ad..4e95711 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -12,18 +12,10 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym(self):
-        """Test breakpoint enable/disable for a breakpoint ID with multiple locations."""
-        self.buildDsym()
-        self.breakpoint_locations_test()
-
-    @dwarf_test
     @expectedFailureWindows("llvm.org/pr24528")
-    def test_with_dwarf(self):
+    def test(self):
         """Test breakpoint enable/disable for a breakpoint ID with multiple locations."""
-        self.buildDwarf()
+        self.build()
         self.breakpoint_locations_test()
 
     def setUp(self):
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py b/lldb/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
index 2efa53a..b71fbab 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
@@ -12,17 +12,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym(self):
+    def test(self):
         """Test breakpoint command for different options."""
-        self.buildDsym()
-        self.breakpoint_options_test()
-
-    @dwarf_test
-    def test_with_dwarf(self):
-        """Test breakpoint command for different options."""
-        self.buildDwarf()
+        self.build()
         self.breakpoint_options_test()
 
     def setUp(self):
diff --git a/lldb/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py b/lldb/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
index 67a29a4..d67c43f 100644
--- a/lldb/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
+++ b/lldb/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
@@ -24,27 +24,24 @@
         self.line = line_number(_SRC_FILE, '// Set break point at this line.')
         self.src_path = os.path.join(os.getcwd(), _SRC_FILE)
 
-    @dwarf_test
     @skipIfHostWindows
     def test_symlink_paths_set(self):
         pwd_symlink = self.create_src_symlink()
-        self.build(pwd_symlink)
+        self.doBuild(pwd_symlink)
         self.runCmd("settings set %s %s" % (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
         lldbutil.run_break_set_by_file_and_line(self, self.src_path, self.line)
 
-    @dwarf_test
     @skipUnlessHostLinux
     def test_symlink_paths_set_procselfcwd(self):
         pwd_symlink = '/proc/self/cwd'
-        self.build(pwd_symlink)
+        self.doBuild(pwd_symlink)
         self.runCmd("settings set %s %s" % (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
         lldbutil.run_break_set_by_file_and_line(self, self.src_path, self.line)
 
-    @dwarf_test
     @skipIfHostWindows
     def test_symlink_paths_unset(self):
         pwd_symlink = self.create_src_symlink()
-        self.build(pwd_symlink)
+        self.doBuild(pwd_symlink)
         self.runCmd('settings clear ' + _COMP_DIR_SYM_LINK_PROP)
         self.assertRaises(AssertionError, lldbutil.run_break_set_by_file_and_line, self, self.src_path, self.line)
 
@@ -54,8 +51,8 @@
         self.addTearDownHook(lambda: os.remove(pwd_symlink))
         return pwd_symlink
 
-    def build(self, pwd_symlink):
-        self.buildDwarf(None, None, {'PWD': pwd_symlink}, True)
+    def doBuild(self, pwd_symlink):
+        self.build(None, None, {'PWD': pwd_symlink}, True)
 
         exe = os.path.join(os.getcwd(), _EXE_NAME)
         self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)
diff --git a/lldb/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py b/lldb/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
index fe1459f..5f94352 100644
--- a/lldb/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
+++ b/lldb/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
@@ -10,17 +10,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
     @unittest2.expectedFailure("llvm.org/pr23478")
-    def test_with_dsym (self):
-        self.buildDsym ()
-        self.consecutive_breakpoints_tests()
-
-    @dwarf_test
-    @unittest2.expectedFailure("llvm.org/pr23478")
-    def test_with_dwarf (self):
-        self.buildDwarf ()
+    def test (self):
+        self.build ()
         self.consecutive_breakpoints_tests()
 
     def consecutive_breakpoints_tests(self):
diff --git a/lldb/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py b/lldb/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
index 8fcd08b..23ccbb5 100644
--- a/lldb/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
+++ b/lldb/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
@@ -12,16 +12,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym (self):
-        self.buildDsym ()
-        self.breakpoint_id_tests ()
-
-    @dwarf_test
     @expectedFailureWindows("llvm.org/pr24764")
-    def test_with_dwarf (self):
-        self.buildDwarf ()
+    def test (self):
+        self.build ()
         self.breakpoint_id_tests ()
 
     def verify_breakpoint_locations(self, target, bp_dict):
diff --git a/lldb/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py b/lldb/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
index 5078fcd..aa52a2c 100644
--- a/lldb/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
+++ b/lldb/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
@@ -14,20 +14,11 @@
     mydir = TestBase.compute_mydir(__file__)
     my_var = 10
 
-    @skipUnlessDarwin
-    @python_api_test
-    @dsym_test
-    def test_cpp_exception_breakpoint (self):
-        """Test setting and hitting the C++ exception breakpoint."""
-        self.buildDsym()
-        self.do_cpp_exception_bkpt ()
-
     @python_api_test
     @expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support throw or catch
-    @dwarf_test
-    def test_cpp_exception_breakpoint_with_dwarf(self):
+    def test_cpp_exception_breakpoint(self):
         """Test setting and hitting the C++ exception breakpoint."""
-        self.buildDwarf()
+        self.build()
         self.do_cpp_exception_bkpt ()
 
     def setUp (self):
diff --git a/lldb/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py b/lldb/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
index de532c8..65197ed 100644
--- a/lldb/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
+++ b/lldb/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
@@ -12,17 +12,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym(self):
+    def test(self):
         """Test breakpoint set before we have a target. """
-        self.buildDsym()
-        self.dummy_breakpoint_test()
-
-    @dwarf_test
-    def test_with_dwarf(self):
-        """Test breakpoint set before we have a target. """
-        self.buildDwarf()
+        self.build()
         self.dummy_breakpoint_test()
 
     def setUp(self):
diff --git a/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py b/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
index d3549dc..5681b12 100644
--- a/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
+++ b/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
@@ -14,17 +14,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym_and_run_command(self):
+    def test_with_run_command(self):
         """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
-        self.buildDsym()
-        self.inlined_breakpoints()
-
-    @dwarf_test
-    def test_with_dwarf_and_run_command(self):
-        """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
-        self.buildDwarf()
+        self.build()
         self.inlined_breakpoints()
 
     def setUp(self):
diff --git a/lldb/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py b/lldb/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
index 1c82379..6feb31a 100644
--- a/lldb/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
+++ b/lldb/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
@@ -16,17 +16,9 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @dsym_test
-    def test_break_with_dsym(self):
-        """Test setting Objective C specific breakpoints (dSYM)."""
-        self.buildDsym()
-        self.setTearDownCleanup()
-        self.check_objc_breakpoints(True)
-
-    @dwarf_test
-    def test_break_with_dwarf(self):
+    def test_break(self):
         """Test setting Objective C specific breakpoints (DWARF in .o files)."""
-        self.buildDwarf()
+        self.build()
         self.setTearDownCleanup()
         self.check_objc_breakpoints(False)