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

QtTestDriverTest doesn't get built nor executed and leaks #190

Closed
muggenhor opened this issue May 19, 2018 · 4 comments
Closed

QtTestDriverTest doesn't get built nor executed and leaks #190

muggenhor opened this issue May 19, 2018 · 4 comments

Comments

@muggenhor
Copy link
Contributor

muggenhor commented May 19, 2018

Because of a typo in tests/CMakeLists.txt QtTestDriverTest doesn't get built and thus not executed either:

if(Qt5TEST_FOUND)

This should be (note the title case instead of full upper case):

if(Qt5Test_FOUND)

When fixing that however, I'm getting a memory leak: https://travis-ci.org/muggenhor/cucumber-cpp/jobs/381075041

@konserw Given that you originally introduced the QtTest driver in #165, can you have a look at this and try to fix it?

This is the output:

108/109 Test #108: QtTestDriverTest .................................................................***Failed    1.26 sec
==10192== Memcheck, a memory error detector
==10192== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10192== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==10192== Command: /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest
==10192== 
SUCCESS (The test body has not been run)
SUCCESS (The test body has been run)
= Step invocation =
SUCCESS (Succeeding step)
SUCCESS (Failing step)
SUCCESS (Failing step has a message)
SUCCESS (Pending step with no description - result)
SUCCESS (Pending step with no description - description)
SUCCESS (Pending step with description - result)
SUCCESS (Pending step with description - description)
SUCCESS (Inexistent step)
= Constructors and destructors =
== Succeeding step ==
SUCCESS (Contexts created after invoke)
SUCCESS (Contexts destroyed after invoke)
SUCCESS (Contexts created after end scenario)
SUCCESS (Contexts destroyed after end scenario)
== Failing step ==
SUCCESS (Contexts created after invoke)
SUCCESS (Contexts destroyed after invoke)
SUCCESS (Contexts created after end scenario)
SUCCESS (Contexts destroyed after end scenario)
= Step failure description is reset =
SUCCESS (Failing step description is set)
SUCCESS (Failing step description is the same)
==10192== 
==10192== HEAP SUMMARY:
==10192==     in use at exit: 116 bytes in 3 blocks
==10192==   total heap usage: 734 allocs, 731 frees, 68,470 bytes allocated
==10192== 
==10192== 4 bytes in 1 blocks are definitely lost in loss record 1 of 3
==10192==    at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10192==    by 0x60EBAF1: qrand() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x623974B: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x62146D1: QFile::open(QFlags<QIODevice::OpenModeFlag>) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x6239DC2: QTemporaryFile::open(QFlags<QIODevice::OpenModeFlag>) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x45F463: QTemporaryFile::open() (in /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest)
==10192==    by 0x45EDE1: cucumber::internal::QtTestStep::invokeStepBody() (in /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest)
==10192==    by 0x445536: QtTestStepDouble::invokeStepBody() (in /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest)
==10192==    by 0x4455E7: QtTestDriverTest::stepInvocationRunsStepBody() (in /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest)
==10192==    by 0x445567: QtTestDriverTest::runAllTests() (in /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest)
==10192==    by 0x444570: cucumber::internal::DriverTest::run() (in /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest)
==10192==    by 0x4434BD: main (in /home/travis/build/muggenhor/cucumber-cpp/build/tests/QtTestDriverTest)
==10192== 
==10192== 56 bytes in 1 blocks are still reachable in loss record 2 of 3
==10192==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10192==    by 0x7350B58: UDataMemory_createNewInstance_52 (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x734ECCA: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x734F629: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x734F83D: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x735015B: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x735C59B: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x735D2B9: ucnv_getStandardName_52 (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x63252CB: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x6325DDC: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x6321D66: QTextCodec::codecForLocale() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x6182C40: QString::toLocal8Bit() const (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192== 
==10192== 56 bytes in 1 blocks are still reachable in loss record 3 of 3
==10192==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10192==    by 0x7350B58: UDataMemory_createNewInstance_52 (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x734EC9C: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x734F888: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x735015B: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x735C59B: ??? (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x735D2B9: ucnv_getStandardName_52 (in /usr/lib/x86_64-linux-gnu/libicuuc.so.52.1)
==10192==    by 0x63252CB: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x6325DDC: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x6321D66: QTextCodec::codecForLocale() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x6182C40: QString::toLocal8Bit() const (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192==    by 0x626CC38: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
==10192== 
==10192== LEAK SUMMARY:
==10192==    definitely lost: 4 bytes in 1 blocks
==10192==    indirectly lost: 0 bytes in 0 blocks
==10192==      possibly lost: 0 bytes in 0 blocks
==10192==    still reachable: 112 bytes in 2 blocks
==10192==         suppressed: 0 bytes in 0 blocks
==10192== 
==10192== For counts of detected and suppressed errors, rerun with: -v
==10192== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
@konserw
Copy link
Contributor

konserw commented May 21, 2018

Yes I know about that for some time - one user send me email that Qt test driver doesn't work for him. I've quickly fixed that typo on my branch, but then noticed the leak. I was investigating it for some time but haven't been able to fix it.
I'm afraid we have been bitten by this bug: https://bugreports.qt.io/browse/QTBUG-21298

@konserw
Copy link
Contributor

konserw commented May 31, 2018

I've tried to fix leak by adding qcoreapp:
master...konserw:fix-qt
And it works on my machine (Arch linux) but still fails on travis:
https://travis-ci.org/konserw/cucumber-cpp/jobs/382327922
Suggestions? shall we just suppress it?

@muggenhor
Copy link
Contributor Author

Yes, if we're not misusing any API then suppression is fine.

@ursfassler
Copy link
Contributor

Mentioned bug is fixed in Qt version 5.10.0. I can no longer reproduce the problem with Qt 5.15.10.

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