diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-14 15:45:35 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-14 15:45:35 +0200 |
commit | 4456984da780b14572e1ec0f079a4d349ab299bd (patch) | |
tree | f586a281a81c57c91c49e83a5d3ec6c7eece0578 /tests/auto/testlib | |
parent | e824abd987d77efaa085fe1f9fb514d270798d55 (diff) | |
parent | 281121697340084f7d385eab530f41916789b94d (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
tests/auto/corelib/io/qfile/tst_qfile.cpp
tests/auto/corelib/io/qprocess/tst_qprocess.cpp
tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
Change-Id: Ia93ce500349d96a2fbf0b4a37b73f088cc505c6e
Diffstat (limited to 'tests/auto/testlib')
-rw-r--r-- | tests/auto/testlib/selftests/expected_crashes_3.txt | 1 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/tst_selftests.cpp | 26 |
2 files changed, 22 insertions, 5 deletions
diff --git a/tests/auto/testlib/selftests/expected_crashes_3.txt b/tests/auto/testlib/selftests/expected_crashes_3.txt index 57c3ddc2ba..0e3f60dd1b 100644 --- a/tests/auto/testlib/selftests/expected_crashes_3.txt +++ b/tests/auto/testlib/selftests/expected_crashes_3.txt @@ -2,6 +2,7 @@ Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ PASS : tst_Crashes::initTestCase() QFATAL : tst_Crashes::crash() Received signal 11 + Function time: ms Total time: ms FAIL! : tst_Crashes::crash() Received a fatal error. Loc: [Unknown file(0)] Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 42d929c4a1..63c48fc809 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -316,6 +316,7 @@ tst_Selftests::tst_Selftests() void tst_Selftests::initTestCase() { + QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString())); //Detect the location of the sub programs QString subProgram = QLatin1String("float/float"); #if defined(Q_OS_WIN) @@ -625,13 +626,28 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge for (int n = 0; n < loggers.count(); ++n) { QString logger = loggers[n]; -#if defined(Q_OS_WIN) - if (n == 0 && subdir == QLatin1String("crashes")) { // Remove stack trace which is output to stdout. - const int exceptionLogStart = actualOutputs.first().indexOf("A crash occurred in "); + if (n == 0 && subdir == QLatin1String("crashes")) { + QByteArray &actual = actualOutputs[0]; +#ifndef Q_OS_WIN + // Remove digits of times to match the expected file. + const QLatin1String timePattern("Function time:"); + int timePos = actual.indexOf(timePattern); + if (timePos >= 0) { + timePos += timePattern.size(); + const int nextLinePos = actual.indexOf('\n', timePos); + for (int c = (nextLinePos != -1 ? nextLinePos : actual.size()) - 1; c >= timePos; --c) { + if (actual.at(c) >= '0' && actual.at(c) <= '9') + actual.remove(c, 1); + } + } +#else // !Q_OS_WIN + // Remove stack trace which is output to stdout. + const int exceptionLogStart = actual.indexOf("A crash occurred in "); if (exceptionLogStart >= 0) - actualOutputs[0].truncate(exceptionLogStart); - } + actual.truncate(exceptionLogStart); #endif // Q_OS_WIN + } + QList<QByteArray> res = splitLines(actualOutputs[n]); const QString expectedFileName = expectedFileNameFromTest(subdir, logger); QList<QByteArray> exp = expectedResult(expectedFileName); |