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

Tests fail on Fedora with gcc 6.1.1 #325

Closed
daveisfera opened this issue May 14, 2016 · 7 comments
Closed

Tests fail on Fedora with gcc 6.1.1 #325

daveisfera opened this issue May 14, 2016 · 7 comments

Comments

@daveisfera
Copy link

I just started working on packaging fmt library for Fedora and the test 9 fails on Rawhide with gcc 6.1.1. Here's the output:

      Start  9: posix-mock-test
 9/10 Test  #9: posix-mock-test ..................***Exception: SegFault  0.22 sec

What can I do to help diagnose the source of this issue?

@nabijaczleweli
Copy link

Use GDB

@daveisfera
Copy link
Author

I know 0 about the tests and how they're run. So I need some info like:

  • Can a parameter be given to make test so it will run the tests in GDB?
  • How do I run an individual test?

@daveisfera
Copy link
Author

daveisfera commented May 14, 2016

I played around a bit and figured out how to run the failing test in GDB. Here's what I ran:

/usr/bin/ctest
gdb /usr/bin/ctest
set follow-fork-mode child
run --rerun-failed

And here's the stacktrace:

#0  testing::internal::FunctionMockerBase<void (__locale_struct*)>::InvokeWith(std::tuple<__locale_struct*> const&) (args=std::tuple containing = {...}, this=0x7fffffffe100)
    at /builddir/build/BUILD/fmt-3.0.0/test/gmock/gmock.h:10094
#1  testing::internal::FunctionMocker<void (__locale_struct*)>::Invoke(__locale_struct*) (a1=0x2a, this=0x7fffffffe100)
        at /builddir/build/BUILD/fmt-3.0.0/test/gmock/gmock.h:10408
#2  LocaleMock::freelocale (gmock_a1=0x2a, this=0x7fffffffe068) at /builddir/build/BUILD/fmt-3.0.0/test/posix-mock-test.cc:483
#3  freelocale (locale=locale@entry=0x2a) at /builddir/build/BUILD/fmt-3.0.0/test/posix-mock-test.cc:518
#4  0x000055555558e7b6 in fmt::Locale::~Locale (this=<synthetic pointer>, __in_chrg=<optimized out>) at /builddir/build/BUILD/fmt-3.0.0/fmt/posix.h:379
#5  LocaleTest_Locale_Test::TestBody (this=<optimized out>) at /builddir/build/BUILD/fmt-3.0.0/test/posix-mock-test.cc:542
#6  0x00005555555d3ea4 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void> (location=0x5555555da5ab "the test body", method=<optimized out>,
            object=<optimized out>) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3562
#7  testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=object@entry=0x555555807530, method=<optimized out>,
                location=location@entry=0x5555555da5ab "the test body") at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3598
#8  0x00005555555c9d7a in testing::Test::Run (this=this@entry=0x555555807530) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3635
#9  0x00005555555c9f6d in testing::Test::Run (this=0x555555807530) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3626
#10 testing::TestInfo::Run (this=0x555555808d50) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3810
#11 0x00005555555ca0f5 in testing::TestInfo::Run (this=<optimized out>) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3785
#12 testing::TestCase::Run (this=0x555555808be0) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3928
#13 0x00005555555ca5ad in testing::TestCase::Run (this=<optimized out>) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:5837
#14 testing::internal::UnitTestImpl::RunAllTests (this=0x555555806d30) at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:5799
#15 0x00005555555d4354 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (
                    location=0x5555555d9920 "auxiliary test code (environments or event listeners)", method=<optimized out>, object=<optimized out>)
    at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3562
#16 testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x555555806d30, method=<optimized out>,
        location=location@entry=0x5555555d9920 "auxiliary test code (environments or event listeners)") at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:3598
#17 0x00005555555ca889 in testing::UnitTest::Run (this=0x5555557f4b60 <testing::UnitTest::GetInstance()::instance>)
            at /builddir/build/BUILD/fmt-3.0.0/test/gmock-gtest-all.cc:5410
#18 0x000055555558882f in RUN_ALL_TESTS () at /builddir/build/BUILD/fmt-3.0.0/test/./gtest/gtest.h:20058
#19 main (argc=<optimized out>, argv=<optimized out>) at /builddir/build/BUILD/fmt-3.0.0/test/test-main.cc:57

@vitaut
Copy link
Contributor

vitaut commented May 14, 2016

Thanks for the bug report. I was able to reproduce it and will look into it. As an interesting detail, this seems to only occur in the release version.

@vitaut
Copy link
Contributor

vitaut commented May 15, 2016

The problem is caused by "delete this" in GMock when this is a null pointer. It is related to google/googletest#705. Should be fixed in d00b43c

I should probably submit the fix to GMock to fix this once and for all.

@daveisfera
Copy link
Author

Ok, I applied the patch from d00b43c and the tests pass. Thanks.

@vitaut
Copy link
Contributor

vitaut commented May 24, 2016

This might have been fixed in Google Test too, at least InvokeWith no longer calls GetValueAndDelete:

  Result InvokeWith(const ArgumentTuple& args)
        GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
    scoped_ptr<ResultHolder> holder(
        DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args)));
    return holder->Unwrap();
}

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

3 participants