Issue 144077
Summary lldb's HostTests cause Windows Terminal to completely exit
Labels lldb, platform:windows
Assignees
Reporter DavidSpickett
    Found this on Linaro's Windows on Arm bot. Build lldb as normal in a Windows Terminal (not conhost) and then:
```
ninja check-lldb-unit
```
When this gets to host tests, the current terminal and any other terminal windows will close at some point during the tests.

I narrowed it down to:
```
TEST(Host, FindProcesses) {
  SubsystemRAII<FileSystem, HostInfo> subsystems;

  if (test_arg != 0) {
    // Give the parent time to retrieve information about self.
    // It will kill self when it is done.
 std::this_thread::sleep_for(std::chrono::seconds(10));
    exit(0);
 }

  bool foundPID = false;
  ProcessLaunchInfo info;
 ProcessInstanceInfoList processes;
  ProcessInstanceInfoMatch match(TestMainArgv0, NameMatch::Equals);
 info.SetExecutableFile(FileSpec(TestMainArgv0),
 /*add_exe_file_as_first_arg=*/true);
 info.GetArguments().AppendArgument("--gtest_filter=Host.FindProcesses");
 info.GetArguments().AppendArgument("--test-arg=48");
  std::promise<int> exit_status;
  info.SetMonitorProcessCallback([&](lldb::pid_t pid, int signal, int status) {
    exit_status.set_value(status);
  });
 ASSERT_THAT_ERROR(Host::LaunchProcess(info).takeError(), Succeeded());
 ASSERT_TRUE(Host::FindProcesses(match, processes));
  for (const auto &process : processes) {
    if (process.GetProcessID() == info.GetProcessID()) {
 ASSERT_EQ(process.GetExecutableFile().GetFilename(),
 info.GetExecutableFile().GetFilename());
      foundPID = true;
    }
 }
  ASSERT_TRUE(foundPID);
  auto clean_up = llvm::make_scope_exit([&] {
 Host::Kill(info.GetProcessID(), SIGKILL);
 exit_status.get_future().get();
  });
}
```
Same thing happens if you run HostTests.exe directly.

Working theory is that it is finding the wrong process and managing to SIGKILL the terminal itself.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to