[bind10-dev] proposal: catching exceptions in run_unittests.cc:main()

Michal 'vorner' Vaner michal.vaner at nic.cz
Tue Jan 25 09:23:57 UTC 2011


On Mon, Jan 24, 2011 at 04:23:45PM -0800, JINMEI Tatuya / 神明達哉 wrote:
> I've noticed the EXPECT_NO_THROW practice in tests you wrote.
> Actually, this approach has the same problem and I've been suffering
> from that, too:-) EXPECT_NO_THROW only reports it throws "something"
> and obscures what's wrong:
> query_unittest.cc:330: Failure
> Expected: responseCheck(response, Rcode::NOERROR(), AA_FLAG, 0, 1, 0, __null, soa_txt, __null) doesn't throw an exception.
>   Actual: it throws
> What's the purpose of using EXPECT_NO_THROW, btw?  So that you can
> still run the rest of the tests (in the same run_unittests program)?
> If so, I see the point, and in that case I wonder whether we might
> write an additional wrapper:

Yes, I noticed that problem as well. But I found it more useful to have the
output of other EXPECT_ statements in the same test which fail than the actual
exception. They can clue a lot on what's going on.

And yes, the other point about it is I want to run the other tests as well.

A wrapper telling more would be nice. We could catch std::exception as well and
print it's e.what(), which might tell something as well, even when we don't have
the line numbers.

Have a nice day

Never underestimate the bandwidth of a station wagon full of HDDs.

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20110125/1c18f732/attachment.bin>

More information about the bind10-dev mailing list