[PATCH] D88308: [unittests] Preserve LD_LIBRARY_PATH in crash recovery test

Mikhail Maltsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 09:37:12 PDT 2020


miyuki updated this revision to Diff 294731.
miyuki edited the summary of this revision.
miyuki added a comment.

Use setenv in the parent process


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88308

Files:
  llvm/unittests/Support/CrashRecoveryTest.cpp


Index: llvm/unittests/Support/CrashRecoveryTest.cpp
===================================================================
--- llvm/unittests/Support/CrashRecoveryTest.cpp
+++ llvm/unittests/Support/CrashRecoveryTest.cpp
@@ -170,12 +170,12 @@
       Executable, "--gtest_filter=CrashRecoveryTest.UnixCRCReturnCode"};
 
   // Add LLVM_CRC_UNIXCRCRETURNCODE to the environment of the child process.
-  std::vector<StringRef> EnvTable;
-  EnvTable.push_back("LLVM_CRC_UNIXCRCRETURNCODE=1");
+  int Res = setenv("LLVM_CRC_UNIXCRCRETURNCODE", "1", 0);
+  ASSERT_EQ(Res, 0);
 
   std::string Error;
   bool ExecutionFailed;
-  int RetCode = ExecuteAndWait(Executable, argv, makeArrayRef(EnvTable), {}, 0, 0, &Error,
+  int RetCode = ExecuteAndWait(Executable, argv, {}, {}, 0, 0, &Error,
                                &ExecutionFailed);
   ASSERT_EQ(-2, RetCode);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88308.294731.patch
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200928/03464a5e/attachment.bin>


More information about the llvm-commits mailing list