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
Pick-to: 6.4 6.3
Change-Id: I169235a12190e3f72525cddfe1a44a4bee19eca1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
bb10
Volker Hilsheimer 2022-06-18 22:46:15 +02:00
parent 797a493f50
commit ea4d6b987a
1 changed files with 16 additions and 0 deletions

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: