Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-11-02 13:44:54


Well, that makes a lot of sense. But when I build/test with bjam
the tail of bjam.log looks like:

gcc.archive
..\..\..\bin.v2\libs\serialization\build\gcc-3.4.4\debug\link-static
\libboost_serialization-gcc34-d-1_34_1.a
gcc.link
..\..\..\bin.v2\libs\serialization\test\test_shared_ptr_132_text_archiv
e.test\gcc-3.4.4\debug\link-static\test_shared_ptr_132_text_archive.exe
testing.capture-output
..\..\..\bin.v2\libs\serialization\test\test_shared_ptr_1
32_text_archive.test\gcc-3.4.4\debug\link-static\test_shared_ptr_132_text_archiv
e.run
====== BEGIN OUTPUT ======
assertion "result.second" failed: file
"..\..\..\libs\serialization\src\extended
_type_info.cpp", line 75

EXIT STATUS: 34304
====== END OUTPUT ======
**passed**
..\..\..\bin.v2\libs\serialization\test\test_shared_ptr_132_text_arch
ive.test\gcc-3.4.4\debug\link-static\test_shared_ptr_132_text_archive.test
...updated 32 targets...

Peter Dimov wrote:
> Robert Ramey:
>> I've traced through the code with the gdb and seems to me
>> that when assert is invoked, the program bails more or less
>> immediatly without jumping back to the orginal main or
>> invoking an exception that can be caught. This results
>> in tests which provoke assertions as being marked "passed".
>
> assert should in principle call abort(), which should return a
> failure exit code to the OS, so the test should fail...
>
>> Actually, this is unbelievable to me and I have to
>> believe that I'm missing something really dumb. I
>> also took a cursory look at Boost Test code and don't
>> see any special provision made for assert.
>>
>> Also I investigated BOOST_ASSERT. It looks
>> to me that this code is not conditional upon
>> NDEBUG not being defined - that is that the
>> code included by BOOST_ASSERT would
>> still appear in a release build. Again, I can't help but
>> feel that I'm missing something really obvious.
>
> BOOST_ASSERT works in three modes. By default, it maps to assert, and
> assert does obey NDEBUG. If BOOST_DISABLE_ASSERTS is defined,
> BOOST_ASSERT is compiled out. If BOOST_ENABLE_ASSERT_HANDLER is
> defined, failed asserts call a function that can be supplied by the
> user. So if your code uses BOOST_ASSERT, you can define a custom
> handler in your tests that prints a message and cause the test to
> fail.
>
> http://www.boost.org/libs/utility/assert.html
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk