[1.33.1][test][vc80] new user question concerning 1_33_1\libs\test\doc\examples\unit_test_example1.html & unit_test_example1.cpp/
Hi, I've built and run this with libboost_unit_test_framework-vc80-mt-gd-1_33_1.lib in my Linker->Input->Additional Dependencies.
The single test looks like this:
void free_test_function()
{
// reports 'error in "free_test_function": test 2 == 1 failed'
BOOST_CHECK(2 == 1); // non-critical test => continue after failure
int* p = (int*)0;
*p = 0;
}
When I run it, I see the falied message (2!=1), but I don't get the final 'No errors found' message since '*p=0' causes an unhandlled exception.
But when I run it with
#include
How did you build the library?
It looks like async exceptions were not enabled during library build.
Gennadiy
"John McMahon"
Hi Grennadiy, I downloaded the prebuilt vc80 1.33.1 versionfrom http://www.boost-consulting.com/products/free
John
----- Original Message -----
From: Gennadiy Rozental
Newsgroups: gmane.comp.lib.boost.user
To: boost-users@lists.boost.org
Sent: Monday, April 30, 2007 6:04 PM
Subject: Re: [1.33.1][test][vc80] new user questionconcerning1_33_1\libs\test\doc\examples\unit_test_example1.html&unit_test_example1.cpp/
How did you build the library?
It looks like async exceptions were not enabled during library build.
Gennadiy
"John McMahon"
"John"
wrote in message news:BAY144-DAV160A3C2B6ECB7E9B54F0ECA74C0@phx.gbl... Hi Grennadiy, I downloaded the prebuilt vc80 1.33.1 versionfrom http://www.boost-consulting.com/products/free John
Yes. This version is not correct. The issue is addressed in 1.34.0 AFAIK. Switch to 1.34 (preferable). Or build the library yourself from the Boost.Test sources. Gennadiy
built a new libboost_unit_test_framework-vc80-mt-gd-1_33_1.lib and just now
prepended my vc80 lib search path to point to the folder I did the 1.33.1
libirary build.
It gave the same error at the same point.
Also, http://www.boost-consulting.com/products/free/beta contains the line:
"Nothing here yet. We expect to have a beta version of the Boost 1.34
installer soon"
thanks
"Gennadiy Rozental"
"John"
wrote in message news:BAY144-DAV160A3C2B6ECB7E9B54F0ECA74C0@phx.gbl... Hi Grennadiy, I downloaded the prebuilt vc80 1.33.1 versionfrom http://www.boost-consulting.com/products/free John Yes. This version is not correct. The issue is addressed in 1.34.0 AFAIK.
Switch to 1.34 (preferable). Or build the library yourself from the Boost.Test sources.
Gennadiy
"John McMahon"
built a new libboost_unit_test_framework-vc80-mt-gd-1_33_1.lib and just now prepended my vc80 lib search path to point to the folder I did the 1.33.1 libirary build.
The error was in tools if I am not mistaken. You need to make sure manually that async exceptions flag is turned on (/Ga?)
Would it be this?:
"Use /EHa to specify the asynchronous exception handling model (C++
exception handling with structured exception handling exceptions). /EHa may
result in a less performant image because the compiler will not optimize a
catch block as aggressively, even if the compiler does not see a throw.
/GX is deprecated in Visual C++ 2005; use /EH (Exception Handling Model)
instead. For more information, see Deprecated Compiler Options."
Also, I'm guessing, but it looks like I should set the compiler flag in
boost\boost_1_33_1\tools\build\v1\vc-8_0-tools.jam
I edited it to contain
flags vc-8_0 C++FLAGS : /EHa ; # no idea if the syntax is right; also is
this the right compiler option? or /EHsh. Tried both. to no avail.
and ran
bjam --v2 --with-test "-sTOOLS=vc-8_0" "-sVS80_ROOT=C:\Program
Files\Microsoft Visual Studio 8\VC"
(I see no corresponding v2 vc-8_0-tools.jam.)
This built
..\boost\boost_1_33_1\bin.v2\libs\test\build\msvc\debug\asynch-exceptions-on\link-static\boost_unit_test_framework-vc-d-1_33.lib
(notice no lib- prepended).
When I point my lib path to this library, I get the same exception - only
this time on the console outut rather than in a popup.
John
----
Log out out from vc80 link step.
1>Searching libraries
1> Searching
D:\john\SyncFolder\projects\programming\c++\boost\boost_1_33_1\bin.v2\libs\test\build\msvc\debug\asynch-exceptions-on\link-static\boost_unit_test_framework-vc-d-1_33.lib:
1> Found "void __cdecl boost::test_tools::tt_detail::check_impl(class
boost::test_tools::predicate_result const &,class
boost::basic_wrap_stringstream<char> &,class
boost::unit_test::basic_cstring<char const >,unsigned int,enum
boost::test_tools::tt_detail::tool_level,enum
boost::test_tools::tt_detail::check_type,unsigned int,...)"
(?check_impl@tt_detail@test_tools@boost@@YAXABVpredicate_result@23@AAV?$basic_wrap_stringstream@D@3@V?$basic_cstring@$$CBD@unit_test@3@IW4tool_level@123@W4check_type@123@IZZ)
1> Referenced in BoostTest1.obj
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(test_tools.obj)
1> Found "public: void __thiscall boost::unit_test::test_suite::add(class
boost::unit_test::test_unit *,unsigned long,unsigned int)"
(?add@test_suite@unit_test@boost@@QAEXPAVtest_unit@23@KI@Z)
1> Referenced in BoostTest1.obj
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_suite.obj)
1> Found "void __cdecl boost::unit_test::framework::test_unit_aborted(void)"
(?test_unit_aborted@framework@unit_test@boost@@YAXXZ)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(test_tools.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Found "public: class boost::unit_test::unit_test_log_t & __thiscall
boost::unit_test::unit_test_log_t::operator<<(struct
boost::unit_test::log::checkpoint const &)"
(??6unit_test_log_t@unit_test@boost@@QAEAAV012@ABUcheckpoint@log@12@@Z)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(test_tools.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_log.obj)
1> Found "public: bool __thiscall
boost::unit_test::test_results::passed(void)const "
(?passed@test_results@unit_test@boost@@QBE_NXZ)
1> Referenced in
boost_unit_test_framework-vc-d-1_33.lib(unit_test_suite.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(results_collector.obj)
1> Found "int __cdecl boost::unit_test::runtime_config::random_seed(void)"
(?random_seed@runtime_config@unit_test@boost@@YAHXZ)
1> Referenced in
boost_unit_test_framework-vc-d-1_33.lib(unit_test_suite.obj)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_parameters.obj)
1> Found "public: enum boost::unit_test::unit_test_monitor_t::error_level
__thiscall
boost::unit_test::unit_test_monitor_t::execute_and_translate(class
boost::unit_test::test_case const &)"
(?execute_and_translate@unit_test_monitor_t@unit_test@boost@@QAE?AW4error_level@123@ABVtest_case@23@@Z)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_monitor.obj)
1> Found "void __cdecl boost::detect_memory_leak(long)"
(?detect_memory_leak@boost@@YAXJ@Z)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(execution_monitor.obj)
"Gennadiy Rozental"
"John McMahon"
wrote in message news:f15bem$ehn$1@sea.gmane.org... built a new libboost_unit_test_framework-vc80-mt-gd-1_33_1.lib and just now prepended my vc80 lib search path to point to the folder I did the 1.33.1 libirary build.
The error was in tools if I am not mistaken. You need to make sure manually that async exceptions flag is turned on (/Ga?)
"John McMahon"
Would it be this?: "Use /EHa to specify the asynchronous exception handling model (C++ exception handling with structured exception handling exceptions). /EHa may result in a less performant image because the compiler will not optimize a catch block as aggressively, even if the compiler does not see a throw. /GX is deprecated in Visual C++ 2005; use /EH (Exception Handling Model) instead. For more information, see Deprecated Compiler Options."
Also, I'm guessing, but it looks like I should set the compiler flag in boost\boost_1_33_1\tools\build\v1\vc-8_0-tools.jam
I edited it to contain flags vc-8_0 C++FLAGS : /EHa ; # no idea if the syntax is right; also is this the right compiler option? or /EHsh. Tried both. to no avail.
Ask Boost.Build guys.
and ran
bjam --v2 --with-test "-sTOOLS=vc-8_0" "-sVS80_ROOT=C:\Program Files\Microsoft Visual Studio 8\VC"
Make sure you cleanup results of previous run
(I see no corresponding v2 vc-8_0-tools.jam.)
This built ..\boost\boost_1_33_1\bin.v2\libs\test\build\msvc\debug\asynch-exceptions-on\link-static\boost_unit_test_framework-vc-d-1_33.lib
(notice no lib- prepended).
When I point my lib path to this library, I get the same exception - only this time on the console outut rather than in a popup.
Could you please show me the output?
John
---- Log out out from vc80 link step. 1>Searching libraries
1> Searching D:\john\SyncFolder\projects\programming\c++\boost\boost_1_33_1\bin.v2\libs\test\build\msvc\debug\asynch-exceptions-on\link-static\boost_unit_test_framework-vc-d-1_33.lib:
1> Found "void __cdecl boost::test_tools::tt_detail::check_impl(class boost::test_tools::predicate_result const &,class boost::basic_wrap_stringstream<char> &,class boost::unit_test::basic_cstring<char const >,unsigned int,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,unsigned int,...)" (?check_impl@tt_detail@test_tools@boost@@YAXABVpredicate_result@23@AAV?$basic_wrap_stringstream@D@3@V?$basic_cstring@$$CBD@unit_test@3@IW4tool_level@123@W4check_type@123@IZZ)
1> Referenced in BoostTest1.obj
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(test_tools.obj)
1> Found "public: void __thiscall boost::unit_test::test_suite::add(class boost::unit_test::test_unit *,unsigned long,unsigned int)" (?add@test_suite@unit_test@boost@@QAEXPAVtest_unit@23@KI@Z)
1> Referenced in BoostTest1.obj
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_suite.obj)
1> Found "void __cdecl boost::unit_test::framework::test_unit_aborted(void)" (?test_unit_aborted@framework@unit_test@boost@@YAXXZ)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(test_tools.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Found "public: class boost::unit_test::unit_test_log_t & __thiscall boost::unit_test::unit_test_log_t::operator<<(struct boost::unit_test::log::checkpoint const &)" (??6unit_test_log_t@unit_test@boost@@QAEAAV012@ABUcheckpoint@log@12@@Z)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(test_tools.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_log.obj)
1> Found "public: bool __thiscall boost::unit_test::test_results::passed(void)const " (?passed@test_results@unit_test@boost@@QBE_NXZ)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(unit_test_suite.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(results_collector.obj)
1> Found "int __cdecl boost::unit_test::runtime_config::random_seed(void)" (?random_seed@runtime_config@unit_test@boost@@YAHXZ)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(unit_test_suite.obj)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_parameters.obj)
1> Found "public: enum boost::unit_test::unit_test_monitor_t::error_level __thiscall boost::unit_test::unit_test_monitor_t::execute_and_translate(class boost::unit_test::test_case const &)" (?execute_and_translate@unit_test_monitor_t@unit_test@boost@@QAE?AW4error_level@123@ABVtest_case@23@@Z)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(unit_test_monitor.obj)
1> Found "void __cdecl boost::detect_memory_leak(long)" (?detect_memory_leak@boost@@YAXJ@Z)
1> Referenced in boost_unit_test_framework-vc-d-1_33.lib(framework.obj)
1> Loaded boost_unit_test_framework-vc-d-1_33.lib(execution_monitor.obj)
"Gennadiy Rozental"
wrote in message news:f15bka$f5b$1@sea.gmane.org... "John McMahon"
wrote in message news:f15bem$ehn$1@sea.gmane.org... built a new libboost_unit_test_framework-vc80-mt-gd-1_33_1.lib and just now prepended my vc80 lib search path to point to the folder I did the 1.33.1 libirary build.
The error was in tools if I am not mistaken. You need to make sure manually that async exceptions flag is turned on (/Ga?)
Hi Grennadiy, thanks for your help so far.
I might just switch to the no libraries solution and wait for 1.34 binaries to be built, since I don't have time on my schedule to dig deeper into the boost build.
Correct me if I'm wrong - if I chose to use the synchronous exceptions version of the libraries now on Boost Consulting website, the core libraries ought to work fine, it is just that I ought to expect runtime exceptions to terminate the execution of any code I write using it. Ie please confirm that there's no reason to think that boost-test, etc might not function with this exception model.
Just on the no-libraries solution. I can't find anything documented about any special compiler settings to get it to work with vc80.
When I set /EHsc, the popped up exception occurs. When I set /EHa, the program _appears_ to finish fine, but on closer inspection of the console output, I discover the access violation message is there in the console. But I guess this is not what I should get with my no-libraries test. What am I doing wrong here?
--
OUTPUT:
$ ./Boost_test_1_withoutSeparateLibrary.exe
Running 1 test case...
d:/john/syncfolder/projects/programming/c++/vc++/projects/boost_test_1/boost_test_1/getstarted.cpp(13): error in "free_te
st_function": check 3 == 1 failed
unknown location(0): fatal error in "free_test_function": memory access violation
*** 1 failure detected (1 failure expected) in test suite "Unit test example 1"
---
#include
"John McMahon"
wrote in message news:f1766r$khc$1@sea.gmane.org... Hi Grennadiy, thanks for your help so far. I might just switch to the no libraries solution and wait for 1.34 binaries to be built, since I don't have time on my schedule to dig deeper into the boost build. Correct me if I'm wrong - if I chose to use the synchronous exceptions version of the libraries now on Boost Consulting website, the core libraries ought to work fine, it is just that I ought to expect runtime exceptions to terminate the execution of any code I write using it.
Boost.Test won;t be able to catch system errors, like memory access violation
Ie please confirm that there's no reason to > think that boost-test, etc might not function with this exception model.
Just on the no-libraries solution. I can't find anything documented about any special compiler settings to get it to work with vc80.
VC 8.0 was not available at the time
When I set /EHsc, the popped up exception occurs. When I set /EHa, the program _appears_ to finish fine, but on closer inspection of the console output, I discover the access violation message is there in the console. But I guess this is not what I should get with my no-libraries test. What am I doing wrong here?
I don't see anything wrong with an output below. Memory access violation is
caught and reported by the UTF.
Gennadiy
--
OUTPUT:
$ ./Boost_test_1_withoutSeparateLibrary.exe
Running 1 test case...
d:/john/syncfolder/projects/programming/c++/vc++/projects/boost_test_1/boost_test_1/getstarted.cpp(13):
error in "free_te
st_function": check 3 == 1 failed
unknown location(0): fatal error in "free_test_function": memory access
violation
*** 1 failure detected (1 failure expected) in test suite "Unit test example
1"
---
#include
participants (3)
-
Gennadiy Rozental
-
John
-
John McMahon