From 975c711358a1b91d9feba2200d1d85c2cc8cbd87 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Fri, 6 Jul 2018 20:40:00 +0000 Subject: [PATCH] [test-suite] Add a decorator for the lack of libstdcxx on the system. This generalizes a bunch of target-specific tests. MacOS has no libstdcxx anymore, and neither does FreeBSD (or Windows). llvm-svn: 336463 --- lldb/packages/Python/lldbsuite/test/decorators.py | 12 ++++++++++++ .../libstdcpp/iterator/TestDataFormatterStdIterator.py | 3 +-- .../libstdcpp/list/TestDataFormatterStdList.py | 3 +-- .../libstdcpp/map/TestDataFormatterStdMap.py | 4 +--- .../libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py | 4 +--- .../libstdcpp/string/TestDataFormatterStdString.py | 3 +-- .../libstdcpp/tuple/TestDataFormatterStdTuple.py | 4 +--- .../libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py | 4 +--- .../libstdcpp/vbool/TestDataFormatterStdVBool.py | 6 +----- .../libstdcpp/vector/TestDataFormatterStdVector.py | 4 +--- 10 files changed, 21 insertions(+), 26 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 1fdfd2c..1e6cd14 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -687,6 +687,18 @@ def skipUnlessSupportedTypeAttribute(attr): return None return skipTestIfFn(compiler_doesnt_support_struct_attribute) +def skipUnlessLibstdcxxAvailable(func): + """Decorate the item to skip test unless libstdc++ is available on the system.""" + def compiler_doesnt_support_libstdcxx(self): + compiler_path = self.getCompiler() + f = tempfile.NamedTemporaryFile() + f = tempfile.NamedTemporaryFile() + cmd = "echo '#include | %s -x c++ -stdlib=libstdc++ -o %s -" % (compiler_path, f.name) + if os.popen(cmd).close() is not None: + return "libstdcxx not available on the sytem" + return None + return skipTestIfFn(compiler_doesnt_support_libstdcxx)(func) + def skipUnlessThreadSanitizer(func): """Decorate the item to skip test unless Clang -fsanitize=thread is supported.""" diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py index 47b0a24..9acfcd6 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py @@ -23,8 +23,7 @@ class StdIteratorDataFormatterTestCase(TestBase): # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') - @skipIfWindows # libstdcpp not ported to Windows - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): """Test that libstdcpp iterators format properly.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py index ecbea5b..10aed32 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py @@ -27,8 +27,7 @@ class StdListDataFormatterTestCase(TestBase): self.final_line = line_number( 'main.cpp', '// Set final break point at this line.') - @skipIfWindows # libstdcpp not ported to Windows - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py index 0abfbcb..b6d2724 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py @@ -23,9 +23,7 @@ class StdMapDataFormatterTestCase(TestBase): # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') - @skipIfWindows # libstdcpp not ported to Windows - @skipIfFreeBSD - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py index 9d2c105..2161984 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py @@ -15,10 +15,8 @@ from lldbsuite.test import lldbutil class StdSmartPtrDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfFreeBSD - @skipIfWindows # libstdcpp not ported to Windows @skipIfDarwin # doesn't compile on Darwin - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): self.build() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py index 8f6d94a..957389a 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py @@ -24,8 +24,7 @@ class StdStringDataFormatterTestCase(TestBase): # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') - @skipIfWindows # libstdcpp not ported to Windows - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py index 81a36ee..4de854e 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py @@ -15,10 +15,8 @@ from lldbsuite.test import lldbutil class StdTupleDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfFreeBSD - @skipIfWindows # libstdcpp not ported to Windows @skipIfDarwin # doesn't compile on Darwin - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): self.build() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py index fec2e4c..6a22b3b 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py @@ -15,10 +15,8 @@ from lldbsuite.test import lldbutil class StdUniquePtrDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfFreeBSD - @skipIfWindows # libstdcpp not ported to Windows @skipIfDarwin # doesn't compile on Darwin - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): self.build() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py index 7b497c6..20815df 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py @@ -23,12 +23,8 @@ class StdVBoolDataFormatterTestCase(TestBase): # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') - @expectedFailureAll( - oslist=['freebsd'], - bugnumber='llvm.org/pr20548 fails to build on lab.llvm.org buildbot') - @skipIfWindows # libstdcpp not ported to Windows. @skipIfDarwin - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py index 00d2c03..3cc0dc6 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py @@ -23,9 +23,7 @@ class StdVectorDataFormatterTestCase(TestBase): # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') - @skipIfFreeBSD - @skipIfWindows # libstdcpp not ported to Windows - @skipIfwatchOS # libstdcpp not ported to watchos + @skipUnlessLibstdcxxAvailable def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() -- 2.7.4