From 45ae11cd80ab83d11c6310c954b0537c2d863a91 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 8 Mar 2018 19:46:39 +0000 Subject: [PATCH] [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 --- lldb/packages/Python/lldbsuite/test/decorators.py | 6 ++++++ lldb/packages/Python/lldbsuite/test/dotest.py | 3 +++ lldb/packages/Python/lldbsuite/test/dotest_args.py | 5 +++++ .../test/functionalities/register/register_command/TestRegisters.py | 1 + lldb/packages/Python/lldbsuite/test/lldbtest_config.py | 3 +++ lldb/test/CMakeLists.txt | 4 ++++ 6 files changed, 22 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 3837937..72c2ed7 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -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.""" diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 800a60e..41a15eb 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -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( diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py index c6e4a4b..1f3eca3 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest_args.py +++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -127,6 +127,11 @@ def create_parser(): 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', help='Specify the name of the dir created to store the session files of tests with errored or failed status. If not specified, the test driver uses the timestamp as the session dir name') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py index f82443f..b28e8c7 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py @@ -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() diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest_config.py b/lldb/packages/Python/lldbsuite/test/lldbtest_config.py index 2e8e302..30546af 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest_config.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest_config.py @@ -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 diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt index 38a50a9..04758c6 100644 --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -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 -- 2.7.4