[vtk-developers] vtkRenderingOpenGL2Cxx-TestDepthOfFieldPass ERRORs

Bill Lorensen bill.lorensen at gmail.com
Tue Oct 27 15:46:17 EDT 2015


Testing/Core/vtkTestErrorObserver.h

You can git grep for ErrorObserver and see how it is used.


On Tue, Oct 27, 2015 at 2:57 PM, Andras Lasso <lasso at queensu.ca> wrote:
> I didn't know about vtkErrorObserver and its capability to trap errors. Where this class is located? I can't find it in the latest VKT master on github and google search does not bring up anything relevant either.
>
> An object-specific error trap can work well for dealing with expected errors. The difference compared to the vtkTestingOutputWindow approach is that the behavior is more explicit, more deterministic, with a small drawback that you must have the pointer to the object that is supposed to throw errors (sometimes it may be tricky to get the object pointer, but it should be doable).
>
> Using vtkTestingOutputWindow you can catch unexpected errors by a combination of counting all the errors/warnings, comparing the numbers to expected numbers, and resetting the counters. Convenience macros can be used for checking the numbers and resetting the counters, which makes the tests quite well readable (see some examples in my previous email).
>
> Andras
>
> -----Original Message-----
> From: Ben Boeckel [mailto:ben.boeckel at kitware.com]
> Sent: Tuesday, October 27, 2015 12:36 AM
> To: Andras Lasso <lasso at queensu.ca>
> Cc: Bill Lorensen <bill.lorensen at gmail.com>; VTK Developers <vtk-developers at vtk.org>
> Subject: Re: [vtk-developers] vtkRenderingOpenGL2Cxx-TestDepthOfFieldPass ERRORs
>
> On Tue, Oct 27, 2015 at 03:42:20 +0000, Andras Lasso wrote:
>> The limitation of using FAIL_REGULAR_EXPRESSION CTest property for
>> catching errors is that it's very difficult (if at all possible) to
>> catch unexpected errors when there are expected errors as well.
>
> That's what vtkErrorObserver is for. It traps errors (without printing to stderr) which are then compared against to ensure they happened. Any errors not expected or which didn't actually fire are a failure caught either by the error-happened checking code or by CTest.
>
>> When you use vtkTestingOutputWindow class then the default behavior is
>> to return with failure at the end of the test if warnings/errors have
>> been logged; but you can easily mark sections of code that are
>> expected/allowed to log errors. See some examples below.
>
> How do you catch bits of code which output extra errors or stop outputting errors in this case?
>
> --Ben



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtk-developers mailing list