forked from qt-creator/qt-creator
Debugger: Make autotests auto-configure and compile test project
Change-Id: I2b939409374508687f4ea2e0d4cae65ac62498c7 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -93,6 +93,7 @@
|
|||||||
#include <projectexplorer/abi.h>
|
#include <projectexplorer/abi.h>
|
||||||
#include <projectexplorer/applicationrunconfiguration.h>
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/buildmanager.h>
|
||||||
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
@@ -972,6 +973,8 @@ public slots:
|
|||||||
public slots:
|
public slots:
|
||||||
void testLoadProject(const QString &proFile, const TestCallBack &cb);
|
void testLoadProject(const QString &proFile, const TestCallBack &cb);
|
||||||
void testProjectLoaded(ProjectExplorer::Project *project);
|
void testProjectLoaded(ProjectExplorer::Project *project);
|
||||||
|
void testProjectEvaluated();
|
||||||
|
void testProjectBuilt(bool success);
|
||||||
void testUnloadProject();
|
void testUnloadProject();
|
||||||
void testFinished();
|
void testFinished();
|
||||||
|
|
||||||
@@ -989,6 +992,7 @@ public slots:
|
|||||||
void testBenchmark1();
|
void testBenchmark1();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ProjectExplorer::Project *m_testProject;
|
||||||
bool m_testSuccess;
|
bool m_testSuccess;
|
||||||
QList<TestCallBack> m_testCallbacks;
|
QList<TestCallBack> m_testCallbacks;
|
||||||
|
|
||||||
@@ -3429,10 +3433,13 @@ void DebuggerPluginPrivate::testLoadProject(const QString &proFile, const TestCa
|
|||||||
|
|
||||||
m_testCallbacks.append(cb);
|
m_testCallbacks.append(cb);
|
||||||
QString error;
|
QString error;
|
||||||
if (pe->openProject(proFile, &error))
|
if (pe->openProject(proFile, &error)) {
|
||||||
return; // Will end up in callback.
|
// Will end up in callback below due to the connections to
|
||||||
|
// signal currentProjectChanged().
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Eat the unused callback.
|
// Project opening failed. Eat the unused callback.
|
||||||
qWarning("Cannot open %s: %s", qPrintable(proFile), qPrintable(error));
|
qWarning("Cannot open %s: %s", qPrintable(proFile), qPrintable(error));
|
||||||
QVERIFY(false);
|
QVERIFY(false);
|
||||||
m_testCallbacks.pop_back();
|
m_testCallbacks.pop_back();
|
||||||
@@ -3444,14 +3451,25 @@ void DebuggerPluginPrivate::testProjectLoaded(Project *project)
|
|||||||
qWarning("Changed to null project.");
|
qWarning("Changed to null project.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
m_testProject = project;
|
||||||
disconnect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
connect(project, SIGNAL(proFilesEvaluated()), SLOT(testProjectEvaluated()));
|
||||||
this, SLOT(testProjectLoaded(ProjectExplorer::Project*)));
|
project->configureAsExampleProject(QStringList());
|
||||||
|
}
|
||||||
|
|
||||||
QString fileName = project->document()->fileName();
|
void DebuggerPluginPrivate::testProjectEvaluated()
|
||||||
|
{
|
||||||
|
QString fileName = m_testProject->document()->fileName();
|
||||||
QVERIFY(!fileName.isEmpty());
|
QVERIFY(!fileName.isEmpty());
|
||||||
qWarning("Project %s loaded", qPrintable(fileName));
|
qWarning("Project %s loaded", qPrintable(fileName));
|
||||||
|
connect(ProjectExplorerPlugin::instance()->buildManager(),
|
||||||
|
SIGNAL(buildQueueFinished(bool)),
|
||||||
|
SLOT(testProjectBuilt(bool)));
|
||||||
|
ProjectExplorerPlugin::instance()->buildProject(m_testProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerPluginPrivate::testProjectBuilt(bool success)
|
||||||
|
{
|
||||||
|
QVERIFY(success);
|
||||||
QVERIFY(!m_testCallbacks.isEmpty());
|
QVERIFY(!m_testCallbacks.isEmpty());
|
||||||
TestCallBack cb = m_testCallbacks.takeLast();
|
TestCallBack cb = m_testCallbacks.takeLast();
|
||||||
invoke<void>(cb.receiver, cb.slot);
|
invoke<void>(cb.receiver, cb.slot);
|
||||||
@@ -3474,12 +3492,13 @@ static Kit *currentKit()
|
|||||||
Target *t = activeTarget();
|
Target *t = activeTarget();
|
||||||
if (!t || !t->isEnabled())
|
if (!t || !t->isEnabled())
|
||||||
return 0;
|
return 0;
|
||||||
return activeTarget()->kit();
|
return t->kit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalApplicationRunConfiguration *activeLocalRunConfiguration()
|
static LocalApplicationRunConfiguration *activeLocalRunConfiguration()
|
||||||
{
|
{
|
||||||
return qobject_cast<LocalApplicationRunConfiguration *>(activeTarget()->activeRunConfiguration());
|
Target *t = activeTarget();
|
||||||
|
return t ? qobject_cast<LocalApplicationRunConfiguration *>(t->activeRunConfiguration()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb)
|
void DebuggerPluginPrivate::testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb)
|
||||||
|
|||||||
Reference in New Issue
Block a user