cc82bad
From 73a7b085454ca5b9d8f28529da26c54c5109678a Mon Sep 17 00:00:00 2001
cc82bad
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jkt@kde.org>
cc82bad
Date: Thu, 15 Sep 2016 17:34:52 +0200
cc82bad
Subject: [PATCH] tests: Skip QtWebKit tests when building with ASAN
cc82bad
cc82bad
So yeah, this is evil, but without this patch, I'm getting a funny
cc82bad
looking failure from ASAN's stack-buffer-overflow from within qtwebkit's
cc82bad
JSC.
cc82bad
cc82bad
Given that QtWebKit is unsupported an dead for all practical purposes, I
cc82bad
suppose that there's no chance of an actual fix hitting their tree. I
cc82bad
could probably instrument the CI builds to skip the relevant ASAN checks
cc82bad
for QtWebKit, but it isn't as easy as just not using -fsanitize=address
cc82bad
because we still have to link with the appropriate libraries because the
cc82bad
rest of Qt is ASAN-enabled.
cc82bad
cc82bad
So this change just prevents the offending webkit-using code to execute;
cc82bad
the idea is that the test won't fail, and we will be able to focus on
cc82bad
other ASAN failures in the rest of the build.
cc82bad
cc82bad
Change-Id: I6fefdae1cdd7ed730a2742ff95e9547933f6520e
cc82bad
---
cc82bad
 tests/Composer/test_Html_formatting.cpp | 15 +++++++++++++++
cc82bad
 1 file changed, 15 insertions(+)
cc82bad
cc82bad
diff --git a/tests/Composer/test_Html_formatting.cpp b/tests/Composer/test_Html_formatting.cpp
cc82bad
index 4653a26a6..2f74a7eb9 100644
cc82bad
--- a/tests/Composer/test_Html_formatting.cpp
cc82bad
+++ b/tests/Composer/test_Html_formatting.cpp
cc82bad
@@ -31,6 +31,13 @@
cc82bad
 #include "Composer/SenderIdentitiesModel.h"
cc82bad
 #include "Composer/SubjectMangling.h"
cc82bad
 
cc82bad
+#if defined(__has_feature)
cc82bad
+#  if  __has_feature(address_sanitizer)
cc82bad
+#    define SKIP_WEBKIT_TESTS
cc82bad
+#  endif
cc82bad
+#endif
cc82bad
+
cc82bad
+
cc82bad
 Q_DECLARE_METATYPE(QList<QUrl>)
cc82bad
 
cc82bad
 static QString visualizeWhitespace(QString s)
cc82bad
@@ -303,6 +310,9 @@ void HtmlFormattingTest::testPlainTextFormattingViaPaste()
cc82bad
     if (expandedFlowed.isEmpty())
cc82bad
         expandedFlowed = formattedFlowed;
cc82bad
 
cc82bad
+#ifdef SKIP_WEBKIT_TESTS
cc82bad
+    QSKIP("ASAN build -- QtWebKit is known to be broken, skipping");
cc82bad
+#else
cc82bad
     {
cc82bad
         WebRenderingTester tester;
cc82bad
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED)),
cc82bad
@@ -320,6 +330,7 @@ void HtmlFormattingTest::testPlainTextFormattingViaPaste()
cc82bad
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED, WebRenderingTester::RenderExpandEverythingCollapsed)),
cc82bad
                  visualizeWhitespace(expandedFlowed));
cc82bad
     }
cc82bad
+#endif
cc82bad
 }
cc82bad
 
cc82bad
 void HtmlFormattingTest::testPlainTextFormattingViaPaste_data()
cc82bad
@@ -584,6 +595,9 @@ void HtmlFormattingTest::testPlainTextFormattingViaPasteDelSp()
cc82bad
     QFETCH(QString, expandedFlowed);
cc82bad
     QFETCH(QString, expandedFlowedDelSp);
cc82bad
 
cc82bad
+#ifdef SKIP_WEBKIT_TESTS
cc82bad
+    QSKIP("ASAN build -- QtWebKit is known to be broken, skipping");
cc82bad
+#else
cc82bad
     {
cc82bad
         WebRenderingTester tester;
cc82bad
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED, WebRenderingTester::RenderExpandEverythingCollapsed)),
cc82bad
@@ -594,6 +608,7 @@ void HtmlFormattingTest::testPlainTextFormattingViaPasteDelSp()
cc82bad
         LONG_STR_QCOMPARE(visualizeWhitespace(tester.asPlainText(source, UiUtils::FlowedFormat::FLOWED_DELSP, WebRenderingTester::RenderExpandEverythingCollapsed)),
cc82bad
                  visualizeWhitespace(expandedFlowedDelSp));
cc82bad
     }
cc82bad
+#endif
cc82bad
 }
cc82bad
 
cc82bad