Skip to content

Commit 85adb80

Browse files
separate logs and traces artifacts and wait for hyprland startup with some slack
1 parent d6b9b65 commit 85adb80

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

.github/workflows/nix-test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,16 @@ jobs:
5151
- name: Check exit status
5252
run: grep 0 result/exit_status
5353

54-
- name: Upload artifacts
54+
- name: Upload logs
5555
if: always()
5656
uses: actions/upload-artifact@v4
5757
with:
5858
name: logs
59-
path: result
59+
path: result/logs
60+
61+
- name: Upload traces
62+
if: always()
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: traces
66+
path: result/traces

nix/overlays.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ in {
3434
# Dependencies
3535
(final: prev: {
3636
hyprutils = prev.hyprutils.override {debug = true;};
37+
hyprgraphics = prev.hyprgraphics.override {debug = true;};
3738
hyprlock-debug = prev.hyprlock.override {debug = true;};
3839
hyprlock-test-meta = prev.callPackage ./test-meta.nix {
3940
stdenv = prev.gcc14Stdenv;

nix/tests/default.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ in {
8282
machine.wait_for_unit("multi-user.target")
8383
# Startup Hyprland as the test compositor for hyprlock
8484
print("Running Hyprland")
85-
_, __ = machine.execute("systemd-run -q -u hyprland --uid $(id -u alice) -p RuntimeMaxSec=60 ${envAddToSystemdRun} --setenv PATH=$PATH ${pkgs.hyprland}/bin/Hyprland -c ${flake.hyprlock-test-meta}/share/hypr/hyprland.conf")
86-
_, __ = machine.execute("sleep 5")
85+
machine.execute("systemd-run -q -u hyprland --uid $(id -u alice) -p RuntimeMaxSec=60 ${envAddToSystemdRun} --setenv PATH=$PATH ${pkgs.hyprland}/bin/Hyprland -c ${flake.hyprlock-test-meta}/share/hypr/hyprland.conf")
86+
machine.wait_for_file("/tmp/hyprland_exec_once_notification")
87+
machine.execute("sleep 1") # slack just to be save
88+
8789
_, systeminfo = machine.execute("hyprctl --instance 0 systeminfo")
8890
print(systeminfo)
8991
@@ -94,7 +96,7 @@ in {
9496
hyprlock_cmd = f"hyprlock --config {str(hyprlock_config)} -v 2>&1 >{log_file_path}; echo $? > /tmp/exit_status"
9597
if ${APITRACE_RECORD_PY}:
9698
hyprlock_cmd = f"${lib.getExe' pkgs.apitrace "apitrace"} trace --output {log_file_path}.trace --api egl {hyprlock_cmd}"
97-
_, __ = machine.execute(f"hyprctl --instance 0 dispatch exec '{hyprlock_cmd}'")
99+
machine.execute(f"hyprctl --instance 0 dispatch exec '{hyprlock_cmd}'")
98100
99101
wait_for_lock_exit_status, out = machine.execute("WAYLAND_DISPLAY=wayland-1 ${flake.hyprlock-test-meta}/bin/wait-for-lock")
100102
print(f"Wait for lock exit code: {wait_for_lock_exit_status}")
@@ -107,7 +109,7 @@ in {
107109
# wrong password
108110
machine.send_chars("asdf\n")
109111
110-
_, __ = machine.execute("sleep 3") # default fail_timeout is 2 seconds
112+
machine.execute("sleep 3") # default fail_timeout is 2 seconds
111113
112114
# correct password
113115
machine.send_chars("abcdefghijklmnopqrstuvwxyz1234567890-=!@#$%^&*()_+[]{};':\"]\\|,./<>?`~")
@@ -126,13 +128,13 @@ in {
126128
machine.send_key("z")
127129
machine.send_chars("\n")
128130
129-
_, __ = machine.execute(f"waitpid {hyprlock_pid}")
131+
machine.execute(f"waitpid {hyprlock_pid}")
130132
_, exit_status = machine.execute("cat /tmp/exit_status")
131133
print(f"Hyprlock exited with {exit_status}")
132134
133-
machine.copy_from_vm(log_file_path)
135+
machine.copy_from_vm(log_file_path, "logs")
134136
if ${APITRACE_RECORD_PY}:
135-
machine.copy_from_vm(log_file_path + ".trace")
137+
machine.copy_from_vm(log_file_path + ".trace", "traces")
136138
137139
_, out = machine.execute(f"cat {log_file_path}")
138140
print(f"Hyprlock log:\n{out}")

tests/hyprland.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
monitor = Virtual-1,1920x1080@60,auto-right,1
22
monitor = ,disabled
33

4-
# see nix/tests/default.nix
5-
# exec-once = run_hyprlock_tests.sh
6-
74
input {
85
# to type german and polish specific letters via compose keys
96
kb_layout = eu
@@ -39,3 +36,6 @@ misc {
3936
debug {
4037
disable_logs = 0
4138
}
39+
40+
# we use this in nix/tests/default.nix to be able to wait for hyprland startup
41+
exec-once = echo "startup" > /tmp/hyprland_exec_once_notification

0 commit comments

Comments
 (0)