From 46d0d8e3000554a4ec502279ffa25af94f4eb11e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sat, 18 Jun 2022 22:46:15 +0200 Subject: Skip tests that terminate threads under ASAN Thread termination might prevent stack unwinding, which then generates ASAN errors such as ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7f3c1d7858b0 at pc 0x7f3c243d8918 bp 0x7f3c1d7857f0 sp 0x7f3c1d7857e8 Skip such tests so that we can enable blocking CI runs under ASAN. Fixes: QTBUG-104421 Change-Id: I169235a12190e3f72525cddfe1a44a4bee19eca1 Reviewed-by: Giuseppe D'Angelo (cherry picked from commit ea4d6b987ae10f1bb910081b523c3b22b11f7b64) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/thread/qthread/tst_qthread.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index b5f2ebdabf..54309cbcb1 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -462,6 +462,10 @@ void tst_QThread::terminate() #if defined(Q_OS_ANDROID) QSKIP("Thread termination is not supported on Android."); #endif +#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) + QSKIP("Thread termination might result in stack underflow address sanitizer errors.") +#endif + Terminate_Thread thread; { QMutexLocker locker(&thread.mutex); @@ -528,6 +532,10 @@ void tst_QThread::terminated() #if defined(Q_OS_ANDROID) QSKIP("Thread termination is not supported on Android."); #endif +#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) + QSKIP("Thread termination might result in stack underflow address sanitizer errors.") +#endif + SignalRecorder recorder; Terminate_Thread thread; connect(&thread, SIGNAL(finished()), &recorder, SLOT(slot()), Qt::DirectConnection); @@ -1739,6 +1747,10 @@ Q_SIGNALS: void tst_QThread::terminateAndPrematureDestruction() { +#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) + QSKIP("Thread termination might result in stack underflow address sanitizer errors.") +#endif + WaitToRun_Thread thread; QSignalSpy spy(&thread, &WaitToRun_Thread::running); thread.start(); @@ -1755,6 +1767,10 @@ void tst_QThread::terminateAndPrematureDestruction() void tst_QThread::terminateAndDoubleDestruction() { +#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) + QSKIP("Thread termination might result in stack underflow address sanitizer errors.") +#endif + class ChildObject : public QObject { public: -- cgit v1.2.3