[fdo-dev] Catching exceptions in FDORDBMS Unit Tests

Frank Warmerdam warmerdam at pobox.com
Fri Sep 8 22:22:42 EDT 2006


On 9/5/06, Mateusz Loskot <mateusz at loskot.net> wrote:
> Hi,
>
> Recently, I started to play with Unit Tests in details and
> I'm not sure I understand how they are expected work.
>
> First, I see the main() function, in file UnitTest/Common/UnitTest.cpp,
> is *not* wrapped with try-catch.
> Hmm, so where exceptions (most of them) are supposed to be
> caught, for example to print some meaningful message
> (e.g. using FdoException::GetExceptionMessage())
> and terminate execution?

Mateusz,

I have come to the conclusion that part of the CppUnit
test harnass (TextTestRunner?) is in fact trapping all
exceptions within the test operations.   So, this is a
need that is already anticipated by the test harnass.

Of course, that doesn't explain why things aren't working
for you. I too have had very anomolous results on Linux
when unexpected exceptions are fired.  I was unable to
determine why, and I suspect there is something
questionable in my build environment.  Perhaps a
flaw in the version of g++ or the c++ runtime options
in place.

Hopefully we will learn more in the future.  In the
meantime, if I step through to track unexpected
exceptions, and "fix" them I find the unit tests
(for fdogdal in my case) do work ok on Linux.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Fdo_dev mailing list