[PATCH] D34744: [DWARF] - Simplify HandleExpectedError implementation in DWARFDebugInfoTest

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 04:52:00 PDT 2017


grimar added inline comments.


================
Comment at: unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:102
   auto ExpectedDG = dwarfgen::Generator::create(Triple, Version);
   if (HandleExpectedError(ExpectedDG))
     return;
----------------
grimar wrote:
> zturner wrote:
> > I recently added some functions to llvm that server this purpose better.  I would suggest just deleting this function, and adding this:
> > 
> > ```
> > #include "llvm/Testing/Support/Error.h"
> > ...
> > ASSERT_THAT_EXPECTED(ExpectedDG, Succeeded());
> > ```
> I'll take a look what ASSERT_THAT_EXPECTED do. If I got correctly from quivk look, that might be a better solution, really. Thanks !
After closer look I think ASSERT_THAT_EXPECTED will not work here.

ASSERT_THAT_EXPECTED fails the test if ExpectedDG not exist:

```
error: Value of: llvm::detail::TakeExpected(ExpectedDG)
Expected: succeeded
  Actual: failed  (: error: unable to get target for 'i386-pc-windows-msvc', see
 --version and --triple.)
[  FAILED  ] DWARFDebugInfo.TestDWARF32Version2Addr4AllForms (115792 ms)
```

But what code expected to do is to pass the test in this case.


https://reviews.llvm.org/D34744





More information about the llvm-commits mailing list