Commit 8f9d61fc authored by Manuel Breugelmans's avatar Manuel Breugelmans

Memory leaks (regression)

parent ceb85ed0
......@@ -78,7 +78,13 @@ Executable::Executable()
}
Executable::~Executable()
{}
{
if (m_output) {
m_output->close();
delete m_output;
}
removeTempFiles();
}
void Executable::setLocation(const KUrl& url)
{
......@@ -264,7 +270,10 @@ void Executable::initTempOutputFile()
m_stdOutFilePath = pathPrefix + "-out.tmp";
m_stdErrFilePath = pathPrefix + "-err.tmp";
m_textOutFilePath = pathPrefix + "-txt.tmp";
if (m_output) delete m_output;
if (m_output) {
m_output->close();
delete m_output;
}
m_output = new QFile(m_outputPath);
QFile err(m_stdErrFilePath);
......
......@@ -127,6 +127,7 @@ void Case::setSource(const KUrl& source)
Case::~Case()
{
if (m_executable) delete m_executable;
}
bool Case::shouldRun() const
......
......@@ -23,8 +23,7 @@
#include "../xmlregister.h"
#include "../qtestsettings.h"
#include "../qtestmodelitems.h"
#include "../qtestmodelitems.h"
#include "../qtestmodelitems.h"
#include "../qtestconfig.h"
#include <kasserts.h>
......@@ -89,13 +88,15 @@ class FakeSettings : public ISettings
void QTestRegisterTest::init()
{
reg = new XmlRegister();
reg->setSettings( new FakeSettings() );
m_settings = new FakeSettings();
reg->setSettings( m_settings );
}
void QTestRegisterTest::cleanup()
{
if (reg->root()) delete reg->root();
delete reg;
delete m_settings;
}
void QTestRegisterTest::compareSuites(Suite* exp, Suite* actual)
......
......@@ -29,6 +29,8 @@ namespace QTest {
class XmlRegister;
class Suite;
class Case;
class ISettings;
namespace Test {
class QTestRegisterTest : public QObject
......@@ -47,6 +49,7 @@ private slots:
private: // state
QTest::XmlRegister* reg;
QTest::ISettings* m_settings;
private: // helpers
void compareSuites(QTest::Suite* exp,
......
......@@ -55,6 +55,7 @@ Q_DECLARE_METATYPE(QList<QStringList>)
void QTestRunnerTest::init()
{
m_settings = new FakeSettings;
OutputParser::fto_resetResultMemoryLeakStats();
m_runner = new RunnerTestHelper;
m_runner->initializeGUI();
......@@ -64,6 +65,7 @@ void QTestRunnerTest::cleanup()
{
m_runner->cleanupGUI();
delete m_runner;
delete m_settings;
int nrofLeaks = 0;
bool foundLeaks = OutputParser::fto_hasResultMemoryLeaks(nrofLeaks);
......@@ -415,7 +417,7 @@ Veritas::Test* QTestRunnerTest::fetchRoot(QByteArray& testRegistrationXml)
QBuffer buff(&testRegistrationXml);
XmlRegister reg;
reg.setSource(&buff);
reg.setSettings(new FakeSettings());
reg.setSettings(m_settings);
reg.reload(0);
return reg.root();
}
......
......@@ -27,6 +27,7 @@ namespace Veritas { class Test; class RunnerTestHelper; }
namespace QTest
{
class ISettings;
class QTestRunnerTest : public QObject
{
......@@ -53,6 +54,7 @@ private:
private:
Veritas::RunnerTestHelper* m_runner;
ISettings* m_settings;
};
}
......
#!/usr/bin/python
#!/usr/bin/python
# run valgrind's memory error checker on all tests.
# filter uninteresting errors and known false positives
# eg staticly initialized memory from libraries like libfontconfig
......@@ -89,6 +88,8 @@ class BackTrace:
return False # something Qt-Font related, not interested in this
if frame.func.find('__nss_database_lookup') != -1:
return False # more crap
if frame.func.find('KCatalogPrivate::setupGettextEnv()') and frame.sfile=="kcatalog.cpp":
return False
if frame.sfile:
if frame.sfile.find("xtest") != -1 or frame.sfile.find("veritas") != -1:
is_interesting = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment