Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run examples in CI #2675

Closed
wants to merge 3 commits into from
Closed

Conversation

notgull
Copy link
Member

@notgull notgull commented Feb 6, 2023

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

This PR sets up the example so that they can be ran in the CI using X11 under xvfb, essentially allowing us to run them as integration tests. I accomplish this by spawning a thread that sends a user event to the event loop that makes it time out.

There are ways of running the examples of other platforms, but I figured I'd start with X11.

@kchibisov
Copy link
Member

Is the point to ensure that it starts without crashing? If so it might not be that useful. Though, I'm not even sure how to write tests for stuff like that. Usually for libraries like winit you want to test what events you produce based on server events.

So you can ensure that event ordering, inner values, and such works as expected. From what I can tell, only on Wayland it could be possible, but it'll take so much effort to add meaning that it's not really feasible to maintain(you simply need to implement fake compositor sending fake events).

@notgull
Copy link
Member Author

notgull commented Feb 6, 2023

Is the point to ensure that it starts without crashing? If so it might not be that useful.

I figure that, for examples, it can't hurt to at least double check that everything starts up and shuts down okay. As far as I can tell, there's nothing in the winit codebase that checks this on a CI run.

Though, I'm not even sure how to write tests for stuff like that.

This would probably require a more complicated testing setup. I don't really want to work on anything more complicated than this before #2614 lands, since Xlib is a pain and a half to successfully integration test.

From what I can tell, only on Wayland it could be possible, but it'll take so much effort to add meaning that it's not really feasible to maintain(you simply need to implement fake compositor sending fake events).

Hmm, on Wayland, is there not an equivalent to xvfb yet?

@kchibisov
Copy link
Member

Hmm, on Wayland, is there not an equivalent to xvfb yet?

You can run compositors in headless mode without issues, like sway :p. I was talking about sending specific input from compositor and testing the replies, like wayland-rs is doing, but they have much simpler task.

@notgull notgull marked this pull request as ready for review February 6, 2023 17:47
@madsmtm
Copy link
Member

madsmtm commented Feb 7, 2023

Related: #2088

@notgull
Copy link
Member Author

notgull commented Jul 29, 2023

Putting in the effort to rebase this would take more emotional investment than I currently do in this PR.

@notgull notgull closed this Jul 29, 2023
@notgull notgull deleted the test-examples branch July 29, 2023 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants