Enabled libc++ formatter tests on Linux
authorVince Harron <vince@nethacker.com>
Mon, 4 May 2015 02:56:32 +0000 (02:56 +0000)
committerVince Harron <vince@nethacker.com>
Mon, 4 May 2015 02:56:32 +0000 (02:56 +0000)
Refactored TestInitializerList to not be an inline test.
Refactored Makefiles to use USE_LIBCPP instead of adding FLAGS directly
Fixed copy/paste error in TestDataFormatterUnordered class name

Differenttial Revision: http://reviews.llvm.org/D9426

llvm-svn: 236401

24 files changed:
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/main.cpp
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile
lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
lldb/test/lldbtest.py
lldb/test/make/Makefile.rules

index a099be0..8d31bdf 100644 (file)
@@ -1,6 +1,57 @@
-import lldbinline
+"""
+Test lldb data formatter subsystem.
+"""
+
+import os, time
+import unittest2
+import lldb
 from lldbtest import *
+import lldbutil
+
+class InitializerListTestCase(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    @skipUnlessDarwin
+    @dsym_test
+    def test_with_dsym(self):
+        """Test data formatter commands."""
+        self.buildDsym()
+        self.data_formatter_commands()
+
+    @skipIfWindows # libc++ not ported to Windows yet
+    @skipIfGcc
+    @expectedFailureLinux # fails on clang 3.5 and tot
+    @dwarf_test
+    def test_with_dwarf(self):
+        """Test data formatter commands."""
+        self.buildDwarf()
+        self.data_formatter_commands()
+
+    def setUp(self):
+        # Call super's setUp().
+        TestBase.setUp(self)
+
+    def data_formatter_commands(self):
+        """Test that that file and class static variables display correctly."""
+        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+        bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # The stop reason of the thread should be breakpoint.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        self.expect("frame variable ili", substrs = ['[1] = 2','[4] = 5'])
+        self.expect("frame variable ils", substrs = ['[4] = "surprise it is a long string!! yay!!"'])
+
+        self.expect('image list', substrs = self.getLibcPlusPlusLibs())
 
-# added decorator to mark as XFAIL for Linux
-# non-core functionality, need to reenable and fix later (DES 2014.11.07)
-lldbinline.MakeInlineTest(__file__, globals(),expectedFailureLinux)
+if __name__ == '__main__':
+    import atexit
+    lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
+    unittest2.main()
index f89bb2c..9109a20 100644 (file)
@@ -16,6 +16,6 @@ int main ()
     std::initializer_list<int> ili{1,2,3,4,5};
     std::initializer_list<std::string> ils{"1","2","3","4","surprise it is a long string!! yay!!"};
     
-    return 0; //% self.expect("frame variable ili", substrs = ['[1] = 2','[4] = 5'])
-     //% self.expect("frame variable ils", substrs = ['[4] = "surprise it is a long string!! yay!!"'])
+    return 0; // Set break point at this line.
 }
+
index f2f2b3f..1f609a4 100644 (file)
@@ -2,7 +2,6 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-
-CXXFLAGS += -stdlib=libc++ -O0
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
+CXXFLAGS += -O0
index b396f38..0fbcc3a 100644 (file)
@@ -19,7 +19,7 @@ class LibcxxIteratorDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # libc++ not ported to Windows yet
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index f2f2b3f..1f609a4 100644 (file)
@@ -2,7 +2,6 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-
-CXXFLAGS += -stdlib=libc++ -O0
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
+CXXFLAGS += -O0
index ca1fd94..ee743b9 100644 (file)
@@ -19,7 +19,7 @@ class LibcxxListDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # libc++ not ported to Windows yet
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index 2e45441..8881ea0 100644 (file)
@@ -19,7 +19,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # libc++ not ported to Windows yet
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index ec2eb06..2c3b72a 100644 (file)
@@ -19,8 +19,8 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
     @skipIfWindows # libc++ not ported to Windows yet
+    @skipIfGcc
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test data formatter commands."""
index f2f2b3f..1f609a4 100644 (file)
@@ -2,7 +2,6 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-
-CXXFLAGS += -stdlib=libc++ -O0
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
+CXXFLAGS += -O0
index 24e73bb..f51f050 100644 (file)
@@ -19,7 +19,7 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # libc++ not ported to Windows yet
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index f2f2b3f..1f609a4 100644 (file)
@@ -2,7 +2,6 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-
-CXXFLAGS += -stdlib=libc++ -O0
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
+CXXFLAGS += -O0
index 37792a5..d855399 100644 (file)
@@ -19,7 +19,7 @@ class LibcxxSetDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # libc++ not ported to Windows yet
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index f2f2b3f..1f609a4 100644 (file)
@@ -2,7 +2,6 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-
-CXXFLAGS += -stdlib=libc++ -O0
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
+CXXFLAGS += -O0
index 7acee81..fd3ecfe 100644 (file)
@@ -20,7 +20,7 @@ class LibcxxStringDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # libc++ not ported to Windows yet
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index e681e09..1f609a4 100644 (file)
@@ -2,7 +2,6 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-
-CXXFLAGS += -stdlib=libc++ -O0 -std=c++11
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
+CXXFLAGS += -O0
index 7f2a7dd..dfcd0f0 100644 (file)
@@ -8,7 +8,7 @@ import lldb
 from lldbtest import *
 import lldbutil
 
-class LibcxxMultiMapDataFormatterTestCase(TestBase):
+class LibcxxUnorderedDataFormatterTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
@@ -19,8 +19,8 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
     @dwarf_test
+    @skipIfGcc
     def test_with_dwarf_and_run_command(self):
         """Test data formatter commands."""
         self.buildDwarf()
index f2f2b3f..637fa7e 100644 (file)
@@ -1,8 +1,7 @@
 LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
-
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
+CXXFLAGS += -O0
 
-CXXFLAGS += -stdlib=libc++ -O0
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
index 8dba1ff..e5abcd6 100644 (file)
@@ -19,7 +19,7 @@ class LibcxxVBoolDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # http://llvm.org/pr21800
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index f2f2b3f..1f609a4 100644 (file)
@@ -2,7 +2,6 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-
-CXXFLAGS += -stdlib=libc++ -O0
-LDFLAGS += -stdlib=libc++
\ No newline at end of file
+CXXFLAGS += -O0
index 08546a5..b7c9618 100644 (file)
@@ -19,7 +19,7 @@ class LibcxxVectorDataFormatterTestCase(TestBase):
         self.buildDsym()
         self.data_formatter_commands()
 
-    @skipIfLinux # No standard locations for libc++ on Linux, so skip for now 
+    @skipIfGcc
     @skipIfWindows # libc++ not ported to Windows yet
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
index 1f5a294..a67e64c 100644 (file)
@@ -1737,7 +1737,7 @@ class Base(unittest2.TestCase):
             return self.lib_dir
 
     def getLibcPlusPlusLibs(self):
-        if sys.platform.startswith('freebsd'):
+        if sys.platform.startswith('freebsd') or sys.platform.startswith('linux'):
             return ['libc++.so.1']
         else:
             return ['libc++.1.dylib','libc++abi.dylib']
index 2d146a5..3d17d24 100644 (file)
@@ -237,6 +237,10 @@ ifeq (1,$(USE_LIBCPP))
        ifneq (,$(findstring clang,$(CC)))
                CXXFLAGS += -stdlib=libc++
                LDFLAGS += -stdlib=libc++
+               ifeq "$(OS)" "Linux"
+                       # This is the default install location on Ubuntu 14.04
+                       CXXFLAGS += -I/usr/include/c++/v1
+               endif
        endif
 endif