forked from qt-creator/qt-creator
debugger: extend semi-automanated tests to one level of expansion
Change-Id: I9063f4eecfe4c42926771cc46539932b4e353b8d Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -1106,6 +1106,12 @@ 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:
|
||||
|
||||
@@ -177,6 +177,7 @@ public:
|
||||
m_memoryAgent(engine),
|
||||
m_isStateDebugging(false),
|
||||
m_testsPossible(true),
|
||||
m_testsRunning(false),
|
||||
m_taskHub(0)
|
||||
{
|
||||
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
|
||||
@@ -319,6 +320,7 @@ public:
|
||||
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;
|
||||
@@ -1802,6 +1804,11 @@ void DebuggerEngine::handleAutoTests()
|
||||
d->handleAutoTests();
|
||||
}
|
||||
|
||||
bool DebuggerEngine::isAutoTestRunning() const
|
||||
{
|
||||
return d->m_testsRunning;
|
||||
}
|
||||
|
||||
void DebuggerEnginePrivate::handleAutoTests()
|
||||
{
|
||||
if (!m_testsPossible)
|
||||
@@ -1826,11 +1833,14 @@ void DebuggerEnginePrivate::handleAutoTests()
|
||||
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;
|
||||
@@ -1856,15 +1866,20 @@ void DebuggerEnginePrivate::handleAutoTestLine(int line)
|
||||
return;
|
||||
s = s.mid(pos + 2).trimmed();
|
||||
QString cmd = s.section(QLatin1Char(' '), 0, 0);
|
||||
if (cmd == QLatin1String("Expand")) {
|
||||
m_engine->showMessage(_("'Expand' found in line %1, but not implemented yet.").arg(line));
|
||||
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.contains(QLatin1Char('.'))) {
|
||||
m_engine->showMessage(_("variable %1 found in line %2 contains '.', but 'Expand' is not implemented yet.").arg(name).arg(line));
|
||||
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);
|
||||
@@ -1886,9 +1901,10 @@ void DebuggerEnginePrivate::handleAutoTestLine(int line)
|
||||
} else if (cmd == QLatin1String("CheckType")) {
|
||||
QString name = s.section(QLatin1Char(' '), 1, 1);
|
||||
if (name.isEmpty()) {
|
||||
reportTestError(_("'CheckType' needs arguments."), line);
|
||||
} else if (name.contains(QLatin1Char('.'))) {
|
||||
m_engine->showMessage(_("variable %1 found in line %2 contains '.', but 'Expand' is not implemented yet.").arg(name).arg(line));
|
||||
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);
|
||||
|
||||
@@ -405,6 +405,7 @@ protected:
|
||||
DebuggerState state);
|
||||
|
||||
virtual void handleAutoTests();
|
||||
virtual bool isAutoTestRunning() const;
|
||||
|
||||
private:
|
||||
// Wrapper engine needs access to state of its subengines.
|
||||
|
||||
@@ -107,6 +107,8 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms)
|
||||
options += "partial,";
|
||||
if (params.tooltipOnly)
|
||||
options += "tooltiponly,";
|
||||
if (isAutoTestRunning())
|
||||
options += "autotest,";
|
||||
options.chop(1);
|
||||
|
||||
QByteArray resultVar;
|
||||
|
||||
@@ -649,7 +649,6 @@ namespace qdatetime {
|
||||
// Check time.(ISO) "" QString.
|
||||
// Check time.(Locale) "" QString.
|
||||
// Check time.(SystemLocale) "" QString.
|
||||
// CheckType time.toLocalTime QDateTime.
|
||||
// Check time.toString "" QString.
|
||||
// Continue.
|
||||
|
||||
@@ -670,7 +669,7 @@ namespace qdatetime {
|
||||
// Check date.(Locale) "" QString.
|
||||
// Check date.(SystemLocale) "" QString.
|
||||
// Check date.toString "" QString.
|
||||
// Check date.toUTC <not available> <unknown>.
|
||||
// Check date.toUTC QDateTime.
|
||||
// Continue.
|
||||
|
||||
date = QDateTime::currentDateTime();
|
||||
@@ -1136,8 +1135,8 @@ namespace qlist {
|
||||
BREAK_HERE;
|
||||
// Expand l.
|
||||
// Check l <3 items> QList<unsigned long long>.
|
||||
// Check l.0 101 unsigned long long.
|
||||
// Check l.2 102 unsigned long long.
|
||||
// CheckType l.0 101 unsigned long long.
|
||||
// CheckType l.2 102 unsigned long long.
|
||||
// Continue.
|
||||
dummyStatement(&l);
|
||||
}
|
||||
@@ -1409,8 +1408,8 @@ namespace qmap {
|
||||
BREAK_HERE;
|
||||
// Expand map.
|
||||
// Check map <6 items> QMultiMap<unsigned int, float>.
|
||||
// Check map.[0] 11 11 float.
|
||||
// Check map.[5] 22 22 float.
|
||||
// Check map.0 11 float.
|
||||
// Check map.5 22 float.
|
||||
// Continue.
|
||||
dummyStatement(&map);
|
||||
}
|
||||
@@ -1992,7 +1991,7 @@ namespace final {
|
||||
BREAK_HERE;
|
||||
// Expand settings.
|
||||
// Check settings "" QSettings.
|
||||
// Check settings.QObject "" QSettings.
|
||||
// Check settings.[QObject] "" QSettings.
|
||||
// Check value "" QVariant (QString).
|
||||
// Continue.
|
||||
dummyStatement(&settings, &value);
|
||||
@@ -2262,7 +2261,7 @@ namespace qxml {
|
||||
// Check atts.attList.2.qname "name3" QString.
|
||||
// Check atts.attList.2.uri "uri3" QString.
|
||||
// Check atts.attList.2.value "value3" QString.
|
||||
// Check atts.d <unavailable synchronous data> .
|
||||
// CheckType atts.d QXmlAttributesPrivate.
|
||||
// Continue.
|
||||
dummyStatement();
|
||||
}
|
||||
@@ -3086,7 +3085,7 @@ namespace stdvector {
|
||||
// Expand v v.0 v.0.x.
|
||||
// Check v <4 items> std::vector<Foo>.
|
||||
// CheckType v.0 Foo.
|
||||
// Check v.0.a 1 int.
|
||||
// Check v.[1].a 1 int.
|
||||
// CheckType v.3 Foo.
|
||||
// Continue.
|
||||
dummyStatement(&v);
|
||||
@@ -3103,29 +3102,28 @@ namespace stdvector {
|
||||
BREAK_HERE;
|
||||
// Expand v.
|
||||
// Check v <5 items> std::vector<bool>.
|
||||
// Check v.0 1 bool.
|
||||
// Check v.1 0 bool.
|
||||
// Check v.2 0 bool.
|
||||
// Check v.3 1 bool.
|
||||
// Check v.4 0 bool.
|
||||
// Check v.0 true bool.
|
||||
// Check v.1 false bool.
|
||||
// Check v.2 false bool.
|
||||
// Check v.3 true bool.
|
||||
// Check v.4 false bool.
|
||||
// Continue.
|
||||
dummyStatement(&v);
|
||||
}
|
||||
|
||||
void testStdVectorBool2()
|
||||
{
|
||||
std::vector<bool> v1(50, true);
|
||||
std::vector<bool> v1(65, true);
|
||||
std::vector<bool> v2(65);
|
||||
BREAK_HERE;
|
||||
// Expand v1.
|
||||
// Expand v2.
|
||||
// Check v1 <50 items> std::vector<bool>.
|
||||
// Check v1 <65 items> std::vector<bool>.
|
||||
// Check v1.0 true bool.
|
||||
// Check v1.64 true bool.
|
||||
// Check v2 <65 items> std::vector<bool>.
|
||||
// Check v.0 1 bool.
|
||||
// Check v.1 0 bool.
|
||||
// Check v.2 0 bool.
|
||||
// Check v.3 1 bool.
|
||||
// Check v.4 0 bool.
|
||||
// Check v2.0 false bool.
|
||||
// Check v2.64 false bool.
|
||||
// Continue.
|
||||
dummyStatement(&v1, &v2);
|
||||
}
|
||||
@@ -3555,7 +3553,7 @@ namespace qthread {
|
||||
// Expand this.
|
||||
// Check j 3 int.
|
||||
// CheckType this qthread::Thread.
|
||||
// Check this.QThread "This is thread #3" qthread::Thread.
|
||||
// Check this.[QThread] "This is thread #3" qthread::Thread.
|
||||
// Continue.
|
||||
dummyStatement(this);
|
||||
}
|
||||
@@ -4327,7 +4325,6 @@ namespace basic {
|
||||
BREAK_HERE;
|
||||
// Expand s.
|
||||
// CheckType s char *.
|
||||
// Check s.*s 0 '\0' char.
|
||||
// Continue.
|
||||
|
||||
// Manual: Open pinnable tooltip.
|
||||
@@ -4549,7 +4546,7 @@ namespace basic {
|
||||
BREAK_HERE;
|
||||
// Expand s.
|
||||
// CheckType s char *.
|
||||
// Check s.*s 97 'a' char.
|
||||
// Skip Check s.*s 97 'a' char.
|
||||
// Check u "" QString.
|
||||
// CheckType w wchar_t *.
|
||||
// Continue.
|
||||
@@ -5069,7 +5066,6 @@ namespace qscript {
|
||||
s = engine.newVariant(QVariant(43.0));
|
||||
s = engine.newVariant(QVariant(QString("sss")));
|
||||
s = engine.newDate(date);
|
||||
x = s.toInt32();
|
||||
date = s.toDateTime();
|
||||
s.setProperty("a", QScriptValue());
|
||||
QScriptValue d = s.data();
|
||||
@@ -5676,13 +5672,13 @@ namespace bug5799 {
|
||||
// CheckType a1 bug5799::S1 [10].
|
||||
// CheckType a2 bug5799::Array.
|
||||
// CheckType s2 bug5799::S2.
|
||||
// CheckType s2.bug5799::S1 bug5799::S1.
|
||||
// Check s2.bug5799::S1.m1 5 int.
|
||||
// Check s2.bug5799::S1.m2 32767 int.
|
||||
// CheckType s2.[bug5799::S1] bug5799::S1.
|
||||
// Check s2.[bug5799::S1].m1 5 int.
|
||||
// Check s2.[bug5799::S1].m2 32767 int.
|
||||
// CheckType s4 bug5799::S4.
|
||||
// CheckType s4.bug5799::S3 bug5799::S3.
|
||||
// Check s4.bug5799::S3.m1 5 int.
|
||||
// Check s4.bug5799::S3.m2 0 int.
|
||||
// CheckType s4.[bug5799::S3] bug5799::S3.
|
||||
// Check s4.[bug5799::S3].m1 5 int.
|
||||
// Check s4.[bug5799::S3].m2 0 int.
|
||||
// Continue.
|
||||
dummyStatement(&s2, &s4, &a1, &a2);
|
||||
}
|
||||
@@ -5798,9 +5794,11 @@ namespace bug6857 {
|
||||
void test6857()
|
||||
{
|
||||
MyFile file("/tmp/tt");
|
||||
file.setObjectName("A file");
|
||||
BREAK_HERE;
|
||||
// Expand file.
|
||||
// Check file.QFile "/tmp/tt" QFile.
|
||||
// Check file "A file" MyFile.
|
||||
// Check file.[QFile] "/tmp/tt" QFile.
|
||||
// Continue.
|
||||
dummyStatement(&file);
|
||||
}
|
||||
@@ -5819,9 +5817,11 @@ namespace bug6858 {
|
||||
void test6858()
|
||||
{
|
||||
MyFile file("/tmp/tt");
|
||||
file.setObjectName("Another file");
|
||||
QFile *pfile = &file;
|
||||
BREAK_HERE;
|
||||
// Check pfile "/tmp/tt" bug6858::MyFile.
|
||||
// Check pfile "Another file" bug6858::MyFile.
|
||||
// Check pfile.[QFile] "/tmp/tt" QFile.
|
||||
// Continue.
|
||||
dummyStatement(&file, pfile);
|
||||
}
|
||||
@@ -5846,7 +5846,7 @@ namespace bug6933 {
|
||||
Base *b = &d;
|
||||
BREAK_HERE;
|
||||
// Expand b b.bug6933::Base
|
||||
// Check b.bug6933::Base.[vptr]
|
||||
// Check b.[bug6933::Base].[vptr]
|
||||
dummyStatement(&d, b);
|
||||
}
|
||||
}
|
||||
@@ -5914,14 +5914,14 @@ namespace gdb13393 {
|
||||
BREAK_HERE;
|
||||
// Expand d ptr ptrConst ptrToPtr ref refConst s.
|
||||
// CheckType d gdb13393::Derived.
|
||||
// CheckType d.gdb13393::Base gdb13393::Derived.
|
||||
// CheckType d.[gdb13393::Base] gdb13393::Derived.
|
||||
// Check d.b 2 int.
|
||||
// CheckType ptr gdb13393::Derived.
|
||||
// CheckType ptr.[vptr] .
|
||||
// Check ptr.a 1 int.
|
||||
// CheckType ptr.[gdb12293::Base] gdb13393::Base.
|
||||
// Check ptr.[a] 1 int.
|
||||
// CheckType ptrConst gdb13393::Derived.
|
||||
// CheckType ptrConst.[vptr] .
|
||||
// Check ptrConst.a 1 int.
|
||||
// CheckType ptrConst.[gdb13393::Base] gdb13393::Base.
|
||||
// Check ptrConst.b 2 int.
|
||||
// CheckType ptrToPtr gdb13393::Derived.
|
||||
// CheckType ptrToPtr.[vptr] .
|
||||
// Check ptrToPtr.a 1 int.
|
||||
@@ -5977,7 +5977,7 @@ namespace gdb10586 {
|
||||
// Check v.a 2 int.
|
||||
// Check s.x 1 int.
|
||||
// Continue.
|
||||
dummyStatement(&v, &n);
|
||||
dummyStatement(&v, &n, &s);
|
||||
}
|
||||
|
||||
void test10586()
|
||||
|
||||
Reference in New Issue
Block a user