mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[unittests] Preserve LD_LIBRARY_PATH in crash recovery test
We need to preserve the LD_LIBRARY_PATH environment variable when spawning a child process (certain setups rely on non-standard paths for e.g. libstdc++). In order to achieve this, set LLVM_CRC_UNIXCRCRETURNCODE in the parent process instead of creating the child's environment from scratch. Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D88308
This commit is contained in:
parent
f4f70547af
commit
48709cc3db
@ -170,12 +170,12 @@ TEST(CrashRecoveryTest, UnixCRCReturnCode) {
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user