mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixosTests/cosmic: skip testing GUI app if not present
In cases when a given GUI app is absent (encountered when excluding packages like `cosmic-term`, etc), the test fails because the GUI app doesn't launch. That, while being a failure, is not connected to the COSMIC DE itself. So if a binary is missing, skip launch-testing it.
This commit is contained in:
parent
0aae134f2f
commit
26a8f74022
1 changed files with 7 additions and 5 deletions
|
@ -112,11 +112,13 @@
|
|||
gui_apps_to_launch['cosmic-term'] = 'com.system76.CosmicTerm'
|
||||
|
||||
for gui_app, app_id in gui_apps_to_launch.items():
|
||||
machine.succeed(f"su - ${user.name} -c 'WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/${toString user.uid} ${DISPLAY} {gui_app} >&2 &'", timeout=5)
|
||||
# Nix builds the following non-commented expression to the following:
|
||||
# `su - alice -c 'WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 lswt --json | jq ".toplevels" | grep "^ \\"app-id\\": \\"{app_id}\\"$"' `
|
||||
machine.wait_until_succeeds(f''''su - ${user.name} -c 'WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/${toString user.uid} lswt --json | jq ".toplevels" | grep "^ \\"app-id\\": \\"{app_id}\\"$"' '''', timeout=30)
|
||||
machine.succeed(f"pkill {gui_app}", timeout=5)
|
||||
# Don't fail the test if binary is absent
|
||||
if machine.execute(f"su - ${user.name} -c 'command -v {gui_app}'", timeout=5)[0] == 0:
|
||||
machine.succeed(f"su - ${user.name} -c 'WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/${toString user.uid} ${DISPLAY} {gui_app} >&2 &'", timeout=5)
|
||||
# Nix builds the following non-commented expression to the following:
|
||||
# `su - alice -c 'WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 lswt --json | jq ".toplevels" | grep "^ \\"app-id\\": \\"{app_id}\\"$"' `
|
||||
machine.wait_until_succeeds(f''''su - ${user.name} -c 'WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/${toString user.uid} lswt --json | jq ".toplevels" | grep "^ \\"app-id\\": \\"{app_id}\\"$"' '''', timeout=30)
|
||||
machine.succeed(f"pkill {gui_app}", timeout=5)
|
||||
|
||||
machine.succeed("echo 'test completed succeessfully' > /${testName}", timeout=5)
|
||||
machine.copy_from_vm('/${testName}')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue