|
Boost Users : |
Subject: [Boost-users] [Test] Test executable crashes always
From: Nate Widmyer (touring_fan_at_[hidden])
Date: 2018-01-03 14:39:55
Hello,
I've made some unit tests with boost test before without issue, but on my latest rather ordinary test, I've been able to get Boost test to crash the executable in debug and release mode when boost test is making a report before terminating.
test_exe.exe!boost::unit_test::framework::get(unsigned long id, boost::unit_test::test_unit_type t) Line 1388 C++
test_exe.exe!boost::unit_test::framework::get<boost::unit_test::test_unit>(unsigned long id) Line 208 C++
test_exe.exe!boost::unit_test::results_reporter::make_report(boost::unit_test::report_level l, unsigned long id) Line 175 C++
test_exe.exe!boost::unit_test::unit_test_main(boost::unit_test::test_suite *(*)(int, char * *) init_func, int argc, char * * argv) Line 235 C++
test_exe.exe!main(int argc, char * * argv) Line 287 C++
That's the default report_level of 'confirm'
If I use report_level=short or detailed, I get a similar crash:
test_exe.exe!boost::unit_test::framework::get(unsigned long id, boost::unit_test::test_unit_type t) Line 1388 C++
test_exe.exe!boost::unit_test::framework::get<boost::unit_test::test_suite>(unsigned long id) Line 207 C++
test_exe.exe!boost::unit_test::traverse_test_tree(unsigned long id, boost::unit_test::test_tree_visitor & V, bool ignore_status) Line 365 C++
test_exe.exe!boost::unit_test::results_reporter::make_report(boost::unit_test::report_level l, unsigned long id) Line 185 C++
test_exe.exe!boost::unit_test::unit_test_main(boost::unit_test::test_suite *(*)(int, char * *) init_func, int argc, char * * argv) Line 235 C++
test_exe.exe!main(int argc, char * * argv) Line 287 C++
Here's the get() method:
test_unit&
get( test_unit_id id, test_unit_type t )
{
test_unit* res = impl::s_frk_state().m_test_units[id];
BOOST_TEST_I_ASSRT( (res->p_type & t) != 0, internal_error( "Invalid test unit type" ) );
return *res;
}
Crash occurs on line 2 of the function. I logged 'res' each time the function is called and many times its valid, but when it runs this one test (by itself or with others), 'res' always ends up being NULL.
id seems to always be '1', and t is TUT_ANY (17) if generating a confirmation report or TUT_SUITE (16) if generating a short or detailed report.
If I use the option '--report_level=no', then execution does complete fine.
I followed through on some process of elimination and it seems to be related to using a fixture?
Having no test body still causes the crash. It wasn't until I removed the fixture (and its usage in the body of the test) did the executable not crash.
I ensured that I was using the standard fixture model found here:
OS is Win 7 w/ VS2015
boost is 1.64.0 and was built with: b2 toolset=msvc-14.0 link=static runtime-link=static variant=debug address-model=64 --without-atomic --without-container --without-context --without-coroutine --without-coroutine2 --without-graph --without-graph_parallel --without-iostreams --without-locale --without-math --without-mpi --without-serialization --without-signals --without-type_erasure --without-wave -j4 --abbreviate-paths --without-python -d2
Any help would of something to look at or change would be appreciated.
Thanks for your time,
Nathan
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net