================ @@ -90,6 +90,31 @@ TEST(Host, LaunchProcessSetsArgv0) { ASSERT_THAT(exit_status.get_future().get(), 0); } +TEST(Host, FindProcesses) { + SubsystemRAII<FileSystem> subsystems; + + if (test_arg != 0) + exit(0); + + ProcessLaunchInfo info; + ProcessInstanceInfoList processes; + ProcessInstanceInfoMatch match; + ProcessInstanceInfo p_info; + 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::GetProcessInfo(info.GetProcessID(), p_info)); + ASSERT_TRUE(Host::FindProcesses(match, processes)); + EXPECT_TRUE(match.ProcessIDsMatch(p_info)); ---------------- labath wrote:
What does this check.. that an empty match object matches the result? Could we check the result of `GetName` or something similar? https://github.com/llvm/llvm-project/pull/138687 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits