[test] Skip a test when using an out-of-tree debugserver

The test "test_fp_special_purpose_register_read" in TestRegisters.py
fails on Darwin machines configured to use an out-of-tree debugserver.

The error message is: 'register read ftag' returns expected result, got
'ftag = 0x80'. This indicates that the debugserver in use is too old.

This commit introduces a decorator which can be used to skip tests which
rely on having a just-built debugserver. This resolves the issue:

$ ./bin/llvm-dotest -p TestRegisters.py -v
  1 out of 617 test suites processed - TestRegisters.py
  Test Methods:          7
  Success:               6
  Skip:                  1
...

llvm-svn: 327052
This commit is contained in:
Vedant Kumar 2018-03-08 19:46:39 +00:00
parent c9a1a6e964
commit 45ae11cd80
6 changed files with 22 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import use_lldb_suite
import lldb
from . import configuration
from . import test_categories
from . import lldbtest_config
from lldbsuite.test_event.event_builder import EventBuilder
from lldbsuite.support import funcutils
from lldbsuite.test import lldbplatform
@ -476,6 +477,11 @@ def expectedFlakeyAndroid(bugnumber=None, api_levels=None, archs=None):
archs),
bugnumber)
def skipIfOutOfTreeDebugserver(func):
"""Decorate the item to skip tests if using an out-of-tree debugserver."""
def is_out_of_tree_debugserver():
return "out-of-tree debugserver" if lldbtest_config.out_of_tree_debugserver else None
return skipTestIfFn(is_out_of_tree_debugserver)(func)
def skipIfRemote(func):
"""Decorate the item to skip tests if testing remotely."""

View File

@ -307,6 +307,9 @@ def parseOptionsAndInitTestdirs():
if args.log_success:
lldbtest_config.log_success = args.log_success
if args.out_of_tree_debugserver:
lldbtest_config.out_of_tree_debugserver = args.out_of_tree_debugserver
# Set SDKROOT if we are using an Apple SDK
if platform_system == 'Darwin' and args.apple_sdk:
os.environ['SDKROOT'] = seven.get_command_output(

View File

@ -126,6 +126,11 @@ def create_parser():
'--server',
metavar='server-path',
help='The path to the debug server executable to use')
group.add_argument(
'--out-of-tree-debugserver',
dest='out_of_tree_debugserver',
action='store_true',
help='A flag to indicate an out-of-tree debug server is being used')
group.add_argument(
'-s',
metavar='name',

View File

@ -69,6 +69,7 @@ class RegisterCommandsTestCase(TestBase):
@expectedFailureAndroid(archs=["i386"])
@skipIfFreeBSD # llvm.org/pr25057
@skipIf(archs=no_match(['amd64', 'i386', 'x86_64']))
@skipIfOutOfTreeDebugserver
def test_fp_special_purpose_register_read(self):
"""Test commands that read fpu special purpose registers."""
self.build()

View File

@ -16,5 +16,8 @@ channels = []
# leave logs/traces even for successful test runs
log_success = False
# Indicate whether we're testing with an out-of-tree debugserver
out_of_tree_debugserver = False
# path to the lldb command line executable tool
lldbExec = None

View File

@ -113,6 +113,10 @@ if(CMAKE_HOST_APPLE)
list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH})
endif()
if(SKIP_DEBUGSERVER)
list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
endif()
set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
add_python_test_target(check-lldb-single