Skip to content

Commit

Permalink
Fix for LP builds (#1287)
Browse files Browse the repository at this point in the history
(cherry picked from commit a187e10)
  • Loading branch information
AlanGriffiths committed Feb 17, 2020
1 parent 0153a17 commit 12cf31d
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions tests/miral/external_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ struct ExternalClient : miral::TestServer
{
ExternalClient()
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
add_to_environment("XDG_RUNTIME_DIR", "/tmp");
start_server_in_setup = false;
add_server_init(external_client);
}
Expand Down Expand Up @@ -81,6 +79,9 @@ auto const app_x11_env = "MIR_SERVER_APP_ENV_X11";

TEST_F(ExternalClient, default_app_env_is_as_expected)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
add_to_environment("XDG_RUNTIME_DIR", "/tmp");

start_server();

EXPECT_THAT(client_env_value("GDK_BACKEND"), StrEq("wayland"));
Expand All @@ -92,6 +93,9 @@ TEST_F(ExternalClient, default_app_env_is_as_expected)

TEST_F(ExternalClient, default_app_env_x11_is_as_expected)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
start_server();
Expand All @@ -105,6 +109,9 @@ TEST_F(ExternalClient, default_app_env_x11_is_as_expected)

TEST_F(ExternalClient, override_app_env_can_set_gdk_backend)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
add_to_environment("XDG_RUNTIME_DIR", "/tmp");

add_to_environment(app_env, "GDK_BACKEND=mir");
start_server();

Expand All @@ -113,6 +120,9 @@ TEST_F(ExternalClient, override_app_env_can_set_gdk_backend)

TEST_F(ExternalClient, override_app_env_x11_can_unset)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_to_environment(app_x11_env, "-GDK_BACKEND");
add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
Expand All @@ -123,6 +133,9 @@ TEST_F(ExternalClient, override_app_env_x11_can_unset)

TEST_F(ExternalClient, override_app_env_x11_can_unset_and_set)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_to_environment(app_x11_env, "-GDK_BACKEND:QT_QPA_PLATFORM=xcb");
add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
Expand All @@ -134,6 +147,9 @@ TEST_F(ExternalClient, override_app_env_x11_can_unset_and_set)

TEST_F(ExternalClient, override_app_env_x11_can_set_and_unset)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_to_environment(app_x11_env, "QT_QPA_PLATFORM=xcb:-GDK_BACKEND");
add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
Expand All @@ -145,6 +161,9 @@ TEST_F(ExternalClient, override_app_env_x11_can_set_and_unset)

TEST_F(ExternalClient, stray_separators_are_ignored)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_to_environment(app_x11_env, "::QT_QPA_PLATFORM=xcb::-GDK_BACKEND::");
add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
Expand All @@ -156,6 +175,9 @@ TEST_F(ExternalClient, stray_separators_are_ignored)

TEST_F(ExternalClient, empty_override_does_nothing)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_to_environment(app_x11_env, "");
add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
Expand All @@ -170,6 +192,9 @@ TEST_F(ExternalClient, empty_override_does_nothing)

TEST_F(ExternalClient, strange_override_does_nothing)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_to_environment(app_x11_env, "=====");
add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
Expand All @@ -184,6 +209,9 @@ TEST_F(ExternalClient, strange_override_does_nothing)

TEST_F(ExternalClient, another_strange_override_does_nothing)
{
if (getenv("XDG_RUNTIME_DIR") == nullptr)
return; // Starting an X server on LP builder doesn't work - skip the test

add_to_environment(app_x11_env, ":::");
add_server_init(x11);
add_to_environment("MIR_SERVER_ENABLE_X11", "");
Expand Down

0 comments on commit 12cf31d

Please sign in to comment.