From 62118e9d781b1d2517f6dccc9cad064d3dd72fc4 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 6 Dec 2016 12:05:05 +0100 Subject: [PATCH] Valgrind: Move some memcheck auto tests into plugin Due to changed dependencies it is nowadays necessary to have more of the plugin infrastructure at hand. Moving memcheck related tests to be able to execute them as QC plugin unit test. Change-Id: Iab492b3cb87728425b950ca9387edf292d895350 Reviewed-by: hjk --- .../unit_testdata/memcheck-output-sample1.xml | 370 +++++++ src/plugins/valgrind/valgrind.pro | 13 + src/plugins/valgrind/valgrind.qbs | 11 + .../valgrind/valgrindmemcheckparsertest.cpp | 98 +- .../valgrind/valgrindmemcheckparsertest.h | 25 +- src/plugins/valgrind/valgrindplugin.cpp | 14 + src/plugins/valgrind/valgrindplugin.h | 2 + .../valgrind/valgrindtestrunnertest.cpp | 160 +-- .../plugins/valgrind/valgrindtestrunnertest.h | 35 +- .../data/memcheck-output-untitled.xml | 984 ------------------ tests/auto/valgrind/memcheck/memcheck.pro | 11 +- tests/auto/valgrind/memcheck/memcheck.qbs | 4 +- tests/auto/valgrind/memcheck/parsertests.pro | 14 - tests/auto/valgrind/memcheck/parsertests.qbs | 13 - tests/auto/valgrind/memcheck/testrunner.pro | 12 - tests/auto/valgrind/memcheck/testrunner.qbs | 24 - 16 files changed, 604 insertions(+), 1186 deletions(-) create mode 100644 src/plugins/valgrind/unit_testdata/memcheck-output-sample1.xml rename tests/auto/valgrind/memcheck/parsertests.cpp => src/plugins/valgrind/valgrindmemcheckparsertest.cpp (86%) rename tests/auto/valgrind/memcheck/parsertests.h => src/plugins/valgrind/valgrindmemcheckparsertest.h (92%) rename tests/auto/valgrind/memcheck/testrunner.cpp => src/plugins/valgrind/valgrindtestrunnertest.cpp (81%) rename tests/auto/valgrind/memcheck/testrunner.h => src/plugins/valgrind/valgrindtestrunnertest.h (79%) delete mode 100644 tests/auto/valgrind/memcheck/data/memcheck-output-untitled.xml delete mode 100644 tests/auto/valgrind/memcheck/parsertests.pro delete mode 100644 tests/auto/valgrind/memcheck/parsertests.qbs delete mode 100644 tests/auto/valgrind/memcheck/testrunner.pro delete mode 100644 tests/auto/valgrind/memcheck/testrunner.qbs diff --git a/src/plugins/valgrind/unit_testdata/memcheck-output-sample1.xml b/src/plugins/valgrind/unit_testdata/memcheck-output-sample1.xml new file mode 100644 index 00000000000..e4278497c9d --- /dev/null +++ b/src/plugins/valgrind/unit_testdata/memcheck-output-sample1.xml @@ -0,0 +1,370 @@ + + + + +4 +memcheck + + + Memcheck, a memory error detector + Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. + Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info + Command: kate + + +22733 +17584 +memcheck + + + + /usr/bin/valgrind.bin + --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp + --xml=yes + --xml-file=test.xml + --track-origins=yes + + + kate + + + + + RUNNING + + + + + 0x9 + 1 + InvalidRead + Invalid read of size 4 + + + 0x6E47964 + /usr/lib/libQtGui.so.4.7.0 + QFrame::frameStyle() const + /build/buildd/qt4-x11-4.7.0/src/gui/widgets + qframe.cpp + 252 + + + 0x118F2AF7 + /usr/lib/kde4/plugins/styles/oxygen.so + + + 0x6A81671 + /usr/lib/libQtGui.so.4.7.0 + QWidget::event(QEvent*) + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qwidget.cpp + 8273 + + + 0x6A2B6EB + /usr/lib/libQtGui.so.4.7.0 + QApplicationPrivate::notify_helper(QObject*, QEvent*) + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qapplication.cpp + 4396 + + + + Address 0x11527cb8 is not stack'd, malloc'd or (recently) free'd + + + + + FINISHED + + + + + 0x13 + 1 + Leak_PossiblyLost + + 2 bytes in 1 blocks are possibly lost in loss record 2 of 2,003 + 2 + 1 + + + + 0x4C284A8 + /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so + malloc + /build/buildd/valgrind-3.6.0~svn20100212/coregrind/m_replacemalloc + vg_replace_malloc.c + 236 + + + 0xD4D7754 + /lib/libglib-2.0.so.0.2400.1 + g_malloc + + + 0xD4EF11D + /lib/libglib-2.0.so.0.2400.1 + g_strdup + + + 0xD503DC4 + /lib/libglib-2.0.so.0.2400.1 + g_get_language_names + + + 0xD4F89A9 + /lib/libglib-2.0.so.0.2400.1 + g_thread_init_glib + + + 0x8396569 + /usr/lib/libQtCore.so.4.7.0 + QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*) + /build/buildd/qt4-x11-4.7.0/src/corelib/kernel + qeventdispatcher_glib.cpp + 299 + + + 0x6ADDBEE + /usr/lib/libQtGui.so.4.7.0 + QGuiEventDispatcherGlibPrivate::QGuiEventDispatcherGlibPrivate() + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qguieventdispatcher_glib.cpp + 171 + + + 0x6ADDCDD + /usr/lib/libQtGui.so.4.7.0 + QGuiEventDispatcherGlib::QGuiEventDispatcherGlib(QObject*) + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qguieventdispatcher_glib.cpp + 186 + + + 0x6AA5152 + /usr/lib/libQtGui.so.4.7.0 + QApplicationPrivate::createEventDispatcher() + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qapplication_x11.cpp + 605 + + + 0x836D069 + /usr/lib/libQtCore.so.4.7.0 + QCoreApplication::init() + /build/buildd/qt4-x11-4.7.0/src/corelib/kernel + qcoreapplication.cpp + 552 + + + 0x836D134 + /usr/lib/libQtCore.so.4.7.0 + QCoreApplication::QCoreApplication(QCoreApplicationPrivate&) + /build/buildd/qt4-x11-4.7.0/src/corelib/kernel + qcoreapplication.cpp + 477 + + + 0x6A3815A + /usr/lib/libQtGui.so.4.7.0 + QApplication::QApplication(int&, char**, bool, int) + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qapplication.cpp + 745 + + + + + + 0x7e4 + 1 + Leak_DefinitelyLost + + 544,542 (56 direct, 544,486 indirect) bytes in 1 blocks are definitely lost in loss record 2,003 of 2,003 + 544542 + 1 + + + + 0x4C284A8 + /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so + malloc + /build/buildd/valgrind-3.6.0~svn20100212/coregrind/m_replacemalloc + vg_replace_malloc.c + 236 + + + 0x82A1A6C + /usr/lib/libQtCore.so.4.7.0 + QMapData::node_create(QMapData::Node**, int, int) + /build/buildd/qt4-x11-4.7.0/src/corelib/tools + qmap.cpp + 140 + + + 0x8336F68 + /usr/lib/libQtCore.so.4.7.0 + QMap<QSettingsKey, QVariant>::detach_helper() + /build/buildd/qt4-x11-4.7.0/src/corelib/../../include/QtCore/../../src/corelib/tools + qmap.h + 449 + + + 0x832C564 + /usr/lib/libQtCore.so.4.7.0 + QConfFile::mergedKeyMap() const + /build/buildd/qt4-x11-4.7.0/src/corelib/../../include/QtCore/../../src/corelib/tools + qmap.h + 202 + + + 0x833305A + /usr/lib/libQtCore.so.4.7.0 + QConfFileSettingsPrivate::syncConfFile(int) + /build/buildd/qt4-x11-4.7.0/src/corelib/io + qsettings.cpp + 1569 + + + 0x8333D5B + /usr/lib/libQtCore.so.4.7.0 + QConfFileSettingsPrivate::sync() + /build/buildd/qt4-x11-4.7.0/src/corelib/io + qsettings.cpp + 1386 + + + 0x83260D9 + /usr/lib/libQtCore.so.4.7.0 + QSettingsPrivate::update() + /build/buildd/qt4-x11-4.7.0/src/corelib/io + qsettings.cpp + 415 + + + 0x83267C7 + /usr/lib/libQtCore.so.4.7.0 + QSettings::event(QEvent*) + /build/buildd/qt4-x11-4.7.0/src/corelib/io + qsettings.cpp + 3326 + + + 0x6A2B6EB + /usr/lib/libQtGui.so.4.7.0 + QApplicationPrivate::notify_helper(QObject*, QEvent*) + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qapplication.cpp + 4396 + + + 0x6A311DC + /usr/lib/libQtGui.so.4.7.0 + QApplication::notify(QObject*, QEvent*) + /build/buildd/qt4-x11-4.7.0/src/gui/kernel + qapplication.cpp + 4277 + + + 0x6443535 + /usr/lib/libkdeui.so.5.5.0 + KApplication::notify(QObject*, QEvent*) + + + 0x83690AB + /usr/lib/libQtCore.so.4.7.0 + QCoreApplication::notifyInternal(QObject*, QEvent*) + /build/buildd/qt4-x11-4.7.0/src/corelib/kernel + qcoreapplication.cpp + 732 + + + + + + + 2 + 0x9 + + + + + + 12 + X on SUSE11 writev uninit padding + + + 2 + dl-hack3-cond-1 + + + 2 + glibc-2.5.x-on-SUSE-10.2-(PPC)-2a + + + + + diff --git a/src/plugins/valgrind/valgrind.pro b/src/plugins/valgrind/valgrind.pro index e7c82174fe4..504a9123cc2 100644 --- a/src/plugins/valgrind/valgrind.pro +++ b/src/plugins/valgrind/valgrind.pro @@ -55,3 +55,16 @@ FORMS += \ RESOURCES += \ valgrind.qrc + +equals(TEST, 1) { + DEFINES += "PARSERTESTS_DATA_DIR=\\\"$$_PRO_FILE_PWD_/unit_testdata\\\"" + DEFINES += "VALGRIND_FAKE_PATH=\\\"$$IDE_BUILD_TREE/src/tools/valgrindfake\\\"" + DEFINES += "TESTRUNNER_SRC_DIR=\\\"$$_PRO_FILE_PWD_/../../../tests/auto/valgrind/memcheck/testapps\\\"" + DEFINES += "TESTRUNNER_APP_DIR=\\\"$(PWD)/../../../tests/auto/valgrind/memcheck/testapps\\\"" + + HEADERS += valgrindmemcheckparsertest.h \ + valgrindtestrunnertest.h + + SOURCES += valgrindmemcheckparsertest.cpp \ + valgrindtestrunnertest.cpp +} diff --git a/src/plugins/valgrind/valgrind.qbs b/src/plugins/valgrind/valgrind.qbs index beaf1bb830e..9bffc87ef95 100644 --- a/src/plugins/valgrind/valgrind.qbs +++ b/src/plugins/valgrind/valgrind.qbs @@ -88,4 +88,15 @@ QtcPlugin { "threadedparser.cpp", "threadedparser.h", ] } + + Group { + name: "Test sources" + condition: qtc.testsEnabled + files: [ + "valgrindmemcheckparsertest.cpp", + "valgrindmemcheckparsertest.h", + "valgrindtestrunnertest.cpp", + "valgrindtestrunnertest.h", + ] + } } diff --git a/tests/auto/valgrind/memcheck/parsertests.cpp b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp similarity index 86% rename from tests/auto/valgrind/memcheck/parsertests.cpp rename to src/plugins/valgrind/valgrindmemcheckparsertest.cpp index 4d700e599be..58000ca2a4e 100644 --- a/tests/auto/valgrind/memcheck/parsertests.cpp +++ b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp @@ -24,31 +24,26 @@ ** ****************************************************************************/ -#include -#include -#include -#include +#include "valgrindmemcheckparsertest.h" +#include "xmlprotocol/frame.h" +#include "xmlprotocol/parser.h" +#include "xmlprotocol/stack.h" +#include "xmlprotocol/suppression.h" + +#include #include #include -#include -#include "parsertests.h" - -#include -#include #include #include +#include #include #include #include #include #include -#include -#include - -using namespace Valgrind; using namespace Valgrind::XmlProtocol; QT_BEGIN_NAMESPACE @@ -64,7 +59,10 @@ inline bool qCompare(int const &t1, MemcheckErrorKind const &t2, } // namespace QTest QT_END_NAMESPACE -void dumpFrame(const Frame &f) +namespace Valgrind { +namespace Test { + +static void dumpFrame(const Frame &f) { qDebug() << f.instructionPointer() << f.directory() << f.fileName() << f.functionName() << f.line() << f.object(); @@ -74,10 +72,10 @@ void dumpError(const Error &e) { qDebug() << e.kind() << e.leakedBlocks() << e.leakedBytes() << e.what() << e.tid() << e.unique(); qDebug() << "stacks:" << e.stacks().size(); - Q_FOREACH(const Stack& s, e.stacks()) { + for (const Stack &s : e.stacks()) { qDebug() << s.auxWhat() << s.directory() << s.file() << s.line() << s.helgrindThreadId(); qDebug() << "frames:"; - Q_FOREACH(const Frame& f, s.frames()) { + for (const Frame &f : s.frames()) { dumpFrame(f); } } @@ -85,7 +83,17 @@ void dumpError(const Error &e) static QString fakeValgrindExecutable() { - return QLatin1String(VALGRIND_FAKE_PATH); + QString valgrindFakePath(VALGRIND_FAKE_PATH); + if (Utils::HostOsInfo::isWindowsHost()) { + QFileInfo fi(QString(valgrindFakePath + "/debug"), "valgrind-fake.exe"); + if (fi.exists()) + return fi.canonicalFilePath(); + fi = QFileInfo(QString(valgrindFakePath + "/release"), "valgrind-fake.exe"); + if (fi.exists()) + return fi.canonicalFilePath(); + qFatal("Neither debug nor release build valgrind-fake found."); + } + return valgrindFakePath + "/valgrind-fake"; } static QString dataFile(const QLatin1String &file) @@ -93,10 +101,8 @@ static QString dataFile(const QLatin1String &file) return QLatin1String(PARSERTESTS_DATA_DIR) + QLatin1String("/") + file; } -void ParserTests::initTestCase() +void ValgrindMemcheckParserTest::initTestCase() { - new ExtensionSystem::PluginManager; - new ProjectExplorer::ProjectExplorerPlugin; m_server = new QTcpServer(this); QVERIFY(m_server->listen()); @@ -104,7 +110,7 @@ void ParserTests::initTestCase() m_process = 0; } -void ParserTests::initTest(const QLatin1String &testfile, const QStringList &otherArgs) +void ValgrindMemcheckParserTest::initTest(const QLatin1String &testfile, const QStringList &otherArgs) { QVERIFY(!m_server->hasPendingConnections()); @@ -132,7 +138,7 @@ void ParserTests::initTest(const QLatin1String &testfile, const QStringList &oth QVERIFY(m_socket); } -void ParserTests::cleanup() +void ValgrindMemcheckParserTest::cleanup() { if (m_socket) { delete m_socket; @@ -144,7 +150,7 @@ void ParserTests::cleanup() } } -void ParserTests::testHelgrindSample1() +void ValgrindMemcheckParserTest::testHelgrindSample1() { QSKIP("testfile does not exist"); @@ -240,7 +246,7 @@ void ParserTests::testHelgrindSample1() // QCOMPARE(rec.suppcounts, expectedSuppCounts); } -void ParserTests::testMemcheckSample1() +void ValgrindMemcheckParserTest::testMemcheckSample1() { initTest(QLatin1String("memcheck-output-sample1.xml")); @@ -316,7 +322,7 @@ void ParserTests::testMemcheckSample1() QCOMPARE(rec.suppcounts, expectedSuppCounts); } -void ParserTests::testMemcheckSample2() +void ValgrindMemcheckParserTest::testMemcheckSample2() { QSKIP("testfile does not exist"); @@ -342,7 +348,7 @@ void ParserTests::testMemcheckSample2() QCOMPARE(stacks.last().auxWhat(), QLatin1String("Address 0x11b66c50 is 0 bytes inside a block of size 16 free'd")); } -void ParserTests::testMemcheckSample3() +void ValgrindMemcheckParserTest::testMemcheckSample3() { QSKIP("testfile does not exist"); @@ -394,7 +400,7 @@ void ParserTests::testMemcheckSample3() QCOMPARE(rec.suppcounts.at(2).second, qint64(3)); } -void ParserTests::testMemcheckCharm() +void ValgrindMemcheckParserTest::testMemcheckCharm() { QSKIP("testfile does not exist"); @@ -415,7 +421,7 @@ void ParserTests::testMemcheckCharm() QVERIFY2(parser.errorString().isEmpty(), qPrintable(parser.errorString())); } -void ParserTests::testValgrindCrash() +void ValgrindMemcheckParserTest::testValgrindCrash() { initTest(QLatin1String("memcheck-output-sample1.xml"), QStringList() << "--crash"); @@ -430,7 +436,7 @@ void ParserTests::testValgrindCrash() QCOMPARE(parser.errorString(), m_socket->errorString()); } -void ParserTests::testValgrindGarbage() +void ValgrindMemcheckParserTest::testValgrindGarbage() { initTest(QLatin1String("memcheck-output-sample1.xml"), QStringList() << "--garbage"); @@ -444,7 +450,7 @@ void ParserTests::testValgrindGarbage() qDebug() << parser.errorString(); } -void ParserTests::testParserStop() +void ValgrindMemcheckParserTest::testParserStop() { ThreadedParser parser; Memcheck::MemcheckRunner runner; @@ -455,31 +461,39 @@ void ParserTests::testParserStop() << "--wait" << "5"); runner.setProcessChannelMode(QProcess::ForwardedChannels); + runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice( + Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE))); runner.start(); QTest::qWait(500); runner.stop(); } -void ParserTests::testRealValgrind() +void ValgrindMemcheckParserTest::testRealValgrind() { + const Utils::Environment &sysEnv = Utils::Environment::systemEnvironment(); + auto fileName = sysEnv.searchInPath("valgrind"); + if (fileName.isEmpty()) + QSKIP("This test needs valgrind in PATH"); QString executable = QProcessEnvironment::systemEnvironment().value("VALGRIND_TEST_BIN", fakeValgrindExecutable()); qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this"; ThreadedParser parser; ProjectExplorer::StandardRunnable debuggee; debuggee.executable = executable; - + debuggee.environment = sysEnv; Memcheck::MemcheckRunner runner; runner.setValgrindExecutable(QLatin1String("valgrind")); runner.setDebuggee(debuggee); + runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice( + Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE))); runner.setParser(&parser); RunnerDumper dumper(&runner, &parser); runner.start(); runner.waitForFinished(); } -void ParserTests::testValgrindStartError_data() +void ValgrindMemcheckParserTest::testValgrindStartError_data() { QTest::addColumn("valgrindExe"); QTest::addColumn("valgrindArgs"); @@ -497,24 +511,27 @@ void ParserTests::testValgrindStartError_data() << fakeValgrindExecutable() << QString(); } -void ParserTests::testValgrindStartError() +void ValgrindMemcheckParserTest::testValgrindStartError() { QFETCH(QString, valgrindExe); QFETCH(QStringList, valgrindArgs); - QFETCH(QString, debuggeeExecutable); + QFETCH(QString, debuggee); QFETCH(QString, debuggeeArgs); ThreadedParser parser; - ProjectExplorer::StandardRunnable debuggee; - debuggee.executable = debuggeeExecutable; - debuggee.commandLineArguments = debuggeeArgs; + ProjectExplorer::StandardRunnable debuggeeExecutable; + debuggeeExecutable.executable = debuggee; + debuggeeExecutable.environment = Utils::Environment::systemEnvironment(); + debuggeeExecutable.commandLineArguments = debuggeeArgs; Memcheck::MemcheckRunner runner; runner.setParser(&parser); runner.setValgrindExecutable(valgrindExe); runner.setValgrindArguments(valgrindArgs); - runner.setDebuggee(debuggee); + runner.setDebuggee(debuggeeExecutable); + runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice( + Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE))); RunnerDumper dumper(&runner, &parser); runner.start(); runner.waitForFinished(); @@ -522,4 +539,5 @@ void ParserTests::testValgrindStartError() // just finish without deadlock and we are fine } -QTEST_MAIN(ParserTests) +} // namespace Test +} // namespace Valgrind diff --git a/tests/auto/valgrind/memcheck/parsertests.h b/src/plugins/valgrind/valgrindmemcheckparsertest.h similarity index 92% rename from tests/auto/valgrind/memcheck/parsertests.h rename to src/plugins/valgrind/valgrindmemcheckparsertest.h index cb65dd85577..f4c8f75676a 100644 --- a/tests/auto/valgrind/memcheck/parsertests.h +++ b/src/plugins/valgrind/valgrindmemcheckparsertest.h @@ -32,11 +32,11 @@ #include #include -#include -#include -#include -#include -#include +#include "xmlprotocol/error.h" +#include "xmlprotocol/status.h" +#include "xmlprotocol/threadedparser.h" +#include "xmlprotocol/parser.h" +#include "memcheck/memcheckrunner.h" QT_BEGIN_NAMESPACE class QTcpServer; @@ -44,6 +44,10 @@ class QTcpSocket; class QProcess; QT_END_NAMESPACE + +namespace Valgrind { +namespace Test { + void dumpError(const Valgrind::XmlProtocol::Error &e); class Recorder : public QObject @@ -134,7 +138,7 @@ public: }; -class ParserTests : public QObject +class ValgrindMemcheckParserTest : public QObject { Q_OBJECT @@ -159,7 +163,10 @@ private Q_SLOTS: private: void initTest(const QLatin1String &testfile, const QStringList &otherArgs = QStringList()); - QTcpServer *m_server; - QProcess *m_process; - QTcpSocket *m_socket; + QTcpServer *m_server = 0; + QProcess *m_process = 0; + QTcpSocket *m_socket = 0; }; + +} // namespace Test +} // namespace Valgrind diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp index 4ae0a361c85..ce58373512a 100644 --- a/src/plugins/valgrind/valgrindplugin.cpp +++ b/src/plugins/valgrind/valgrindplugin.cpp @@ -32,6 +32,11 @@ #include "valgrindsettings.h" #include "valgrindconfigwidget.h" +#ifdef WITH_TESTS +# include "valgrindmemcheckparsertest.h" +# include "valgrindtestrunnertest.h" +#endif + #include #include #include @@ -117,5 +122,14 @@ ValgrindGlobalSettings *ValgrindPlugin::globalSettings() return theGlobalSettings; } +QList ValgrindPlugin::createTestObjects() const +{ + QList tests; +#ifdef WITH_TESTS + tests << new Test::ValgrindMemcheckParserTest << new Test::ValgrindTestRunnerTest; +#endif + return tests; +} + } // namespace Internal } // namespace Valgrind diff --git a/src/plugins/valgrind/valgrindplugin.h b/src/plugins/valgrind/valgrindplugin.h index b3f8cd2bd6e..e6a4fbd8eee 100644 --- a/src/plugins/valgrind/valgrindplugin.h +++ b/src/plugins/valgrind/valgrindplugin.h @@ -48,6 +48,8 @@ public: ShutdownFlag aboutToShutdown() override; static ValgrindGlobalSettings *globalSettings(); +private: + QList createTestObjects() const override; }; } // namespace Internal diff --git a/tests/auto/valgrind/memcheck/testrunner.cpp b/src/plugins/valgrind/valgrindtestrunnertest.cpp similarity index 81% rename from tests/auto/valgrind/memcheck/testrunner.cpp rename to src/plugins/valgrind/valgrindtestrunnertest.cpp index 06bf1c05122..8e930bc3b6e 100644 --- a/tests/auto/valgrind/memcheck/testrunner.cpp +++ b/src/plugins/valgrind/valgrindtestrunnertest.cpp @@ -24,76 +24,78 @@ ** ****************************************************************************/ -#include "testrunner.h" +#include "valgrindtestrunnertest.h" -#include -#include -#include -#include -#include -#include +#include "xmlprotocol/frame.h" +#include "xmlprotocol/stack.h" +#include "xmlprotocol/suppression.h" +#include "xmlprotocol/threadedparser.h" +#include "xmlprotocol/parser.h" +#include "memcheck/memcheckrunner.h" +#include #include #include -#include #include #include #include #include -const QString appSrcDir(TESTRUNNER_SRC_DIR); -const QString appBinDir(TESTRUNNER_APP_DIR); +#define HEADER_LENGTH 25 -#define HEADER_LENGTH 30 +using namespace Valgrind::XmlProtocol; +using namespace Valgrind::Memcheck; -bool on64bit() +namespace Valgrind { +namespace Test { + +//BEGIN Test Helpers and boilerplate code + +static const QString appSrcDir(TESTRUNNER_SRC_DIR); +static const QString appBinDir(TESTRUNNER_APP_DIR); + +static bool on64bit() { return sizeof(char*) == 8; } -QString srcDirForApp(const QString &app) +static QString srcDirForApp(const QString &app) { - return appSrcDir + QLatin1Char('/') + app; + return QDir::cleanPath(appSrcDir + QLatin1Char('/') + app); } -QTEST_MAIN(Valgrind::TestRunner) - -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; -using namespace Valgrind::Memcheck; - -//BEGIN Test Helpers and boilerplate code - -TestRunner::TestRunner(QObject *parent) - : QObject(parent), - m_parser(0), - m_runner(0) +ValgrindTestRunnerTest::ValgrindTestRunnerTest(QObject *parent) + : QObject(parent) { qRegisterMetaType(); } -QString TestRunner::runTestBinary(const QString &binary, const QStringList &vArgs) +QString ValgrindTestRunnerTest::runTestBinary(const QString &binary, const QStringList &vArgs) { - const QString binPath = appBinDir + QLatin1Char('/') + binary; - if (!QFileInfo(binPath).isExecutable()) - qFatal("No such test app: %s", qPrintable(binPath)); + const QFileInfo binPathFileInfo(appBinDir, binary); + if (!binPathFileInfo.isExecutable()) + return QString(); ProjectExplorer::StandardRunnable debuggee; + const QString &binPath = binPathFileInfo.canonicalFilePath(); debuggee.executable = binPath; + debuggee.environment = Utils::Environment::systemEnvironment(); m_runner->setValgrindArguments(QStringList() << "--num-callers=50" << "--track-origins=yes" << vArgs); m_runner->setDebuggee(debuggee); + m_runner->setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice( + Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE))); m_runner->start(); m_runner->waitForFinished(); return binPath; } -void TestRunner::logMessageReceived(const QByteArray &message) +void ValgrindTestRunnerTest::logMessageReceived(const QByteArray &message) { qDebug() << "log message received:" << message; m_logMessages << message; } -void TestRunner::internalError(const QString &error) +void ValgrindTestRunnerTest::internalError(const QString &error) { if (!m_expectCrash) QFAIL(qPrintable(error)); @@ -101,12 +103,12 @@ void TestRunner::internalError(const QString &error) qDebug() << "expected crash:" << error; } -void TestRunner::error(const Error &error) +void ValgrindTestRunnerTest::error(const Error &error) { m_errors << error; } -void TestRunner::cleanup() +void ValgrindTestRunnerTest::cleanup() { Q_ASSERT(m_runner); delete m_runner; @@ -120,14 +122,12 @@ void TestRunner::cleanup() m_expectCrash = false; } -void TestRunner::initTestCase() -{ - new ExtensionSystem::PluginManager; - new ProjectExplorer::ProjectExplorerPlugin; -} - -void TestRunner::init() +void ValgrindTestRunnerTest::init() { + const Utils::Environment &sysEnv = Utils::Environment::systemEnvironment(); + auto fileName = sysEnv.searchInPath("valgrind"); + if (fileName.isEmpty()) + QSKIP("This test needs valgrind in PATH"); Q_ASSERT(m_logMessages.isEmpty()); Q_ASSERT(!m_runner); @@ -135,24 +135,27 @@ void TestRunner::init() m_runner->setValgrindExecutable(QLatin1String("valgrind")); m_runner->setProcessChannelMode(QProcess::ForwardedChannels); connect(m_runner, &MemcheckRunner::logMessageReceived, - this, &TestRunner::logMessageReceived); + this, &ValgrindTestRunnerTest::logMessageReceived); connect(m_runner, &ValgrindRunner::processErrorReceived, - this, &TestRunner::internalError); + this, &ValgrindTestRunnerTest::internalError); Q_ASSERT(!m_parser); m_parser = new ThreadedParser; connect(m_parser, &ThreadedParser::internalError, - this, &TestRunner::internalError); + this, &ValgrindTestRunnerTest::internalError); connect(m_parser, &ThreadedParser::error, - this, &TestRunner::error); + this, &ValgrindTestRunnerTest::error); m_runner->setParser(m_parser); } //BEGIN: Actual test cases -void TestRunner::testLeak1() +void ValgrindTestRunnerTest::testLeak1() { const QString binary = runTestBinary(QLatin1String("leak1/leak1")); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); QVERIFY(m_logMessages.isEmpty()); @@ -183,9 +186,12 @@ void TestRunner::testLeak1() } } -void TestRunner::testLeak2() +void ValgrindTestRunnerTest::testLeak2() { const QString binary = runTestBinary(QLatin1String("leak2/leak2")); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); QVERIFY(m_logMessages.isEmpty()); QCOMPARE(m_errors.count(), 1); @@ -220,10 +226,12 @@ void TestRunner::testLeak2() } } -void TestRunner::testLeak3() +void ValgrindTestRunnerTest::testLeak3() { const QString binary = runTestBinary(QLatin1String("leak3/leak3"), QStringList() << "--show-reachable=yes"); - + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); QVERIFY(m_logMessages.isEmpty()); QCOMPARE(m_errors.count(), 1); @@ -258,16 +266,19 @@ void TestRunner::testLeak3() } } -void TestRunner::testLeak4() +void ValgrindTestRunnerTest::testLeak4() { const QString app("leak4"); const QString binary = runTestBinary(app + QLatin1Char('/') + app, QStringList() << "--show-reachable=yes"); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp("leak4"); QVERIFY(m_logMessages.isEmpty()); - QCOMPARE(m_errors.count(), 2); + QCOMPARE(m_errors.count(), 3); //BEGIN first error { const Error error = m_errors.first(); @@ -306,7 +317,7 @@ void TestRunner::testLeak4() } //BEGIN second error { - const Error error = m_errors.last(); + const Error error = m_errors.at(1); QCOMPARE(error.kind(), int(Leak_DefinitelyLost)); QCOMPARE(error.leakedBlocks(), qint64(1)); if (on64bit()) @@ -334,12 +345,16 @@ void TestRunner::testLeak4() QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); } } + // TODO add third error check } -void TestRunner::uninit1() +void ValgrindTestRunnerTest::testUninit1() { const QString app("uninit1"); const QString binary = runTestBinary(app + QLatin1Char('/') + app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp(app); QVERIFY(m_logMessages.isEmpty()); @@ -378,11 +393,14 @@ void TestRunner::uninit1() } } -void TestRunner::uninit2() +void ValgrindTestRunnerTest::testUninit2() { const QString app("uninit2"); m_expectCrash = true; const QString binary = runTestBinary(app + QLatin1Char('/') + app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp(app); QVERIFY(m_logMessages.isEmpty()); @@ -442,11 +460,14 @@ void TestRunner::uninit2() } } -void TestRunner::uninit3() +void ValgrindTestRunnerTest::testUninit3() { const QString app("uninit3"); m_expectCrash = true; const QString binary = runTestBinary(app + QLatin1Char('/') + app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp(app); QVERIFY(m_logMessages.isEmpty()); @@ -506,10 +527,13 @@ void TestRunner::uninit3() } } -void TestRunner::syscall() +void ValgrindTestRunnerTest::testSyscall() { const QString app("syscall"); const QString binary = runTestBinary(app + QLatin1Char('/') + app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp(app); QVERIFY(m_logMessages.isEmpty()); @@ -565,10 +589,13 @@ void TestRunner::syscall() } } -void TestRunner::free1() +void ValgrindTestRunnerTest::testFree1() { const QString app("free1"); const QString binary = runTestBinary(app + QLatin1Char('/') + app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp(app); QVERIFY(m_logMessages.isEmpty()); @@ -619,10 +646,13 @@ void TestRunner::free1() } } -void TestRunner::free2() +void ValgrindTestRunnerTest::testFree2() { const QString app("free2"); const QString binary = runTestBinary(app + QLatin1Char('/') + app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp(app); QVERIFY(m_logMessages.isEmpty()); @@ -677,12 +707,14 @@ void TestRunner::free2() } } -void TestRunner::invalidjump() +void ValgrindTestRunnerTest::testInvalidjump() { const QString app("invalidjump"); m_expectCrash = true; const QString binary = runTestBinary(app + QLatin1Char('/') + app); - const QString srcDir = srcDirForApp(app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); QVERIFY(m_logMessages.isEmpty()); @@ -705,11 +737,14 @@ void TestRunner::invalidjump() } -void TestRunner::overlap() +void ValgrindTestRunnerTest::testOverlap() { const QString app("overlap"); m_expectCrash = true; const QString binary = runTestBinary(app + QLatin1Char('/') + app); + if (binary.isEmpty()) + QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " + "manually before executing this test."); const QString srcDir = srcDirForApp(app); QVERIFY(m_logMessages.isEmpty()); @@ -735,3 +770,6 @@ void TestRunner::overlap() QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); } } + +} // namespace Test +} // namespace Valgrind diff --git a/tests/auto/valgrind/memcheck/testrunner.h b/src/plugins/valgrind/valgrindtestrunnertest.h similarity index 79% rename from tests/auto/valgrind/memcheck/testrunner.h rename to src/plugins/valgrind/valgrindtestrunnertest.h index 79eccf675a6..263f8e58760 100644 --- a/tests/auto/valgrind/memcheck/testrunner.h +++ b/src/plugins/valgrind/valgrindtestrunnertest.h @@ -29,7 +29,7 @@ #include #include -#include +#include "xmlprotocol/error.h" namespace Valgrind { @@ -41,15 +41,16 @@ namespace Memcheck { class MemcheckRunner; } -class TestRunner : public QObject +namespace Test { + +class ValgrindTestRunnerTest : public QObject { Q_OBJECT public: - explicit TestRunner(QObject *parent = 0); + explicit ValgrindTestRunnerTest(QObject *parent = 0); -private Q_SLOTS: - void initTestCase(); +private slots: void init(); void cleanup(); @@ -58,18 +59,17 @@ private Q_SLOTS: void testLeak3(); void testLeak4(); - void uninit1(); - void uninit2(); - void uninit3(); + void testUninit1(); + void testUninit2(); + void testUninit3(); - void free1(); - void free2(); + void testFree1(); + void testFree2(); - void invalidjump(); - void syscall(); - void overlap(); + void testInvalidjump(); + void testSyscall(); + void testOverlap(); -private Q_SLOTS: void logMessageReceived(const QByteArray &message); void internalError(const QString &error); void error(const Valgrind::XmlProtocol::Error &error); @@ -77,11 +77,12 @@ private Q_SLOTS: private: QString runTestBinary(const QString &binary, const QStringList &vArgs = QStringList()); - XmlProtocol::ThreadedParser *m_parser; - Memcheck::MemcheckRunner *m_runner; + XmlProtocol::ThreadedParser *m_parser = 0; + Memcheck::MemcheckRunner *m_runner = 0; QList m_logMessages; QList m_errors; - bool m_expectCrash; + bool m_expectCrash = false; }; +} // namespace Test } // namespace Valgrind diff --git a/tests/auto/valgrind/memcheck/data/memcheck-output-untitled.xml b/tests/auto/valgrind/memcheck/data/memcheck-output-untitled.xml deleted file mode 100644 index d4678d6592d..00000000000 --- a/tests/auto/valgrind/memcheck/data/memcheck-output-untitled.xml +++ /dev/null @@ -1,984 +0,0 @@ - - - - -4 -memcheck - - - Memcheck, a memory error detector - Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. - Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info - Command: /home/chris/untitled/untitled - - -20854 -20386 -memcheck - - - - /usr/bin/valgrind.bin - --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp - --xml=yes - --xml-file=/tmp/bla - - - /home/chris/untitled/untitled - - - - - RUNNING - - - - - - FINISHED - - - - - 0x107 - 1 - Leak_PossiblyLost - - 120 bytes in 1 blocks are possibly lost in loss record 184 of 270 - 120 - 1 - - - - 0x402517B - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - memalign - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 581 - - - 0x40251D8 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - posix_memalign - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 709 - - - 0x42BE546 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - - - 0x42BFA2F - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_slice_alloc - - - 0x42C06DD - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_slist_prepend - - - 0x42C368E - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_strsplit - - - 0x42D9393 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_get_language_names - - - 0x42D98E6 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - - - 0x42CB919 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_thread_init_glib - - - 0x4254506 - /usr/lib/i386-linux-gnu/libgthread-2.0.so.0.2800.6 - g_thread_init - - - 0x8D4D458 - /home/chris/untitled/untitled - QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*) - - - 0x85C7CA5 - /home/chris/untitled/untitled - QGuiEventDispatcherGlibPrivate::QGuiEventDispatcherGlibPrivate() - - - - - - 0x109 - 1 - Leak_DefinitelyLost - - 122 (56 direct, 66 indirect) bytes in 1 blocks are definitely lost in loss record 186 of 270 - 122 - 1 - - - - 0x402641D - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - operator new(unsigned int) - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 255 - - - 0x8D0FC45 - /home/chris/untitled/untitled - QLibraryPrivate::findOrCreate(QString const&, QString const&) - - - 0x8D10347 - /home/chris/untitled/untitled - QLibrary::setFileNameAndVersion(QString const&, int) - - - 0x8D10404 - /home/chris/untitled/untitled - QLibrary::QLibrary(QString const&, int, QObject*) - - - 0x859BD96 - /home/chris/untitled/untitled - qt_load_library_runtime(char const*, int, int, char const*) - - - 0x859C93C - /home/chris/untitled/untitled - qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long) - - - 0x853EEDC - /home/chris/untitled/untitled - QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) - - - 0x853F766 - /home/chris/untitled/untitled - QApplication::QApplication(int&, char**, int) - - - 0x805209E - /home/chris/untitled/untitled - createApplication(int&, char**) - /home/chris/untitled/qmlapplicationviewer - qmlapplicationviewer.cpp - 175 - - - 0x805185F - /home/chris/untitled/untitled - main - /home/chris/untitled - main.cpp - 6 - - - - - - 0x10a - 1 - Leak_DefinitelyLost - - 124 bytes in 1 blocks are definitely lost in loss record 187 of 270 - 124 - 1 - - - - 0x4026864 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - malloc - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 236 - - - 0x4635902 - /usr/lib/i386-linux-gnu/libxcb.so.1.1.0 - get_peer_sock_name - /build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src - xcb_auth.c - 259 - - - 0x4635A04 - /usr/lib/i386-linux-gnu/libxcb.so.1.1.0 - _xcb_get_auth_info - /build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src - xcb_auth.c - 302 - - - 0x46353D1 - /usr/lib/i386-linux-gnu/libxcb.so.1.1.0 - xcb_connect_to_display_with_auth_info - /build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src - xcb_util.c - 424 - - - 0x46355DB - /usr/lib/i386-linux-gnu/libxcb.so.1.1.0 - xcb_connect - /build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src - xcb_util.c - 395 - - - 0x4169A22 - /usr/lib/i386-linux-gnu/libX11.so.6.3.0 - _XConnectXCB - - - 0x41598F3 - /usr/lib/i386-linux-gnu/libX11.so.6.3.0 - XOpenDisplay - - - 0x859E45F - /home/chris/untitled/untitled - qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long) - - - 0x853EEDC - /home/chris/untitled/untitled - QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) - - - 0x853F766 - /home/chris/untitled/untitled - QApplication::QApplication(int&, char**, int) - - - 0x805209E - /home/chris/untitled/untitled - createApplication(int&, char**) - /home/chris/untitled/qmlapplicationviewer - qmlapplicationviewer.cpp - 175 - - - 0x805185F - /home/chris/untitled/untitled - main - /home/chris/untitled - main.cpp - 6 - - - - - - 0x10f - 1 - Leak_DefinitelyLost - - 138 (56 direct, 82 indirect) bytes in 1 blocks are definitely lost in loss record 192 of 270 - 138 - 1 - - - - 0x402641D - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - operator new(unsigned int) - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 255 - - - 0x8D0FC45 - /home/chris/untitled/untitled - QLibraryPrivate::findOrCreate(QString const&, QString const&) - - - 0x8D10347 - /home/chris/untitled/untitled - QLibrary::setFileNameAndVersion(QString const&, int) - - - 0x8D10404 - /home/chris/untitled/untitled - QLibrary::QLibrary(QString const&, int, QObject*) - - - 0x859BD96 - /home/chris/untitled/untitled - qt_load_library_runtime(char const*, int, int, char const*) - - - 0x859DE94 - /home/chris/untitled/untitled - qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long) - - - 0x853EEDC - /home/chris/untitled/untitled - QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) - - - 0x853F766 - /home/chris/untitled/untitled - QApplication::QApplication(int&, char**, int) - - - 0x805209E - /home/chris/untitled/untitled - createApplication(int&, char**) - /home/chris/untitled/qmlapplicationviewer - qmlapplicationviewer.cpp - 175 - - - 0x805185F - /home/chris/untitled/untitled - main - /home/chris/untitled - main.cpp - 6 - - - - - - 0x114 - 1 - Leak_DefinitelyLost - - 158 (56 direct, 102 indirect) bytes in 1 blocks are definitely lost in loss record 197 of 270 - 158 - 1 - - - - 0x402641D - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - operator new(unsigned int) - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 255 - - - 0x8D0FC45 - /home/chris/untitled/untitled - QLibraryPrivate::findOrCreate(QString const&, QString const&) - - - 0x8D1023F - /home/chris/untitled/untitled - QLibrary::setFileNameAndVersion(QString const&, QString const&) - - - 0x8D102A4 - /home/chris/untitled/untitled - QLibrary::QLibrary(QString const&, QString const&, QObject*) - - - 0x8C8FCCD - /home/chris/untitled/untitled - qt_initIcu(QString const&) - - - 0x8C4B0CF - /home/chris/untitled/untitled - QLocalePrivate::updateSystemPrivate() - - - 0x8C4B3C6 - /home/chris/untitled/untitled - systemPrivate() - - - 0x8C4B40C - /home/chris/untitled/untitled - defaultPrivate() - - - 0x8C4B55F - /home/chris/untitled/untitled - QLocale::QLocale() - - - 0x8CCF6F3 - /home/chris/untitled/untitled - QResourceFileEngine::QResourceFileEngine(QString const&) - - - 0x8CF87DC - /home/chris/untitled/untitled - _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry&, QFileSystemMetaData&, QAbstractFileEngine*&, bool) - - - 0x8CF8947 - /home/chris/untitled/untitled - QFileSystemEngine::resolveEntryAndCreateLegacyEngine(QFileSystemEntry&, QFileSystemMetaData&) - - - - - - 0x116 - 1 - Leak_PossiblyLost - - 160 bytes in 1 blocks are possibly lost in loss record 199 of 270 - 160 - 1 - - - - 0x4025315 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - calloc - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 467 - - - 0x4010CD7 - /lib/i386-linux-gnu/ld-2.13.so - allocate_dtv - /build/buildd/eglibc-2.13/elf - dl-tls.c - 300 - - - 0x401146B - /lib/i386-linux-gnu/ld-2.13.so - _dl_allocate_tls - /build/buildd/eglibc-2.13/elf - dl-tls.c - 464 - - - 0x433E5C6 - /lib/i386-linux-gnu/libpthread-2.13.so - pthread_create@@GLIBC_2.1 - /build/buildd/eglibc-2.13/nptl - allocatestack.c - 570 - - - 0x83A6BED - /home/chris/untitled/untitled - QTWTF::TCMalloc_PageHeap::initializeScavenger() - - - 0x83A92E9 - /home/chris/untitled/untitled - QTWTF::TCMalloc_ThreadCache::InitModule() - - - 0x83AA188 - /home/chris/untitled/untitled - QTWTF::fastMalloc(unsigned int) - - - 0x83AEE4B - /home/chris/untitled/untitled - QTWTF::initializeThreading() - - - 0x8338CBF - /home/chris/untitled/untitled - QTJSC::initializeThreading() - - - 0x82897BE - /home/chris/untitled/untitled - QScriptEnginePrivate::QScriptEnginePrivate() - - - 0x828AAB2 - /home/chris/untitled/untitled - QScriptEngine::QScriptEngine() - - - 0x8063261 - /home/chris/untitled/untitled - QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate*) - - - - - - 0x117 - 1 - Leak_DefinitelyLost - - 160 (40 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 200 of 270 - 160 - 1 - - - - 0x4026864 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - malloc - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 236 - - - 0x4565FAB - /lib/i386-linux-gnu/libc-2.13.so - nss_parse_service_list - /build/buildd/eglibc-2.13/nss - nsswitch.c - 626 - - - 0x4566584 - /lib/i386-linux-gnu/libc-2.13.so - __nss_database_lookup - /build/buildd/eglibc-2.13/nss - nsswitch.c - 167 - - - 0x6BAAE9B - - - 0x6BAC9F4 - - - 0x451C7EA - /lib/i386-linux-gnu/libc-2.13.so - getpwuid_r@@GLIBC_2.1.2 - /build/buildd/eglibc-2.13/pwd/../nss - getXXbyYY_r.c - 256 - - - 0x85A34E4 - /home/chris/untitled/untitled - sm_performSaveYourself(QSessionManagerPrivate*) - - - 0x85A3F56 - /home/chris/untitled/untitled - sm_saveYourselfCallback(_SmcConn*, void*, int, int, int, int) - - - 0x4047727 - /usr/lib/i386-linux-gnu/libSM.so.6.0.1 - _SmcProcessMessage - - - 0x405D1B5 - /usr/lib/i386-linux-gnu/libICE.so.6.3.0 - IceProcessMessages - - - 0x858FE67 - /home/chris/untitled/untitled - QSmSocketReceiver::socketActivated(int) - - - 0x8D3A9C1 - /home/chris/untitled/untitled - QMetaObject::activate(QObject*, QMetaObject const*, int, void**) - - - - - - 0x118 - 1 - Leak_DefinitelyLost - - 166 (56 direct, 110 indirect) bytes in 1 blocks are definitely lost in loss record 201 of 270 - 166 - 1 - - - - 0x402641D - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - operator new(unsigned int) - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 255 - - - 0x8D0FC45 - /home/chris/untitled/untitled - QLibraryPrivate::findOrCreate(QString const&, QString const&) - - - 0x8D1023F - /home/chris/untitled/untitled - QLibrary::setFileNameAndVersion(QString const&, QString const&) - - - 0x8D102A4 - /home/chris/untitled/untitled - QLibrary::QLibrary(QString const&, QString const&, QObject*) - - - 0x8C8FA56 - /home/chris/untitled/untitled - qt_initIcu(QString const&) - - - 0x8C4B0CF - /home/chris/untitled/untitled - QLocalePrivate::updateSystemPrivate() - - - 0x8C4B3C6 - /home/chris/untitled/untitled - systemPrivate() - - - 0x8C4B40C - /home/chris/untitled/untitled - defaultPrivate() - - - 0x8C4B55F - /home/chris/untitled/untitled - QLocale::QLocale() - - - 0x8CCF6F3 - /home/chris/untitled/untitled - QResourceFileEngine::QResourceFileEngine(QString const&) - - - 0x8CF87DC - /home/chris/untitled/untitled - _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry&, QFileSystemMetaData&, QAbstractFileEngine*&, bool) - - - 0x8CF8947 - /home/chris/untitled/untitled - QFileSystemEngine::resolveEntryAndCreateLegacyEngine(QFileSystemEntry&, QFileSystemMetaData&) - - - - - - 0x11d - 1 - Leak_DefinitelyLost - - 216 bytes in 1 blocks are definitely lost in loss record 206 of 270 - 216 - 1 - - - - 0x4026864 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - malloc - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 236 - - - 0x4193FB2 - /usr/lib/i386-linux-gnu/libX11.so.6.3.0 - _XimOpenIM - - - 0x4193BCF - /usr/lib/i386-linux-gnu/libX11.so.6.3.0 - _XimRegisterIMInstantiateCallback - - - 0x41789A7 - /usr/lib/i386-linux-gnu/libX11.so.6.3.0 - XRegisterIMInstantiateCallback - - - 0x89FB291 - /home/chris/untitled/untitled - QXIMInputContext::QXIMInputContext() - - - 0x89F9450 - /home/chris/untitled/untitled - QInputContextFactory::create(QString const&, QObject*) - - - 0x85361C7 - /home/chris/untitled/untitled - QApplication::inputContext() const - - - 0x85662A7 - /home/chris/untitled/untitled - QWidgetPrivate::inputContext() const - - - 0x8571D7C - /home/chris/untitled/untitled - QWidget::setAttribute(Qt::WidgetAttribute, bool) - - - 0x8A54527 - /home/chris/untitled/untitled - QGraphicsViewPrivate::updateInputMethodSensitivity() - - - 0x8A55E1A - /home/chris/untitled/untitled - QGraphicsView::setScene(QGraphicsScene*) - - - 0x805273E - /home/chris/untitled/untitled - QDeclarativeViewPrivate::init() - - - - - - 0x126 - 1 - Leak_PossiblyLost - - 360 bytes in 3 blocks are possibly lost in loss record 215 of 270 - 360 - 3 - - - - 0x402517B - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - memalign - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 581 - - - 0x40251D8 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - posix_memalign - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 709 - - - 0x42BE546 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - - - 0x42BFA4C - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_slice_alloc - - - 0x42C06DD - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_slist_prepend - - - 0x42C368E - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_strsplit - - - 0x42D9393 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_get_language_names - - - 0x42D98E6 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - - - 0x42CB919 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_thread_init_glib - - - 0x4254506 - /usr/lib/i386-linux-gnu/libgthread-2.0.so.0.2800.6 - g_thread_init - - - 0x8D4D458 - /home/chris/untitled/untitled - QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*) - - - 0x85C7CA5 - /home/chris/untitled/untitled - QGuiEventDispatcherGlibPrivate::QGuiEventDispatcherGlibPrivate() - - - - - - 0x128 - 1 - Leak_DefinitelyLost - - 396 (256 direct, 140 indirect) bytes in 2 blocks are definitely lost in loss record 217 of 270 - 396 - 2 - - - - 0x4026864 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - malloc - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 236 - - - 0x4086087 - /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4 - - - 0x4086F7C - /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4 - - - 0x4087073 - /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4 - - - 0x408C6EB - /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4 - - - 0x4607790 - /lib/i386-linux-gnu/libexpat.so.1.5.2 - - - 0x4608670 - /lib/i386-linux-gnu/libexpat.so.1.5.2 - - - 0x4608F92 - /lib/i386-linux-gnu/libexpat.so.1.5.2 - - - 0x460A7D9 - /lib/i386-linux-gnu/libexpat.so.1.5.2 - - - 0x460C5F2 - /lib/i386-linux-gnu/libexpat.so.1.5.2 - XML_ParseBuffer - - - 0x408B2B2 - /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4 - FcConfigParseAndLoad - - - 0x408B60B - /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4 - FcConfigParseAndLoad - - - - - - 0x144 - 1 - Leak_PossiblyLost - - 1,240 bytes in 5 blocks are possibly lost in loss record 245 of 270 - 1240 - 5 - - - - 0x402517B - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - memalign - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 581 - - - 0x40251D8 - /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so - posix_memalign - /build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc - vg_replace_malloc.c - 709 - - - 0x42BE546 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - - - 0x42BFA4C - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_slice_alloc - - - 0x42729D8 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_array_sized_new - - - 0x4272AB2 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_array_new - - - 0x42CB7FE - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_static_private_set - - - 0x4282D0E - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_get_filename_charsets - - - 0x4282D9C - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - - - 0x42CB909 - /lib/i386-linux-gnu/libglib-2.0.so.0.2800.6 - g_thread_init_glib - - - 0x4254506 - /usr/lib/i386-linux-gnu/libgthread-2.0.so.0.2800.6 - g_thread_init - - - 0x8D4D458 - /home/chris/untitled/untitled - QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*) - - - - - - - - - - 80 - U1004-ARM-_dl_relocate_object - - - - - diff --git a/tests/auto/valgrind/memcheck/memcheck.pro b/tests/auto/valgrind/memcheck/memcheck.pro index 89ac9529618..ca8134e6264 100644 --- a/tests/auto/valgrind/memcheck/memcheck.pro +++ b/tests/auto/valgrind/memcheck/memcheck.pro @@ -1,16 +1,9 @@ TEMPLATE = subdirs -parsertests.file = parsertests.pro - # avoid race conditions when compiling shadowbuild and having more than one compile job -modeldemo.depends = parsertests modeldemo.file = modeldemo.pro +testapps.depends = modeldemo -testapps.depends = modeldemo parsertests - -testrunner.file = testrunner.pro -testrunner.depends = testapps - -SUBDIRS += parsertests modeldemo testapps testrunner +SUBDIRS += modeldemo testapps diff --git a/tests/auto/valgrind/memcheck/memcheck.qbs b/tests/auto/valgrind/memcheck/memcheck.qbs index 531319c8117..c633a605a39 100644 --- a/tests/auto/valgrind/memcheck/memcheck.qbs +++ b/tests/auto/valgrind/memcheck/memcheck.qbs @@ -4,8 +4,6 @@ Project { name: "Memcheck autotests" references: [ "testapps/testapps.qbs", - "modeldemo.qbs", - "parsertests.qbs", - "testrunner.qbs" + "modeldemo.qbs" ] } diff --git a/tests/auto/valgrind/memcheck/parsertests.pro b/tests/auto/valgrind/memcheck/parsertests.pro deleted file mode 100644 index b4f829804df..00000000000 --- a/tests/auto/valgrind/memcheck/parsertests.pro +++ /dev/null @@ -1,14 +0,0 @@ -QTC_LIB_DEPENDS += utils ssh -QTC_PLUGIN_DEPENDS += debugger projectexplorer -include(../../qttest.pri) -include($$IDE_SOURCE_TREE/src/plugins/valgrind/valgrind_test.pri) - -TARGET = tst_parsertests - -QT += network - -DEFINES += "PARSERTESTS_DATA_DIR=\\\"$$_PRO_FILE_PWD_/data\\\"" -DEFINES += "VALGRIND_FAKE_PATH=\\\"$$IDE_BUILD_TREE/src/tools/valgrindfake/valgrind-fake\\\"" - -SOURCES += parsertests.cpp -HEADERS += parsertests.h diff --git a/tests/auto/valgrind/memcheck/parsertests.qbs b/tests/auto/valgrind/memcheck/parsertests.qbs deleted file mode 100644 index 99d6f6474f8..00000000000 --- a/tests/auto/valgrind/memcheck/parsertests.qbs +++ /dev/null @@ -1,13 +0,0 @@ -import qbs -import "../valgrindautotest.qbs" as ValgrindAutotest - -ValgrindAutotest { - name: "Memcheck parser autotest" - Depends { name: "valgrind-fake" } - Depends { name: "Qt.network" } - files: ["parsertests.h", "parsertests.cpp"] - cpp.defines: base.concat([ - 'PARSERTESTS_DATA_DIR="' + path + '/data"', - 'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + qtc.ide_bin_path + '/valgrind-fake"' - ]) -} diff --git a/tests/auto/valgrind/memcheck/testrunner.pro b/tests/auto/valgrind/memcheck/testrunner.pro deleted file mode 100644 index b0b07ea394d..00000000000 --- a/tests/auto/valgrind/memcheck/testrunner.pro +++ /dev/null @@ -1,12 +0,0 @@ -QTC_LIB_DEPENDS += utils ssh -QTC_PLUGIN_DEPENDS += debugger projectexplorer -include(../../qttest.pri) -include($$IDE_SOURCE_TREE/src/plugins/valgrind/valgrind_test.pri) - -TARGET = tst_testrunner - -DEFINES += "TESTRUNNER_SRC_DIR=\\\"$$_PRO_FILE_PWD_/testapps\\\"" -DEFINES += "TESTRUNNER_APP_DIR=\\\"$(PWD)/testapps\\\"" - -SOURCES += testrunner.cpp -HEADERS += testrunner.h diff --git a/tests/auto/valgrind/memcheck/testrunner.qbs b/tests/auto/valgrind/memcheck/testrunner.qbs deleted file mode 100644 index 4d0e76cb028..00000000000 --- a/tests/auto/valgrind/memcheck/testrunner.qbs +++ /dev/null @@ -1,24 +0,0 @@ -import qbs -import "../valgrindautotest.qbs" as ValgrindAutotest - -ValgrindAutotest { - name: "Memcheck test runner" - Depends { name: "Memcheck free1 autotest" } - Depends { name: "Memcheck free2 autotest" } - Depends { name: "Memcheck invalidjump autotest" } - Depends { name: "Memcheck leak1 autotest" } - Depends { name: "Memcheck leak2 autotest" } - Depends { name: "Memcheck leak3 autotest" } - Depends { name: "Memcheck leak4 autotest" } - Depends { name: "Memcheck overlap autotest" } - Depends { name: "Memcheck syscall autotest" } - Depends { name: "Memcheck uninit1 autotest" } - Depends { name: "Memcheck uninit2 autotest" } - Depends { name: "Memcheck uninit3 autotest" } - files: ["testrunner.h", "testrunner.cpp"] - destinationDirectory: qtc.ide_bin_path - cpp.defines: base.concat([ - 'TESTRUNNER_SRC_DIR="' + path + '/testapps"', - 'TESTRUNNER_APP_DIR="' + project.buildDirectory + '/' + destinationDirectory + '/testapps"' - ]) -}