outputview: also detect glib assert messages

parent bcfa790c
Pipeline #37428 failed with stage
in 60 minutes and 28 seconds
......@@ -439,6 +439,31 @@ FilteredItem NativeAppErrorFilterStrategy::errorInLine(const QString& line)
ErrorFormat(QStringLiteral("(file:\\/\\/(?:[^:]+)):([1-9][0-9]*): ([a-zA-Z]+)Error"), 1, 2, -1),
// END: Qt
// BEGIN: glib
// all messages may have an initial entry like "GIO:" in case the log domain was set
// the function name after the line number may be missing
// g_assert(0)
// ERROR:/foo/test.cpp:46:int main(): assertion failed: (0)
ErrorFormat(QStringLiteral("^(.+:)?ERROR:(.+):([1-9][0-9]*):(.+:)? assertion failed"), 2, 3, -1),
// g_assert_not_reached()
// ERROR:/foo/test.cpp:2024:int main(): code should not be reached
ErrorFormat(QStringLiteral("^(.+:)?ERROR:(.+):([1-9][0-9]*):(.+:)? code should not be reached"), 2, 3, -1),
// g_assert_null() / g_assert_nonnull()
// ERROR:/foo/test.cpp:18:int main(): 'bar' should not be nullptr
// ERROR:/foo/test.c:18:int main(): 'bar' should not be NULL
ErrorFormat(QStringLiteral("^(.+:)?ERROR:(.+):([1-9][0-9]*):(.+:)? '.+' should (not )?be (nullptr|NULL)"), 2, 3, -1),
// g_assert_true() / g_assert_false()
// ERROR:/foo/test.cpp:18:int main(): 'foo' should be TRUE
// ERROR:/foo/test.cpp:18:int main(): 'foo' should be FALSE
ErrorFormat(QStringLiteral("^(.+:)?ERROR:(.+):([1-9][0-9]*):(.+:)? '.+' should be (TRUE|FALSE)"), 2, 3, -1),
// END: glib
};
return match(NATIVE_APPLICATION_ERROR_FILTERS, line);
......
......@@ -336,6 +336,69 @@ void TestFilteringStrategy::testNativeAppErrorFilterStrategy_data()
<< "/path/to/foo.qml"
<< 6 << 4 << FilteredItem::ErrorItem;
// END: Qt
// BEGIN: glib
QTest::newRow("g_assert(0) with domain")
<< "GIO:ERROR:/foo/test.cpp:46:int main(): assertion failed: (0)"
<< "/foo/test.cpp"
<< 45 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert(0) without domain")
<< "ERROR:/foo/test.cpp:46:int main(): assertion failed: (0)"
<< "/foo/test.cpp"
<< 45 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_cmpint(1, ==, 2) with domain")
<< "GIO:ERROR:/foo/test.cpp:2024: assertion failed (1 == 2): (1 == 2)"
<< "/foo/test.cpp"
<< 2023 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_cmpint(1, ==, 2) without domain")
<< "ERROR:/foo/test.cpp:2024:int main(): assertion failed (1 == 2): (1 == 2)"
<< "/foo/test.cpp"
<< 2023 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_not_reached() with domain")
<< "GIO:ERROR:/foo/test.cpp:2024:int main(): code should not be reached"
<< "/foo/test.cpp"
<< 2023 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_not_reached() without domain")
<< "ERROR:/foo/test.cpp:2024: code should not be reached"
<< "/foo/test.cpp"
<< 2023 << 0 << FilteredItem::ErrorItem;
// with prefix, but without function name
QTest::newRow("g_assert_null() C")
<< "GIO:ERROR:/foo/test.c:18: 'bar' should be NULL"
<< "/foo/test.c"
<< 17 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_null() C++")
<< "ERROR:/foo/test.c:18:int main(): 'bar' should be NULL"
<< "/foo/test.c"
<< 17 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_nonnull() C")
<< "ERROR:/foo/test.cpp:18:int main(): 'bar' should be nullptr"
<< "/foo/test.cpp"
<< 17 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_nonnull() C++")
<< "GIO:ERROR:/foo/test.cpp:18:int main(): 'bar' should be nullptr"
<< "/foo/test.cpp"
<< 17 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_true()")
<< "GIO:ERROR:/foo/test.cpp:42:int main(): 'bar' should be TRUE"
<< "/foo/test.cpp"
<< 41 << 0 << FilteredItem::ErrorItem;
QTest::newRow("g_assert_false()")
<< "ERROR:/foo/test.c:42:int main(): 'bar' should be FALSE"
<< "/foo/test.c"
<< 41 << 0 << FilteredItem::ErrorItem;
// END: glib
}
void TestFilteringStrategy::testNativeAppErrorFilterStrategy()
......
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