[Lldb-commits] [PATCH] D158237: Change LLGSTest.cpp to run environment_check inferior with stdin/stdout disabled, to work around ASAN CI bot issue

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 18 16:28:08 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG18b211cb1521: Disable stdin/stdout for environment_check inferior process (authored by jasonmolenda).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158237/new/

https://reviews.llvm.org/D158237

Files:
  lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp
  lldb/unittests/tools/lldb-server/tests/TestClient.cpp
  lldb/unittests/tools/lldb-server/tests/TestClient.h


Index: lldb/unittests/tools/lldb-server/tests/TestClient.h
===================================================================
--- lldb/unittests/tools/lldb-server/tests/TestClient.h
+++ lldb/unittests/tools/lldb-server/tests/TestClient.h
@@ -48,8 +48,9 @@
   /// using this for generic tests, as the two stubs have different
   /// command-line interfaces.
   static llvm::Expected<std::unique_ptr<TestClient>>
-  launchCustom(llvm::StringRef Log, llvm::ArrayRef<llvm::StringRef> ServerArgs, llvm::ArrayRef<llvm::StringRef> InferiorArgs);
-
+  launchCustom(llvm::StringRef Log, bool disable_stdio,
+               llvm::ArrayRef<llvm::StringRef> ServerArgs,
+               llvm::ArrayRef<llvm::StringRef> InferiorArgs);
 
   ~TestClient() override;
   llvm::Error SetInferior(llvm::ArrayRef<std::string> inferior_args);
Index: lldb/unittests/tools/lldb-server/tests/TestClient.cpp
===================================================================
--- lldb/unittests/tools/lldb-server/tests/TestClient.cpp
+++ lldb/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -59,10 +59,13 @@
 }
 
 Expected<std::unique_ptr<TestClient>> TestClient::launch(StringRef Log, ArrayRef<StringRef> InferiorArgs) {
-  return launchCustom(Log, {}, InferiorArgs);
+  return launchCustom(Log, false, {}, InferiorArgs);
 }
 
-Expected<std::unique_ptr<TestClient>> TestClient::launchCustom(StringRef Log, ArrayRef<StringRef> ServerArgs, ArrayRef<StringRef> InferiorArgs) {
+Expected<std::unique_ptr<TestClient>>
+TestClient::launchCustom(StringRef Log, bool disable_stdio,
+                         ArrayRef<StringRef> ServerArgs,
+                         ArrayRef<StringRef> InferiorArgs) {
   const ArchSpec &arch_spec = HostInfo::GetArchitecture();
   Args args;
   args.AppendArgument(LLDB_SERVER);
@@ -111,6 +114,8 @@
   // Accept().
   Info.SetMonitorProcessCallback(&ProcessLaunchInfo::NoOpMonitorCallback);
 
+  if (disable_stdio)
+    Info.GetFlags().Set(lldb::eLaunchFlagDisableSTDIO);
   status = Host::LaunchProcess(Info);
   if (status.Fail())
     return status.ToError();
Index: lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp
===================================================================
--- lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp
+++ lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp
@@ -41,9 +41,10 @@
   // Test that --env takes precedence over inherited environment variables.
   putenv(const_cast<char *>("LLDB_TEST_MAGIC_VARIABLE=foobar"));
 
-  auto ClientOr = TestClient::launchCustom(getLogFileName(),
-      { "--env", "LLDB_TEST_MAGIC_VARIABLE=LLDB_TEST_MAGIC_VALUE" },
-                                     {getInferiorPath("environment_check")});
+  auto ClientOr = TestClient::launchCustom(
+      getLogFileName(), /* disable_stdio */ true,
+      {"--env", "LLDB_TEST_MAGIC_VARIABLE=LLDB_TEST_MAGIC_VALUE"},
+      {getInferiorPath("environment_check")});
   ASSERT_THAT_EXPECTED(ClientOr, Succeeded());
   auto &Client = **ClientOr;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158237.551672.patch
Type: text/x-patch
Size: 2975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230818/c2a7e910/attachment-0001.bin>


More information about the lldb-commits mailing list