[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).

<rdar://problem/41896105>

llvm-svn: 336463
This commit is contained in:
Davide Italiano 2018-07-06 20:40:00 +00:00
parent b3091da3af
commit 975c711358
10 changed files with 21 additions and 26 deletions

View File

@ -687,6 +687,18 @@ def skipUnlessSupportedTypeAttribute(attr):
return None return None
return skipTestIfFn(compiler_doesnt_support_struct_attribute) 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 <string> | %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): def skipUnlessThreadSanitizer(func):
"""Decorate the item to skip test unless Clang -fsanitize=thread is supported.""" """Decorate the item to skip test unless Clang -fsanitize=thread is supported."""

View File

@ -23,8 +23,7 @@ class StdIteratorDataFormatterTestCase(TestBase):
# Find the line number to break at. # Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.') self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIfWindows # libstdcpp not ported to Windows @skipUnlessLibstdcxxAvailable
@skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self): def test_with_run_command(self):
"""Test that libstdcpp iterators format properly.""" """Test that libstdcpp iterators format properly."""
self.build() self.build()

View File

@ -27,8 +27,7 @@ class StdListDataFormatterTestCase(TestBase):
self.final_line = line_number( self.final_line = line_number(
'main.cpp', '// Set final break point at this line.') 'main.cpp', '// Set final break point at this line.')
@skipIfWindows # libstdcpp not ported to Windows @skipUnlessLibstdcxxAvailable
@skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self): def test_with_run_command(self):
"""Test that that file and class static variables display correctly.""" """Test that that file and class static variables display correctly."""
self.build() self.build()

View File

@ -23,9 +23,7 @@ class StdMapDataFormatterTestCase(TestBase):
# Find the line number to break at. # Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.') self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIfWindows # libstdcpp not ported to Windows @skipUnlessLibstdcxxAvailable
@skipIfFreeBSD
@skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self): def test_with_run_command(self):
"""Test that that file and class static variables display correctly.""" """Test that that file and class static variables display correctly."""
self.build() self.build()

View File

@ -15,10 +15,8 @@ from lldbsuite.test import lldbutil
class StdSmartPtrDataFormatterTestCase(TestBase): class StdSmartPtrDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__) mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
@skipIfDarwin # doesn't compile on Darwin @skipIfDarwin # doesn't compile on Darwin
@skipIfwatchOS # libstdcpp not ported to watchos @skipUnlessLibstdcxxAvailable
def test_with_run_command(self): def test_with_run_command(self):
self.build() self.build()
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

View File

@ -24,8 +24,7 @@ class StdStringDataFormatterTestCase(TestBase):
# Find the line number to break at. # Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.') self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIfWindows # libstdcpp not ported to Windows @skipUnlessLibstdcxxAvailable
@skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self): def test_with_run_command(self):
"""Test that that file and class static variables display correctly.""" """Test that that file and class static variables display correctly."""
self.build() self.build()

View File

@ -15,10 +15,8 @@ from lldbsuite.test import lldbutil
class StdTupleDataFormatterTestCase(TestBase): class StdTupleDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__) mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
@skipIfDarwin # doesn't compile on Darwin @skipIfDarwin # doesn't compile on Darwin
@skipIfwatchOS # libstdcpp not ported to watchos @skipUnlessLibstdcxxAvailable
def test_with_run_command(self): def test_with_run_command(self):
self.build() self.build()
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

View File

@ -15,10 +15,8 @@ from lldbsuite.test import lldbutil
class StdUniquePtrDataFormatterTestCase(TestBase): class StdUniquePtrDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__) mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
@skipIfDarwin # doesn't compile on Darwin @skipIfDarwin # doesn't compile on Darwin
@skipIfwatchOS # libstdcpp not ported to watchos @skipUnlessLibstdcxxAvailable
def test_with_run_command(self): def test_with_run_command(self):
self.build() self.build()
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

View File

@ -23,12 +23,8 @@ class StdVBoolDataFormatterTestCase(TestBase):
# Find the line number to break at. # Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.') 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 @skipIfDarwin
@skipIfwatchOS # libstdcpp not ported to watchos @skipUnlessLibstdcxxAvailable
def test_with_run_command(self): def test_with_run_command(self):
"""Test that that file and class static variables display correctly.""" """Test that that file and class static variables display correctly."""
self.build() self.build()

View File

@ -23,9 +23,7 @@ class StdVectorDataFormatterTestCase(TestBase):
# Find the line number to break at. # Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.') self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIfFreeBSD @skipUnlessLibstdcxxAvailable
@skipIfWindows # libstdcpp not ported to Windows
@skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self): def test_with_run_command(self):
"""Test that that file and class static variables display correctly.""" """Test that that file and class static variables display correctly."""
self.build() self.build()