Blob Blame History Raw
From 73a7b085454ca5b9d8f28529da26c54c5109678a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jkt@kde.org>
Date: Thu, 15 Sep 2016 17:34:52 +0200
Subject: [PATCH] tests: Skip QtWebKit tests when building with ASAN

So yeah, this is evil, but without this patch, I'm getting a funny
looking failure from ASAN's stack-buffer-overflow from within qtwebkit's
JSC.

Given that QtWebKit is unsupported an dead for all practical purposes, I
suppose that there's no chance of an actual fix hitting their tree. I
could probably instrument the CI builds to skip the relevant ASAN checks
for QtWebKit, but it isn't as easy as just not using -fsanitize=address
because we still have to link with the appropriate libraries because the
rest of Qt is ASAN-enabled.

So this change just prevents the offending webkit-using code to execute;
the idea is that the test won't fail, and we will be able to focus on
other ASAN failures in the rest of the build.

Change-Id: I6fefdae1cdd7ed730a2742ff95e9547933f6520e
---
 tests/Composer/test_Html_formatting.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/Composer/test_Html_formatting.cpp b/tests/Composer/test_Html_formatting.cpp
index 4653a26a6..2f74a7eb9 100644
--- a/tests/Composer/test_Html_formatting.cpp
+++ b/tests/Composer/test_Html_formatting.cpp
@@ -31,6 +31,13 @@
 #include "Composer/SenderIdentitiesModel.h"
 #include "Composer/SubjectMangling.h"
 
+#if defined(__has_feature)
+#  if  __has_feature(address_sanitizer)
+#    define SKIP_WEBKIT_TESTS
+#  endif
+#endif
+
+
 Q_DECLARE_METATYPE(QList<QUrl>)
 
 static QString visualizeWhitespace(QString s)
@@ -303,6 +310,9 @@ void HtmlFormattingTest::testPlainTextFormattingViaPaste()
     if (expandedFlowed.isEmpty())
         expandedFlowed = formattedFlowed;
 
+#ifdef SKIP_WEBKIT_TESTS
+    QSKIP("ASAN build -- QtWebKit is known to be broken, skipping");
+#else
     {
         WebRenderingTester tester;
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED)),
@@ -320,6 +330,7 @@ void HtmlFormattingTest::testPlainTextFormattingViaPaste()
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED, WebRenderingTester::RenderExpandEverythingCollapsed)),
                  visualizeWhitespace(expandedFlowed));
     }
+#endif
 }
 
 void HtmlFormattingTest::testPlainTextFormattingViaPaste_data()
@@ -584,6 +595,9 @@ void HtmlFormattingTest::testPlainTextFormattingViaPasteDelSp()
     QFETCH(QString, expandedFlowed);
     QFETCH(QString, expandedFlowedDelSp);
 
+#ifdef SKIP_WEBKIT_TESTS
+    QSKIP("ASAN build -- QtWebKit is known to be broken, skipping");
+#else
     {
         WebRenderingTester tester;
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED, WebRenderingTester::RenderExpandEverythingCollapsed)),
@@ -594,6 +608,7 @@ void HtmlFormattingTest::testPlainTextFormattingViaPasteDelSp()
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED_DELSP, WebRenderingTester::RenderExpandEverythingCollapsed)),
                  visualizeWhitespace(expandedFlowedDelSp));
     }
+#endif
 }