Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current Unit Tests Fail With Segfault #394

Closed
theNerd247 opened this issue Jul 7, 2016 · 2 comments
Closed

Current Unit Tests Fail With Segfault #394

theNerd247 opened this issue Jul 7, 2016 · 2 comments

Comments

@theNerd247
Copy link

Here's the back trace. I'm running on Arch Linux and compiling with g++ 6.1.1 (compiling as 64 bit):

Program received signal SIGSEGV, Segmentation fault.
0x000000000046d24c in YAML::MockEventHandler::OnDocumentStart(YAML::Mark const&) ()
(gdb) bt
#0  0x000000000046d24c in YAML::MockEventHandler::OnDocumentStart(YAML::Mark const&) ()
#1  0x000000000069702f in YAML::SingleDocParser::HandleDocument(YAML::EventHandler&) ()
#2  0x000000000067735a in YAML::Parser::HandleNextDocument(YAML::EventHandler&) ()
#3  0x000000000046c3ef in YAML::(anonymous namespace)::EncodingTest::Run() ()
#4  0x00000000006d6724 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#5  0x00000000006cf4ac in testing::Test::Run() [clone .part.387] ()
#6  0x00000000006cf665 in testing::TestInfo::Run() [clone .part.388] ()
#7  0x00000000006cf7c5 in testing::TestCase::Run() [clone .part.389] ()
#8  0x00000000006cfc15 in testing::internal::UnitTestImpl::RunAllTests() ()
#9  0x00000000006d6b74 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#10 0x00000000006cff25 in testing::UnitTest::Run() ()
#11 0x000000000043a70f in main ()
@mvduin
Copy link

mvduin commented Dec 15, 2016

Problem still present in current HEAD, segfault while running EncodingTest.UTF8_noBOM.

gcc version 6.2.1 20161124 (Debian 6.2.1-5).

The segfault does not occur in a Debug (-O0) build but does in a RelWithDebInfo (-O2 -DNDEBUG) build. Testing shows that -O2 -DNDEBUG seems to be the minimum for the crash to occur:
-O3 -DNDEBUG: segfault
-O2 -DNDEBUG: segfault
-O1 -DNDEBUG: ok
-Og -DNDEBUG: ok
-O3: ok
-O2: ok

More detailed traceback from a RelWithDebInfo build:

#0  testing::internal::FunctionMockerBase<void (YAML::Mark const&)>::InvokeWith(std::tuple<YAML::Mark const&> const&) (args=std::tuple containing = {...}, this=0x555555c0e410)
    at yaml-cpp/test/gmock-1.7.0/include/gmock/gmock-spec-builders.h:1530
#1  testing::internal::FunctionMocker<void (YAML::Mark const&)>::Invoke(YAML::Mark const&) (
    a1=..., this=0x555555c0e410)
    at yaml-cpp/test/gmock-1.7.0/include/gmock/gmock-generated-function-mockers.h:97
#2  YAML::MockEventHandler::OnDocumentStart (this=this@entry=0x555555c0e408, gmock_a1=...)
    at yaml-cpp/test/mock_event_handler.h:10
#3  0x00005555558650cf in YAML::SingleDocParser::HandleDocument (
    this=this@entry=0x7fffffffdb10, eventHandler=...)
    at yaml-cpp/src/singledocparser.cpp:32
#4  0x000055555584aa5d in YAML::Parser::HandleNextDocument (this=this@entry=0x7fffffffdc50, 
    eventHandler=...) at yaml-cpp/src/parser.cpp:39
#5  0x000055555562419d in YAML::HandlerTest::Parse (
    example="- |\n  !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n- |\n  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍ", <incomplete sequence \303>..., this=0x555555c0e3f0)
    at yaml-cpp/test/handler_test.h:17
#6  YAML::(anonymous namespace)::EncodingTest::Run (this=0x555555c0e3f0)
    at yaml-cpp/test/integration/encoding_test.cpp:105
#7  0x000055555589a8c4 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void> (location=0x5555558f10a9 "the test body", method=<optimized out>, 
    object=<optimized out>)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2078
#8  testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (
    object=object@entry=0x555555c0e3f0, method=<optimized out>, 
    location=location@entry=0x5555558f10a9 "the test body")
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2114
#9  0x000055555589325a in testing::Test::Run (this=this@entry=0x555555c0e3f0)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2151
#10 0x000055555589342d in testing::Test::Run (this=0x555555c0e3f0)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2142
#11 testing::TestInfo::Run (this=0x555555bc7560)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2326
#12 0x00005555558935a5 in testing::TestInfo::Run (this=<optimized out>)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2301
#13 testing::TestCase::Run (this=0x555555bc7650)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2444
#14 0x0000555555893a15 in testing::TestCase::Run (this=<optimized out>)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:4353
#15 testing::internal::UnitTestImpl::RunAllTests (this=0x555555bbed70)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:4315
#16 0x000055555589ad14 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (
    location=0x5555558f06f8 "auxiliary test code (environments or event listeners)", 
    method=<optimized out>, object=<optimized out>)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2078
#17 testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x555555bbed70, method=<optimized out>, 
    location=location@entry=0x5555558f06f8 "auxiliary test code (environments or event listeners)") at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:2114
#18 0x0000555555893d49 in testing::UnitTest::Run (
    this=0x555555bac9a0 <testing::UnitTest::GetInstance()::instance>)
    at yaml-cpp/test/gmock-1.7.0/gtest/src/gtest.cc:3926
#19 0x00005555555ef79f in RUN_ALL_TESTS ()
    at yaml-cpp/test/gmock-1.7.0/gtest/include/gtest/gtest.h:2288
#20 main (argc=<optimized out>, argv=<optimized out>)
    at yaml-cpp/test/main.cpp:5

@tepperly
Copy link

This problem disappeared for me with the latest available version on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants