[Boost-bugs] [Boost C++ Libraries] #10943: SIGSEGV in compiler_log_formatter::log_start

Subject: [Boost-bugs] [Boost C++ Libraries] #10943: SIGSEGV in compiler_log_formatter::log_start
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-01-19 12:04:25


#10943: SIGSEGV in compiler_log_formatter::log_start
------------------------------+---------------------
 Reporter: InonShar@… | Owner: rogeeff
     Type: Support Requests | Status: new
Milestone: To Be Determined | Component: test
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 = SIGSEGV in output::compiler_log_formatter::log_start() call to
 ostream::_M_insert<unsigned long>() =

 Hi!

 I'm trying to compile a code which uses the Boost.Test module, and while
 playing around with some of the parameters it seems to have broken: I now
 get a segmentation fault whenever I run the code, at the printout of the
 first line to the log file. The custom-named log file exists, but is
 empty, and no error message is emitted.

 My setup is done using the following code, after which a
 BOOST_GLOBAL_FIXTURE is initiallized (succesfully). If I understand the
 stack trace, the error seems to occur only when starting to traverse the
 test_unit tree.

 == Stack trace: ==
 {{{
         Thread [1] 5624 [core: 6] (Suspended : Signal :
 SIGSEGV:Segmentation fault)
         std::ostream::sentry::sentry() at 0x3495a915b1
         std::ostream& std::ostream::_M_insert<unsigned long>() at
 0x3495a95168
         boost::unit_test::output::compiler_log_formatter::log_start() at
 compiler_log_formatter.ipp:50 0x45aaa3
         boost::unit_test::unit_test_log_t::test_start() at
 unit_test_log.ipp:138 0x469ad5
         boost::unit_test::ut_detail::test_start_caller::operator() at
 framework.ipp:71 0x489832
 boost::unit_test::ut_detail::invoker<int>::invoke<boost::unit_test::ut_detail::test_start_caller>()
 at callback.hpp:42 0x4de998
         boost::unit_test::ut_detail::callback0_impl_t<int,
 boost::unit_test::ut_detail::test_start_caller>::invoke() at
 callback.hpp:89 0x4db5a7
         boost::unit_test::callback0<int>::operator() at callback.hpp:118
 0x4a24ff
 boost::detail::do_invoke<boost::scoped_ptr<boost::detail::translate_exception_base>,
 boost::unit_test::callback0<int> >() at execution_monitor.ipp:244 0x497784
         boost::execution_monitor::catch_signals() at
 execution_monitor.ipp:841 0x461918
         boost::execution_monitor::execute() at execution_monitor.ipp:1,167
 0x4619dc
         boost::unit_test::framework::run() at framework.ipp:418 0x45dc32
         boost::unit_test::unit_test_main() at unit_test_main.ipp:185
 0x46a85e
         main() at unit_test_main.ipp:237 0x46aa58
 }}}

 == Loaded by the BOOST_GLOBAL_FIXTURE ==

 {{{
 #!cpp

 static const bool TestingDefs::formatBoostTestForJenkins = false;

 /// Loaded by the BOOST_GLOBAL_FIXTURE
 struct BoostTestFlags
 {
                 BoostTestFlags() :
                                 m_set(false)
                 {
                         Func_Reporter;
                         if (!m_set)
                                 m_set = set();
                 }

                 bool set()
                 {
                         m_sOFStreamDirName =
 GlobalLoggerSingleton::instance()->getFullFilePath();

                         m_sOFStreamFileName = m_sOFStreamDirName +
 string("/") + string("BoostTests_") +
 to_iso_string(second_clock::local_time());
                         m_sOFStreamFileName += ".";
 ///< add filename extension according to filetype, TBD later on.
                         BETIS_LOGMSG((LM_INFO,"Boost.Test output will be
 written to %s",m_sOFStreamFileName.c_str()));

                         if (TestingDefs::formatBoostTestForJenkins)
                         {
                                 m_sOFStreamFileName += "xml";
 m_oFStreamBoostTests.open(m_sOFStreamFileName.c_str(), std::ofstream::out
 | std::ofstream::trunc);
                                 if (!m_oFStreamBoostTests.is_open())
                                 {
 BETIS_LOGMSG((LM_ERROR,"BoostTestFlags::BoostTestFlags() Could not open
 output file stream for writing!"));
                                         return false;
                                 }
 boost::unit_test::unit_test_log.set_stream(m_oFStreamBoostTests);
 boost::unit_test::unit_test_log.set_format((boost::unit_test::output_format)
 XML); ///< --output_format=XML
 boost::unit_test::unit_test_log.set_threshold_level((boost::unit_test::log_level)
 0); ///< --log_level=all
 boost::unit_test::results_reporter::set_level(boost::unit_test::report_level(NO_REPORT));
 ///< --report_level=no
 boost::unit_test::results_reporter::set_format((boost::unit_test::output_format)
 XML);

                         }
                         else ///< Flags for human readability, verbose
                         {
                                 m_sOFStreamFileName += "log";
 m_oFStreamBoostTests.open(m_sOFStreamFileName.c_str(), std::ofstream::out
 | std::ofstream::trunc);
                                 if (!m_oFStreamBoostTests.is_open())
                                 {
 BETIS_LOGMSG((LM_ERROR,"BoostTestFlags::BoostTestFlags() Could not open
 output file stream for writing!"));
                                         return false;
                                 }
 boost::unit_test::unit_test_log.set_stream(m_oFStreamBoostTests);
 boost::unit_test::unit_test_log.set_format((boost::unit_test::output_format)
 CLF); ///< Compiler Log Format
 boost::unit_test::unit_test_log.set_threshold_level((boost::unit_test::log_level)
 0);
 boost::unit_test::results_reporter::set_level(boost::unit_test::report_level(DETAILED_REPORT));
 boost::unit_test::results_reporter::set_format((boost::unit_test::output_format)
 CLF);
                                 cout.setf(ios_base::unitbuf); ///< Turn
 off STDOUT buffering to improve accuracy of communication between
 Boost.Test and Tests Runner (since Boost.Test does not provide a way to
 flush the stream). @warning This costs in execution time. @see
 github.com/xgsa/cdt-tests-runner/wiki/Features#known-problems
                         }
                         return true;
                 }
                 ~BoostTestFlags()
                 {
                         Func_Reporter;
                 }

         private:
                 ofstream m_oFStreamBoostTests;
                 string m_sOFStreamDirName;
                 string m_sOFStreamFileName;
                 bool m_set;
 };
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10943>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC