From e40308ab1b89346e3f7072f160b2cb5b799f8789 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Jun 2013 13:29:11 +0200 Subject: Debugger: Remove in-plugin dumper autotest handling It's covered by tst_dumper nowadays. Change-Id: Id6b91e5a4ad2ac2472d598c4f0ba4c95c334af6d Reviewed-by: Christian Stenger --- share/qtcreator/dumper/gbridge.py | 6 - src/plugins/debugger/debuggercore.h | 3 +- src/plugins/debugger/debuggerengine.cpp | 158 --------------------------- src/plugins/debugger/debuggerengine.h | 3 - src/plugins/debugger/debuggerplugin.cpp | 37 ------- src/plugins/debugger/debuggerplugin.h | 1 - src/plugins/debugger/gdb/gdbengine.cpp | 3 +- src/plugins/debugger/gdb/pythongdbengine.cpp | 2 - 8 files changed, 2 insertions(+), 211 deletions(-) diff --git a/share/qtcreator/dumper/gbridge.py b/share/qtcreator/dumper/gbridge.py index dfcac6f543..87c1daea99 100644 --- a/share/qtcreator/dumper/gbridge.py +++ b/share/qtcreator/dumper/gbridge.py @@ -1429,12 +1429,6 @@ class Dumper: if fullUpdateNeeded and not self.tooltipOnly and not self.noLocals: 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. if len(resultVarName) > 0: try: diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index 18787baa8b..c613f4c63d 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -71,8 +71,7 @@ class GlobalDebuggerOptions; enum TestCases { // Gdb - TestNoBoundsOfCurrentFunction = 1, - TestPythonDumpers + TestNoBoundsOfCurrentFunction = 1 }; class DebuggerCore : public QObject diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 65ad5ce929..0daecf7c90 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -168,8 +168,6 @@ public: m_disassemblerAgent(engine), m_memoryAgent(engine), m_isStateDebugging(false), - m_testsPossible(true), - m_testsRunning(false), m_taskHub(0) { connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation())); @@ -303,17 +301,7 @@ public: bool m_isStateDebugging; 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; - 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)); } -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() { if (!m_taskHub) { diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 78bbba90b2..74626857f7 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -395,9 +395,6 @@ protected: virtual void slaveEngineStateChanged(DebuggerEngine *engine, DebuggerState state); - virtual void handleAutoTests(); - virtual bool isAutoTestRunning() const; - private: // Wrapper engine needs access to state of its subengines. friend class Internal::QmlCppEngine; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 285dad7376..5b5793b426 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -953,10 +953,6 @@ public slots: void testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb); void testRunControlFinished(); - void testPythonDumpers1(); - void testPythonDumpers2(); - void testPythonDumpers3(); - void testStateMachine1(); void testStateMachine2(); void testStateMachine3(); @@ -3576,39 +3572,6 @@ void DebuggerPluginPrivate::testFinished() 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(); -} - /////////////////////////////////////////////////////////////////////////// diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 1c3925486b..e00a40304a 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -78,7 +78,6 @@ private: #ifdef WITH_TESTS private slots: void testBenchmark(); - void testPythonDumpers(); void testStateMachine(); #endif }; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 4acb49cd36..e65dde09cb 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1742,7 +1742,7 @@ void GdbEngine::handleStop2(const GdbMi &data) } else { showMessage(_("HANDLING SIGNAL " + name)); if (debuggerCore()->boolSetting(UseMessageBoxForSignals) - && !isStopperThread && !isAutoTestRunning()) + && !isStopperThread) showStoppedBySignalMessageBox(_(meaning), _(name)); if (!name.isEmpty() && !meaning.isEmpty()) reasontr = msgStoppedBySignal(_(meaning), _(name)); @@ -4136,7 +4136,6 @@ void GdbEngine::rebuildWatchModel() showMessage(_("").arg(count), LogMiscInput); showStatusMessage(tr("Finished retrieving data"), 400); showToolTip(); - handleAutoTests(); } static QByteArray arrayFillCommand(const char *array, const QByteArray ¶ms) diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp index e1d62ab703..0963d1e9c1 100644 --- a/src/plugins/debugger/gdb/pythongdbengine.cpp +++ b/src/plugins/debugger/gdb/pythongdbengine.cpp @@ -119,8 +119,6 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms) options += "partial,"; if (params.tooltipOnly) options += "tooltiponly,"; - if (isAutoTestRunning()) - options += "autotest,"; options.chop(1); QByteArray resultVar; -- cgit v1.2.1