1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[RGT] Don't use EXPECT* macros in a subprocess that exits by signalling

Found by the Rotten Green Tests project.

Differential Revision: https://reviews.llvm.org/D95256
This commit is contained in:
Paul Robinson 2021-01-15 08:52:58 -08:00
parent 6be86e0db5
commit 7db9c41fd4

View File

@ -157,8 +157,12 @@ TEST(CrashRecoveryTest, UnixCRCReturnCode) {
if (getenv("LLVM_CRC_UNIXCRCRETURNCODE")) {
llvm::CrashRecoveryContext::Enable();
CrashRecoveryContext CRC;
EXPECT_FALSE(CRC.RunSafely(abort));
EXPECT_EQ(CRC.RetCode, 128 + SIGABRT);
// This path runs in a subprocess that exits by signalling, so don't use
// the googletest macros to verify things as they won't report properly.
if (CRC.RunSafely(abort))
llvm_unreachable("RunSafely returned true!");
if (CRC.RetCode != 128 + SIGABRT)
llvm_unreachable("Unexpected RetCode!");
// re-throw signal
llvm::sys::unregisterHandlers();
raise(CRC.RetCode - 128);