[PATCH] D95256: [RGT] Don't use EXPECT* macros in a test subprcess that exits by signalling.

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 11:59:30 PST 2021


probinson created this revision.
probinson added a reviewer: aganea.
probinson requested review of this revision.
Herald added a project: LLVM.

Found by the Rotten Green Tests project.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95256

Files:
  llvm/unittests/Support/CrashRecoveryTest.cpp


Index: llvm/unittests/Support/CrashRecoveryTest.cpp
===================================================================
--- llvm/unittests/Support/CrashRecoveryTest.cpp
+++ llvm/unittests/Support/CrashRecoveryTest.cpp
@@ -157,8 +157,12 @@
   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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95256.318601.patch
Type: text/x-patch
Size: 865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210122/bb34a5b0/attachment.bin>


More information about the llvm-commits mailing list