forked from qt-creator/qt-creator
Debugger: Remove in-plugin dumper autotest handling
It's covered by tst_dumper nowadays. Change-Id: Id6b91e5a4ad2ac2472d598c4f0ba4c95c334af6d Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -1429,12 +1429,6 @@ class Dumper:
|
|||||||
if fullUpdateNeeded and not self.tooltipOnly and not self.noLocals:
|
if fullUpdateNeeded and not self.tooltipOnly and not self.noLocals:
|
||||||
locals = listOfLocals(varList)
|
locals = listOfLocals(varList)
|
||||||
|
|
||||||
if "autotest" in options:
|
|
||||||
for item in listOfLocals([]):
|
|
||||||
self.expandedINames.add(item.iname)
|
|
||||||
self.expandedINames.discard("")
|
|
||||||
#warn("EXPANDED: %s" % self.expandedINames)
|
|
||||||
|
|
||||||
# Take care of the return value of the last function call.
|
# Take care of the return value of the last function call.
|
||||||
if len(resultVarName) > 0:
|
if len(resultVarName) > 0:
|
||||||
try:
|
try:
|
||||||
|
@@ -71,8 +71,7 @@ class GlobalDebuggerOptions;
|
|||||||
enum TestCases
|
enum TestCases
|
||||||
{
|
{
|
||||||
// Gdb
|
// Gdb
|
||||||
TestNoBoundsOfCurrentFunction = 1,
|
TestNoBoundsOfCurrentFunction = 1
|
||||||
TestPythonDumpers
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DebuggerCore : public QObject
|
class DebuggerCore : public QObject
|
||||||
|
@@ -168,8 +168,6 @@ public:
|
|||||||
m_disassemblerAgent(engine),
|
m_disassemblerAgent(engine),
|
||||||
m_memoryAgent(engine),
|
m_memoryAgent(engine),
|
||||||
m_isStateDebugging(false),
|
m_isStateDebugging(false),
|
||||||
m_testsPossible(true),
|
|
||||||
m_testsRunning(false),
|
|
||||||
m_taskHub(0)
|
m_taskHub(0)
|
||||||
{
|
{
|
||||||
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
|
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
|
||||||
@@ -303,17 +301,7 @@ public:
|
|||||||
bool m_isStateDebugging;
|
bool m_isStateDebugging;
|
||||||
|
|
||||||
Utils::FileInProjectFinder m_fileFinder;
|
Utils::FileInProjectFinder m_fileFinder;
|
||||||
// Testing
|
|
||||||
void handleAutoTests();
|
|
||||||
void handleAutoTestLine(int line);
|
|
||||||
void reportTestError(const QString &msg, int line);
|
|
||||||
bool m_testsPossible;
|
|
||||||
bool m_testsRunning;
|
|
||||||
bool m_breakOnError;
|
|
||||||
bool m_foundError;
|
|
||||||
QStringList m_testContents;
|
|
||||||
TaskHub *m_taskHub;
|
TaskHub *m_taskHub;
|
||||||
QString m_testFileName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1880,152 +1868,6 @@ void DebuggerEngine::checkForReleaseBuild(const DebuggerStartParameters &sp)
|
|||||||
"Setting breakpoints by file name and line number may fail.\n").append(detailedWarning));
|
"Setting breakpoints by file name and line number may fail.\n").append(detailedWarning));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::handleAutoTests()
|
|
||||||
{
|
|
||||||
d->handleAutoTests();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DebuggerEngine::isAutoTestRunning() const
|
|
||||||
{
|
|
||||||
return d->m_testsRunning;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::handleAutoTests()
|
|
||||||
{
|
|
||||||
if (!m_testsPossible)
|
|
||||||
return;
|
|
||||||
|
|
||||||
StackFrame frame = m_engine->stackHandler()->currentFrame();
|
|
||||||
if (!frame.file.endsWith(QLatin1String("debugger/simple/simple_test_app.cpp")))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_testContents.isEmpty()) {
|
|
||||||
QFile file(frame.file);
|
|
||||||
file.open(QIODevice::ReadOnly);
|
|
||||||
QTextStream ts(&file);
|
|
||||||
m_testFileName = QFileInfo(frame.file).absoluteFilePath();
|
|
||||||
m_testContents = ts.readAll().split(QLatin1Char('\n'));
|
|
||||||
if (m_testContents.isEmpty()) {
|
|
||||||
m_testsPossible = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foreach (const QString &s, m_testContents) {
|
|
||||||
if (s.startsWith(QLatin1String("#define USE_AUTORUN"))) {
|
|
||||||
if (s.startsWith(QLatin1String("#define USE_AUTORUN 1"))) {
|
|
||||||
m_testsPossible = true;
|
|
||||||
m_breakOnError = false;
|
|
||||||
m_testsRunning = true;
|
|
||||||
} else if (s.startsWith(QLatin1String("#define USE_AUTORUN 2"))) {
|
|
||||||
m_testsPossible = true;
|
|
||||||
m_testsRunning = true;
|
|
||||||
m_breakOnError = true;
|
|
||||||
} else {
|
|
||||||
m_testsPossible = false;
|
|
||||||
m_testsRunning = false;
|
|
||||||
m_breakOnError = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_testsPossible)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int line = frame.line;
|
|
||||||
if (line > 1 && line < m_testContents.size())
|
|
||||||
handleAutoTestLine(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::handleAutoTestLine(int line)
|
|
||||||
{
|
|
||||||
QString s = m_testContents.at(line).trimmed();
|
|
||||||
if (s.endsWith(QLatin1Char('.')))
|
|
||||||
s.chop(1);
|
|
||||||
int pos = s.indexOf(QLatin1String("//"));
|
|
||||||
if (pos == -1)
|
|
||||||
return;
|
|
||||||
s = s.mid(pos + 2).trimmed();
|
|
||||||
QString cmd = s.section(QLatin1Char(' '), 0, 0);
|
|
||||||
if (cmd == QLatin1String("Skip")) {
|
|
||||||
m_engine->showMessage(_("Skipping test %1").arg(line));
|
|
||||||
handleAutoTestLine(line + 1);
|
|
||||||
} else if (cmd == QLatin1String("Expand")) {
|
|
||||||
m_engine->showMessage(_("'Expand' found in line %1, "
|
|
||||||
"but is not implemented yet.").arg(line));
|
|
||||||
handleAutoTestLine(line + 1);
|
|
||||||
} else if (cmd == QLatin1String("Check")) {
|
|
||||||
QString name = s.section(QLatin1Char(' '), 1, 1);
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
reportTestError(_("'Check' needs arguments."), line);
|
|
||||||
} else if (name.count(QLatin1Char('.')) >= 2) {
|
|
||||||
m_engine->showMessage(_("Variable %1 found in line %2 is nested "
|
|
||||||
"too deeply for the current implementation.").arg(name).arg(line));
|
|
||||||
} else {
|
|
||||||
QByteArray iname = "local." + name.toLatin1();
|
|
||||||
QString found = m_engine->watchHandler()->displayForAutoTest(iname);
|
|
||||||
if (found.isEmpty()) {
|
|
||||||
reportTestError(_("Check referes to unknown variable %1.")
|
|
||||||
.arg(name), line);
|
|
||||||
} else {
|
|
||||||
QString needle = s.section(QLatin1Char(' '), 2, -1);
|
|
||||||
if (needle == found) {
|
|
||||||
m_engine->showMessage(_("Check in line %1 for %2 was successful")
|
|
||||||
.arg(line).arg(needle));
|
|
||||||
} else {
|
|
||||||
reportTestError(_("Check for %1 failed. Got %2.")
|
|
||||||
.arg(needle).arg(found), line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handleAutoTestLine(line + 1);
|
|
||||||
} else if (cmd == QLatin1String("CheckType")) {
|
|
||||||
QString name = s.section(QLatin1Char(' '), 1, 1);
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
reportTestError(_("'CheckType' needs arguments."), line);
|
|
||||||
} else if (name.count(QLatin1Char('.')) >= 2) {
|
|
||||||
m_engine->showMessage(_("Variable %1 found in line %2 is nested "
|
|
||||||
"too deeply for the current implementation.").arg(name).arg(line));
|
|
||||||
} else {
|
|
||||||
QByteArray iname = "local." + name.toLatin1();
|
|
||||||
QString found = m_engine->watchHandler()->displayForAutoTest(iname);
|
|
||||||
if (found.isEmpty()) {
|
|
||||||
reportTestError(_("CheckType referes to unknown variable %1.")
|
|
||||||
.arg(name), line);
|
|
||||||
} else {
|
|
||||||
QString needle = s.section(QLatin1Char(' '), 2, -1);
|
|
||||||
if (found.endsWith(needle)) {
|
|
||||||
m_engine->showMessage(_("CheckType in line %1 for %2 was successful")
|
|
||||||
.arg(line).arg(needle));
|
|
||||||
} else {
|
|
||||||
reportTestError(_("CheckType for %1 failed. Got %2.")
|
|
||||||
.arg(needle).arg(found), line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handleAutoTestLine(line + 1);
|
|
||||||
} else if (cmd == QLatin1String("Continue")) {
|
|
||||||
if (state() == InferiorStopOk) {
|
|
||||||
m_engine->showMessage(_("Continue in line %1 processed.").arg(line));
|
|
||||||
if (!m_breakOnError || !m_foundError)
|
|
||||||
m_engine->continueInferior();
|
|
||||||
else
|
|
||||||
m_foundError = false;
|
|
||||||
} else {
|
|
||||||
m_engine->showMessage(_("Auto-run aborted in line %1. State is %2.")
|
|
||||||
.arg(line).arg(state()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::reportTestError(const QString &msg, int line)
|
|
||||||
{
|
|
||||||
m_engine->showMessage(_("### Line %1: %2").arg(line).arg(msg));
|
|
||||||
m_foundError = true;
|
|
||||||
Task task(Task::Error, msg, Utils::FileName::fromUserInput(m_testFileName), line + 1, Core::Id("DebuggerTest"));
|
|
||||||
taskHub()->addTask(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskHub *DebuggerEnginePrivate::taskHub()
|
TaskHub *DebuggerEnginePrivate::taskHub()
|
||||||
{
|
{
|
||||||
if (!m_taskHub) {
|
if (!m_taskHub) {
|
||||||
|
@@ -395,9 +395,6 @@ protected:
|
|||||||
virtual void slaveEngineStateChanged(DebuggerEngine *engine,
|
virtual void slaveEngineStateChanged(DebuggerEngine *engine,
|
||||||
DebuggerState state);
|
DebuggerState state);
|
||||||
|
|
||||||
virtual void handleAutoTests();
|
|
||||||
virtual bool isAutoTestRunning() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Wrapper engine needs access to state of its subengines.
|
// Wrapper engine needs access to state of its subengines.
|
||||||
friend class Internal::QmlCppEngine;
|
friend class Internal::QmlCppEngine;
|
||||||
|
@@ -953,10 +953,6 @@ public slots:
|
|||||||
void testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb);
|
void testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb);
|
||||||
void testRunControlFinished();
|
void testRunControlFinished();
|
||||||
|
|
||||||
void testPythonDumpers1();
|
|
||||||
void testPythonDumpers2();
|
|
||||||
void testPythonDumpers3();
|
|
||||||
|
|
||||||
void testStateMachine1();
|
void testStateMachine1();
|
||||||
void testStateMachine2();
|
void testStateMachine2();
|
||||||
void testStateMachine3();
|
void testStateMachine3();
|
||||||
@@ -3576,39 +3572,6 @@ void DebuggerPluginPrivate::testFinished()
|
|||||||
QVERIFY(m_testSuccess);
|
QVERIFY(m_testSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void DebuggerPlugin::testPythonDumpers()
|
|
||||||
{
|
|
||||||
theDebuggerCore->testPythonDumpers1();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::testPythonDumpers1()
|
|
||||||
{
|
|
||||||
m_testSuccess = true;
|
|
||||||
QString proFile = ICore::resourcePath();
|
|
||||||
if (Utils::HostOsInfo::isMacHost())
|
|
||||||
proFile += QLatin1String("/../..");
|
|
||||||
proFile += QLatin1String("/../../tests/manual/debugger/simple/simple.pro");
|
|
||||||
testLoadProject(proFile, TestCallBack(this, "testPythonDumpers2"));
|
|
||||||
QVERIFY(m_testSuccess);
|
|
||||||
QTestEventLoop::instance().enterLoop(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::testPythonDumpers2()
|
|
||||||
{
|
|
||||||
DebuggerStartParameters sp;
|
|
||||||
fillParameters(&sp, currentKit());
|
|
||||||
sp.executable = activeLocalRunConfiguration()->executable();
|
|
||||||
testRunProject(sp, TestCallBack(this, "testPythonDumpers3"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::testPythonDumpers3()
|
|
||||||
{
|
|
||||||
testUnloadProject();
|
|
||||||
testFinished();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@@ -78,7 +78,6 @@ private:
|
|||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
private slots:
|
private slots:
|
||||||
void testBenchmark();
|
void testBenchmark();
|
||||||
void testPythonDumpers();
|
|
||||||
void testStateMachine();
|
void testStateMachine();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@@ -1742,7 +1742,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
|
|||||||
} else {
|
} else {
|
||||||
showMessage(_("HANDLING SIGNAL " + name));
|
showMessage(_("HANDLING SIGNAL " + name));
|
||||||
if (debuggerCore()->boolSetting(UseMessageBoxForSignals)
|
if (debuggerCore()->boolSetting(UseMessageBoxForSignals)
|
||||||
&& !isStopperThread && !isAutoTestRunning())
|
&& !isStopperThread)
|
||||||
showStoppedBySignalMessageBox(_(meaning), _(name));
|
showStoppedBySignalMessageBox(_(meaning), _(name));
|
||||||
if (!name.isEmpty() && !meaning.isEmpty())
|
if (!name.isEmpty() && !meaning.isEmpty())
|
||||||
reasontr = msgStoppedBySignal(_(meaning), _(name));
|
reasontr = msgStoppedBySignal(_(meaning), _(name));
|
||||||
@@ -4136,7 +4136,6 @@ void GdbEngine::rebuildWatchModel()
|
|||||||
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
|
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
|
||||||
showStatusMessage(tr("Finished retrieving data"), 400);
|
showStatusMessage(tr("Finished retrieving data"), 400);
|
||||||
showToolTip();
|
showToolTip();
|
||||||
handleAutoTests();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QByteArray arrayFillCommand(const char *array, const QByteArray ¶ms)
|
static QByteArray arrayFillCommand(const char *array, const QByteArray ¶ms)
|
||||||
|
@@ -119,8 +119,6 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms)
|
|||||||
options += "partial,";
|
options += "partial,";
|
||||||
if (params.tooltipOnly)
|
if (params.tooltipOnly)
|
||||||
options += "tooltiponly,";
|
options += "tooltiponly,";
|
||||||
if (isAutoTestRunning())
|
|
||||||
options += "autotest,";
|
|
||||||
options.chop(1);
|
options.chop(1);
|
||||||
|
|
||||||
QByteArray resultVar;
|
QByteArray resultVar;
|
||||||
|
Reference in New Issue
Block a user