forked from OSchip/llvm-project
Fix xpasses on the gcc buildbots using compiler versions to qualify the xfail.
- Note that this is not correct, as the failure is associated with build options of libc.so, however it's failing on a Debian buildbot that uses gcc 4.6.2 (and the real goal is a complete backtrace even with -fomit-frame-pointer). - Adds helpers to lldbtest.py to check the expectedCompiler and expectedVersion, with an eventual goal of reducing the number of test decorators. --- Currently allows a comparison operator and a compiler version to be specified. --- Can be extended to support ranges of compiler versions. llvm-svn: 182155
This commit is contained in:
parent
a360d7e7a3
commit
c97a6083e2
|
@ -15,7 +15,8 @@ class AssertingInferiorTestCase(TestBase):
|
|||
self.buildDsym()
|
||||
self.inferior_asserting()
|
||||
|
||||
@expectedFailureLinux # bugzilla 15671 - backtrace does not include the assert site
|
||||
@expectedFailureLinux(15671, ['clang', 'icc']) # llvm.org/pr15671 - backtrace does not include the assert site
|
||||
@expectedFailureGcc(15671, ['>=', '4.6.3']) # avoid an xpass on the buildbots where libc was not built with -fomit-frame-pointer
|
||||
def test_inferior_asserting_dwarf(self):
|
||||
"""Test that lldb reliably catches the inferior asserting (command)."""
|
||||
self.buildDwarf()
|
||||
|
@ -44,7 +45,8 @@ class AssertingInferiorTestCase(TestBase):
|
|||
self.buildDsym()
|
||||
self.inferior_asserting_expr()
|
||||
|
||||
@expectedFailureLinux # bugzilla 15671 - backtrace does not include the assert site
|
||||
@expectedFailureLinux(15671, ['clang', 'icc']) # llvm.org/pr15671 - backtrace does not include the assert site
|
||||
@expectedFailureGcc(15671, ['>=', '4.6.3']) # avoid an xpass on the buildbots where libc was not built with -fomit-frame-pointer
|
||||
def test_inferior_asserting_expr(self):
|
||||
"""Test that the lldb expression interpreter can read from the inferior after asserting (command)."""
|
||||
self.buildDwarf()
|
||||
|
@ -56,7 +58,8 @@ class AssertingInferiorTestCase(TestBase):
|
|||
self.buildDsym()
|
||||
self.inferior_asserting_step()
|
||||
|
||||
@expectedFailureLinux # bugzilla 15671 - backtrace does not include the assert site
|
||||
@expectedFailureLinux(15671, ['clang', 'icc']) # llvm.org/pr15671 - backtrace does not include the assert site
|
||||
@expectedFailureGcc(15671, ['>=', '4.6.3']) # avoid an xpass on the buildbots where libc was not built with -fomit-frame-pointer
|
||||
def test_inferior_asserting_step(self):
|
||||
"""Test that lldb functions correctly after stepping through a call to assert()."""
|
||||
self.buildDwarf()
|
||||
|
|
|
@ -370,7 +370,7 @@ def dwarf_test(func):
|
|||
wrapper.__dwarf_test__ = True
|
||||
return wrapper
|
||||
|
||||
def expectedFailureGcc(bugnumber=None):
|
||||
def expectedFailureGcc(bugnumber=None, compiler_version=["=", None]):
|
||||
if callable(bugnumber):
|
||||
@wraps(bugnumber)
|
||||
def expectedFailureGcc_easy_wrapper(*args, **kwargs):
|
||||
|
@ -380,7 +380,7 @@ def expectedFailureGcc(bugnumber=None):
|
|||
try:
|
||||
bugnumber(*args, **kwargs)
|
||||
except Exception:
|
||||
if "gcc" in test_compiler:
|
||||
if "gcc" in test_compiler and self.expectedVersion(compiler_version):
|
||||
raise case._ExpectedFailure(sys.exc_info(),None)
|
||||
else:
|
||||
raise
|
||||
|
@ -397,7 +397,7 @@ def expectedFailureGcc(bugnumber=None):
|
|||
try:
|
||||
func(*args, **kwargs)
|
||||
except Exception:
|
||||
if "gcc" in test_compiler:
|
||||
if "gcc" in test_compiler and self.expectedVersion(compiler_version):
|
||||
raise case._ExpectedFailure(sys.exc_info(),bugnumber)
|
||||
else:
|
||||
raise
|
||||
|
@ -515,7 +515,7 @@ def expectedFailurei386(bugnumber=None):
|
|||
return wrapper
|
||||
return expectedFailurei386_impl
|
||||
|
||||
def expectedFailureLinux(bugnumber=None):
|
||||
def expectedFailureLinux(bugnumber=None, compilers=None):
|
||||
if callable(bugnumber):
|
||||
@wraps(bugnumber)
|
||||
def expectedFailureLinux_easy_wrapper(*args, **kwargs):
|
||||
|
@ -525,11 +525,11 @@ def expectedFailureLinux(bugnumber=None):
|
|||
try:
|
||||
bugnumber(*args, **kwargs)
|
||||
except Exception:
|
||||
if "linux" in platform:
|
||||
if "linux" in platform and self.expectedCompiler(compilers):
|
||||
raise case._ExpectedFailure(sys.exc_info(),None)
|
||||
else:
|
||||
raise
|
||||
if "linux" in platform:
|
||||
if "linux" in platform and self.expectedCompiler(compilers):
|
||||
raise case._UnexpectedSuccess(sys.exc_info(),None)
|
||||
return expectedFailureLinux_easy_wrapper
|
||||
else:
|
||||
|
@ -542,11 +542,11 @@ def expectedFailureLinux(bugnumber=None):
|
|||
try:
|
||||
func(*args, **kwargs)
|
||||
except Exception:
|
||||
if "linux" in platform:
|
||||
if "linux" in platform and self.expectedCompiler(compilers):
|
||||
raise case._ExpectedFailure(sys.exc_info(),bugnumber)
|
||||
else:
|
||||
raise
|
||||
if "linux" in platform:
|
||||
if "linux" in platform and self.expectedCompiler(compilers):
|
||||
raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
|
||||
return wrapper
|
||||
return expectedFailureLinux_impl
|
||||
|
@ -1151,6 +1151,32 @@ class Base(unittest2.TestCase):
|
|||
version = m.group(1)
|
||||
return version
|
||||
|
||||
def expectedVersion(self, compiler_version):
|
||||
"""Determines if compiler_version matches the current tool chain."""
|
||||
if (compiler_version == None):
|
||||
return True
|
||||
operator = str(compiler_version[0])
|
||||
version = compiler_version[1]
|
||||
|
||||
if (version == None):
|
||||
return True
|
||||
if (operator == '>'):
|
||||
return self.getCompilerVersion() > version
|
||||
if (operator == '>=' or operator == '=>'):
|
||||
return self.getCompilerVersion() >= version
|
||||
if (operator == '<'):
|
||||
return self.getCompilerVersion() < version
|
||||
if (operator == '<=' or operator == '=<'):
|
||||
return self.getCompilerVersion() <= version
|
||||
if (operator == '!=' or operator == '!' or operator == 'not'):
|
||||
return str(version) not in str(self.getCompilerVersion())
|
||||
return str(version) in str(self.getCompilerVersion())
|
||||
|
||||
def expectedCompiler(self, compilers):
|
||||
if (compilers == None):
|
||||
return True
|
||||
return self.getCompiler() in compilers
|
||||
|
||||
def getRunOptions(self):
|
||||
"""Command line option for -A and -C to run this test again, called from
|
||||
self.dumpSessionInfo()."""
|
||||
|
|
Loading…
Reference in New Issue