Commit f6e2cfc2 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Autotests: Add some helpful output on failure.



These turned out to be useful when investigating test failures.

Change-Id: I2e588123dba84bfdfa1094d70bc604e7dfca02ea
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent ad58c2bb
......@@ -209,7 +209,7 @@ void tst_PluginManager::circularPlugins()
QCOMPARE(spec->state(), PluginSpec::Resolved);
QCOMPARE(spec->plugin(), (IPlugin*)0);
} else if (spec->name() == "plugin2") {
QVERIFY(!spec->hasError());
QVERIFY2(!spec->hasError(), qPrintable(spec->errorString()));
QCOMPARE(spec->state(), PluginSpec::Running);
} else if (spec->name() == "plugin3") {
QVERIFY(spec->hasError());
......
......@@ -246,7 +246,7 @@ void tst_PluginSpec::loadLibrary()
PluginManager *manager = new PluginManager();
QVERIFY(spec->read("testplugin/testplugin.xml"));
QVERIFY(spec->resolveDependencies(QList<PluginSpec *>()));
QVERIFY(spec->loadLibrary());
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString));
QVERIFY(spec->plugin != 0);
QVERIFY(QString::fromLocal8Bit(spec->plugin->metaObject()->className()) == QString::fromLocal8Bit("MyPlugin::MyPluginImpl"));
QCOMPARE(spec->state, PluginSpec::Loaded);
......@@ -261,7 +261,7 @@ void tst_PluginSpec::initializePlugin()
Internal::PluginSpecPrivate spec(0);
QVERIFY(spec.read("testplugin/testplugin.xml"));
QVERIFY(spec.resolveDependencies(QList<PluginSpec *>()));
QVERIFY(spec.loadLibrary());
QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString));
bool isInitialized;
QMetaObject::invokeMethod(spec.plugin, "isInitialized",
Qt::DirectConnection, Q_RETURN_ARG(bool, isInitialized));
......@@ -279,7 +279,7 @@ void tst_PluginSpec::initializeExtensions()
Internal::PluginSpecPrivate spec(0);
QVERIFY(spec.read("testplugin/testplugin.xml"));
QVERIFY(spec.resolveDependencies(QList<PluginSpec *>()));
QVERIFY(spec.loadLibrary());
QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString));
bool isExtensionsInitialized;
QVERIFY(spec.initializePlugin());
QMetaObject::invokeMethod(spec.plugin, "isExtensionsInitialized",
......
......@@ -91,11 +91,7 @@ void dumpError(const Error &e)
static QString fakeValgrindExecutable()
{
QString ret(VALGRIND_FAKE_PATH);
QFileInfo fileInfo(ret);
Q_ASSERT(fileInfo.isExecutable());
Q_ASSERT(!fileInfo.isDir());
return ret;
return QLatin1String(VALGRIND_FAKE_PATH);
}
static QString dataFile(const QLatin1String &file)
......@@ -118,8 +114,13 @@ void ParserTests::initTest(const QLatin1String &testfile, const QStringList &oth
m_process = new QProcess(m_server);
m_process->setProcessChannelMode(QProcess::ForwardedChannels);
const QString fakeValgrind = fakeValgrindExecutable();
QFileInfo fileInfo(fakeValgrind);
QVERIFY2(fileInfo.isExecutable(), qPrintable(fakeValgrind));
QVERIFY2(!fileInfo.isDir(), qPrintable(fakeValgrind));
m_process->start(
fakeValgrindExecutable(),
fakeValgrind,
QStringList()
<< QString::fromLatin1("--xml-socket=127.0.0.1:%1").arg(m_server->serverPort())
<< QLatin1String("-i")
......
......@@ -76,7 +76,8 @@ TestRunner::TestRunner(QObject *parent)
QString TestRunner::runTestBinary(const QString &binary, const QStringList &vArgs)
{
const QString binPath = appBinDir + QDir::separator() + binary;
Q_ASSERT(QFileInfo(binPath).isExecutable());
if (!QFileInfo(binPath).isExecutable())
qFatal("No such test app: %s", qPrintable(binPath));
m_runner->setValgrindArguments(QStringList() << "--num-callers=50" << "--track-origins=yes" << vArgs);
m_runner->setDebuggeeExecutable(binPath);
m_runner->start();
......
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