[PATCH] D100787: [globalisel][unittest] Better error reporting when unittests fail

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 19 12:38:53 PDT 2021


dsanders created this revision.
dsanders added a reviewer: qcolombet.
Herald added a subscriber: rovka.
dsanders requested review of this revision.
Herald added a project: LLVM.

When CheckMachineFunction() fails, emit the full input it receives just like
FileCheck itself does.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100787

Files:
  llvm/unittests/CodeGen/GlobalISel/GISelMITest.h


Index: llvm/unittests/CodeGen/GlobalISel/GISelMITest.h
===================================================================
--- llvm/unittests/CodeGen/GlobalISel/GISelMITest.h
+++ llvm/unittests/CodeGen/GlobalISel/GISelMITest.h
@@ -195,6 +195,10 @@
 
   auto OutBuffer = OutputBuf->getBuffer();
   SM.AddNewSourceBuffer(std::move(OutputBuf), SMLoc());
-  return FC.checkInput(SM, OutBuffer);
+  bool Result = FC.checkInput(SM, OutBuffer);
+  if (!Result)
+    errs() << "Full FileCheck input was:\n<<<<<<\n"
+           << OutBuffer << "\n>>>>>>\n";
+  return Result;
 }
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100787.338604.patch
Type: text/x-patch
Size: 578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210419/28795afc/attachment.bin>


More information about the llvm-commits mailing list