Fix build: Use temporary directories for tests' XDG_RUNTIME_DIR

Using XDG_RUNTIME_DIR="." does not work after qtbase 5542785, and it was a
rather brittle solution anyway.

Fixes: QTBUG-79185
Change-Id: Iaf9ced66709cc6cbac8a2d54efc64e1a8c528561
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2019-10-14 11:10:42 +02:00 committed by Johan Helsing
parent 7c4b2334a3
commit 918cc075b9
3 changed files with 6 additions and 3 deletions

View File

@ -507,7 +507,8 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters()
int main(int argc, char **argv)
{
setenv("XDG_RUNTIME_DIR", ".", 1);
QTemporaryDir tmpRuntimeDir;
setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
MockCompositor compositor;

View File

@ -173,7 +173,8 @@ void tst_inputcontext::inputContextReconfigurationWhenTogglingTextInputExtension
int main(int argc, char *argv[])
{
qputenv("XDG_RUNTIME_DIR", ".");
QTemporaryDir tmpRuntimeDir;
qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit());
qputenv("QT_QPA_PLATFORM", "wayland");
tst_inputcontext tc;

View File

@ -77,7 +77,8 @@ public:
#define QCOMPOSITOR_TEST_MAIN(test) \
int main(int argc, char **argv) \
{ \
setenv("XDG_RUNTIME_DIR", ".", 1); \
QTemporaryDir tmpRuntimeDir; \
setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); \
setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \
setenv("QT_QPA_PLATFORM", "wayland", 1); \
test tc; \