1
0
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:
Mikhail Maltsev 2020-09-28 17:46:03 +01:00
parent f4f70547af
commit 48709cc3db

View File

@ -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);
}