diff options
Diffstat (limited to 'tests/auto/corelib/kernel')
4 files changed, 43 insertions, 4 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 9bd66c0835..25da013292 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -3024,6 +3024,16 @@ void tst_QObject::recursiveSignalEmission() QSKIP("No qprocess support", SkipAll); #else QProcess proc; + + // Add the executable's directory to path so that we can find the test helper next to it + // in a cross-platform way. We must do this because the CWD is not pointing to this directory + // in debug-and-release builds. + QByteArray pathEnv = qgetenv("PATH"); + qputenv("PATH", + pathEnv + QDir::listSeparator().toLatin1() + + QCoreApplication::applicationDirPath().toLocal8Bit()); + auto restore = qScopeGuard([&] { qputenv("PATH", pathEnv); }); + // signalbug helper app should always be next to this test binary const QString path = QStringLiteral("signalbug_helper"); proc.start(path); diff --git a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp index fa2d5e3723..6be2744f3e 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp @@ -35,6 +35,7 @@ #include <QTest> #include <QThread> #include <QElapsedTimer> +#include <QScopeGuard> #define EXISTING_SHARE "existing" #define EXISTING_SIZE 1024 @@ -444,8 +445,20 @@ void tst_QSharedMemory::readOnly() QSKIP("No qprocess support", SkipAll); #elif defined(Q_OS_MACOS) QSKIP("QTBUG-59936: Times out on macOS", SkipAll); +#elif defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) + QSKIP("ASan prevents the crash this test is looking for.", SkipAll); #else rememberKey("readonly_segfault"); + + // Add the executable's directory to path so that we can find the test helper next to it + // in a cross-platform way. We must do this because the CWD is not pointing to this directory + // in debug-and-release builds. + QByteArray path = qgetenv("PATH"); + qputenv("PATH", + path + QDir::listSeparator().toLatin1() + + QCoreApplication::applicationDirPath().toLocal8Bit()); + auto restore = qScopeGuard([&] { qputenv("PATH", path); }); + // ### on windows disable the popup somehow QProcess p; p.start(m_helperBinary, QStringList("readonly_segfault")); @@ -747,6 +760,15 @@ void tst_QSharedMemory::simpleProcessProducerConsumer() rememberKey("market"); + // Add the executable's directory to path so that we can find the test helper next to it + // in a cross-platform way. We must do this because the CWD is not pointing to this directory + // in debug-and-release builds. + QByteArray path = qgetenv("PATH"); + qputenv("PATH", + path + QDir::listSeparator().toLatin1() + + QCoreApplication::applicationDirPath().toLocal8Bit()); + auto restore = qScopeGuard([&] { qputenv("PATH", path); }); + QProcess producer; producer.start(m_helperBinary, QStringList("producer")); QVERIFY2(producer.waitForStarted(), "Could not start helper binary"); diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp index 5f010ae3d1..a73d806067 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp @@ -70,7 +70,14 @@ private: }; tst_QSystemSemaphore::tst_QSystemSemaphore() - : m_helperBinary("acquirerelease_helper") + : +#ifdef Q_OS_WIN + // On windows the CWD is not the same as the test binary, so we cannot use the ./ path. + m_helperBinary("acquirerelease_helper") +#else + // But on Unix we *must* + m_helperBinary("./acquirerelease_helper") +#endif { } diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index c47b25eadb..9f4e1773c8 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -401,9 +401,9 @@ void tst_QTranslator::translationInThreadWhileInstallingTranslator() thread.runningCondition.wait(&thread.startupLock); - QTranslator *tor = new QTranslator; - tor->load("hellotr_la"); - QCoreApplication::installTranslator(tor); + QTranslator tor; + tor.load("hellotr_la"); + QCoreApplication::installTranslator(&tor); ++thread.terminate; |