summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp')
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp22
1 files changed, 22 insertions, 0 deletions
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");