Skip to content

Core: Add a test suite #9297

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

Merged
merged 63 commits into from
Jun 26, 2025
Merged

Core: Add a test suite #9297

merged 63 commits into from
Jun 26, 2025

Conversation

vaxerski
Copy link
Member

@vaxerski vaxerski commented Feb 2, 2025

Currently we only test whether hyprland compiles, but we don't actually test... well, anything else.

This MR is a WIP that adds a test suite.

For now it runs, works, and tests spawing two kitties with smart gaps, that's about it.

TODOs:

  • Test... well, more.
  • Add a plugin that will be built alongside to allow for simulating keystrokes mouse strokes and other stuff
  • consider thinking about visual tests?

@fufexan nix, meson, ci pls? Tester needs to be ran from /hyprtester, btw.

cc @PaideiaDilemma @gulafaran

Sorry, something went wrong.

@fufexan
Copy link
Member

fufexan commented Feb 2, 2025

Good idea, but I suggest we use https://nix.dev/tutorials/nixos/integration-testing-using-virtual-machines.html. These are much simpler to use since we don't need to build our own testing framework, and there are plenty of examples to help.

I'll try to cook something up today or tomorrow if I have time.

@vaxerski
Copy link
Member Author

vaxerski commented Feb 3, 2025

what? Just run the tester and fail if it returns non-zero

@ghost
Copy link

ghost commented Feb 4, 2025

there are a lot of magic numbers, should they be extracted?

@PaideiaDilemma
Copy link
Contributor

This is cool ; )

Do we want something like swapConfig(file) in hyprtester, so that the same test can be executed with different configurations, or do we just change config options via IPC?

Also is there a reason why we don't want to allow passing the path to Hyprland binary and a path to the test suite directory right away?

@ghost
Copy link

ghost commented Feb 5, 2025

swap config sounds kinda sus ngl

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

why cant we just use the config from the examples, everything else can be done via ipc like paideia mentioned

https://github.com/hyprwm/Hyprland/blob/main/example/hyprland.conf

@vaxerski
Copy link
Member Author

vaxerski commented Feb 6, 2025

Do we want something like swapConfig(file) in hyprtester, so that the same test can be executed with different configurations, or do we just change config options via IPC?

Probably not, use the config which is in the tester directory and the rest can be IPC

Also is there a reason why we don't want to allow passing the path to Hyprland binary and a path to the test suite directory right away?

No, just laziness.

@vaxerski
Copy link
Member Author

vaxerski commented Feb 6, 2025

why cant we just use the config from the examples, everything else can be done via ipc like paideia mentioned

easier and faster to just append a few things to a special config file

@mhydock
Copy link
Contributor

mhydock commented Mar 19, 2025

These tests look like they're behavior/integration tests, which are undoubtedly valuable, but is there any interest in adding unit tests? Additionally, instead of hand-rolling a test framework, perhaps consider using an already established test framework? I personally like the look of Catch2 (at least for unit tests), but I'm ok with anything as long as it a) has mass appeal b) autowires tests instead of needing to explicitly list them and c) is easy to read.

@vaxerski
Copy link
Member Author

unit tests on hyprland are quite difficult as most of the functions are very dependent on other things

@fufexan
Copy link
Member

fufexan commented Mar 22, 2025

The current impl doesn't pass tests because the plugin does not load in Hyprland when built in a clean repo. A version mismatch. Though it loads fine when built in a dirty repo. If anyone with Nix knowledge can look into this, I'd be grateful, as I don't have time to debug this in a timely manner.

@vaxerski
Copy link
Member Author

@fufexan can you fix the nix conflicts

fufexan and others added 14 commits June 24, 2025 21:41

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan
Don't print hyprland's log.
eee

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan
fufexan and others added 8 commits June 24, 2025 21:58

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
vaxerski Vaxry

Verified

This commit was signed with the committer’s verified signature.
vaxerski Vaxry

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan

Verified

This commit was signed with the committer’s verified signature.
vaxerski Vaxry
try

Verified

This commit was signed with the committer’s verified signature.
vaxerski Vaxry
cf

Verified

This commit was signed with the committer’s verified signature.
vaxerski Vaxry
@vaxerski
Copy link
Member Author

we got some tests in, they seem to be working reliably. More tests will be added as time goes on. As a baseline, this framework LGTM

@vaxerski vaxerski marked this pull request as ready for review June 26, 2025 16:29

Verified

This commit was signed with the committer’s verified signature.
vaxerski Vaxry
@vaxerski vaxerski merged commit 3d6476c into hyprwm:main Jun 26, 2025
11 of 13 checks passed
fufexan added a commit to fufexan/Hyprland that referenced this pull request Jun 26, 2025

Verified

This commit was signed with the committer’s verified signature.
fufexan Mihai Fufezan
Adds a test suite for testing hyprland's features with a runtime tester

---------

Co-authored-by: Mihai Fufezan <[email protected]>
@malikwirin
Copy link

A new testing framework called hyprtest??
When can I replace Gtests with it in my projects?

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.

None yet

5 participants