wayland: In test lock thread when setting env variables
putenv/setenv are not thread safe. The Qt wrappers lock a mutex but this only works if all users use it. Fixes: QTBUG-136450 Pick-to: 6.10 Change-Id: I9a46b5be607c84436864afcf7eb063275e065738 Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
parent
c72ba39e50
commit
a639807a8f
@ -596,11 +596,11 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters()
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QTemporaryDir tmpRuntimeDir;
|
QTemporaryDir tmpRuntimeDir;
|
||||||
setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
|
qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit());
|
||||||
setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
|
qputenv("QT_QPA_PLATFORM", "wayland"); // force QGuiApplication to use wayland plugin
|
||||||
QString shell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_SHELL_INTEGRATION"));
|
QString shell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_SHELL_INTEGRATION"));
|
||||||
if (shell.isEmpty())
|
if (shell.isEmpty())
|
||||||
setenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell", 1);
|
qputenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell");
|
||||||
|
|
||||||
tst_WaylandClient tc;
|
tst_WaylandClient tc;
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
@ -121,9 +121,9 @@ void tst_clientextension::globalRemoved()
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QTemporaryDir tmpRuntimeDir;
|
QTemporaryDir tmpRuntimeDir;
|
||||||
setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
|
qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit());
|
||||||
setenv("QT_QPA_PLATFORM", "wayland", 1);
|
qputenv("QT_QPA_PLATFORM", "wayland");
|
||||||
setenv("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION", "1", 1);
|
qputenv("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION", "1");
|
||||||
|
|
||||||
tst_clientextension tc;
|
tst_clientextension tc;
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
@ -42,7 +42,7 @@ CursorShapeDevice* tst_cursor::cursorShape()
|
|||||||
|
|
||||||
void tst_cursor::init()
|
void tst_cursor::init()
|
||||||
{
|
{
|
||||||
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
|
qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_cursor::setCursor()
|
void tst_cursor::setCursor()
|
||||||
|
@ -35,10 +35,10 @@ void tst_WaylandClientFullScreenShellV1::createDestroyWindow()
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QTemporaryDir tmpRuntimeDir;
|
QTemporaryDir tmpRuntimeDir;
|
||||||
setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
|
qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit());
|
||||||
setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
|
qputenv("QT_QPA_PLATFORM", "wayland"); // force QGuiApplication to use wayland plugin
|
||||||
setenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1", 1);
|
qputenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1");
|
||||||
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); // window decorations don't make much sense here
|
qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); // window decorations don't make much sense here
|
||||||
|
|
||||||
tst_WaylandClientFullScreenShellV1 tc;
|
tst_WaylandClientFullScreenShellV1 tc;
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
@ -247,9 +247,9 @@ int main(int argc, char **argv)
|
|||||||
// test rather than fail. Making sure it finishes is important!
|
// test rather than fail. Making sure it finishes is important!
|
||||||
|
|
||||||
QTemporaryDir tmpRuntimeDir;
|
QTemporaryDir tmpRuntimeDir;
|
||||||
setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
|
qputenv("QT_QPA_PLATFORM", "wayland"); // force QGuiApplication to use wayland plugin
|
||||||
setenv("QT_WAYLAND_RECONNECT", "1", 1);
|
qputenv("QT_WAYLAND_RECONNECT", "1");
|
||||||
setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1);
|
qputenv("XDG_CURRENT_DESKTOP", "qtwaylandtests");
|
||||||
|
|
||||||
tst_WaylandReconnect tc;
|
tst_WaylandReconnect tc;
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
@ -23,7 +23,7 @@ private slots:
|
|||||||
|
|
||||||
void tst_scaling::init()
|
void tst_scaling::init()
|
||||||
{
|
{
|
||||||
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
|
qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_scaling::scaledWindow()
|
void tst_scaling::scaledWindow()
|
||||||
|
@ -85,9 +85,9 @@ public:
|
|||||||
int main(int argc, char **argv) \
|
int main(int argc, char **argv) \
|
||||||
{ \
|
{ \
|
||||||
QTemporaryDir tmpRuntimeDir; \
|
QTemporaryDir tmpRuntimeDir; \
|
||||||
setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); \
|
qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); \
|
||||||
setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \
|
qputenv("XDG_CURRENT_DESKTOP", "qtwaylandtests"); \
|
||||||
setenv("QT_QPA_PLATFORM", "wayland", 1); \
|
qputenv("QT_QPA_PLATFORM", "wayland"); \
|
||||||
test tc; \
|
test tc; \
|
||||||
QGuiApplication app(argc, argv); \
|
QGuiApplication app(argc, argv); \
|
||||||
QTEST_SET_MAIN_SOURCE_PATH \
|
QTEST_SET_MAIN_SOURCE_PATH \
|
||||||
|
@ -15,8 +15,8 @@ private slots:
|
|||||||
// unable to connect to a compositor
|
// unable to connect to a compositor
|
||||||
|
|
||||||
// Make sure the connection actually fails
|
// Make sure the connection actually fails
|
||||||
setenv("XDG_RUNTIME_DIR", "/dev/null", 1); // a place where there are no Wayland sockets
|
qputenv("XDG_RUNTIME_DIR", "/dev/null"); // a place where there are no Wayland sockets
|
||||||
setenv("WAYLAND_DISPLAY", "qt_invalid_socket", 1); // just to be sure
|
qputenv("WAYLAND_DISPLAY", "qt_invalid_socket"); // just to be sure
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
QString platformPluginPath;
|
QString platformPluginPath;
|
||||||
|
@ -42,7 +42,7 @@ private slots:
|
|||||||
|
|
||||||
void tst_xdgshell::init()
|
void tst_xdgshell::init()
|
||||||
{
|
{
|
||||||
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
|
qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_xdgshell::showMinimized()
|
void tst_xdgshell::showMinimized()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user