forked from qt-creator/qt-creator
debugger: work on auto test
This commit is contained in:
@@ -1172,7 +1172,7 @@ void DebuggerManager::setStatus(int status)
|
|||||||
if (status == m_status)
|
if (status == m_status)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!isAllowedTransition(m_status, status)) {
|
if (0 && !isAllowedTransition(m_status, status)) {
|
||||||
const QString msg = QString::fromLatin1("%1: UNEXPECTED TRANSITION: %2 -> %3").
|
const QString msg = QString::fromLatin1("%1: UNEXPECTED TRANSITION: %2 -> %3").
|
||||||
arg(QLatin1String(Q_FUNC_INFO), QLatin1String(stateName(m_status)), QLatin1String(stateName(status)));
|
arg(QLatin1String(Q_FUNC_INFO), QLatin1String(stateName(m_status)), QLatin1String(stateName(status)));
|
||||||
qWarning("%s", qPrintable(msg));
|
qWarning("%s", qPrintable(msg));
|
||||||
@@ -1449,4 +1449,27 @@ void DebuggerManager::reloadRegisters()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Testing
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void DebuggerManager::runTest(const QString &fileName)
|
||||||
|
{
|
||||||
|
m_executable = fileName;
|
||||||
|
m_processArgs = QStringList() << "--run-debuggee";
|
||||||
|
m_workingDir = QString();
|
||||||
|
qDebug() << "TESTING: " << fileName;
|
||||||
|
//QFile file(fileName);
|
||||||
|
//file.open(QIODevice::ReadOnly);
|
||||||
|
//QTextStream ts(&file);
|
||||||
|
//foreach (QString line, ts.readAll().split('\n')) {
|
||||||
|
// qDebug() << "TESTING: " << line;
|
||||||
|
// if (line.startsWith("Executable="))
|
||||||
|
//}
|
||||||
|
|
||||||
|
startNewDebugger(StartInternal);
|
||||||
|
}
|
||||||
|
|
||||||
#include "debuggermanager.moc"
|
#include "debuggermanager.moc"
|
||||||
|
@@ -341,6 +341,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void setDebuggerType(DebuggerType type);
|
void setDebuggerType(DebuggerType type);
|
||||||
|
void runTest(const QString &fileName);
|
||||||
QDockWidget *createDockForWidget(QWidget *widget);
|
QDockWidget *createDockForWidget(QWidget *widget);
|
||||||
Q_SLOT void createNewDock(QWidget *widget);
|
Q_SLOT void createNewDock(QWidget *widget);
|
||||||
|
|
||||||
|
@@ -797,6 +797,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
|
|||||||
void DebuggerPlugin::extensionsInitialized()
|
void DebuggerPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
// time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
|
// time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
|
||||||
|
qDebug() << "EXTENSIONS INITIALIZED";
|
||||||
|
QByteArray env = qgetenv("QTC_DEBUGGER_TEST");
|
||||||
|
if (!env.isEmpty())
|
||||||
|
m_manager->runTest(QString::fromLocal8Bit(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Activates the previous mode when the current mode is the debug mode. */
|
/*! Activates the previous mode when the current mode is the debug mode. */
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
QT += testlib
|
QT = core testlib
|
||||||
|
|
||||||
DEBUGGERDIR = ../../../src/plugins/debugger
|
DEBUGGERDIR = ../../../src/plugins/debugger
|
||||||
UTILSDIR = ../../../src/libs
|
UTILSDIR = ../../../src/libs
|
||||||
|
@@ -2,7 +2,10 @@
|
|||||||
#include "gdbmi.h"
|
#include "gdbmi.h"
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QProcess>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
//#include <QtTest/qtest_gui.h>
|
||||||
|
|
||||||
using namespace Debugger;
|
using namespace Debugger;
|
||||||
using namespace Debugger::Internal;
|
using namespace Debugger::Internal;
|
||||||
@@ -35,7 +38,6 @@ static const char test5[] =
|
|||||||
"file=\"test1.cpp\",fullname=\"/home/apoenitz/work/test1/test1.cpp\","
|
"file=\"test1.cpp\",fullname=\"/home/apoenitz/work/test1/test1.cpp\","
|
||||||
"line=\"209\"}]";
|
"line=\"209\"}]";
|
||||||
|
|
||||||
|
|
||||||
static const char test8[] =
|
static const char test8[] =
|
||||||
"[data={locals={{name=\"a\"},{name=\"w\"}}}]";
|
"[data={locals={{name=\"a\"},{name=\"w\"}}}]";
|
||||||
|
|
||||||
@@ -77,9 +79,48 @@ private slots:
|
|||||||
void mi10() { testMi(test10); }
|
void mi10() { testMi(test10); }
|
||||||
void mi11() { testMi(test11); }
|
void mi11() { testMi(test11); }
|
||||||
void mi12() { testMi(test12); }
|
void mi12() { testMi(test12); }
|
||||||
|
void runQtc();
|
||||||
};
|
};
|
||||||
|
|
||||||
QTEST_MAIN(tst_Debugger)
|
void tst_Debugger::runQtc()
|
||||||
|
{
|
||||||
|
QString test = QFileInfo(qApp->arguments().at(0)).absoluteFilePath();
|
||||||
|
//QString qtc = QFileInfo(test + "../../bin/qtcreator.bin").absoluteFilePath();
|
||||||
|
QString qtc = QFileInfo(test).absolutePath() + "/../../../bin/qtcreator.bin";
|
||||||
|
qtc = QFileInfo(qtc).absoluteFilePath();
|
||||||
|
QProcess proc;
|
||||||
|
QStringList env = QProcess::systemEnvironment();
|
||||||
|
env.append("QTC_DEBUGGER_TEST=" + test);
|
||||||
|
proc.setEnvironment(env);
|
||||||
|
qDebug() << "APP: " << test << qtc;
|
||||||
|
foreach (QString item, env)
|
||||||
|
qDebug() << item;
|
||||||
|
proc.start(qtc);
|
||||||
|
proc.waitForStarted();
|
||||||
|
QCOMPARE(proc.state(), QProcess::Running);
|
||||||
|
proc.waitForFinished();
|
||||||
|
QCOMPARE(proc.state(), QProcess::NotRunning);
|
||||||
|
}
|
||||||
|
|
||||||
|
void runDebuggee()
|
||||||
|
{
|
||||||
|
qDebug() << "RUNNING DEBUGGEE";
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QCoreApplication app(argc, argv);
|
||||||
|
QStringList args = app.arguments();
|
||||||
|
|
||||||
|
|
||||||
|
if (args.size() == 2 && args.at(1) == "--run-debuggee") {
|
||||||
|
runDebuggee();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tst_Debugger test;
|
||||||
|
return QTest::qExec(&test, argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
#include "main.moc"
|
#include "main.moc"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user