Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Related: Issue mentions build failures when x11 is excluded from MIR_PLATFORM

What's new?

test_platform_prober.cpp unconditionally used MockX11 and Wayland platform code, causing link failures when these platforms weren't built. All platform-specific test code is now properly guarded:

X11 platform guards (#if defined(MIR_BUILD_PLATFORM_X11)):

  • Header include: #include <mir/test/doubles/mock_x11.h>
  • Test fixture member: testing::NiceMock<mtd::MockX11> x11; in FullProbeStack
  • Helper method: enable_host_x11() definition
  • Test functions: 2 X11-specific tests

Wayland platform guards (#if defined(MIR_BUILD_PLATFORM_WAYLAND)):

  • Helper method: enable_host_wayland() definition
  • Test functions: 2 Wayland-specific tests

Combined X11 and Wayland guards (#if defined(MIR_BUILD_PLATFORM_X11) && defined(MIR_BUILD_PLATFORM_WAYLAND)):

  • Test functions: 7 tests requiring both platforms

Build system updates:

  • Added add_compile_definitions(MIR_BUILD_PLATFORM_WAYLAND) in tests/unit-tests/CMakeLists.txt to define the Wayland platform macro for conditional compilation

Pattern matches existing platform conditionals for GBM_KMS, ATOMIC_KMS, X11, and EGLSTREAM_KMS.

How to test

Build with MIR_PLATFORM excluding x11 - should compile without linker errors. Build with MIR_PLATFORM excluding wayland - should compile without linker errors. Build with both platforms included - all tests should run as before.

Checklist

  • Tests added and pass
  • Adequate documentation added
  • (optional) Added Screenshots or videos
Original prompt

This section details on the original issue you should resolve

<issue_title>test_platform_prober assumes the x11 platform is built</issue_title>
<issue_description>When x11 is excluded from MIR_PLATFORM, the tests fail to build:

/usr/bin/ld: tests/unit-tests/CMakeFiles/mir_umock_unit_tests.dir/graphics/test_platform_prober.cpp.o: in function `testing::NiceMock<mir::test::doubles::MockX11>::~NiceMock()':
/usr/include/gmock/gmock-nice-strict.h:149:(.text._ZN7testing8NiceMockIN3mir4test7doubles7MockX11EED2Ev[_ZN7testing8NiceMockIN3mir4test7doubles7MockX11EED5Ev]+0x18): undefined reference to `mir::test::doubles::MockX11::~MockX11()'
/usr/bin/ld: tests/unit-tests/CMakeFiles/mir_umock_unit_tests.dir/graphics/test_platform_prober.cpp.o: in function `testing::NiceMock<mir::test::doubles::MockX11>::NiceMock()':
/usr/include/gmock/gmock-nice-strict.h:158:(.text._ZN7testing8NiceMockIN3mir4test7doubles7MockX11EEC2Ev[_ZN7testing8NiceMockIN3mir4test7doubles7MockX11EEC5Ev]+0x25): undefined reference to `mir::test::doubles::MockX11::MockX11()'
```</issue_description>

<agent_instructions>Make the X11 test conditional on the `MIR_PLATFORM` definition including `x11`</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 15, 2026 11:28
Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix test_platform_prober for cases without x11 platform Fix test_platform_prober conditional compilation when x11 platform excluded Jan 15, 2026
Copilot AI requested a review from Saviq January 15, 2026 11:39
@Saviq
Copy link
Contributor

Saviq commented Jan 15, 2026

@copilot while here, there's tests that also unconditionally, expect the wayland platform to be built, can you add a guard for them, too, please?

Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot while here, there's tests that also unconditionally, expect the wayland platform to be built, can you add a guard for them, too, please?

Done in 7f0bda7. Added guards for:

  • enable_host_wayland() method with #if defined(MIR_BUILD_PLATFORM_WAYLAND)
  • 2 Wayland-only tests
  • 6 tests requiring both X11 and Wayland with #if defined(MIR_BUILD_PLATFORM_X11) && defined(MIR_BUILD_PLATFORM_WAYLAND)

Copilot AI changed the title Fix test_platform_prober conditional compilation when x11 platform excluded Fix test_platform_prober conditional compilation when x11 or wayland platforms excluded Jan 15, 2026
@Saviq Saviq marked this pull request as ready for review January 15, 2026 12:13
@Saviq Saviq requested a review from a team as a code owner January 15, 2026 12:13
temporary_env.emplace_back(std::make_unique<mtf::TemporaryEnvironmentValue>("MIR_SERVER_VIRTUAL_OUTPUT", "1280x1024"));
}

#if defined(MIR_BUILD_PLATFORM_WAYLAND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot you also need to define MIR_BUILD_PLATFORM_WAYLAND when it is enabled in the build. See tests/unit-tests/CMakeLists.txt:16 for the similar MIR_BUILD_PLATFORM_X11 definition

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please work on the above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8ea7f63. Added add_compile_definitions(MIR_BUILD_PLATFORM_WAYLAND) in tests/unit-tests/CMakeLists.txt following the same pattern as X11.

Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
@github-actions
Copy link

TICS Quality Gate

✔️ Passed

No changed files applicable for TICS analysis quality gating.

TICS / TICS / Run TICS analysis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_platform_prober assumes the x11 platform is built

3 participants