Commit 262e3ab9 authored by hjk's avatar hjk
Browse files

Debugger: Record version of GCC in tests



Change-Id: Id86c313d2a5238c0e301c3b23bde7fabe00efdda
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent e4615675
......@@ -162,10 +162,11 @@ struct LldbOnly {};
struct Context
{
Context() : qtVersion(0) {}
Context() : qtVersion(0), gccVersion(0) {}
QByteArray nameSpace;
int qtVersion;
int gccVersion;
};
struct Name
......@@ -199,12 +200,16 @@ static QByteArray parentIName(const QByteArray &iname)
struct ValueBase
{
ValueBase() : hasPtrSuffix(false), isFloatValue(false), substituteNamespace(true), version(0) {}
ValueBase()
: hasPtrSuffix(false), isFloatValue(false), substituteNamespace(true),
qtVersion(0), minimalGccVersion(0)
{}
bool hasPtrSuffix;
bool isFloatValue;
bool substituteNamespace;
int version;
int qtVersion;
int minimalGccVersion;
};
struct Value : public ValueBase
......@@ -220,18 +225,24 @@ struct Value : public ValueBase
return true;
if (context.qtVersion) {
if (version == 4) {
if (qtVersion == 4) {
if (context.qtVersion < 0x40000 || context.qtVersion >= 0x50000) {
//QWARN("Qt 4 specific case skipped");
return true;
}
} else if (version == 5) {
} else if (qtVersion == 5) {
if (context.qtVersion < 0x50000 || context.qtVersion >= 0x60000) {
//QWARN("Qt 5 specific case skipped");
return true;
}
}
}
if (minimalGccVersion && context.gccVersion) {
if (minimalGccVersion >= context.gccVersion) {
//QWARN("Current GCC is too old for this test.")
return true;
}
}
QString actualValue = actualValue0;
if (actualValue == QLatin1String(" "))
actualValue.clear(); // FIXME: Remove later.
......@@ -257,6 +268,8 @@ struct Value : public ValueBase
return actualValue == expectedValue;
}
void setMinimalGccVersion(int version) { minimalGccVersion = version; }
QString value;
};
......@@ -274,12 +287,12 @@ struct FloatValue : Value
struct Value4 : Value
{
Value4(const QByteArray &value) : Value(value) { version = 4; }
Value4(const QByteArray &value) : Value(value) { qtVersion = 4; }
};
struct Value5 : Value
{
Value5(const QByteArray &value) : Value(value) { version = 5; }
Value5(const QByteArray &value) : Value(value) { qtVersion = 5; }
};
struct UnsubstitutedValue : Value
......@@ -289,19 +302,19 @@ struct UnsubstitutedValue : Value
struct Type
{
Type() : version(0) {}
Type(const char *str) : type(str), version(0) {}
Type(const QByteArray &ba) : type(ba), version(0) {}
Type() : qtVersion(0) {}
Type(const char *str) : type(str), qtVersion(0) {}
Type(const QByteArray &ba) : type(ba), qtVersion(0) {}
bool matches(const QByteArray &actualType0, const Context &context) const
{
if (context.qtVersion) {
if (version == 4) {
if (qtVersion == 4) {
if (context.qtVersion < 0x40000 || context.qtVersion >= 0x50000) {
//QWARN("Qt 4 specific case skipped");
return true;
}
} else if (version == 5) {
} else if (qtVersion == 5) {
if (context.qtVersion < 0x50000 || context.qtVersion >= 0x60000) {
//QWARN("Qt 5 specific case skipped");
return true;
......@@ -319,17 +332,17 @@ struct Type
return actualType == expectedType;
}
QByteArray type;
int version;
int qtVersion;
};
struct Type4 : Type
{
Type4(const QByteArray &ba) : Type(ba) { version = 4; }
Type4(const QByteArray &ba) : Type(ba) { qtVersion = 4; }
};
struct Type5 : Type
{
Type5(const QByteArray &ba) : Type(ba) { version = 5; }
Type5(const QByteArray &ba) : Type(ba) { qtVersion = 5; }
};
enum DebuggerEngine
......@@ -825,11 +838,16 @@ void tst_Dumpers::dumper()
"\n\nint main(int argc, char *argv[])"
"\n{"
"\n int qtversion = " + (data.useQt ? "QT_VERSION" : "0") + ";"
"\n#ifdef __GNUC__"
"\n int gccversion = 0x10000 * __GNUC__ + 0x100 * __GNUC_MINOR__;"
"\n#else"
"\n int gccversion = 0;"
"\n#endif"
"\n" + (data.useQHash ?
"\n#if QT_VERSION >= 0x050000"
"\nqt_qhash_seed.testAndSetRelaxed(-1, 0);"
"\n#endif\n" : "") +
"\n unused(&argc, &argv, &qtversion);\n"
"\n unused(&argc, &argv, &qtversion, &gccversion);\n"
"\n" + data.code +
"\n breakHere();"
"\n return 0;"
......@@ -1049,6 +1067,8 @@ void tst_Dumpers::dumper()
dummy.name = QLatin1String(child["name"].data());
if (dummy.iname == "local.qtversion")
context.qtVersion = child["value"].toInt();
else if (dummy.iname == "local.gccversion")
context.gccVersion = child["value"].toInt();
else
parseWatchData(expandedINames, dummy, child, &list);
}
......@@ -1097,7 +1117,7 @@ void tst_Dumpers::dumper()
qDebug() << "SOME TESTS NOT EXECUTED: ";
foreach (const Check &check, data.checks) {
qDebug() << " TEST NOT FOUND FOR INAME: " << check.iname;
if (!fail && check.expectedValue.version != 0)
if (!fail && check.expectedValue.qtVersion != 0)
fail = true;
}
qDebug() << "SEEN INAMES " << seenINames;
......@@ -1110,6 +1130,8 @@ void tst_Dumpers::dumper()
qDebug() << "CONTENTS : " << contents;
qDebug() << "Qt VERSION : "
<< qPrintable(QString::number(context.qtVersion, 16));
qDebug() << "GCC VERSION : "
<< qPrintable(QString::number(context.gccVersion, 16));
qDebug() << "BUILD DIR : " << qPrintable(t->buildPath);
}
QVERIFY(ok);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment