forked from qt-creator/qt-creator
debugger: work on autotest integration
Change-Id: Iafd07a55e20cd2a65c3bcd23208c24855aeb429f Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -66,6 +66,13 @@ class Symbol;
|
|||||||
class DebuggerToolTipManager;
|
class DebuggerToolTipManager;
|
||||||
class GlobalDebuggerOptions;
|
class GlobalDebuggerOptions;
|
||||||
|
|
||||||
|
enum TestCases
|
||||||
|
{
|
||||||
|
// Gdb
|
||||||
|
TestNoBoundsOfCurrentFunction = 1,
|
||||||
|
TestPythonDumpers
|
||||||
|
};
|
||||||
|
|
||||||
class DebuggerCore : public QObject
|
class DebuggerCore : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -89,6 +89,8 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <projectexplorer/abi.h>
|
#include <projectexplorer/abi.h>
|
||||||
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorersettings.h>
|
#include <projectexplorer/projectexplorersettings.h>
|
||||||
@@ -127,6 +129,12 @@
|
|||||||
#include <QtGui/QTreeWidget>
|
#include <QtGui/QTreeWidget>
|
||||||
#include <QtGui/QInputDialog>
|
#include <QtGui/QInputDialog>
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
#include <QtTest/QTest>
|
||||||
|
#include <QtTest/QSignalSpy>
|
||||||
|
#include <QtTest/QTestEventLoop>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
#define DEBUG_STATE 1
|
#define DEBUG_STATE 1
|
||||||
@@ -824,6 +832,14 @@ public slots:
|
|||||||
void evaluateExpression(const QString &expression);
|
void evaluateExpression(const QString &expression);
|
||||||
void coreShutdown();
|
void coreShutdown();
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
public slots:
|
||||||
|
void testStuff(int testCase);
|
||||||
|
void testProjectLoaded(ProjectExplorer::Project *project);
|
||||||
|
void testRunControlFinished();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateDebugActions();
|
void updateDebugActions();
|
||||||
|
|
||||||
@@ -3632,6 +3648,106 @@ QAction *DebuggerPlugin::visibleDebugAction()
|
|||||||
return theDebuggerCore->m_visibleStartAction;
|
return theDebuggerCore->m_visibleStartAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
|
||||||
|
static bool g_success;
|
||||||
|
|
||||||
|
class TestCase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TestCases id;
|
||||||
|
DebuggerEngineType suitableEngine;
|
||||||
|
bool needsProject;
|
||||||
|
};
|
||||||
|
|
||||||
|
static TestCase theTests[] =
|
||||||
|
{
|
||||||
|
{ TestNoBoundsOfCurrentFunction, GdbEngineType, true },
|
||||||
|
{ TestPythonDumpers, GdbEngineType, true },
|
||||||
|
};
|
||||||
|
|
||||||
|
void DebuggerPluginPrivate::testStuff(int testCase)
|
||||||
|
{
|
||||||
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
|
connect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(testProjectLoaded(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
|
QString proFile = ICore::instance()->resourcePath() + "/../../tests/manual/debugger/simple/simple.pro";
|
||||||
|
QString error;
|
||||||
|
if (!pe->openProject(proFile,&error)) {
|
||||||
|
qWarning("Cannot open %s: %s", qPrintable(proFile), qPrintable(error));
|
||||||
|
QVERIFY(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_success == false;
|
||||||
|
QTestEventLoop::instance().enterLoop(20);
|
||||||
|
|
||||||
|
//QCOMPARE(spy.count(), 1); // make sure the signal was emitted exactly one time
|
||||||
|
//QList<QVariant> arguments = spy.takeFirst(); // take the first signal
|
||||||
|
|
||||||
|
//QVERIFY(arguments.at(0).toBool() == true); // verify the first argument
|
||||||
|
QVERIFY(g_success);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerPluginPrivate::testProjectLoaded(Project *project)
|
||||||
|
{
|
||||||
|
if (!project) {
|
||||||
|
qWarning("Changed to null project.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString fileName = project->file()->fileName();
|
||||||
|
QVERIFY(!fileName.isEmpty());
|
||||||
|
qWarning("Project %s loaded", qPrintable(fileName));
|
||||||
|
|
||||||
|
Target *target = project->activeTarget();
|
||||||
|
QVERIFY(target);
|
||||||
|
qWarning("Target %s selected", qPrintable(target->displayName()));
|
||||||
|
|
||||||
|
BuildConfiguration *bc = target->activeBuildConfiguration();
|
||||||
|
QVERIFY(bc);
|
||||||
|
|
||||||
|
RunConfiguration *rc = target->activeRunConfiguration();
|
||||||
|
QVERIFY(rc);
|
||||||
|
|
||||||
|
LocalApplicationRunConfiguration *lrc =
|
||||||
|
qobject_cast<LocalApplicationRunConfiguration *>(rc);
|
||||||
|
QVERIFY(lrc);
|
||||||
|
|
||||||
|
ToolChain *tc = bc->toolChain();
|
||||||
|
QVERIFY(tc);
|
||||||
|
|
||||||
|
DebuggerStartParameters sp;
|
||||||
|
sp.toolChainAbi = tc->targetAbi();
|
||||||
|
sp.executable = lrc->executable();
|
||||||
|
|
||||||
|
RunControl *rctl = createDebugger(sp);
|
||||||
|
QVERIFY(rctl);
|
||||||
|
|
||||||
|
connect(rctl, SIGNAL(finished()), this, SLOT(testRunControlFinished()));
|
||||||
|
ProjectExplorerPlugin::instance()->startRunControl(rctl, DebugRunMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerPluginPrivate::testRunControlFinished()
|
||||||
|
{
|
||||||
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
|
qWarning("Run control finished.");
|
||||||
|
g_success = true;
|
||||||
|
|
||||||
|
disconnect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(testProjectLoaded(ProjectExplorer::Project*)));
|
||||||
|
QTestEventLoop::instance().exitLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerPlugin::testPythonDumpers()
|
||||||
|
{
|
||||||
|
//theDebuggerCore->testStuff(TestDumpers);
|
||||||
|
theDebuggerCore->testStuff(TestPythonDumpers);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#include "debuggerplugin.moc"
|
#include "debuggerplugin.moc"
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ private:
|
|||||||
void remoteCommand(const QStringList &options, const QStringList &arguments);
|
void remoteCommand(const QStringList &options, const QStringList &arguments);
|
||||||
ShutdownFlag aboutToShutdown();
|
ShutdownFlag aboutToShutdown();
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
private slots:
|
||||||
|
void testPythonDumpers();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -2114,7 +2114,7 @@ void GdbEngine::executeNext()
|
|||||||
if (isReverseDebugging()) {
|
if (isReverseDebugging()) {
|
||||||
postCommand("reverse-next", RunRequest, CB(handleExecuteNext));
|
postCommand("reverse-next", RunRequest, CB(handleExecuteNext));
|
||||||
} else {
|
} else {
|
||||||
scheduleTestResponse(GdbTestNoBoundsOfCurrentFunction,
|
scheduleTestResponse(TestNoBoundsOfCurrentFunction,
|
||||||
"@TOKEN@^error,msg=\"Warning:\\nCannot insert breakpoint -39.\\n"
|
"@TOKEN@^error,msg=\"Warning:\\nCannot insert breakpoint -39.\\n"
|
||||||
" Error accessing memory address 0x11673fc: Input/output error.\\n\"");
|
" Error accessing memory address 0x11673fc: Input/output error.\\n\"");
|
||||||
postCommand("-exec-next", RunRequest, CB(handleExecuteNext));
|
postCommand("-exec-next", RunRequest, CB(handleExecuteNext));
|
||||||
|
|||||||
@@ -78,12 +78,6 @@ enum DebuggingHelperState
|
|||||||
DebuggingHelperUnavailable
|
DebuggingHelperUnavailable
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum GdbTestCase
|
|
||||||
{
|
|
||||||
GdbTestNoBoundsOfCurrentFunction = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
class UpdateParameters
|
class UpdateParameters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user