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 <giuseppe.dangelo@kdab.com>
(cherry picked from commit ea4d6b987ae10f1bb910081b523c3b22b11f7b64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2022-06-18 22:46:15 +02:00 committed by Qt Cherry-pick Bot
parent 1197280748
commit 46d0d8e300

View File

@ -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: