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

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 07:46:51 PDT 2017


Is it possible to add a function to the test class called is
ConfigurationSupported() that returns true or false but doesn't deal with
Expected's, and if it returns true then we can expect the call later to
succeed, at which point we can use the macro?
On Thu, Jun 29, 2017 at 4:57 AM George Rimar via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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:
> > 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.
> So to clarify: if ExpectedDG is exist, test should continue and run, if
> not - test should terminate with success result, that is how current code
> works.
>
>
> https://reviews.llvm.org/D34744
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/93a93752/attachment.html>


More information about the llvm-commits mailing list