Catching exceptions in FDORDBMS Unit Tests

Mateusz Loskot mateusz at loskot.net
Tue Sep 5 16:26:54 EDT 2006


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?

AFAIK, the try-catch in main() is must-have if any of used components by
program is supposed to throw anything.
Is this a kind of CppUnit 'magic'?

Every time I run RDBMS Unit Test program, it aborts:

mloskot:~/dev/fdo/_svn/Providers/GenericRdbms/Src/UnitTest$
./UnitTestMySql inittestfile=mysql-mloskot-init.txt

Test ID: 120121415
.F.F.F.F.F.F.F.F.F.F.F..F.F.F.Test is in group 'rollback', skipping test
.Initializing Connection ...
terminate called after throwing an instance of 'FdoException*'
Aborted

I've not analysed how UT programs are compiled and linked, but
I suppose there some compilation flags missing.
BTW, here is interesting thread about exceptions + shared libraries:

http://groups.google.pl/group/comp.lang.c++/browse_frm/thread/1d12ba6d3cf4fec6

Please, could you refer it to current configuration of FDORDBMS
Unit Test build?


Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net




More information about the Fdo_dev mailing list