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

Core: Add a test suite #9297

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft

Core: Add a test suite #9297

wants to merge 42 commits into from

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

@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

@nnyyxxxx
Copy link
Contributor

nnyyxxxx 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?

@nnyyxxxx
Copy link
Contributor

nnyyxxxx commented Feb 5, 2025

swap config sounds kinda sus ngl

Copy link
Contributor

@nnyyxxxx nnyyxxxx 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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Nix NixOS issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants