added new mode for simple test

This mode is the same as USE_AUTORUN, except that the debugger will stop
if an test after a BREAK_HERE has failed.

Change-Id: I786459a101fb2ff0556f7ac640b1b0d21d674e8b
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
David Schulz
2012-02-08 14:45:50 +01:00
committed by hjk
parent 53e2cbfb7f
commit 7889a20e22
2 changed files with 18 additions and 2 deletions

View File

@@ -315,6 +315,8 @@ public:
void handleAutoTestLine(int line); void handleAutoTestLine(int line);
void reportTestError(const QString &msg, int line); void reportTestError(const QString &msg, int line);
bool m_testsPossible; bool m_testsPossible;
bool m_breakOnError;
bool m_foundError;
QStringList m_testContents; QStringList m_testContents;
TaskHub *m_taskHub; TaskHub *m_taskHub;
QString m_testFileName; QString m_testFileName;
@@ -1783,7 +1785,13 @@ void DebuggerEnginePrivate::handleAutoTests()
} }
foreach (const QString &s, m_testContents) { foreach (const QString &s, m_testContents) {
if (s.startsWith(QLatin1String("#define USE_AUTORUN"))) { if (s.startsWith(QLatin1String("#define USE_AUTORUN"))) {
m_testsPossible = s.startsWith(QLatin1String("#define USE_AUTORUN 1")); if (s.startsWith(QLatin1String("#define USE_AUTORUN 1"))) {
m_testsPossible = true;
m_breakOnError = false;
} else if (s.startsWith(QLatin1String("#define USE_AUTORUN 2"))) {
m_testsPossible = true;
m_breakOnError = true;
}
break; break;
} }
} }
@@ -1860,13 +1868,17 @@ void DebuggerEnginePrivate::handleAutoTestLine(int line)
handleAutoTestLine(line + 1); handleAutoTestLine(line + 1);
} else if (cmd == QLatin1String("Continue")) { } else if (cmd == QLatin1String("Continue")) {
m_engine->showMessage(_("Continue in line %1 processed.").arg(line)); m_engine->showMessage(_("Continue in line %1 processed.").arg(line));
m_engine->continueInferior(); if (!m_breakOnError || !m_foundError)
m_engine->continueInferior();
else
m_foundError = false;
} }
} }
void DebuggerEnginePrivate::reportTestError(const QString &msg, int line) void DebuggerEnginePrivate::reportTestError(const QString &msg, int line)
{ {
m_engine->showMessage(_("### Line %1: %2").arg(line).arg(msg)); m_engine->showMessage(_("### Line %1: %2").arg(line).arg(msg));
m_foundError = true;
if (!m_taskHub) { if (!m_taskHub) {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();

View File

@@ -55,8 +55,12 @@
// FIXME: Not implemented yet. // FIXME: Not implemented yet.
// Value: 1
// If the line after a BREAK_HERE line does not contain one of the // If the line after a BREAK_HERE line does not contain one of the
// supported commands, the test stops. // supported commands, the test stops.
// Value: 2
// Same as 1, except that the debugger will stop automatically when
// a test after a BREAK_HERE failed
// Default: 0 // Default: 0
#ifndef USE_AUTORUN #ifndef USE_AUTORUN
#define USE_AUTORUN 0 #define USE_AUTORUN 0