-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Description
Hi
When I have two test_cases with same name and description, a crash appears. Test cases:
TEST_CASE ("A", "[obd parsing]")
{
}
TEST_CASE ("A", "[obd parsing]")
{
}
valgrind output:
==14080== Invalid read of size 8
==14080== at 0x4ECB3A9: std::ostream::sentry::sentry(std::ostream&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==14080== by 0x4ECBA68: std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==14080== by 0x4ECBE57: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==14080== by 0x46D725: Catch::(anonymous namespace)::PosixColourImpl::setColour(char const*) (catch.hpp:6375)
==14080== by 0x46D51C: Catch::(anonymous namespace)::PosixColourImpl::use(Catch::Colour::Code) (catch.hpp:6353)
==14080== by 0x46D8B8: Catch::Colour::use(Catch::Colour::Code) (catch.hpp:6409)
==14080== by 0x46D7F9: Catch::Colour::Colour(Catch::Colour::Code) (catch.hpp:6401)
==14080== by 0x485C61: Catch::TestRegistry::registerTest(Catch::TestCase const&) (catch.hpp:5755)
==14080== by 0x46CE1E: Catch::(anonymous namespace)::RegistryHub::registerTest(Catch::TestCase const&) (catch.hpp:5994)
==14080== by 0x46CB8D: Catch::AutoReg::registerTestCase(Catch::ITestCase*, char const*, Catch::NameAndDesc const&, Catch::SourceLineInfo const&) (catch.hpp:5860)
==14080== by 0x46CA44: Catch::AutoReg::AutoReg(void (*)(), Catch::SourceLineInfo const&, Catch::NameAndDesc const&) (catch.hpp:5845)
==14080== by 0x46C3EF: __static_initialization_and_destruction_0(int, int) (obdHiLevelTest.cc:27)
==14080== Address 0xffffffffffffffe8 is not stack'd, malloc'd or (recently) free'd
==14080==
==14080==
==14080== Process terminating with default action of signal 11 (SIGSEGV)
==14080== Access not within mapped region at address 0xFFFFFFFFFFFFFFE8
==14080== at 0x4ECB3A9: std::ostream::sentry::sentry(std::ostream&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==14080== by 0x4ECBA68: std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==14080== by 0x4ECBE57: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==14080== by 0x46D725: Catch::(anonymous namespace)::PosixColourImpl::setColour(char const*) (catch.hpp:6375)
==14080== by 0x46D51C: Catch::(anonymous namespace)::PosixColourImpl::use(Catch::Colour::Code) (catch.hpp:6353)
==14080== by 0x46D8B8: Catch::Colour::use(Catch::Colour::Code) (catch.hpp:6409)
==14080== by 0x46D7F9: Catch::Colour::Colour(Catch::Colour::Code) (catch.hpp:6401)
==14080== by 0x485C61: Catch::TestRegistry::registerTest(Catch::TestCase const&) (catch.hpp:5755)
==14080== by 0x46CE1E: Catch::(anonymous namespace)::RegistryHub::registerTest(Catch::TestCase const&) (catch.hpp:5994)
==14080== by 0x46CB8D: Catch::AutoReg::registerTestCase(Catch::ITestCase*, char const*, Catch::NameAndDesc const&, Catch::SourceLineInfo const&) (catch.hpp:5860)
==14080== by 0x46CA44: Catch::AutoReg::AutoReg(void (*)(), Catch::SourceLineInfo const&, Catch::NameAndDesc const&) (catch.hpp:5845)
==14080== by 0x46C3EF: __static_initialization_and_destruction_0(int, int) (obdHiLevelTest.cc:27)
==14080== If you believe this happened as a result of a stack
==14080== overflow in your program's main thread (unlikely but
==14080== possible), you can try to increase the size of the
==14080== main thread stack using the --main-stacksize= flag.
==14080== The main thread stack size used in this run was 8388608.
If I only change one of TEST_CASE name like so:
TEST_CASE ("A", "[obd parsing]")
{
}
TEST_CASE ("B", "[obd parsing]")
{
}
then everything is back to normal.
My config:
- CATCH v1.1 build 14 (develop branch)
- Generated: 2015-03-04 18:32:24.627737
- gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Oh, and the relevant fact is that I have 2 files 👍
- first.cc : it has
#define CATCH_CONFIG_MAIN - second.cc : no
CATCH_CONFIG_MAIN
If I duplicate test_cases in first.cc, an error is raised (already defined). But if I do this in second.cc, the bug arises.
Regs
Metadata
Metadata
Assignees
Labels
No labels