Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py @@ -1216,8 +1216,8 @@ # Don't do debugserver tests on anything except OS X. configuration.dont_do_debugserver_test = "linux" in target_platform or "freebsd" in target_platform or "windows" in target_platform - # Don't do lldb-server (llgs) tests on anything except Linux. - configuration.dont_do_llgs_test = not ("linux" in target_platform) + # Don't do lldb-server (llgs) tests on anything except Linux and Windows. + configuration.dont_do_llgs_test = not ("linux" in target_platform) and not ("windows" in target_platform) # Collect tests from the specified testing directories. If a test # subdirectory filter is explicitly specified, limit the search to that Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py @@ -104,6 +104,7 @@ # tests don't get skipped. # + @skipIfWindows # no auxv support. @llgs_test def test_supports_auxv_llgs(self): self.init_llgs_test() @@ -127,6 +128,7 @@ self.set_inferior_startup_launch() self.auxv_data_is_correct_size() + @skipIfWindows @llgs_test def test_auxv_data_is_correct_size_llgs(self): self.init_llgs_test() @@ -165,6 +167,7 @@ self.set_inferior_startup_launch() self.auxv_keys_look_valid() + @skipIfWindows @llgs_test def test_auxv_keys_look_valid_llgs(self): self.init_llgs_test() @@ -212,6 +215,7 @@ self.set_inferior_startup_launch() self.auxv_chunked_reads_work() + @skipIfWindows @llgs_test def test_auxv_chunked_reads_work_llgs(self): self.init_llgs_test() Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py @@ -14,17 +14,18 @@ @skipIfDarwinEmbedded # lldb-server tests not updated to work on ios etc yet def attach_commandline_kill_after_initial_stop(self): + reg_expr = r"^\$[XW][0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" procs = self.prep_debug_monitor_and_inferior() self.test_sequence.add_log_lines([ "read packet: $k#6b", - {"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"}, + {"direction": "send", "regex": reg_expr}, ], True) if self.stub_sends_two_stop_notifications_on_kill: # Add an expectation for a second X result for stubs that send two # of these. self.test_sequence.add_log_lines([ - {"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"}, + {"direction": "send", "regex": reg_expr}, ], True) self.expect_gdbremote_sequence() Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py @@ -1,6 +1,6 @@ from __future__ import print_function - +import json import gdbremote_testcase import lldbgdbserverutils from lldbsuite.support import seven @@ -20,9 +20,9 @@ info = self.parse_process_info_response(context) self.test_sequence.add_log_lines([ - 'read packet: $jModulesInfo:[{"file":"%s","triple":"%s"}]]#00' % ( - lldbutil.append_to_process_working_directory(self, "a.out"), - seven.unhexlify(info["triple"])), + 'read packet: $jModulesInfo:%s]#00' % json.dumps( + [{"file":lldbutil.append_to_process_working_directory(self, "a.out"), + "triple":seven.unhexlify(info["triple"])}]), {"direction": "send", "regex": r'^\$\[{(.*)}\]\]#[0-9A-Fa-f]{2}', "capture": {1: "spec"}}, Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py @@ -174,12 +174,11 @@ self.build() self.qProcessInfo_contains_keys(set(['cputype', 'cpusubtype'])) - @skipUnlessPlatform(["linux"]) @llgs_test - def test_qProcessInfo_contains_triple_llgs_linux(self): + def test_qProcessInfo_contains_triple_ppid_llgs(self): self.init_llgs_test() self.build() - self.qProcessInfo_contains_keys(set(['triple'])) + self.qProcessInfo_contains_keys(set(['triple', 'parent-pid'])) @skipUnlessDarwin @debugserver_test @@ -202,9 +201,9 @@ # for the remote Host and Process. self.qProcessInfo_does_not_contain_keys(set(['triple'])) - @skipUnlessPlatform(["linux"]) + @skipIfDarwin @llgs_test - def test_qProcessInfo_does_not_contain_cputype_cpusubtype_llgs_linux(self): + def test_qProcessInfo_does_not_contain_cputype_cpusubtype_llgs(self): self.init_llgs_test() self.build() self.qProcessInfo_does_not_contain_keys(set(['cputype', 'cpusubtype'])) Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py @@ -20,6 +20,7 @@ self.single_step_only_steps_one_instruction( use_Hc_packet=True, step_instruction="s") + @skipIfWindows # No pty support to test any inferior std -i/e/o @llgs_test @expectedFailureAndroid( bugnumber="llvm.org/pr24739", Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py @@ -205,6 +205,11 @@ self.set_inferior_startup_launch() self.stop_reply_reports_multiple_threads(5) + # In current implementation of llgs on Windows, as a response to '\x03' packet, the debugger + # of the native process will trigger a call to DebugBreakProcess that will create a new thread + # to handle the exception debug event. So one more stop thread will be notified to the + # delegate, e.g. llgs. So tests below to assert the stop threads number will all fail. + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_stop_reply_reports_multiple_threads_llgs(self): self.init_llgs_test() @@ -226,6 +231,7 @@ self.set_inferior_startup_launch() self.no_QListThreadsInStopReply_supplies_no_threads(5) + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_no_QListThreadsInStopReply_supplies_no_threads_llgs(self): self.init_llgs_test() @@ -263,6 +269,7 @@ self.set_inferior_startup_launch() self.stop_reply_reports_correct_threads(5) + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_stop_reply_reports_correct_threads_llgs(self): self.init_llgs_test() @@ -287,6 +294,7 @@ self.assertTrue(int(stop_reply_pcs[thread_id], 16) == int(threads_info_pcs[thread_id], 16)) + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_stop_reply_contains_thread_pcs_llgs(self): self.init_llgs_test() Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py @@ -54,7 +54,15 @@ # Wait until all threads have started. threads = self.wait_for_thread_count(thread_count, timeout_seconds=3) self.assertIsNotNone(threads) - self.assertEqual(len(threads), thread_count) + + # On Windows, there could be more threads spawned. For example, DebugBreakProcess will + # create a new thread from the debugged process to handle an exception event. So here we + # assert 'GreaterEqual' condition. + triple = self.dbg.GetSelectedPlatform().GetTriple() + if re.match(".*-.*-windows", triple): + self.assertGreaterEqual(len(threads), thread_count) + else: + self.assertEqual(len(threads), thread_count) # Grab stop reply for each thread via qThreadStopInfo{tid:hex}. stop_replies = {} @@ -101,7 +109,12 @@ def qThreadStopInfo_works_for_multiple_threads(self, thread_count): (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count) - self.assertEqual(len(stop_replies), thread_count) + triple = self.dbg.GetSelectedPlatform().GetTriple() + # Consider one more thread created by calling DebugBreakProcess. + if re.match(".*-.*-windows", triple): + self.assertGreaterEqual(len(stop_replies), thread_count) + else: + self.assertEqual(len(stop_replies), thread_count) @debugserver_test def test_qThreadStopInfo_works_for_multiple_threads_debugserver(self): @@ -130,7 +143,13 @@ stop_replies.values()) if stop_reason != 0) # All but one thread should report no stop reason. - self.assertEqual(no_stop_reason_count, thread_count - 1) + triple = self.dbg.GetSelectedPlatform().GetTriple() + + # Consider one more thread created by calling DebugBreakProcess. + if re.match(".*-.*-windows", triple): + self.assertGreaterEqual(no_stop_reason_count, thread_count - 1) + else: + self.assertEqual(no_stop_reason_count, thread_count - 1) # Only one thread should should indicate a stop reason. self.assertEqual(with_stop_reason_count, 1) @@ -172,7 +191,8 @@ self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out") # test requires OS with set, equal thread names by default. - @skipUnlessPlatform(["linux"]) + # Windows thread does not have name property, equal names as the process's by default. + @skipUnlessPlatform(["linux", "windows"]) @llgs_test def test_qThreadStopInfo_has_valid_thread_names_llgs(self): self.init_llgs_test() Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py @@ -105,6 +105,7 @@ self.single_step_only_steps_one_instruction( use_Hc_packet=True, step_instruction="vCont;s") + @skipIfWindows # No pty support to test O* & I* notification packets. @llgs_test @expectedFailureAndroid( bugnumber="llvm.org/pr24739", @@ -136,6 +137,7 @@ self.single_step_only_steps_one_instruction( use_Hc_packet=False, step_instruction="vCont;s:{thread}") + @skipIfWindows # No pty support to test O* & I* notification packets. @llgs_test @expectedFailureAndroid( bugnumber="llvm.org/pr24739", Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py @@ -156,6 +156,7 @@ self.build() self.inferior_print_exit() + @skipIfWindows # No pty support to test any inferior output @llgs_test @expectedFlakeyLinux("llvm.org/pr25652") def test_inferior_print_exit_llgs(self): @@ -434,6 +435,7 @@ self.targetHasAVX(), "Advanced Vector Extensions" in register_sets) + @expectedFailureAll(oslist=["windows"]) # no avx for now. @llgs_test def test_qRegisterInfo_contains_avx_registers_llgs(self): self.init_llgs_test() @@ -478,6 +480,7 @@ self.set_inferior_startup_attach() self.qThreadInfo_contains_thread() + @expectedFailureAll(oslist=["windows"]) # expect one more thread stopped @llgs_test def test_qThreadInfo_contains_thread_attach_llgs(self): self.init_llgs_test() @@ -536,6 +539,7 @@ self.set_inferior_startup_attach() self.qThreadInfo_matches_qC() + @expectedFailureAll(oslist=["windows"]) # expect one more thread stopped @llgs_test def test_qThreadInfo_matches_qC_attach_llgs(self): self.init_llgs_test() @@ -664,6 +668,7 @@ self.set_inferior_startup_launch() self.Hg_switches_to_3_threads() + @expectedFailureAll(oslist=["windows"]) # expect 4 threads @llgs_test def test_Hg_switches_to_3_threads_launch_llgs(self): self.init_llgs_test() @@ -679,6 +684,7 @@ self.set_inferior_startup_attach() self.Hg_switches_to_3_threads() + @expectedFailureAll(oslist=["windows"]) # expecting one more thread @llgs_test def test_Hg_switches_to_3_threads_attach_llgs(self): self.init_llgs_test() @@ -808,6 +814,7 @@ # expectations about fixed signal numbers. self.Hc_then_Csignal_signals_correct_thread(self.TARGET_EXC_BAD_ACCESS) + @skipIfWindows # no SIGSEGV support @llgs_test def test_Hc_then_Csignal_signals_correct_thread_launch_llgs(self): self.init_llgs_test() @@ -876,6 +883,7 @@ self.set_inferior_startup_launch() self.m_packet_reads_memory() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_m_packet_reads_memory_llgs(self): self.init_llgs_test() @@ -966,6 +974,7 @@ self.set_inferior_startup_launch() self.qMemoryRegionInfo_reports_code_address_as_executable() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_qMemoryRegionInfo_reports_code_address_as_executable_llgs(self): self.init_llgs_test() @@ -1031,6 +1040,7 @@ self.set_inferior_startup_launch() self.qMemoryRegionInfo_reports_stack_address_as_readable_writeable() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_qMemoryRegionInfo_reports_stack_address_as_readable_writeable_llgs( self): @@ -1096,6 +1106,7 @@ self.set_inferior_startup_launch() self.qMemoryRegionInfo_reports_heap_address_as_readable_writeable() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_qMemoryRegionInfo_reports_heap_address_as_readable_writeable_llgs( self): @@ -1248,6 +1259,7 @@ self.set_inferior_startup_launch() self.breakpoint_set_and_remove_work(want_hardware=False) + @skipIfWindows # No pty support to test any inferior output @llgs_test @expectedFlakeyLinux("llvm.org/pr25652") def test_software_breakpoint_set_and_remove_work_llgs(self): @@ -1384,6 +1396,7 @@ self.set_inferior_startup_launch() self.written_M_content_reads_back_correctly() + @skipIfWindows # No pty support to test any inferior output @llgs_test @expectedFlakeyLinux("llvm.org/pr25652") def test_written_M_content_reads_back_correctly_llgs(self): @@ -1559,6 +1572,7 @@ self.set_inferior_startup_launch() self.P_and_p_thread_suffix_work() + @skipIfWindows @llgs_test def test_P_and_p_thread_suffix_work_llgs(self): self.init_llgs_test() Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py @@ -47,6 +47,7 @@ self.set_inferior_startup_launch() self.sid_is_same_without_setsid() + @skipIfWindows @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target @expectedFailureAll(oslist=['freebsd']) @@ -62,6 +63,7 @@ self.set_inferior_startup_launch() self.sid_is_different_with_setsid() + @skipIfWindows @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target def test_sid_is_different_with_setsid_llgs(self): @@ -76,6 +78,7 @@ self.set_inferior_startup_launch() self.sid_is_different_with_S() + @skipIfWindows @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target def test_sid_is_different_with_S_llgs(self): Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -233,6 +233,10 @@ # Remote platforms don't support named pipe based port negotiation use_named_pipe = False + triple = self.dbg.GetSelectedPlatform().GetTriple() + if re.match(".*-.*-windows", triple): + self.skipTest("Remotely testing is not supported on Windows yet.") + # Grab the ppid from /proc/[shell pid]/stat err, retcode, shell_stat = self.run_platform_command( "cat /proc/$$/stat") @@ -258,6 +262,10 @@ # Remove if it's there. self.debug_monitor_exe = re.sub(r' \(deleted\)$', '', exe) else: + # Need to figure out how to create a named pipe on Windows. + if platform.system() == 'Windows': + use_named_pipe = False + self.debug_monitor_exe = get_lldb_server_exe() if not self.debug_monitor_exe: self.skipTest("lldb-server exe not found") Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py @@ -36,6 +36,7 @@ self.build() self.inferior_abort_received() + @skipIfWindows # No signal is sent on Windows. @llgs_test # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836 @expectedFailureAndroid(api_levels=list(range(16 + 1))) Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py @@ -38,6 +38,7 @@ self.build() self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS) + @skipIfWindows # No signal is sent on Windows. @llgs_test def test_inferior_seg_fault_received_llgs(self): self.init_llgs_test() Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py @@ -925,6 +925,12 @@ # Convert text pids to ints process_ids = [int(text_pid) for text_pid in text_process_ids if text_pid != ''] + elif platform.system() == 'Windows': + output = subprocess.check_output( + "for /f \"tokens=2 delims=,\" %F in ('tasklist /nh /fi \"PID ne 0\" /fo csv') do @echo %~F", shell=True).decode("utf-8") + text_process_ids = output.split('\n')[1:] + process_ids = [int(text_pid) + for text_pid in text_process_ids if text_pid != ''] # elif {your_platform_here}: # fill in process_ids as a list of int type process IDs running on # the local system. Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py @@ -81,6 +81,7 @@ self.ignore_signals(signals_to_ignore) self.expect_exit_code(len(signals_to_ignore)) + @skipIfWindows # no signal support @llgs_test def test_default_signals_behavior(self): self.init_llgs_test() Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py @@ -29,6 +29,7 @@ kv_dict = self.parse_key_val_dict(context.get("key_vals_text")) self.assertEqual(expected_name, kv_dict.get("name")) + @skipIfWindows # the test is not updated for Windows. @llgs_test def test(self): """ Make sure lldb-server can retrieve inferior thread name"""