diff options
| author | hjk <hjk121@nokiamail.com> | 2014-11-21 12:45:34 +0100 |
|---|---|---|
| committer | hjk <hjk121@nokiamail.com> | 2014-11-21 15:12:04 +0100 |
| commit | 20675704c6a0672906ee5da0c093aa13c5b78ede (patch) | |
| tree | c361c072f083870f2bd3eed64a4ea9ce46384765 | |
| parent | 5ad01800a3699d14f4d049314b424f9f6c47983b (diff) | |
| download | qt-creator-20675704c6a0672906ee5da0c093aa13c5b78ede.tar.gz | |
Debugger: Add ability to check for clang version in tests
Change-Id: Ie56de7a0e59cadd8557f7a2fd00d434470000f3c
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
| -rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index ab75fc6117..e1bcdb348b 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -202,6 +202,13 @@ struct GccVersion : VersionBase {} }; +struct ClangVersion : VersionBase +{ + ClangVersion(int minimum = 0, int maximum = INT_MAX) + : VersionBase(minimum, maximum) + {} +}; + struct GdbVersion : VersionBase { GdbVersion(int minimum = 0, int maximum = INT_MAX) @@ -237,11 +244,12 @@ static QString toHex(const QString &str) struct Context { - Context() : qtVersion(0), gccVersion(0) {} + Context() : qtVersion(0), gccVersion(0), clangVersion(0) {} QByteArray nameSpace; int qtVersion; int gccVersion; + int clangVersion; }; struct Name @@ -449,6 +457,8 @@ struct CheckBase CheckBase() : enginesForCheck(AllEngines) {} mutable int enginesForCheck; mutable VersionBase debuggerVersionForCheck; + mutable VersionBase gccVersionForCheck; + mutable VersionBase clangVersionForCheck; mutable QtVersion qtVersionForCheck; }; @@ -467,11 +477,13 @@ struct Check : CheckBase expectedValue(value), expectedType(type) {} - bool matches(DebuggerEngine engine, int debuggerVersion, int qtVersion) const + bool matches(DebuggerEngine engine, int debuggerVersion, const Context &context) const { return (engine & enginesForCheck) && debuggerVersionForCheck.covers(debuggerVersion) - && qtVersionForCheck.covers(qtVersion); + && gccVersionForCheck.covers(context.gccVersion) + && clangVersionForCheck.covers(context.clangVersion) + && qtVersionForCheck.covers(context.qtVersion); } const Check &operator%(DebuggerEngine engine) @@ -487,6 +499,27 @@ struct Check : CheckBase return *this; } + const Check &operator%(LldbVersion version) + { + enginesForCheck = LldbEngine; + debuggerVersionForCheck = version; + return *this; + } + + const Check &operator%(GccVersion version) + { + enginesForCheck = GdbEngine; + gccVersionForCheck = version; + return *this; + } + + const Check &operator%(ClangVersion version) + { + enginesForCheck = GdbEngine; + clangVersionForCheck = version; + return *this; + } + QByteArray iname; Name expectedName; Value expectedValue; @@ -601,6 +634,7 @@ struct DataBase mutable LldbVersion neededLldbVersion; mutable QtVersion neededQtVersion; // HEX! 0x50300 mutable GccVersion neededGccVersion; // DEC. 40702 for 4.7.2 + mutable ClangVersion neededClangVersion; // DEC. mutable BoostVersion neededBoostVersion; // DEC. 105400 for 1.54.0 }; @@ -638,6 +672,12 @@ public: return *this; } + const Data &operator+(const ClangVersion &clangVersion) const + { + neededClangVersion = clangVersion; + return *this; + } + const Data &operator+(const GdbVersion &gdbVersion) const { neededGdbVersion = gdbVersion; @@ -1085,15 +1125,20 @@ void tst_Dumpers::dumper() "\n{" "\n int qtversion = " + (data.useQt ? "QT_VERSION" : "0") + ";" "\n#ifdef __GNUC__" - "\n int gccversion = 0x10000 * __GNUC__ + 0x100 * __GNUC_MINOR__;" + "\n int gccversion = 10000 * __GNUC__ + 100 * __GNUC_MINOR__;" "\n#else" "\n int gccversion = 0;" "\n#endif" + "\n#ifdef __clang__" + "\n int clangversion = 10000 * __clang_major__ + 100 * __clang_minor__;" + "\n#else" + "\n int clangversion = 0;" + "\n#endif" "\n" + (data.useQHash ? "\n#if QT_VERSION >= 0x050000" "\nqt_qhash_seed.store(0);" "\n#endif\n" : "") + - "\n unused(&argc, &argv, &qtversion, &gccversion);\n" + "\n unused(&argc, &argv, &qtversion, &gccversion, &clangversion);\n" "\n" + data.code + "\n BREAK;" "\n return 0;" @@ -1302,6 +1347,8 @@ void tst_Dumpers::dumper() context.qtVersion = child["value"].toInt(); else if (dummy.iname == "local.gccversion") context.gccVersion = child["value"].toInt(); + else if (dummy.iname == "local.clangversion") + context.clangVersion = child["value"].toInt(); else parseWatchData(expandedINames, dummy, child, &list); } @@ -1317,7 +1364,7 @@ void tst_Dumpers::dumper() //qDebug() << "CHECKS" << i << check.iname; if ("local." + check.iname == item.iname) { data.checks.removeAt(i); - if (check.matches(m_debuggerEngine, m_debuggerVersion, context.qtVersion)) { + if (check.matches(m_debuggerEngine, m_debuggerVersion, context)) { //qDebug() << "USING MATCHING TEST FOR " << item.iname; if (!check.expectedName.matches(item.name.toLatin1(), context)) { qDebug() << "INAME : " << item.iname; @@ -1348,7 +1395,7 @@ void tst_Dumpers::dumper() if (!data.checks.isEmpty()) { for (int i = data.checks.size(); --i >= 0; ) { Check check = data.checks.at(i); - if (!check.matches(m_debuggerEngine, m_debuggerVersion, context.qtVersion)) + if (!check.matches(m_debuggerEngine, m_debuggerVersion, context)) data.checks.removeAt(i); } } |
