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 <hjk@qt.io>
This commit is contained in:
Christian Stenger
2016-12-06 12:05:05 +01:00
parent 996a697094
commit 62118e9d78
16 changed files with 604 additions and 1186 deletions

View File

@@ -0,0 +1,370 @@
<?xml version="1.0"?>
<valgrindoutput>
<protocolversion>4</protocolversion>
<protocoltool>memcheck</protocoltool>
<preamble>
<line>Memcheck, a memory error detector</line>
<line>Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.</line>
<line>Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info</line>
<line>Command: kate</line>
</preamble>
<pid>22733</pid>
<ppid>17584</ppid>
<tool>memcheck</tool>
<args>
<vargv>
<exe>/usr/bin/valgrind.bin</exe>
<arg>--suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp</arg>
<arg>--xml=yes</arg>
<arg>--xml-file=test.xml</arg>
<arg>--track-origins=yes</arg>
</vargv>
<argv>
<exe>kate</exe>
</argv>
</args>
<status>
<state>RUNNING</state>
<time>00:00:00:00.241 </time>
</status>
<error>
<unique>0x9</unique>
<tid>1</tid>
<kind>InvalidRead</kind>
<what>Invalid read of size 4</what>
<stack>
<frame>
<ip>0x6E47964</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QFrame::frameStyle() const</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/widgets</dir>
<file>qframe.cpp</file>
<line>252</line>
</frame>
<frame>
<ip>0x118F2AF7</ip>
<obj>/usr/lib/kde4/plugins/styles/oxygen.so</obj>
</frame>
<frame>
<ip>0x6A81671</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QWidget::event(QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qwidget.cpp</file>
<line>8273</line>
</frame>
<frame>
<ip>0x6A2B6EB</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QApplicationPrivate::notify_helper(QObject*, QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qapplication.cpp</file>
<line>4396</line>
</frame>
<!--
<frame>
<ip>0x6A311DC</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QApplication::notify(QObject*, QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qapplication.cpp</file>
<line>4277</line>
</frame>
<frame>
<ip>0x6443535</ip>
<obj>/usr/lib/libkdeui.so.5.5.0</obj>
<fn>KApplication::notify(QObject*, QEvent*)</fn>
</frame>
<frame>
<ip>0x83690AB</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QCoreApplication::notifyInternal(QObject*, QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/kernel</dir>
<file>qcoreapplication.cpp</file>
<line>732</line>
</frame>
<frame>
<ip>0x6A77600</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QWidget::ensurePolished() const</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/../../include/QtCore/../../src/corelib/kernel</dir>
<file>qcoreapplication.h</file>
<line>215</line>
</frame>
<frame>
<ip>0x6A869B2</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QWidget::setVisible(bool)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qwidget.cpp</file>
<line>7539</line>
</frame>
<frame>
<ip>0x18B1ED35</ip>
<obj>/home/milian/projects/compiled/kde4/lib/libkatepartinterfaces.so.4.5.0</obj>
<fn>QWidget::show()</fn>
<dir>/usr/include/qt4/QtGui</dir>
<file>qwidget.h</file>
<line>487</line>
</frame>
<frame>
<ip>0x18C23615</ip>
<obj>/home/milian/projects/compiled/kde4/lib/libkatepartinterfaces.so.4.5.0</obj>
<fn>KateViewInternal::KateViewInternal(KateView*)</fn>
<dir>/home/milian/projects/kde4/kate/part/view</dir>
<file>kateviewinternal.cpp</file>
<line>144</line>
</frame>
<frame>
<ip>0x18C0DA68</ip>
<obj>/home/milian/projects/compiled/kde4/lib/libkatepartinterfaces.so.4.5.0</obj>
<fn>KateView::KateView(KateDocument*, QWidget*)</fn>
<dir>/home/milian/projects/kde4/kate/part/view</dir>
<file>kateview.cpp</file>
<line>136</line>
</frame>
-->
</stack>
<auxwhat>Address 0x11527cb8 is not stack'd, malloc'd or (recently) free'd</auxwhat>
</error>
<status>
<state>FINISHED</state>
<time>00:00:01:49.732 </time>
</status>
<error>
<unique>0x13</unique>
<tid>1</tid>
<kind>Leak_PossiblyLost</kind>
<xwhat>
<text>2 bytes in 1 blocks are possibly lost in loss record 2 of 2,003</text>
<leakedbytes>2</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x4C284A8</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so</obj>
<fn>malloc</fn>
<dir>/build/buildd/valgrind-3.6.0~svn20100212/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>236</line>
</frame>
<frame>
<ip>0xD4D7754</ip>
<obj>/lib/libglib-2.0.so.0.2400.1</obj>
<fn>g_malloc</fn>
</frame>
<frame>
<ip>0xD4EF11D</ip>
<obj>/lib/libglib-2.0.so.0.2400.1</obj>
<fn>g_strdup</fn>
</frame>
<frame>
<ip>0xD503DC4</ip>
<obj>/lib/libglib-2.0.so.0.2400.1</obj>
<fn>g_get_language_names</fn>
</frame>
<frame>
<ip>0xD4F89A9</ip>
<obj>/lib/libglib-2.0.so.0.2400.1</obj>
<fn>g_thread_init_glib</fn>
</frame>
<frame>
<ip>0x8396569</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/kernel</dir>
<file>qeventdispatcher_glib.cpp</file>
<line>299</line>
</frame>
<frame>
<ip>0x6ADDBEE</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QGuiEventDispatcherGlibPrivate::QGuiEventDispatcherGlibPrivate()</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qguieventdispatcher_glib.cpp</file>
<line>171</line>
</frame>
<frame>
<ip>0x6ADDCDD</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QGuiEventDispatcherGlib::QGuiEventDispatcherGlib(QObject*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qguieventdispatcher_glib.cpp</file>
<line>186</line>
</frame>
<frame>
<ip>0x6AA5152</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QApplicationPrivate::createEventDispatcher()</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qapplication_x11.cpp</file>
<line>605</line>
</frame>
<frame>
<ip>0x836D069</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QCoreApplication::init()</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/kernel</dir>
<file>qcoreapplication.cpp</file>
<line>552</line>
</frame>
<frame>
<ip>0x836D134</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QCoreApplication::QCoreApplication(QCoreApplicationPrivate&amp;)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/kernel</dir>
<file>qcoreapplication.cpp</file>
<line>477</line>
</frame>
<frame>
<ip>0x6A3815A</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QApplication::QApplication(int&amp;, char**, bool, int)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qapplication.cpp</file>
<line>745</line>
</frame>
</stack>
</error>
<error>
<unique>0x7e4</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>544,542 (56 direct, 544,486 indirect) bytes in 1 blocks are definitely lost in loss record 2,003 of 2,003</text>
<leakedbytes>544542</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x4C284A8</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so</obj>
<fn>malloc</fn>
<dir>/build/buildd/valgrind-3.6.0~svn20100212/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>236</line>
</frame>
<frame>
<ip>0x82A1A6C</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QMapData::node_create(QMapData::Node**, int, int)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/tools</dir>
<file>qmap.cpp</file>
<line>140</line>
</frame>
<frame>
<ip>0x8336F68</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QMap&lt;QSettingsKey, QVariant&gt;::detach_helper()</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/../../include/QtCore/../../src/corelib/tools</dir>
<file>qmap.h</file>
<line>449</line>
</frame>
<frame>
<ip>0x832C564</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QConfFile::mergedKeyMap() const</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/../../include/QtCore/../../src/corelib/tools</dir>
<file>qmap.h</file>
<line>202</line>
</frame>
<frame>
<ip>0x833305A</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QConfFileSettingsPrivate::syncConfFile(int)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/io</dir>
<file>qsettings.cpp</file>
<line>1569</line>
</frame>
<frame>
<ip>0x8333D5B</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QConfFileSettingsPrivate::sync()</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/io</dir>
<file>qsettings.cpp</file>
<line>1386</line>
</frame>
<frame>
<ip>0x83260D9</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QSettingsPrivate::update()</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/io</dir>
<file>qsettings.cpp</file>
<line>415</line>
</frame>
<frame>
<ip>0x83267C7</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QSettings::event(QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/io</dir>
<file>qsettings.cpp</file>
<line>3326</line>
</frame>
<frame>
<ip>0x6A2B6EB</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QApplicationPrivate::notify_helper(QObject*, QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qapplication.cpp</file>
<line>4396</line>
</frame>
<frame>
<ip>0x6A311DC</ip>
<obj>/usr/lib/libQtGui.so.4.7.0</obj>
<fn>QApplication::notify(QObject*, QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/gui/kernel</dir>
<file>qapplication.cpp</file>
<line>4277</line>
</frame>
<frame>
<ip>0x6443535</ip>
<obj>/usr/lib/libkdeui.so.5.5.0</obj>
<fn>KApplication::notify(QObject*, QEvent*)</fn>
</frame>
<frame>
<ip>0x83690AB</ip>
<obj>/usr/lib/libQtCore.so.4.7.0</obj>
<fn>QCoreApplication::notifyInternal(QObject*, QEvent*)</fn>
<dir>/build/buildd/qt4-x11-4.7.0/src/corelib/kernel</dir>
<file>qcoreapplication.cpp</file>
<line>732</line>
</frame>
</stack>
</error>
<errorcounts>
<pair>
<count>2</count>
<unique>0x9</unique>
</pair>
</errorcounts>
<suppcounts>
<pair>
<count>12</count>
<name>X on SUSE11 writev uninit padding</name>
</pair>
<pair>
<count>2</count>
<name>dl-hack3-cond-1</name>
</pair>
<pair>
<count>2</count>
<name>glibc-2.5.x-on-SUSE-10.2-(PPC)-2a</name>
</pair>
</suppcounts>
</valgrindoutput>

View File

@@ -55,3 +55,16 @@ FORMS += \
RESOURCES += \ RESOURCES += \
valgrind.qrc 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
}

View File

@@ -88,4 +88,15 @@ QtcPlugin {
"threadedparser.cpp", "threadedparser.h", "threadedparser.cpp", "threadedparser.h",
] ]
} }
Group {
name: "Test sources"
condition: qtc.testsEnabled
files: [
"valgrindmemcheckparsertest.cpp",
"valgrindmemcheckparsertest.h",
"valgrindtestrunnertest.cpp",
"valgrindtestrunnertest.h",
]
}
} }

View File

@@ -24,31 +24,26 @@
** **
****************************************************************************/ ****************************************************************************/
#include <valgrind/xmlprotocol/frame.h> #include "valgrindmemcheckparsertest.h"
#include <valgrind/xmlprotocol/parser.h>
#include <valgrind/xmlprotocol/stack.h>
#include <valgrind/xmlprotocol/suppression.h>
#include "xmlprotocol/frame.h"
#include "xmlprotocol/parser.h"
#include "xmlprotocol/stack.h"
#include "xmlprotocol/suppression.h"
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/runnables.h> #include <projectexplorer/runnables.h>
#include <extensionsystem/pluginmanager.h>
#include "parsertests.h"
#include <QCoreApplication>
#include <QDebug>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QProcess>
#include <QString> #include <QString>
#include <QTest> #include <QTest>
#include <QTcpServer> #include <QTcpServer>
#include <QTcpSocket> #include <QTcpSocket>
#include <QSignalSpy> #include <QSignalSpy>
#include <iostream>
#include <QProcess>
using namespace Valgrind;
using namespace Valgrind::XmlProtocol; using namespace Valgrind::XmlProtocol;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -64,7 +59,10 @@ inline bool qCompare(int const &t1, MemcheckErrorKind const &t2,
} // namespace QTest } // namespace QTest
QT_END_NAMESPACE 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() qDebug() << f.instructionPointer() << f.directory() << f.fileName() << f.functionName()
<< f.line() << f.object(); << 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() << e.kind() << e.leakedBlocks() << e.leakedBytes() << e.what() << e.tid() << e.unique();
qDebug() << "stacks:" << e.stacks().size(); 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() << s.auxWhat() << s.directory() << s.file() << s.line() << s.helgrindThreadId();
qDebug() << "frames:"; qDebug() << "frames:";
Q_FOREACH(const Frame& f, s.frames()) { for (const Frame &f : s.frames()) {
dumpFrame(f); dumpFrame(f);
} }
} }
@@ -85,7 +83,17 @@ void dumpError(const Error &e)
static QString fakeValgrindExecutable() 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) static QString dataFile(const QLatin1String &file)
@@ -93,10 +101,8 @@ static QString dataFile(const QLatin1String &file)
return QLatin1String(PARSERTESTS_DATA_DIR) + 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); m_server = new QTcpServer(this);
QVERIFY(m_server->listen()); QVERIFY(m_server->listen());
@@ -104,7 +110,7 @@ void ParserTests::initTestCase()
m_process = 0; 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()); QVERIFY(!m_server->hasPendingConnections());
@@ -132,7 +138,7 @@ void ParserTests::initTest(const QLatin1String &testfile, const QStringList &oth
QVERIFY(m_socket); QVERIFY(m_socket);
} }
void ParserTests::cleanup() void ValgrindMemcheckParserTest::cleanup()
{ {
if (m_socket) { if (m_socket) {
delete m_socket; delete m_socket;
@@ -144,7 +150,7 @@ void ParserTests::cleanup()
} }
} }
void ParserTests::testHelgrindSample1() void ValgrindMemcheckParserTest::testHelgrindSample1()
{ {
QSKIP("testfile does not exist"); QSKIP("testfile does not exist");
@@ -240,7 +246,7 @@ void ParserTests::testHelgrindSample1()
// QCOMPARE(rec.suppcounts, expectedSuppCounts); // QCOMPARE(rec.suppcounts, expectedSuppCounts);
} }
void ParserTests::testMemcheckSample1() void ValgrindMemcheckParserTest::testMemcheckSample1()
{ {
initTest(QLatin1String("memcheck-output-sample1.xml")); initTest(QLatin1String("memcheck-output-sample1.xml"));
@@ -316,7 +322,7 @@ void ParserTests::testMemcheckSample1()
QCOMPARE(rec.suppcounts, expectedSuppCounts); QCOMPARE(rec.suppcounts, expectedSuppCounts);
} }
void ParserTests::testMemcheckSample2() void ValgrindMemcheckParserTest::testMemcheckSample2()
{ {
QSKIP("testfile does not exist"); 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")); 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"); QSKIP("testfile does not exist");
@@ -394,7 +400,7 @@ void ParserTests::testMemcheckSample3()
QCOMPARE(rec.suppcounts.at(2).second, qint64(3)); QCOMPARE(rec.suppcounts.at(2).second, qint64(3));
} }
void ParserTests::testMemcheckCharm() void ValgrindMemcheckParserTest::testMemcheckCharm()
{ {
QSKIP("testfile does not exist"); QSKIP("testfile does not exist");
@@ -415,7 +421,7 @@ void ParserTests::testMemcheckCharm()
QVERIFY2(parser.errorString().isEmpty(), qPrintable(parser.errorString())); QVERIFY2(parser.errorString().isEmpty(), qPrintable(parser.errorString()));
} }
void ParserTests::testValgrindCrash() void ValgrindMemcheckParserTest::testValgrindCrash()
{ {
initTest(QLatin1String("memcheck-output-sample1.xml"), QStringList() << "--crash"); initTest(QLatin1String("memcheck-output-sample1.xml"), QStringList() << "--crash");
@@ -430,7 +436,7 @@ void ParserTests::testValgrindCrash()
QCOMPARE(parser.errorString(), m_socket->errorString()); QCOMPARE(parser.errorString(), m_socket->errorString());
} }
void ParserTests::testValgrindGarbage() void ValgrindMemcheckParserTest::testValgrindGarbage()
{ {
initTest(QLatin1String("memcheck-output-sample1.xml"), QStringList() << "--garbage"); initTest(QLatin1String("memcheck-output-sample1.xml"), QStringList() << "--garbage");
@@ -444,7 +450,7 @@ void ParserTests::testValgrindGarbage()
qDebug() << parser.errorString(); qDebug() << parser.errorString();
} }
void ParserTests::testParserStop() void ValgrindMemcheckParserTest::testParserStop()
{ {
ThreadedParser parser; ThreadedParser parser;
Memcheck::MemcheckRunner runner; Memcheck::MemcheckRunner runner;
@@ -455,31 +461,39 @@ void ParserTests::testParserStop()
<< "--wait" << "5"); << "--wait" << "5");
runner.setProcessChannelMode(QProcess::ForwardedChannels); runner.setProcessChannelMode(QProcess::ForwardedChannels);
runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)));
runner.start(); runner.start();
QTest::qWait(500); QTest::qWait(500);
runner.stop(); 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()); QString executable = QProcessEnvironment::systemEnvironment().value("VALGRIND_TEST_BIN", fakeValgrindExecutable());
qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this"; qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this";
ThreadedParser parser; ThreadedParser parser;
ProjectExplorer::StandardRunnable debuggee; ProjectExplorer::StandardRunnable debuggee;
debuggee.executable = executable; debuggee.executable = executable;
debuggee.environment = sysEnv;
Memcheck::MemcheckRunner runner; Memcheck::MemcheckRunner runner;
runner.setValgrindExecutable(QLatin1String("valgrind")); runner.setValgrindExecutable(QLatin1String("valgrind"));
runner.setDebuggee(debuggee); runner.setDebuggee(debuggee);
runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)));
runner.setParser(&parser); runner.setParser(&parser);
RunnerDumper dumper(&runner, &parser); RunnerDumper dumper(&runner, &parser);
runner.start(); runner.start();
runner.waitForFinished(); runner.waitForFinished();
} }
void ParserTests::testValgrindStartError_data() void ValgrindMemcheckParserTest::testValgrindStartError_data()
{ {
QTest::addColumn<QString>("valgrindExe"); QTest::addColumn<QString>("valgrindExe");
QTest::addColumn<QStringList>("valgrindArgs"); QTest::addColumn<QStringList>("valgrindArgs");
@@ -497,24 +511,27 @@ void ParserTests::testValgrindStartError_data()
<< fakeValgrindExecutable() << QString(); << fakeValgrindExecutable() << QString();
} }
void ParserTests::testValgrindStartError() void ValgrindMemcheckParserTest::testValgrindStartError()
{ {
QFETCH(QString, valgrindExe); QFETCH(QString, valgrindExe);
QFETCH(QStringList, valgrindArgs); QFETCH(QStringList, valgrindArgs);
QFETCH(QString, debuggeeExecutable); QFETCH(QString, debuggee);
QFETCH(QString, debuggeeArgs); QFETCH(QString, debuggeeArgs);
ThreadedParser parser; ThreadedParser parser;
ProjectExplorer::StandardRunnable debuggee; ProjectExplorer::StandardRunnable debuggeeExecutable;
debuggee.executable = debuggeeExecutable; debuggeeExecutable.executable = debuggee;
debuggee.commandLineArguments = debuggeeArgs; debuggeeExecutable.environment = Utils::Environment::systemEnvironment();
debuggeeExecutable.commandLineArguments = debuggeeArgs;
Memcheck::MemcheckRunner runner; Memcheck::MemcheckRunner runner;
runner.setParser(&parser); runner.setParser(&parser);
runner.setValgrindExecutable(valgrindExe); runner.setValgrindExecutable(valgrindExe);
runner.setValgrindArguments(valgrindArgs); 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); RunnerDumper dumper(&runner, &parser);
runner.start(); runner.start();
runner.waitForFinished(); runner.waitForFinished();
@@ -522,4 +539,5 @@ void ParserTests::testValgrindStartError()
// just finish without deadlock and we are fine // just finish without deadlock and we are fine
} }
QTEST_MAIN(ParserTests) } // namespace Test
} // namespace Valgrind

View File

@@ -32,11 +32,11 @@
#include <QVector> #include <QVector>
#include <QDebug> #include <QDebug>
#include <valgrind/xmlprotocol/error.h> #include "xmlprotocol/error.h"
#include <valgrind/xmlprotocol/status.h> #include "xmlprotocol/status.h"
#include <valgrind/xmlprotocol/threadedparser.h> #include "xmlprotocol/threadedparser.h"
#include <valgrind/xmlprotocol/parser.h> #include "xmlprotocol/parser.h"
#include <valgrind/memcheck/memcheckrunner.h> #include "memcheck/memcheckrunner.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QTcpServer; class QTcpServer;
@@ -44,6 +44,10 @@ class QTcpSocket;
class QProcess; class QProcess;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Valgrind {
namespace Test {
void dumpError(const Valgrind::XmlProtocol::Error &e); void dumpError(const Valgrind::XmlProtocol::Error &e);
class Recorder : public QObject class Recorder : public QObject
@@ -134,7 +138,7 @@ public:
}; };
class ParserTests : public QObject class ValgrindMemcheckParserTest : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -159,7 +163,10 @@ private Q_SLOTS:
private: private:
void initTest(const QLatin1String &testfile, const QStringList &otherArgs = QStringList()); void initTest(const QLatin1String &testfile, const QStringList &otherArgs = QStringList());
QTcpServer *m_server; QTcpServer *m_server = 0;
QProcess *m_process; QProcess *m_process = 0;
QTcpSocket *m_socket; QTcpSocket *m_socket = 0;
}; };
} // namespace Test
} // namespace Valgrind

View File

@@ -32,6 +32,11 @@
#include "valgrindsettings.h" #include "valgrindsettings.h"
#include "valgrindconfigwidget.h" #include "valgrindconfigwidget.h"
#ifdef WITH_TESTS
# include "valgrindmemcheckparsertest.h"
# include "valgrindtestrunnertest.h"
#endif
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -117,5 +122,14 @@ ValgrindGlobalSettings *ValgrindPlugin::globalSettings()
return theGlobalSettings; return theGlobalSettings;
} }
QList<QObject *> ValgrindPlugin::createTestObjects() const
{
QList<QObject *> tests;
#ifdef WITH_TESTS
tests << new Test::ValgrindMemcheckParserTest << new Test::ValgrindTestRunnerTest;
#endif
return tests;
}
} // namespace Internal } // namespace Internal
} // namespace Valgrind } // namespace Valgrind

View File

@@ -48,6 +48,8 @@ public:
ShutdownFlag aboutToShutdown() override; ShutdownFlag aboutToShutdown() override;
static ValgrindGlobalSettings *globalSettings(); static ValgrindGlobalSettings *globalSettings();
private:
QList<QObject *> createTestObjects() const override;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -24,76 +24,78 @@
** **
****************************************************************************/ ****************************************************************************/
#include "testrunner.h" #include "valgrindtestrunnertest.h"
#include <valgrind/xmlprotocol/frame.h> #include "xmlprotocol/frame.h"
#include <valgrind/xmlprotocol/stack.h> #include "xmlprotocol/stack.h"
#include <valgrind/xmlprotocol/suppression.h> #include "xmlprotocol/suppression.h"
#include <valgrind/xmlprotocol/threadedparser.h> #include "xmlprotocol/threadedparser.h"
#include <valgrind/xmlprotocol/parser.h> #include "xmlprotocol/parser.h"
#include <valgrind/memcheck/memcheckrunner.h> #include "memcheck/memcheckrunner.h"
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/runnables.h> #include <projectexplorer/runnables.h>
#include <extensionsystem/pluginmanager.h>
#include <QDebug> #include <QDebug>
#include <QTest> #include <QTest>
#include <QDir> #include <QDir>
#include <QSignalSpy> #include <QSignalSpy>
const QString appSrcDir(TESTRUNNER_SRC_DIR); #define HEADER_LENGTH 25
const QString appBinDir(TESTRUNNER_APP_DIR);
#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; 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) ValgrindTestRunnerTest::ValgrindTestRunnerTest(QObject *parent)
: QObject(parent)
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)
{ {
qRegisterMetaType<Error>(); qRegisterMetaType<Error>();
} }
QString TestRunner::runTestBinary(const QString &binary, const QStringList &vArgs) QString ValgrindTestRunnerTest::runTestBinary(const QString &binary, const QStringList &vArgs)
{ {
const QString binPath = appBinDir + QLatin1Char('/') + binary; const QFileInfo binPathFileInfo(appBinDir, binary);
if (!QFileInfo(binPath).isExecutable()) if (!binPathFileInfo.isExecutable())
qFatal("No such test app: %s", qPrintable(binPath)); return QString();
ProjectExplorer::StandardRunnable debuggee; ProjectExplorer::StandardRunnable debuggee;
const QString &binPath = binPathFileInfo.canonicalFilePath();
debuggee.executable = binPath; debuggee.executable = binPath;
debuggee.environment = Utils::Environment::systemEnvironment();
m_runner->setValgrindArguments(QStringList() << "--num-callers=50" << "--track-origins=yes" << vArgs); m_runner->setValgrindArguments(QStringList() << "--num-callers=50" << "--track-origins=yes" << vArgs);
m_runner->setDebuggee(debuggee); m_runner->setDebuggee(debuggee);
m_runner->setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)));
m_runner->start(); m_runner->start();
m_runner->waitForFinished(); m_runner->waitForFinished();
return binPath; return binPath;
} }
void TestRunner::logMessageReceived(const QByteArray &message) void ValgrindTestRunnerTest::logMessageReceived(const QByteArray &message)
{ {
qDebug() << "log message received:" << message; qDebug() << "log message received:" << message;
m_logMessages << message; m_logMessages << message;
} }
void TestRunner::internalError(const QString &error) void ValgrindTestRunnerTest::internalError(const QString &error)
{ {
if (!m_expectCrash) if (!m_expectCrash)
QFAIL(qPrintable(error)); QFAIL(qPrintable(error));
@@ -101,12 +103,12 @@ void TestRunner::internalError(const QString &error)
qDebug() << "expected crash:" << error; qDebug() << "expected crash:" << error;
} }
void TestRunner::error(const Error &error) void ValgrindTestRunnerTest::error(const Error &error)
{ {
m_errors << error; m_errors << error;
} }
void TestRunner::cleanup() void ValgrindTestRunnerTest::cleanup()
{ {
Q_ASSERT(m_runner); Q_ASSERT(m_runner);
delete m_runner; delete m_runner;
@@ -120,14 +122,12 @@ void TestRunner::cleanup()
m_expectCrash = false; m_expectCrash = false;
} }
void TestRunner::initTestCase() void ValgrindTestRunnerTest::init()
{
new ExtensionSystem::PluginManager;
new ProjectExplorer::ProjectExplorerPlugin;
}
void TestRunner::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_logMessages.isEmpty());
Q_ASSERT(!m_runner); Q_ASSERT(!m_runner);
@@ -135,24 +135,27 @@ void TestRunner::init()
m_runner->setValgrindExecutable(QLatin1String("valgrind")); m_runner->setValgrindExecutable(QLatin1String("valgrind"));
m_runner->setProcessChannelMode(QProcess::ForwardedChannels); m_runner->setProcessChannelMode(QProcess::ForwardedChannels);
connect(m_runner, &MemcheckRunner::logMessageReceived, connect(m_runner, &MemcheckRunner::logMessageReceived,
this, &TestRunner::logMessageReceived); this, &ValgrindTestRunnerTest::logMessageReceived);
connect(m_runner, &ValgrindRunner::processErrorReceived, connect(m_runner, &ValgrindRunner::processErrorReceived,
this, &TestRunner::internalError); this, &ValgrindTestRunnerTest::internalError);
Q_ASSERT(!m_parser); Q_ASSERT(!m_parser);
m_parser = new ThreadedParser; m_parser = new ThreadedParser;
connect(m_parser, &ThreadedParser::internalError, connect(m_parser, &ThreadedParser::internalError,
this, &TestRunner::internalError); this, &ValgrindTestRunnerTest::internalError);
connect(m_parser, &ThreadedParser::error, connect(m_parser, &ThreadedParser::error,
this, &TestRunner::error); this, &ValgrindTestRunnerTest::error);
m_runner->setParser(m_parser); m_runner->setParser(m_parser);
} }
//BEGIN: Actual test cases //BEGIN: Actual test cases
void TestRunner::testLeak1() void ValgrindTestRunnerTest::testLeak1()
{ {
const QString binary = runTestBinary(QLatin1String("leak1/leak1")); 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()); QVERIFY(m_logMessages.isEmpty());
@@ -183,9 +186,12 @@ void TestRunner::testLeak1()
} }
} }
void TestRunner::testLeak2() void ValgrindTestRunnerTest::testLeak2()
{ {
const QString binary = runTestBinary(QLatin1String("leak2/leak2")); 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()); QVERIFY(m_logMessages.isEmpty());
QCOMPARE(m_errors.count(), 1); 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"); 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()); QVERIFY(m_logMessages.isEmpty());
QCOMPARE(m_errors.count(), 1); QCOMPARE(m_errors.count(), 1);
@@ -258,16 +266,19 @@ void TestRunner::testLeak3()
} }
} }
void TestRunner::testLeak4() void ValgrindTestRunnerTest::testLeak4()
{ {
const QString app("leak4"); const QString app("leak4");
const QString binary = runTestBinary(app + QLatin1Char('/') + app, const QString binary = runTestBinary(app + QLatin1Char('/') + app,
QStringList() << "--show-reachable=yes"); 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"); const QString srcDir = srcDirForApp("leak4");
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
QCOMPARE(m_errors.count(), 2); QCOMPARE(m_errors.count(), 3);
//BEGIN first error //BEGIN first error
{ {
const Error error = m_errors.first(); const Error error = m_errors.first();
@@ -306,7 +317,7 @@ void TestRunner::testLeak4()
} }
//BEGIN second error //BEGIN second error
{ {
const Error error = m_errors.last(); const Error error = m_errors.at(1);
QCOMPARE(error.kind(), int(Leak_DefinitelyLost)); QCOMPARE(error.kind(), int(Leak_DefinitelyLost));
QCOMPARE(error.leakedBlocks(), qint64(1)); QCOMPARE(error.leakedBlocks(), qint64(1));
if (on64bit()) if (on64bit())
@@ -334,12 +345,16 @@ void TestRunner::testLeak4()
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
// TODO add third error check
} }
void TestRunner::uninit1() void ValgrindTestRunnerTest::testUninit1()
{ {
const QString app("uninit1"); const QString app("uninit1");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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); const QString srcDir = srcDirForApp(app);
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
@@ -378,11 +393,14 @@ void TestRunner::uninit1()
} }
} }
void TestRunner::uninit2() void ValgrindTestRunnerTest::testUninit2()
{ {
const QString app("uninit2"); const QString app("uninit2");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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); const QString srcDir = srcDirForApp(app);
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
@@ -442,11 +460,14 @@ void TestRunner::uninit2()
} }
} }
void TestRunner::uninit3() void ValgrindTestRunnerTest::testUninit3()
{ {
const QString app("uninit3"); const QString app("uninit3");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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); const QString srcDir = srcDirForApp(app);
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
@@ -506,10 +527,13 @@ void TestRunner::uninit3()
} }
} }
void TestRunner::syscall() void ValgrindTestRunnerTest::testSyscall()
{ {
const QString app("syscall"); const QString app("syscall");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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); const QString srcDir = srcDirForApp(app);
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
@@ -565,10 +589,13 @@ void TestRunner::syscall()
} }
} }
void TestRunner::free1() void ValgrindTestRunnerTest::testFree1()
{ {
const QString app("free1"); const QString app("free1");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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); const QString srcDir = srcDirForApp(app);
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
@@ -619,10 +646,13 @@ void TestRunner::free1()
} }
} }
void TestRunner::free2() void ValgrindTestRunnerTest::testFree2()
{ {
const QString app("free2"); const QString app("free2");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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); const QString srcDir = srcDirForApp(app);
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
@@ -677,12 +707,14 @@ void TestRunner::free2()
} }
} }
void TestRunner::invalidjump() void ValgrindTestRunnerTest::testInvalidjump()
{ {
const QString app("invalidjump"); const QString app("invalidjump");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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()); QVERIFY(m_logMessages.isEmpty());
@@ -705,11 +737,14 @@ void TestRunner::invalidjump()
} }
void TestRunner::overlap() void ValgrindTestRunnerTest::testOverlap()
{ {
const QString app("overlap"); const QString app("overlap");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); 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); const QString srcDir = srcDirForApp(app);
QVERIFY(m_logMessages.isEmpty()); QVERIFY(m_logMessages.isEmpty());
@@ -735,3 +770,6 @@ void TestRunner::overlap()
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
} // namespace Test
} // namespace Valgrind

View File

@@ -29,7 +29,7 @@
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
#include <valgrind/xmlprotocol/error.h> #include "xmlprotocol/error.h"
namespace Valgrind { namespace Valgrind {
@@ -41,15 +41,16 @@ namespace Memcheck {
class MemcheckRunner; class MemcheckRunner;
} }
class TestRunner : public QObject namespace Test {
class ValgrindTestRunnerTest : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TestRunner(QObject *parent = 0); explicit ValgrindTestRunnerTest(QObject *parent = 0);
private Q_SLOTS: private slots:
void initTestCase();
void init(); void init();
void cleanup(); void cleanup();
@@ -58,18 +59,17 @@ private Q_SLOTS:
void testLeak3(); void testLeak3();
void testLeak4(); void testLeak4();
void uninit1(); void testUninit1();
void uninit2(); void testUninit2();
void uninit3(); void testUninit3();
void free1(); void testFree1();
void free2(); void testFree2();
void invalidjump(); void testInvalidjump();
void syscall(); void testSyscall();
void overlap(); void testOverlap();
private Q_SLOTS:
void logMessageReceived(const QByteArray &message); void logMessageReceived(const QByteArray &message);
void internalError(const QString &error); void internalError(const QString &error);
void error(const Valgrind::XmlProtocol::Error &error); void error(const Valgrind::XmlProtocol::Error &error);
@@ -77,11 +77,12 @@ private Q_SLOTS:
private: private:
QString runTestBinary(const QString &binary, const QStringList &vArgs = QStringList()); QString runTestBinary(const QString &binary, const QStringList &vArgs = QStringList());
XmlProtocol::ThreadedParser *m_parser; XmlProtocol::ThreadedParser *m_parser = 0;
Memcheck::MemcheckRunner *m_runner; Memcheck::MemcheckRunner *m_runner = 0;
QList<QByteArray> m_logMessages; QList<QByteArray> m_logMessages;
QList<XmlProtocol::Error> m_errors; QList<XmlProtocol::Error> m_errors;
bool m_expectCrash; bool m_expectCrash = false;
}; };
} // namespace Test
} // namespace Valgrind } // namespace Valgrind

View File

@@ -1,984 +0,0 @@
<?xml version="1.0"?>
<valgrindoutput>
<protocolversion>4</protocolversion>
<protocoltool>memcheck</protocoltool>
<preamble>
<line>Memcheck, a memory error detector</line>
<line>Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.</line>
<line>Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info</line>
<line>Command: /home/chris/untitled/untitled</line>
</preamble>
<pid>20854</pid>
<ppid>20386</ppid>
<tool>memcheck</tool>
<args>
<vargv>
<exe>/usr/bin/valgrind.bin</exe>
<arg>--suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp</arg>
<arg>--xml=yes</arg>
<arg>--xml-file=/tmp/bla</arg>
</vargv>
<argv>
<exe>/home/chris/untitled/untitled</exe>
</argv>
</args>
<status>
<state>RUNNING</state>
<time>00:00:00:00.161 </time>
</status>
<status>
<state>FINISHED</state>
<time>00:00:00:12.379 </time>
</status>
<error>
<unique>0x107</unique>
<tid>1</tid>
<kind>Leak_PossiblyLost</kind>
<xwhat>
<text>120 bytes in 1 blocks are possibly lost in loss record 184 of 270</text>
<leakedbytes>120</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x402517B</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>memalign</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>581</line>
</frame>
<frame>
<ip>0x40251D8</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>posix_memalign</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>709</line>
</frame>
<frame>
<ip>0x42BE546</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
</frame>
<frame>
<ip>0x42BFA2F</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_slice_alloc</fn>
</frame>
<frame>
<ip>0x42C06DD</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_slist_prepend</fn>
</frame>
<frame>
<ip>0x42C368E</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_strsplit</fn>
</frame>
<frame>
<ip>0x42D9393</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_get_language_names</fn>
</frame>
<frame>
<ip>0x42D98E6</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
</frame>
<frame>
<ip>0x42CB919</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_thread_init_glib</fn>
</frame>
<frame>
<ip>0x4254506</ip>
<obj>/usr/lib/i386-linux-gnu/libgthread-2.0.so.0.2800.6</obj>
<fn>g_thread_init</fn>
</frame>
<frame>
<ip>0x8D4D458</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*)</fn>
</frame>
<frame>
<ip>0x85C7CA5</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QGuiEventDispatcherGlibPrivate::QGuiEventDispatcherGlibPrivate()</fn>
</frame>
</stack>
</error>
<error>
<unique>0x109</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>122 (56 direct, 66 indirect) bytes in 1 blocks are definitely lost in loss record 186 of 270</text>
<leakedbytes>122</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x402641D</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>operator new(unsigned int)</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>255</line>
</frame>
<frame>
<ip>0x8D0FC45</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibraryPrivate::findOrCreate(QString const&amp;, QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8D10347</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::setFileNameAndVersion(QString const&amp;, int)</fn>
</frame>
<frame>
<ip>0x8D10404</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::QLibrary(QString const&amp;, int, QObject*)</fn>
</frame>
<frame>
<ip>0x859BD96</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>qt_load_library_runtime(char const*, int, int, char const*)</fn>
</frame>
<frame>
<ip>0x859C93C</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long)</fn>
</frame>
<frame>
<ip>0x853EEDC</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long)</fn>
</frame>
<frame>
<ip>0x853F766</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QApplication::QApplication(int&amp;, char**, int)</fn>
</frame>
<frame>
<ip>0x805209E</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>createApplication(int&amp;, char**)</fn>
<dir>/home/chris/untitled/qmlapplicationviewer</dir>
<file>qmlapplicationviewer.cpp</file>
<line>175</line>
</frame>
<frame>
<ip>0x805185F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>main</fn>
<dir>/home/chris/untitled</dir>
<file>main.cpp</file>
<line>6</line>
</frame>
</stack>
</error>
<error>
<unique>0x10a</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>124 bytes in 1 blocks are definitely lost in loss record 187 of 270</text>
<leakedbytes>124</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x4026864</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>malloc</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>236</line>
</frame>
<frame>
<ip>0x4635902</ip>
<obj>/usr/lib/i386-linux-gnu/libxcb.so.1.1.0</obj>
<fn>get_peer_sock_name</fn>
<dir>/build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src</dir>
<file>xcb_auth.c</file>
<line>259</line>
</frame>
<frame>
<ip>0x4635A04</ip>
<obj>/usr/lib/i386-linux-gnu/libxcb.so.1.1.0</obj>
<fn>_xcb_get_auth_info</fn>
<dir>/build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src</dir>
<file>xcb_auth.c</file>
<line>302</line>
</frame>
<frame>
<ip>0x46353D1</ip>
<obj>/usr/lib/i386-linux-gnu/libxcb.so.1.1.0</obj>
<fn>xcb_connect_to_display_with_auth_info</fn>
<dir>/build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src</dir>
<file>xcb_util.c</file>
<line>424</line>
</frame>
<frame>
<ip>0x46355DB</ip>
<obj>/usr/lib/i386-linux-gnu/libxcb.so.1.1.0</obj>
<fn>xcb_connect</fn>
<dir>/build/buildd/libxcb-1.7/obj-i686-linux-gnu/src/../../src</dir>
<file>xcb_util.c</file>
<line>395</line>
</frame>
<frame>
<ip>0x4169A22</ip>
<obj>/usr/lib/i386-linux-gnu/libX11.so.6.3.0</obj>
<fn>_XConnectXCB</fn>
</frame>
<frame>
<ip>0x41598F3</ip>
<obj>/usr/lib/i386-linux-gnu/libX11.so.6.3.0</obj>
<fn>XOpenDisplay</fn>
</frame>
<frame>
<ip>0x859E45F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long)</fn>
</frame>
<frame>
<ip>0x853EEDC</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long)</fn>
</frame>
<frame>
<ip>0x853F766</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QApplication::QApplication(int&amp;, char**, int)</fn>
</frame>
<frame>
<ip>0x805209E</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>createApplication(int&amp;, char**)</fn>
<dir>/home/chris/untitled/qmlapplicationviewer</dir>
<file>qmlapplicationviewer.cpp</file>
<line>175</line>
</frame>
<frame>
<ip>0x805185F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>main</fn>
<dir>/home/chris/untitled</dir>
<file>main.cpp</file>
<line>6</line>
</frame>
</stack>
</error>
<error>
<unique>0x10f</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>138 (56 direct, 82 indirect) bytes in 1 blocks are definitely lost in loss record 192 of 270</text>
<leakedbytes>138</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x402641D</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>operator new(unsigned int)</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>255</line>
</frame>
<frame>
<ip>0x8D0FC45</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibraryPrivate::findOrCreate(QString const&amp;, QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8D10347</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::setFileNameAndVersion(QString const&amp;, int)</fn>
</frame>
<frame>
<ip>0x8D10404</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::QLibrary(QString const&amp;, int, QObject*)</fn>
</frame>
<frame>
<ip>0x859BD96</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>qt_load_library_runtime(char const*, int, int, char const*)</fn>
</frame>
<frame>
<ip>0x859DE94</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long)</fn>
</frame>
<frame>
<ip>0x853EEDC</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long)</fn>
</frame>
<frame>
<ip>0x853F766</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QApplication::QApplication(int&amp;, char**, int)</fn>
</frame>
<frame>
<ip>0x805209E</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>createApplication(int&amp;, char**)</fn>
<dir>/home/chris/untitled/qmlapplicationviewer</dir>
<file>qmlapplicationviewer.cpp</file>
<line>175</line>
</frame>
<frame>
<ip>0x805185F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>main</fn>
<dir>/home/chris/untitled</dir>
<file>main.cpp</file>
<line>6</line>
</frame>
</stack>
</error>
<error>
<unique>0x114</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>158 (56 direct, 102 indirect) bytes in 1 blocks are definitely lost in loss record 197 of 270</text>
<leakedbytes>158</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x402641D</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>operator new(unsigned int)</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>255</line>
</frame>
<frame>
<ip>0x8D0FC45</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibraryPrivate::findOrCreate(QString const&amp;, QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8D1023F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::setFileNameAndVersion(QString const&amp;, QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8D102A4</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::QLibrary(QString const&amp;, QString const&amp;, QObject*)</fn>
</frame>
<frame>
<ip>0x8C8FCCD</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>qt_initIcu(QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8C4B0CF</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLocalePrivate::updateSystemPrivate()</fn>
</frame>
<frame>
<ip>0x8C4B3C6</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>systemPrivate()</fn>
</frame>
<frame>
<ip>0x8C4B40C</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>defaultPrivate()</fn>
</frame>
<frame>
<ip>0x8C4B55F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLocale::QLocale()</fn>
</frame>
<frame>
<ip>0x8CCF6F3</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QResourceFileEngine::QResourceFileEngine(QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8CF87DC</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>_q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry&amp;, QFileSystemMetaData&amp;, QAbstractFileEngine*&amp;, bool)</fn>
</frame>
<frame>
<ip>0x8CF8947</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QFileSystemEngine::resolveEntryAndCreateLegacyEngine(QFileSystemEntry&amp;, QFileSystemMetaData&amp;)</fn>
</frame>
</stack>
</error>
<error>
<unique>0x116</unique>
<tid>1</tid>
<kind>Leak_PossiblyLost</kind>
<xwhat>
<text>160 bytes in 1 blocks are possibly lost in loss record 199 of 270</text>
<leakedbytes>160</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x4025315</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>calloc</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>467</line>
</frame>
<frame>
<ip>0x4010CD7</ip>
<obj>/lib/i386-linux-gnu/ld-2.13.so</obj>
<fn>allocate_dtv</fn>
<dir>/build/buildd/eglibc-2.13/elf</dir>
<file>dl-tls.c</file>
<line>300</line>
</frame>
<frame>
<ip>0x401146B</ip>
<obj>/lib/i386-linux-gnu/ld-2.13.so</obj>
<fn>_dl_allocate_tls</fn>
<dir>/build/buildd/eglibc-2.13/elf</dir>
<file>dl-tls.c</file>
<line>464</line>
</frame>
<frame>
<ip>0x433E5C6</ip>
<obj>/lib/i386-linux-gnu/libpthread-2.13.so</obj>
<fn>pthread_create@@GLIBC_2.1</fn>
<dir>/build/buildd/eglibc-2.13/nptl</dir>
<file>allocatestack.c</file>
<line>570</line>
</frame>
<frame>
<ip>0x83A6BED</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QTWTF::TCMalloc_PageHeap::initializeScavenger()</fn>
</frame>
<frame>
<ip>0x83A92E9</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QTWTF::TCMalloc_ThreadCache::InitModule()</fn>
</frame>
<frame>
<ip>0x83AA188</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QTWTF::fastMalloc(unsigned int)</fn>
</frame>
<frame>
<ip>0x83AEE4B</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QTWTF::initializeThreading()</fn>
</frame>
<frame>
<ip>0x8338CBF</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QTJSC::initializeThreading()</fn>
</frame>
<frame>
<ip>0x82897BE</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QScriptEnginePrivate::QScriptEnginePrivate()</fn>
</frame>
<frame>
<ip>0x828AAB2</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QScriptEngine::QScriptEngine()</fn>
</frame>
<frame>
<ip>0x8063261</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate*)</fn>
</frame>
</stack>
</error>
<error>
<unique>0x117</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>160 (40 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 200 of 270</text>
<leakedbytes>160</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x4026864</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>malloc</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>236</line>
</frame>
<frame>
<ip>0x4565FAB</ip>
<obj>/lib/i386-linux-gnu/libc-2.13.so</obj>
<fn>nss_parse_service_list</fn>
<dir>/build/buildd/eglibc-2.13/nss</dir>
<file>nsswitch.c</file>
<line>626</line>
</frame>
<frame>
<ip>0x4566584</ip>
<obj>/lib/i386-linux-gnu/libc-2.13.so</obj>
<fn>__nss_database_lookup</fn>
<dir>/build/buildd/eglibc-2.13/nss</dir>
<file>nsswitch.c</file>
<line>167</line>
</frame>
<frame>
<ip>0x6BAAE9B</ip>
</frame>
<frame>
<ip>0x6BAC9F4</ip>
</frame>
<frame>
<ip>0x451C7EA</ip>
<obj>/lib/i386-linux-gnu/libc-2.13.so</obj>
<fn>getpwuid_r@@GLIBC_2.1.2</fn>
<dir>/build/buildd/eglibc-2.13/pwd/../nss</dir>
<file>getXXbyYY_r.c</file>
<line>256</line>
</frame>
<frame>
<ip>0x85A34E4</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>sm_performSaveYourself(QSessionManagerPrivate*)</fn>
</frame>
<frame>
<ip>0x85A3F56</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>sm_saveYourselfCallback(_SmcConn*, void*, int, int, int, int)</fn>
</frame>
<frame>
<ip>0x4047727</ip>
<obj>/usr/lib/i386-linux-gnu/libSM.so.6.0.1</obj>
<fn>_SmcProcessMessage</fn>
</frame>
<frame>
<ip>0x405D1B5</ip>
<obj>/usr/lib/i386-linux-gnu/libICE.so.6.3.0</obj>
<fn>IceProcessMessages</fn>
</frame>
<frame>
<ip>0x858FE67</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QSmSocketReceiver::socketActivated(int)</fn>
</frame>
<frame>
<ip>0x8D3A9C1</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QMetaObject::activate(QObject*, QMetaObject const*, int, void**)</fn>
</frame>
</stack>
</error>
<error>
<unique>0x118</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>166 (56 direct, 110 indirect) bytes in 1 blocks are definitely lost in loss record 201 of 270</text>
<leakedbytes>166</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x402641D</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>operator new(unsigned int)</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>255</line>
</frame>
<frame>
<ip>0x8D0FC45</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibraryPrivate::findOrCreate(QString const&amp;, QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8D1023F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::setFileNameAndVersion(QString const&amp;, QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8D102A4</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLibrary::QLibrary(QString const&amp;, QString const&amp;, QObject*)</fn>
</frame>
<frame>
<ip>0x8C8FA56</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>qt_initIcu(QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8C4B0CF</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLocalePrivate::updateSystemPrivate()</fn>
</frame>
<frame>
<ip>0x8C4B3C6</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>systemPrivate()</fn>
</frame>
<frame>
<ip>0x8C4B40C</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>defaultPrivate()</fn>
</frame>
<frame>
<ip>0x8C4B55F</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QLocale::QLocale()</fn>
</frame>
<frame>
<ip>0x8CCF6F3</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QResourceFileEngine::QResourceFileEngine(QString const&amp;)</fn>
</frame>
<frame>
<ip>0x8CF87DC</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>_q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry&amp;, QFileSystemMetaData&amp;, QAbstractFileEngine*&amp;, bool)</fn>
</frame>
<frame>
<ip>0x8CF8947</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QFileSystemEngine::resolveEntryAndCreateLegacyEngine(QFileSystemEntry&amp;, QFileSystemMetaData&amp;)</fn>
</frame>
</stack>
</error>
<error>
<unique>0x11d</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>216 bytes in 1 blocks are definitely lost in loss record 206 of 270</text>
<leakedbytes>216</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x4026864</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>malloc</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>236</line>
</frame>
<frame>
<ip>0x4193FB2</ip>
<obj>/usr/lib/i386-linux-gnu/libX11.so.6.3.0</obj>
<fn>_XimOpenIM</fn>
</frame>
<frame>
<ip>0x4193BCF</ip>
<obj>/usr/lib/i386-linux-gnu/libX11.so.6.3.0</obj>
<fn>_XimRegisterIMInstantiateCallback</fn>
</frame>
<frame>
<ip>0x41789A7</ip>
<obj>/usr/lib/i386-linux-gnu/libX11.so.6.3.0</obj>
<fn>XRegisterIMInstantiateCallback</fn>
</frame>
<frame>
<ip>0x89FB291</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QXIMInputContext::QXIMInputContext()</fn>
</frame>
<frame>
<ip>0x89F9450</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QInputContextFactory::create(QString const&amp;, QObject*)</fn>
</frame>
<frame>
<ip>0x85361C7</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QApplication::inputContext() const</fn>
</frame>
<frame>
<ip>0x85662A7</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QWidgetPrivate::inputContext() const</fn>
</frame>
<frame>
<ip>0x8571D7C</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QWidget::setAttribute(Qt::WidgetAttribute, bool)</fn>
</frame>
<frame>
<ip>0x8A54527</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QGraphicsViewPrivate::updateInputMethodSensitivity()</fn>
</frame>
<frame>
<ip>0x8A55E1A</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QGraphicsView::setScene(QGraphicsScene*)</fn>
</frame>
<frame>
<ip>0x805273E</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QDeclarativeViewPrivate::init()</fn>
</frame>
</stack>
</error>
<error>
<unique>0x126</unique>
<tid>1</tid>
<kind>Leak_PossiblyLost</kind>
<xwhat>
<text>360 bytes in 3 blocks are possibly lost in loss record 215 of 270</text>
<leakedbytes>360</leakedbytes>
<leakedblocks>3</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x402517B</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>memalign</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>581</line>
</frame>
<frame>
<ip>0x40251D8</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>posix_memalign</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>709</line>
</frame>
<frame>
<ip>0x42BE546</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
</frame>
<frame>
<ip>0x42BFA4C</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_slice_alloc</fn>
</frame>
<frame>
<ip>0x42C06DD</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_slist_prepend</fn>
</frame>
<frame>
<ip>0x42C368E</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_strsplit</fn>
</frame>
<frame>
<ip>0x42D9393</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_get_language_names</fn>
</frame>
<frame>
<ip>0x42D98E6</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
</frame>
<frame>
<ip>0x42CB919</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_thread_init_glib</fn>
</frame>
<frame>
<ip>0x4254506</ip>
<obj>/usr/lib/i386-linux-gnu/libgthread-2.0.so.0.2800.6</obj>
<fn>g_thread_init</fn>
</frame>
<frame>
<ip>0x8D4D458</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*)</fn>
</frame>
<frame>
<ip>0x85C7CA5</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QGuiEventDispatcherGlibPrivate::QGuiEventDispatcherGlibPrivate()</fn>
</frame>
</stack>
</error>
<error>
<unique>0x128</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>396 (256 direct, 140 indirect) bytes in 2 blocks are definitely lost in loss record 217 of 270</text>
<leakedbytes>396</leakedbytes>
<leakedblocks>2</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x4026864</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>malloc</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>236</line>
</frame>
<frame>
<ip>0x4086087</ip>
<obj>/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4</obj>
</frame>
<frame>
<ip>0x4086F7C</ip>
<obj>/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4</obj>
</frame>
<frame>
<ip>0x4087073</ip>
<obj>/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4</obj>
</frame>
<frame>
<ip>0x408C6EB</ip>
<obj>/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4</obj>
</frame>
<frame>
<ip>0x4607790</ip>
<obj>/lib/i386-linux-gnu/libexpat.so.1.5.2</obj>
</frame>
<frame>
<ip>0x4608670</ip>
<obj>/lib/i386-linux-gnu/libexpat.so.1.5.2</obj>
</frame>
<frame>
<ip>0x4608F92</ip>
<obj>/lib/i386-linux-gnu/libexpat.so.1.5.2</obj>
</frame>
<frame>
<ip>0x460A7D9</ip>
<obj>/lib/i386-linux-gnu/libexpat.so.1.5.2</obj>
</frame>
<frame>
<ip>0x460C5F2</ip>
<obj>/lib/i386-linux-gnu/libexpat.so.1.5.2</obj>
<fn>XML_ParseBuffer</fn>
</frame>
<frame>
<ip>0x408B2B2</ip>
<obj>/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4</obj>
<fn>FcConfigParseAndLoad</fn>
</frame>
<frame>
<ip>0x408B60B</ip>
<obj>/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4</obj>
<fn>FcConfigParseAndLoad</fn>
</frame>
</stack>
</error>
<error>
<unique>0x144</unique>
<tid>1</tid>
<kind>Leak_PossiblyLost</kind>
<xwhat>
<text>1,240 bytes in 5 blocks are possibly lost in loss record 245 of 270</text>
<leakedbytes>1240</leakedbytes>
<leakedblocks>5</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x402517B</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>memalign</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>581</line>
</frame>
<frame>
<ip>0x40251D8</ip>
<obj>/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so</obj>
<fn>posix_memalign</fn>
<dir>/build/buildd/valgrind-3.6.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>709</line>
</frame>
<frame>
<ip>0x42BE546</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
</frame>
<frame>
<ip>0x42BFA4C</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_slice_alloc</fn>
</frame>
<frame>
<ip>0x42729D8</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_array_sized_new</fn>
</frame>
<frame>
<ip>0x4272AB2</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_array_new</fn>
</frame>
<frame>
<ip>0x42CB7FE</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_static_private_set</fn>
</frame>
<frame>
<ip>0x4282D0E</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_get_filename_charsets</fn>
</frame>
<frame>
<ip>0x4282D9C</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
</frame>
<frame>
<ip>0x42CB909</ip>
<obj>/lib/i386-linux-gnu/libglib-2.0.so.0.2800.6</obj>
<fn>g_thread_init_glib</fn>
</frame>
<frame>
<ip>0x4254506</ip>
<obj>/usr/lib/i386-linux-gnu/libgthread-2.0.so.0.2800.6</obj>
<fn>g_thread_init</fn>
</frame>
<frame>
<ip>0x8D4D458</ip>
<obj>/home/chris/untitled/untitled</obj>
<fn>QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*)</fn>
</frame>
</stack>
</error>
<errorcounts>
</errorcounts>
<suppcounts>
<pair>
<count>80</count>
<name>U1004-ARM-_dl_relocate_object</name>
</pair>
</suppcounts>
</valgrindoutput>

View File

@@ -1,16 +1,9 @@
TEMPLATE = subdirs TEMPLATE = subdirs
parsertests.file = parsertests.pro
# avoid race conditions when compiling shadowbuild and having more than one compile job # avoid race conditions when compiling shadowbuild and having more than one compile job
modeldemo.depends = parsertests
modeldemo.file = modeldemo.pro modeldemo.file = modeldemo.pro
testapps.depends = modeldemo
testapps.depends = modeldemo parsertests SUBDIRS += modeldemo testapps
testrunner.file = testrunner.pro
testrunner.depends = testapps
SUBDIRS += parsertests modeldemo testapps testrunner

View File

@@ -4,8 +4,6 @@ Project {
name: "Memcheck autotests" name: "Memcheck autotests"
references: [ references: [
"testapps/testapps.qbs", "testapps/testapps.qbs",
"modeldemo.qbs", "modeldemo.qbs"
"parsertests.qbs",
"testrunner.qbs"
] ]
} }

View File

@@ -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

View File

@@ -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"'
])
}

View File

@@ -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

View File

@@ -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"'
])
}