summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 21:06:47 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 21:06:47 +0200
commit42e4ae042a4c86e58bcb8b6d2d59ba4a988285b4 (patch)
treea7f25b1d335a834a7c3ae104cee913ef3a4dd4fb /tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
parent4ee4fc18b4067b90efa46ca9baba74f53b54d9ec (diff)
parent168ff3419f256fdb35b586275d293fc0cd773fe1 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
Diffstat (limited to 'tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp')
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
index 3538d90803..c9120d7576 100644
--- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
+++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
@@ -309,7 +309,18 @@ void tst_QThreadStorage::crashOnExit()
QSKIP("No qprocess support", SkipAll);
#else
QString errorMessage;
- QVERIFY2(runCrashOnExit("crashOnExit_helper", &errorMessage),
+
+ // 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); });
+
+ QString binary = QStringLiteral("crashOnExit_helper");
+ QVERIFY2(runCrashOnExit(binary, &errorMessage),
qPrintable(errorMessage));
#endif
}