aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2019-08-05 20:45:35 +0200
committerAndré Hartmann <aha_1980@gmx.de>2019-08-07 10:03:04 +0000
commit932819fe0a1bf8ce41587c9dadcf9a647956c7b6 (patch)
tree1039e89a587b8dfab42f9ffc07b670bf248bdeab
parent185bdcaad8eaf6a514630293a10d949187e6bd54 (diff)
QtOutputFormatter: Add alternate QTest failure pattern
The QTest failure output was modeled after the compiler error pattern, which contains file name and line number to point to the precise error position. Unfortunately, some compilers (MSVC) separate the line number from the file name with "(line)", while others use ":line". Let's handle both when parsing the application or test output, as it was before 9a0ef8ac64, which explicitly separated both parts in the regexp pattern. This amends commit 9a0ef8ac64eb47fd932aebbb0751c431c0b74a08 Fixes: QTCREATORBUG-22800 Change-Id: I58154111612bbb452af19b34f7217afc6dd098df Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
-rw-r--r--src/plugins/qtsupport/qtoutputformatter.cpp10
-rw-r--r--src/plugins/qtsupport/qtoutputformatter.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp
index e6e6581928..dc90c8fda3 100644
--- a/src/plugins/qtsupport/qtoutputformatter.cpp
+++ b/src/plugins/qtsupport/qtoutputformatter.cpp
@@ -420,6 +420,11 @@ void QtSupportPlugin::testQtOutputFormatter_data()
<< 9 << 37 << "../TestProject/test.cpp(123)"
<< "../TestProject/test.cpp" << 123 << -1;
+ QTest::newRow("Unix failed QTest link (alternate)")
+ << " Loc: [/Projects/TestProject/test.cpp:123]"
+ << 9 << 43 << "/Projects/TestProject/test.cpp:123"
+ << "/Projects/TestProject/test.cpp" << 123 << -1;
+
QTest::newRow("Unix relative file link")
<< "file://../main.cpp:157"
<< 0 << 22 << "file://../main.cpp:157"
@@ -431,6 +436,11 @@ void QtSupportPlugin::testQtOutputFormatter_data()
<< 0 << 28 << "..\\TestProject\\test.cpp(123)"
<< "../TestProject/test.cpp" << 123 << -1;
+ QTest::newRow("Windows failed QTest link (alternate)")
+ << " Loc: [c:\\Projects\\TestProject\\test.cpp:123]"
+ << 9 << 45 << "c:\\Projects\\TestProject\\test.cpp:123"
+ << "c:/Projects/TestProject/test.cpp" << 123 << -1;
+
QTest::newRow("Windows failed QTest link with carriage return")
<< "..\\TestProject\\test.cpp(123) : failure location\r"
<< 0 << 28 << "..\\TestProject\\test.cpp(123)"
diff --git a/src/plugins/qtsupport/qtoutputformatter.h b/src/plugins/qtsupport/qtoutputformatter.h
index 45f1a1e396..1d5a886b19 100644
--- a/src/plugins/qtsupport/qtoutputformatter.h
+++ b/src/plugins/qtsupport/qtoutputformatter.h
@@ -33,7 +33,7 @@
#define QT_QML_URL_REGEXP "(?:file|qrc):(?://)?/.+?"
#define QT_ASSERT_REGEXP "ASSERT: .* in file (.+, line \\d+)"
#define QT_ASSERT_X_REGEXP "ASSERT failure in .*: \".*\", file (.+, line \\d+)"
-#define QT_TEST_FAIL_UNIX_REGEXP "^ Loc: \\[((?<file>.+)\\((?<line>\\d+)\\))\\]$"
+#define QT_TEST_FAIL_UNIX_REGEXP "^ Loc: \\[((?<file>.+)(?|\\((?<line>\\d+)\\)|:(?<line>\\d+)))\\]$"
#define QT_TEST_FAIL_WIN_REGEXP "^((?<file>.+)\\((?<line>\\d+)\\)) : failure location\\s*$"
namespace ProjectExplorer { class Project; }