Index: lldb/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py =================================================================== --- lldb/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py +++ lldb/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py @@ -70,7 +70,7 @@ @expectedFailureAndroid(archs=["i386"]) @skipIfFreeBSD # llvm.org/pr25057 @skipIf(archs=no_match(['amd64', 'i386', 'x86_64'])) - @skipIfOutOfTreeDebugserver + @skipIfOutOfTreeDebugserver(['<', '1100']) @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995") @expectedFailureNetBSD def test_fp_special_purpose_register_read(self): Index: lldb/packages/Python/lldbsuite/test/configuration.py =================================================================== --- lldb/packages/Python/lldbsuite/test/configuration.py +++ lldb/packages/Python/lldbsuite/test/configuration.py @@ -36,6 +36,9 @@ # The path to LLDB.framework is optional. lldbFrameworkPath = None +# The path to debugserver is optional. +debugserver = None + # Test suite repeat count. Can be overwritten with '-# count'. count = 1 Index: lldb/packages/Python/lldbsuite/test/decorators.py =================================================================== --- lldb/packages/Python/lldbsuite/test/decorators.py +++ lldb/packages/Python/lldbsuite/test/decorators.py @@ -501,11 +501,18 @@ archs), bugnumber) -def skipIfOutOfTreeDebugserver(func): +def skipIfOutOfTreeDebugserver(debugserver_version=None): """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 is_older_out_of_tree_debugserver(self): + actual_debugserver_version = self.getDebugserverVersion() + # In-tree debugserver has a version number < 100. + if _check_expected_version('<', '100', actual_debugserver_version): + return None + return "unsupported out-of-tree debugserver" if _check_expected_version( + debugserver_version[0], debugserver_version[1], + actual_debugserver_version) else None + return skipTestIfFn(is_older_out_of_tree_debugserver) + def skipIfRemote(func): """Decorate the item to skip tests if testing remotely.""" Index: lldb/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -296,9 +296,6 @@ 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( @@ -365,6 +362,7 @@ sys.exit(-1) if args.server: + configuration.debugserver = args.server os.environ['LLDB_DEBUGSERVER_PATH'] = args.server if args.excluded: Index: lldb/packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest_args.py +++ lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -97,11 +97,6 @@ '--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( '--dwarf-version', metavar='dwarf_version', Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py +++ lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py @@ -15,7 +15,7 @@ # Atomic sequences are not supported yet for MIPS in LLDB. @skipIf(triple='^mips') @expectedFailureNetBSD - @skipIfOutOfTreeDebugserver + @skipIfOutOfTreeDebugserver(['<=', '9999']) def test(self): """Test 100 breakpoints from 100 threads.""" self.build(dictionary=self.getBuildFlags()) Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py +++ lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py @@ -15,7 +15,7 @@ # Atomic sequences are not supported yet for MIPS in LLDB. @skipIf(triple='^mips') @expectedFailureNetBSD - @skipIfOutOfTreeDebugserver + @skipIfOutOfTreeDebugserver(['<=', '9999']) def test(self): """Test 100 threads that cause a segfault.""" self.build(dictionary=self.getBuildFlags()) Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py +++ lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py @@ -17,7 +17,7 @@ # This test is flaky on Darwin. @skipIfDarwin @expectedFailureNetBSD - @skipIfOutOfTreeDebugserver + @skipIfOutOfTreeDebugserver(['<=', '9999']) def test(self): """Test 100 signals from 100 threads.""" self.build(dictionary=self.getBuildFlags()) Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py +++ lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py @@ -16,7 +16,7 @@ @skipIf(triple='^mips') @expectedFailureNetBSD @add_test_categories(["watchpoint"]) - @skipIfOutOfTreeDebugserver + @skipIfOutOfTreeDebugserver(['<=', '9999']) def test(self): """Test 100 watchpoints from 100 threads.""" self.build(dictionary=self.getBuildFlags()) Index: lldb/packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1293,6 +1293,20 @@ version = m.group(1) return version + def getDebugserverVersion(self): + """ Returns a string that represents the debugserver version. """ + if not configuration.debugserver: + return '0' + try: + version_output = check_output([configuration.debugserver, "-v"], stderr=STDOUT) + except CalledProcessError as e: + version_output = e.output + for line in version_output.split(os.linesep): + m = re.search('PROJECT:lldb-([0-9\.]+)', line) + if m: + return m.group(1) + return '0' + def getDwarfVersion(self): """ Returns the dwarf version generated by clang or '0'. """ if configuration.dwarf_version: Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py =================================================================== --- lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py +++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py @@ -51,7 +51,7 @@ context = self.expect_gdbremote_sequence() self.assertTrue(context.get("G_reply")[0] != 'E') - @skipIfOutOfTreeDebugserver + @skipIfOutOfTreeDebugserver(['<', '1100']) @debugserver_test @skipIfDarwinEmbedded def test_g_packet_debugserver(self): Index: lldb/test/CMakeLists.txt =================================================================== --- lldb/test/CMakeLists.txt +++ lldb/test/CMakeLists.txt @@ -108,7 +108,7 @@ set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_DISTRIBUTION_COMPONENTS} PARENT_SCOPE) endif() message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}") - list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver) + list(APPEND LLDB_TEST_COMMON_ARGS --server ${system_debugserver_path}) elseif(TARGET debugserver) set(debugserver_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver) message(STATUS "LLDB Tests use just-built debugserver: ${debugserver_path}")