[Lldb-commits] [lldb] r247173 - Don't allow duplicate names for tests.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 9 11:25:13 PDT 2015


Author: zturner
Date: Wed Sep  9 13:25:13 2015
New Revision: 247173

URL: http://llvm.org/viewvc/llvm-project?rev=247173&view=rev
Log:
Don't allow duplicate names for tests.

We had 2 tests named TestCPPBreakpoints.py.  If one of those tests
failed, both of them would be reported as failures and contribute
to the failure count.  There may be other examples of duplicate
test names, and we should fix those as we find them.

Added:
    lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
      - copied, changed from r247164, lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py
    lldb/trunk/test/lang/cpp/breakpoint-commands/
    lldb/trunk/test/lang/cpp/breakpoint-commands/Makefile
      - copied, changed from r247164, lldb/trunk/test/lang/cpp/breakpoints/Makefile
    lldb/trunk/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py
      - copied, changed from r247164, lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py
    lldb/trunk/test/lang/cpp/breakpoint-commands/nested.cpp
      - copied, changed from r247164, lldb/trunk/test/lang/cpp/breakpoints/nested.cpp
Removed:
    lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py
    lldb/trunk/test/lang/cpp/breakpoints/Makefile
    lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py
    lldb/trunk/test/lang/cpp/breakpoints/nested.cpp

Copied: lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py (from r247164, lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py?p2=lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py&p1=lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py&r1=247164&r2=247173&rev=247173&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py (original)
+++ lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py Wed Sep  9 13:25:13 2015
@@ -8,7 +8,7 @@ import lldb
 from lldbtest import *
 import lldbutil
 
-class TestCPPBreakpoints(TestBase):
+class TestCPPBreakpointLocations(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 

Removed: lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py?rev=247172&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py (original)
+++ lldb/trunk/test/functionalities/breakpoint/cpp/TestCPPBreakpoints.py (removed)
@@ -1,73 +0,0 @@
-"""
-Test lldb breakpoint ids.
-"""
-
-import os, time
-import unittest2
-import lldb
-from lldbtest import *
-import lldbutil
-
-class TestCPPBreakpoints(TestBase):
-
-    mydir = TestBase.compute_mydir(__file__)
-
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym (self):
-        self.buildDsym ()
-        self.breakpoint_id_tests ()
-
-    @dwarf_test
-    def test_with_dwarf (self):
-        self.buildDwarf ()
-        self.breakpoint_id_tests ()
-
-    def verify_breakpoint_locations(self, target, bp_dict):
-        
-        name = bp_dict['name']
-        names = bp_dict['loc_names']
-        bp = target.BreakpointCreateByName (name)
-        self.assertTrue (bp.GetNumLocations() == len(names), "Make sure we find the right number of breakpoint locations")
-        
-        bp_loc_names = list()
-        for bp_loc in bp:
-            bp_loc_names.append(bp_loc.GetAddress().GetFunction().GetName())
-            
-        for name in names:
-            found = name in bp_loc_names
-            if not found:
-                print "Didn't find '%s' in: %s" % (name, bp_loc_names)
-            self.assertTrue (found, "Make sure we find all required locations")
-        
-    def breakpoint_id_tests (self):
-        
-        # Create a target by the debugger.
-        exe = os.path.join(os.getcwd(), "a.out")
-        target = self.dbg.CreateTarget(exe)
-        self.assertTrue(target, VALID_TARGET)
-        bp_dicts = [
-            { 'name' : 'func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
-            { 'name' : 'func2', 'loc_names' : [ 'a::c::func2()', 'c::d::func2()'] },
-            { 'name' : 'func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()', 'c::d::func3()'] },
-            { 'name' : 'c::func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
-            { 'name' : 'c::func2', 'loc_names' : [ 'a::c::func2()'] },
-            { 'name' : 'c::func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()'] },
-            { 'name' : 'a::c::func1', 'loc_names' : [ 'a::c::func1()'] },
-            { 'name' : 'b::c::func1', 'loc_names' : [ 'b::c::func1()'] },
-            { 'name' : 'c::d::func2', 'loc_names' : [ 'c::d::func2()'] },
-            { 'name' : 'a::c::func1()', 'loc_names' : [ 'a::c::func1()'] },
-            { 'name' : 'b::c::func1()', 'loc_names' : [ 'b::c::func1()'] },
-            { 'name' : 'c::d::func2()', 'loc_names' : [ 'c::d::func2()'] },
-        ]
-        
-        for bp_dict in bp_dicts:
-            self.verify_breakpoint_locations(target, bp_dict)
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
-

Copied: lldb/trunk/test/lang/cpp/breakpoint-commands/Makefile (from r247164, lldb/trunk/test/lang/cpp/breakpoints/Makefile)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoint-commands/Makefile?p2=lldb/trunk/test/lang/cpp/breakpoint-commands/Makefile&p1=lldb/trunk/test/lang/cpp/breakpoints/Makefile&r1=247164&r2=247173&rev=247173&view=diff
==============================================================================
    (empty)

Copied: lldb/trunk/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py (from r247164, lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py?p2=lldb/trunk/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py&p1=lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py&r1=247164&r2=247173&rev=247173&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py (original)
+++ lldb/trunk/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py Wed Sep  9 13:25:13 2015
@@ -7,7 +7,7 @@ import unittest2
 import lldb
 from lldbtest import *
 
-class CPPBreakpointTestCase(TestBase):
+class CPPBreakpointCommandsTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 

Copied: lldb/trunk/test/lang/cpp/breakpoint-commands/nested.cpp (from r247164, lldb/trunk/test/lang/cpp/breakpoints/nested.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoint-commands/nested.cpp?p2=lldb/trunk/test/lang/cpp/breakpoint-commands/nested.cpp&p1=lldb/trunk/test/lang/cpp/breakpoints/nested.cpp&r1=247164&r2=247173&rev=247173&view=diff
==============================================================================
    (empty)

Removed: lldb/trunk/test/lang/cpp/breakpoints/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoints/Makefile?rev=247172&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/breakpoints/Makefile (original)
+++ lldb/trunk/test/lang/cpp/breakpoints/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := nested.cpp
-
-include $(LEVEL)/Makefile.rules

Removed: lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py?rev=247172&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py (original)
+++ lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py (removed)
@@ -1,104 +0,0 @@
-"""
-Test lldb breakpoint command for CPP methods & functions in a namespace.
-"""
-
-import os, time
-import unittest2
-import lldb
-from lldbtest import *
-
-class CPPBreakpointTestCase(TestBase):
-
-    mydir = TestBase.compute_mydir(__file__)
-
-    @skipUnlessDarwin
-    @dsym_test
-    def test_with_dsym(self):
-        """Test a sequence of breakpoint command add, list, and delete."""
-        self.buildDsym()
-        self.cpp_breakpoints()
-
-    @dwarf_test
-    def test_with_dwarf(self):
-        """Test a sequence of breakpoint command add, list, and delete."""
-        self.buildDwarf()
-        self.cpp_breakpoints()
-
-    def setUp(self):
-        # Call super's setUp().
-        TestBase.setUp(self)
-
-    def cpp_breakpoints (self):
-        """Test a sequence of breakpoint command add, list, and delete."""
-        exe = os.path.join(os.getcwd(), "a.out")
-
-        # Create a target from the debugger.
-
-        target = self.dbg.CreateTarget (exe)
-        self.assertTrue(target, VALID_TARGET)
-
-        a_out_module = lldb.SBFileSpecList()
-        a_out_module.Append(lldb.SBFileSpec(exe))
-
-        nested_comp_unit = lldb.SBFileSpecList()
-        nested_comp_unit.Append (lldb.SBFileSpec("nested.cpp"))
-
-        # First provide ONLY the method name.  This should get everybody...
-        auto_break = target.BreakpointCreateByName ("Function",
-                                                    lldb.eFunctionNameTypeAuto,
-                                                    a_out_module,
-                                                    nested_comp_unit)
-        self.assertTrue (auto_break.GetNumLocations() == 5)
-
-        # Now add the Baz class specifier.  This should get the version contained in Bar,
-        # AND the one contained in ::
-        auto_break = target.BreakpointCreateByName ("Baz::Function",
-                                                    lldb.eFunctionNameTypeAuto,
-                                                    a_out_module,
-                                                    nested_comp_unit)
-        self.assertTrue (auto_break.GetNumLocations() == 2)
-
-        # Then add the Bar::Baz specifier.  This should get the version contained in Bar only
-        auto_break = target.BreakpointCreateByName ("Bar::Baz::Function",
-                                                    lldb.eFunctionNameTypeAuto,
-                                                    a_out_module,
-                                                    nested_comp_unit)
-        self.assertTrue (auto_break.GetNumLocations() == 1)
-
-        plain_method_break = target.BreakpointCreateByName ("Function", 
-                                                            lldb.eFunctionNameTypeMethod,
-                                                            a_out_module,
-                                                            nested_comp_unit)
-        self.assertTrue (plain_method_break.GetNumLocations() == 3)
-
-        plain_method_break = target.BreakpointCreateByName ("Baz::Function", 
-                                                            lldb.eFunctionNameTypeMethod,
-                                                            a_out_module,
-                                                            nested_comp_unit)
-        self.assertTrue (plain_method_break.GetNumLocations() == 2)
-
-        plain_method_break = target.BreakpointCreateByName ("Bar::Baz::Function", 
-                                                            lldb.eFunctionNameTypeMethod,
-                                                            a_out_module,
-                                                            nested_comp_unit)
-        self.assertTrue (plain_method_break.GetNumLocations() == 1)
-
-        plain_method_break = target.BreakpointCreateByName ("Function", 
-                                                            lldb.eFunctionNameTypeBase,
-                                                            a_out_module,
-                                                            nested_comp_unit)
-        self.assertTrue (plain_method_break.GetNumLocations() == 2)
-
-        plain_method_break = target.BreakpointCreateByName ("Bar::Function", 
-                                                            lldb.eFunctionNameTypeBase,
-                                                            a_out_module,
-                                                            nested_comp_unit)
-        self.assertTrue (plain_method_break.GetNumLocations() == 1)
-
-        
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()

Removed: lldb/trunk/test/lang/cpp/breakpoints/nested.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoints/nested.cpp?rev=247172&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/breakpoints/nested.cpp (original)
+++ lldb/trunk/test/lang/cpp/breakpoints/nested.cpp (removed)
@@ -1,76 +0,0 @@
-#include <stdio.h>
-
-namespace Foo
-{
-  namespace Bar
-  {
-    class Baz
-    {
-    public:
-      Baz (int value):m_value(value) {}
-      int Function () 
-      {
-        printf ("%s returning: %d.\n", __FUNCTION__, m_value);
-        return m_value;
-      }
-    private:
-      int m_value;
-    };
-
-    class Baz2
-    {
-    public:
-      Baz2 (int value):m_value(value) {}
-      int Function () 
-      {
-        printf ("%s returning: %d.\n", __FUNCTION__, m_value);
-        return m_value;
-      }
-    private:
-      int m_value;
-    };
-
-    static int bar_value = 20;
-    int Function ()
-    {
-      printf ("%s returning: %d.\n", __FUNCTION__, bar_value);
-      return bar_value;
-    }
-  }
-}
-
-class Baz
-{
-public:
-    Baz (int value):m_value(value) {}
-    int Function () 
-    {
-        printf ("%s returning: %d.\n", __FUNCTION__, m_value);
-        return m_value;
-    }
-private:
-    int m_value;
-};
-
-int
-Function ()
-{
-    printf ("I am a global function, I return 333.\n");
-    return 333;
-}
-
-int main ()
-{
-  Foo::Bar::Baz mine(200);
-  Foo::Bar::Baz2 mine2(300);
-  ::Baz bare_baz (500);
-
-  printf ("Yup, got %d from Baz.\n", mine.Function());
-  printf ("Yup, got %d from Baz.\n", mine2.Function());
-  printf ("Yup, got %d from Baz.\n", bare_baz.Function());  
-  printf ("And  got %d from Bar.\n", Foo::Bar::Function());
-  printf ("And  got %d from ::.\n", ::Function());
-
-  return 0;
-
-}




More information about the lldb-commits mailing list