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:
|
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:
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ public:
|
|||||||
m_memoryAgent(engine),
|
m_memoryAgent(engine),
|
||||||
m_isStateDebugging(false),
|
m_isStateDebugging(false),
|
||||||
m_testsPossible(true),
|
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()));
|
||||||
@@ -319,6 +320,7 @@ 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_testsRunning;
|
||||||
bool m_breakOnError;
|
bool m_breakOnError;
|
||||||
bool m_foundError;
|
bool m_foundError;
|
||||||
QStringList m_testContents;
|
QStringList m_testContents;
|
||||||
@@ -1802,6 +1804,11 @@ void DebuggerEngine::handleAutoTests()
|
|||||||
d->handleAutoTests();
|
d->handleAutoTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DebuggerEngine::isAutoTestRunning() const
|
||||||
|
{
|
||||||
|
return d->m_testsRunning;
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerEnginePrivate::handleAutoTests()
|
void DebuggerEnginePrivate::handleAutoTests()
|
||||||
{
|
{
|
||||||
if (!m_testsPossible)
|
if (!m_testsPossible)
|
||||||
@@ -1826,11 +1833,14 @@ void DebuggerEnginePrivate::handleAutoTests()
|
|||||||
if (s.startsWith(QLatin1String("#define USE_AUTORUN 1"))) {
|
if (s.startsWith(QLatin1String("#define USE_AUTORUN 1"))) {
|
||||||
m_testsPossible = true;
|
m_testsPossible = true;
|
||||||
m_breakOnError = false;
|
m_breakOnError = false;
|
||||||
|
m_testsRunning = true;
|
||||||
} else if (s.startsWith(QLatin1String("#define USE_AUTORUN 2"))) {
|
} else if (s.startsWith(QLatin1String("#define USE_AUTORUN 2"))) {
|
||||||
m_testsPossible = true;
|
m_testsPossible = true;
|
||||||
|
m_testsRunning = true;
|
||||||
m_breakOnError = true;
|
m_breakOnError = true;
|
||||||
} else {
|
} else {
|
||||||
m_testsPossible = false;
|
m_testsPossible = false;
|
||||||
|
m_testsRunning = false;
|
||||||
m_breakOnError = false;
|
m_breakOnError = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1856,15 +1866,20 @@ void DebuggerEnginePrivate::handleAutoTestLine(int line)
|
|||||||
return;
|
return;
|
||||||
s = s.mid(pos + 2).trimmed();
|
s = s.mid(pos + 2).trimmed();
|
||||||
QString cmd = s.section(QLatin1Char(' '), 0, 0);
|
QString cmd = s.section(QLatin1Char(' '), 0, 0);
|
||||||
if (cmd == QLatin1String("Expand")) {
|
if (cmd == QLatin1String("Skip")) {
|
||||||
m_engine->showMessage(_("'Expand' found in line %1, but not implemented yet.").arg(line));
|
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);
|
handleAutoTestLine(line + 1);
|
||||||
} else if (cmd == QLatin1String("Check")) {
|
} else if (cmd == QLatin1String("Check")) {
|
||||||
QString name = s.section(QLatin1Char(' '), 1, 1);
|
QString name = s.section(QLatin1Char(' '), 1, 1);
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
reportTestError(_("'Check' needs arguments."), line);
|
reportTestError(_("'Check' needs arguments."), line);
|
||||||
} else if (name.contains(QLatin1Char('.'))) {
|
} else if (name.count(QLatin1Char('.')) >= 2) {
|
||||||
m_engine->showMessage(_("variable %1 found in line %2 contains '.', but 'Expand' is not implemented yet.").arg(name).arg(line));
|
m_engine->showMessage(_("Variable %1 found in line %2 is nested "
|
||||||
|
"too deeply for the current implementation.").arg(name).arg(line));
|
||||||
} else {
|
} else {
|
||||||
QByteArray iname = "local." + name.toLatin1();
|
QByteArray iname = "local." + name.toLatin1();
|
||||||
QString found = m_engine->watchHandler()->displayForAutoTest(iname);
|
QString found = m_engine->watchHandler()->displayForAutoTest(iname);
|
||||||
@@ -1886,9 +1901,10 @@ void DebuggerEnginePrivate::handleAutoTestLine(int line)
|
|||||||
} else if (cmd == QLatin1String("CheckType")) {
|
} else if (cmd == QLatin1String("CheckType")) {
|
||||||
QString name = s.section(QLatin1Char(' '), 1, 1);
|
QString name = s.section(QLatin1Char(' '), 1, 1);
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
reportTestError(_("'CheckType' needs arguments."), line);
|
reportTestError(_("'CheckType' needs arguments."), line);
|
||||||
} else if (name.contains(QLatin1Char('.'))) {
|
} else if (name.count(QLatin1Char('.')) >= 2) {
|
||||||
m_engine->showMessage(_("variable %1 found in line %2 contains '.', but 'Expand' is not implemented yet.").arg(name).arg(line));
|
m_engine->showMessage(_("Variable %1 found in line %2 is nested "
|
||||||
|
"too deeply for the current implementation.").arg(name).arg(line));
|
||||||
} else {
|
} else {
|
||||||
QByteArray iname = "local." + name.toLatin1();
|
QByteArray iname = "local." + name.toLatin1();
|
||||||
QString found = m_engine->watchHandler()->displayForAutoTest(iname);
|
QString found = m_engine->watchHandler()->displayForAutoTest(iname);
|
||||||
|
|||||||
@@ -405,6 +405,7 @@ protected:
|
|||||||
DebuggerState state);
|
DebuggerState state);
|
||||||
|
|
||||||
virtual void handleAutoTests();
|
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.
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ 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;
|
||||||
|
|||||||
@@ -649,7 +649,6 @@ namespace qdatetime {
|
|||||||
// Check time.(ISO) "" QString.
|
// Check time.(ISO) "" QString.
|
||||||
// Check time.(Locale) "" QString.
|
// Check time.(Locale) "" QString.
|
||||||
// Check time.(SystemLocale) "" QString.
|
// Check time.(SystemLocale) "" QString.
|
||||||
// CheckType time.toLocalTime QDateTime.
|
|
||||||
// Check time.toString "" QString.
|
// Check time.toString "" QString.
|
||||||
// Continue.
|
// Continue.
|
||||||
|
|
||||||
@@ -670,7 +669,7 @@ namespace qdatetime {
|
|||||||
// Check date.(Locale) "" QString.
|
// Check date.(Locale) "" QString.
|
||||||
// Check date.(SystemLocale) "" QString.
|
// Check date.(SystemLocale) "" QString.
|
||||||
// Check date.toString "" QString.
|
// Check date.toString "" QString.
|
||||||
// Check date.toUTC <not available> <unknown>.
|
// Check date.toUTC QDateTime.
|
||||||
// Continue.
|
// Continue.
|
||||||
|
|
||||||
date = QDateTime::currentDateTime();
|
date = QDateTime::currentDateTime();
|
||||||
@@ -1136,8 +1135,8 @@ namespace qlist {
|
|||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand l.
|
// Expand l.
|
||||||
// Check l <3 items> QList<unsigned long long>.
|
// Check l <3 items> QList<unsigned long long>.
|
||||||
// Check l.0 101 unsigned long long.
|
// CheckType l.0 101 unsigned long long.
|
||||||
// Check l.2 102 unsigned long long.
|
// CheckType l.2 102 unsigned long long.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&l);
|
dummyStatement(&l);
|
||||||
}
|
}
|
||||||
@@ -1409,8 +1408,8 @@ namespace qmap {
|
|||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand map.
|
// Expand map.
|
||||||
// Check map <6 items> QMultiMap<unsigned int, float>.
|
// Check map <6 items> QMultiMap<unsigned int, float>.
|
||||||
// Check map.[0] 11 11 float.
|
// Check map.0 11 float.
|
||||||
// Check map.[5] 22 22 float.
|
// Check map.5 22 float.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&map);
|
dummyStatement(&map);
|
||||||
}
|
}
|
||||||
@@ -1992,7 +1991,7 @@ namespace final {
|
|||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand settings.
|
// Expand settings.
|
||||||
// Check settings "" QSettings.
|
// Check settings "" QSettings.
|
||||||
// Check settings.QObject "" QSettings.
|
// Check settings.[QObject] "" QSettings.
|
||||||
// Check value "" QVariant (QString).
|
// Check value "" QVariant (QString).
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&settings, &value);
|
dummyStatement(&settings, &value);
|
||||||
@@ -2262,7 +2261,7 @@ namespace qxml {
|
|||||||
// Check atts.attList.2.qname "name3" QString.
|
// Check atts.attList.2.qname "name3" QString.
|
||||||
// Check atts.attList.2.uri "uri3" QString.
|
// Check atts.attList.2.uri "uri3" QString.
|
||||||
// Check atts.attList.2.value "value3" QString.
|
// Check atts.attList.2.value "value3" QString.
|
||||||
// Check atts.d <unavailable synchronous data> .
|
// CheckType atts.d QXmlAttributesPrivate.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement();
|
dummyStatement();
|
||||||
}
|
}
|
||||||
@@ -3086,7 +3085,7 @@ namespace stdvector {
|
|||||||
// Expand v v.0 v.0.x.
|
// Expand v v.0 v.0.x.
|
||||||
// Check v <4 items> std::vector<Foo>.
|
// Check v <4 items> std::vector<Foo>.
|
||||||
// CheckType v.0 Foo.
|
// CheckType v.0 Foo.
|
||||||
// Check v.0.a 1 int.
|
// Check v.[1].a 1 int.
|
||||||
// CheckType v.3 Foo.
|
// CheckType v.3 Foo.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&v);
|
dummyStatement(&v);
|
||||||
@@ -3103,29 +3102,28 @@ namespace stdvector {
|
|||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand v.
|
// Expand v.
|
||||||
// Check v <5 items> std::vector<bool>.
|
// Check v <5 items> std::vector<bool>.
|
||||||
// Check v.0 1 bool.
|
// Check v.0 true bool.
|
||||||
// Check v.1 0 bool.
|
// Check v.1 false bool.
|
||||||
// Check v.2 0 bool.
|
// Check v.2 false bool.
|
||||||
// Check v.3 1 bool.
|
// Check v.3 true bool.
|
||||||
// Check v.4 0 bool.
|
// Check v.4 false bool.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&v);
|
dummyStatement(&v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testStdVectorBool2()
|
void testStdVectorBool2()
|
||||||
{
|
{
|
||||||
std::vector<bool> v1(50, true);
|
std::vector<bool> v1(65, true);
|
||||||
std::vector<bool> v2(65);
|
std::vector<bool> v2(65);
|
||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand v1.
|
// Expand v1.
|
||||||
// Expand v2.
|
// 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 v2 <65 items> std::vector<bool>.
|
||||||
// Check v.0 1 bool.
|
// Check v2.0 false bool.
|
||||||
// Check v.1 0 bool.
|
// Check v2.64 false bool.
|
||||||
// Check v.2 0 bool.
|
|
||||||
// Check v.3 1 bool.
|
|
||||||
// Check v.4 0 bool.
|
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&v1, &v2);
|
dummyStatement(&v1, &v2);
|
||||||
}
|
}
|
||||||
@@ -3555,7 +3553,7 @@ namespace qthread {
|
|||||||
// Expand this.
|
// Expand this.
|
||||||
// Check j 3 int.
|
// Check j 3 int.
|
||||||
// CheckType this qthread::Thread.
|
// CheckType this qthread::Thread.
|
||||||
// Check this.QThread "This is thread #3" qthread::Thread.
|
// Check this.[QThread] "This is thread #3" qthread::Thread.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(this);
|
dummyStatement(this);
|
||||||
}
|
}
|
||||||
@@ -4327,7 +4325,6 @@ namespace basic {
|
|||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand s.
|
// Expand s.
|
||||||
// CheckType s char *.
|
// CheckType s char *.
|
||||||
// Check s.*s 0 '\0' char.
|
|
||||||
// Continue.
|
// Continue.
|
||||||
|
|
||||||
// Manual: Open pinnable tooltip.
|
// Manual: Open pinnable tooltip.
|
||||||
@@ -4549,7 +4546,7 @@ namespace basic {
|
|||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand s.
|
// Expand s.
|
||||||
// CheckType s char *.
|
// CheckType s char *.
|
||||||
// Check s.*s 97 'a' char.
|
// Skip Check s.*s 97 'a' char.
|
||||||
// Check u "" QString.
|
// Check u "" QString.
|
||||||
// CheckType w wchar_t *.
|
// CheckType w wchar_t *.
|
||||||
// Continue.
|
// Continue.
|
||||||
@@ -5069,7 +5066,6 @@ namespace qscript {
|
|||||||
s = engine.newVariant(QVariant(43.0));
|
s = engine.newVariant(QVariant(43.0));
|
||||||
s = engine.newVariant(QVariant(QString("sss")));
|
s = engine.newVariant(QVariant(QString("sss")));
|
||||||
s = engine.newDate(date);
|
s = engine.newDate(date);
|
||||||
x = s.toInt32();
|
|
||||||
date = s.toDateTime();
|
date = s.toDateTime();
|
||||||
s.setProperty("a", QScriptValue());
|
s.setProperty("a", QScriptValue());
|
||||||
QScriptValue d = s.data();
|
QScriptValue d = s.data();
|
||||||
@@ -5676,13 +5672,13 @@ namespace bug5799 {
|
|||||||
// CheckType a1 bug5799::S1 [10].
|
// CheckType a1 bug5799::S1 [10].
|
||||||
// CheckType a2 bug5799::Array.
|
// CheckType a2 bug5799::Array.
|
||||||
// CheckType s2 bug5799::S2.
|
// CheckType s2 bug5799::S2.
|
||||||
// CheckType s2.bug5799::S1 bug5799::S1.
|
// CheckType s2.[bug5799::S1] bug5799::S1.
|
||||||
// Check s2.bug5799::S1.m1 5 int.
|
// Check s2.[bug5799::S1].m1 5 int.
|
||||||
// Check s2.bug5799::S1.m2 32767 int.
|
// Check s2.[bug5799::S1].m2 32767 int.
|
||||||
// CheckType s4 bug5799::S4.
|
// CheckType s4 bug5799::S4.
|
||||||
// CheckType s4.bug5799::S3 bug5799::S3.
|
// CheckType s4.[bug5799::S3] bug5799::S3.
|
||||||
// Check s4.bug5799::S3.m1 5 int.
|
// Check s4.[bug5799::S3].m1 5 int.
|
||||||
// Check s4.bug5799::S3.m2 0 int.
|
// Check s4.[bug5799::S3].m2 0 int.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&s2, &s4, &a1, &a2);
|
dummyStatement(&s2, &s4, &a1, &a2);
|
||||||
}
|
}
|
||||||
@@ -5798,9 +5794,11 @@ namespace bug6857 {
|
|||||||
void test6857()
|
void test6857()
|
||||||
{
|
{
|
||||||
MyFile file("/tmp/tt");
|
MyFile file("/tmp/tt");
|
||||||
|
file.setObjectName("A file");
|
||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand file.
|
// Expand file.
|
||||||
// Check file.QFile "/tmp/tt" QFile.
|
// Check file "A file" MyFile.
|
||||||
|
// Check file.[QFile] "/tmp/tt" QFile.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&file);
|
dummyStatement(&file);
|
||||||
}
|
}
|
||||||
@@ -5819,9 +5817,11 @@ namespace bug6858 {
|
|||||||
void test6858()
|
void test6858()
|
||||||
{
|
{
|
||||||
MyFile file("/tmp/tt");
|
MyFile file("/tmp/tt");
|
||||||
|
file.setObjectName("Another file");
|
||||||
QFile *pfile = &file;
|
QFile *pfile = &file;
|
||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Check pfile "/tmp/tt" bug6858::MyFile.
|
// Check pfile "Another file" bug6858::MyFile.
|
||||||
|
// Check pfile.[QFile] "/tmp/tt" QFile.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&file, pfile);
|
dummyStatement(&file, pfile);
|
||||||
}
|
}
|
||||||
@@ -5846,7 +5846,7 @@ namespace bug6933 {
|
|||||||
Base *b = &d;
|
Base *b = &d;
|
||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand b b.bug6933::Base
|
// Expand b b.bug6933::Base
|
||||||
// Check b.bug6933::Base.[vptr]
|
// Check b.[bug6933::Base].[vptr]
|
||||||
dummyStatement(&d, b);
|
dummyStatement(&d, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5914,14 +5914,14 @@ namespace gdb13393 {
|
|||||||
BREAK_HERE;
|
BREAK_HERE;
|
||||||
// Expand d ptr ptrConst ptrToPtr ref refConst s.
|
// Expand d ptr ptrConst ptrToPtr ref refConst s.
|
||||||
// CheckType d gdb13393::Derived.
|
// CheckType d gdb13393::Derived.
|
||||||
// CheckType d.gdb13393::Base gdb13393::Derived.
|
// CheckType d.[gdb13393::Base] gdb13393::Derived.
|
||||||
// Check d.b 2 int.
|
// Check d.b 2 int.
|
||||||
// CheckType ptr gdb13393::Derived.
|
// CheckType ptr gdb13393::Derived.
|
||||||
// CheckType ptr.[vptr] .
|
// CheckType ptr.[gdb12293::Base] gdb13393::Base.
|
||||||
// Check ptr.a 1 int.
|
// Check ptr.[a] 1 int.
|
||||||
// CheckType ptrConst gdb13393::Derived.
|
// CheckType ptrConst gdb13393::Derived.
|
||||||
// CheckType ptrConst.[vptr] .
|
// CheckType ptrConst.[gdb13393::Base] gdb13393::Base.
|
||||||
// Check ptrConst.a 1 int.
|
// Check ptrConst.b 2 int.
|
||||||
// CheckType ptrToPtr gdb13393::Derived.
|
// CheckType ptrToPtr gdb13393::Derived.
|
||||||
// CheckType ptrToPtr.[vptr] .
|
// CheckType ptrToPtr.[vptr] .
|
||||||
// Check ptrToPtr.a 1 int.
|
// Check ptrToPtr.a 1 int.
|
||||||
@@ -5977,7 +5977,7 @@ namespace gdb10586 {
|
|||||||
// Check v.a 2 int.
|
// Check v.a 2 int.
|
||||||
// Check s.x 1 int.
|
// Check s.x 1 int.
|
||||||
// Continue.
|
// Continue.
|
||||||
dummyStatement(&v, &n);
|
dummyStatement(&v, &n, &s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test10586()
|
void test10586()
|
||||||
|
|||||||
Reference in New Issue
Block a user