desktop: rewrite reserved area handling + improve tests (#12383)

This commit is contained in:
Vaxry 2025-12-05 14:16:22 +00:00 committed by GitHub
parent d5c52ef58e
commit 9264436f35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 818 additions and 413 deletions

View file

@ -12,6 +12,7 @@
epoll-shim,
git,
glaze,
gtest,
hyprcursor,
hyprgraphics,
hyprland-protocols,
@ -40,6 +41,7 @@
xorg,
xwayland,
debug ? false,
withTests ? false,
enableXWayland ? true,
withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
wrapRuntimeDeps ? true,
@ -75,7 +77,7 @@ in
assert assertMsg (!withHyprtester) "The option `withHyprtester` has been removed. Hyprtester is always built now.";
customStdenv.mkDerivation (finalAttrs: {
pname = "hyprland${optionalString debug "-debug"}";
inherit version;
inherit version withTests;
src = fs.toSource {
root = ../.;
@ -88,7 +90,6 @@ in
../assets/install
../hyprctl
../hyprland.pc.in
../hyprtester
../LICENSE
../protocols
../src
@ -98,6 +99,7 @@ in
(fs.fileFilter (file: file.hasExt "conf" || file.hasExt "desktop") ../example)
(fs.fileFilter (file: file.hasExt "sh") ../scripts)
(fs.fileFilter (file: file.name == "CMakeLists.txt") ../.)
(optional withTests [../tests ../hyprtester])
]));
};
@ -141,6 +143,7 @@ in
cairo
git
glaze
gtest
hyprcursor
hyprgraphics
hyprland-protocols
@ -195,7 +198,7 @@ in
"NO_UWSM" = true;
"NO_HYPRPM" = true;
"TRACY_ENABLE" = false;
"BUILD_HYPRTESTER" = true;
"WITH_TESTS" = withTests;
};
preConfigure = ''
@ -215,8 +218,11 @@ in
]}
''}
install hyprtester/pointer-warp -t $out/bin
install hyprtester/pointer-scroll -t $out/bin
${optionalString withTests ''
install hyprtester/pointer-warp -t $out/bin
install hyprtester/pointer-scroll -t $out/bin
install hyprland_gtests -t $out/bin
''}
'';
passthru.providedSessions = ["hyprland"];

View file

@ -44,6 +44,8 @@ in {
};
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
hyprland-with-tests = final.hyprland.override {withTests = true;};
hyprland-with-hyprtester =
builtins.trace ''
hyprland-with-hyprtester was removed. Please use the hyprland package.

View file

@ -1,6 +1,6 @@
inputs: pkgs: let
flake = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
hyprland = flake.hyprland;
hyprland = flake.hyprland-with-tests;
in {
tests = pkgs.testers.runNixOSTest {
name = "hyprland-tests";
@ -68,6 +68,12 @@ in {
# Wait for tty to be up
machine.wait_for_unit("multi-user.target")
# Run gtests
print("Running gtests")
exit_status, _out = machine.execute("su - alice -c 'hyprland_gtests 2>&1 | tee /tmp/gtestslog; exit ''${PIPESTATUS[0]}'")
machine.execute(f'echo {exit_status} > /tmp/exit_status_gtests')
# Run hyprtester testing framework/suite
print("Running hyprtester")
exit_status, _out = machine.execute("su - alice -c 'hyprtester -b ${hyprland}/bin/Hyprland -c /etc/test.conf -p ${hyprland}/lib/hyprtestplugin.so 2>&1 | tee /tmp/testerlog; exit ''${PIPESTATUS[0]}'")
@ -76,6 +82,7 @@ in {
# Copy logs to host
machine.execute('cp "$(find /tmp/hypr -name *.log | head -1)" /tmp/hyprlog')
machine.execute(f'echo {exit_status} > /tmp/exit_status')
machine.copy_from_vm("/tmp/gtestslog")
machine.copy_from_vm("/tmp/testerlog")
machine.copy_from_vm("/tmp/hyprlog")
machine.copy_from_vm("/tmp/exit_status")