mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
nixosTests.gnome: Small cleanup
This commit is contained in:
parent
95ee935a64
commit
27be325d39
@ -5,7 +5,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
|||||||
};
|
};
|
||||||
|
|
||||||
nodes.machine = { nodes, ... }: let
|
nodes.machine = { nodes, ... }: let
|
||||||
user = nodes.machine.config.users.users.alice;
|
user = nodes.machine.users.users.alice;
|
||||||
in
|
in
|
||||||
|
|
||||||
{ imports = [ ./common/user-account.nix ];
|
{ imports = [ ./common/user-account.nix ];
|
||||||
@ -43,28 +43,28 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
|||||||
};
|
};
|
||||||
|
|
||||||
testScript = { nodes, ... }: let
|
testScript = { nodes, ... }: let
|
||||||
user = nodes.machine.config.users.users.alice;
|
user = nodes.machine.users.users.alice;
|
||||||
uid = toString user.uid;
|
uid = toString user.uid;
|
||||||
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
|
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
|
||||||
xauthority = "/run/user/${uid}/gdm/Xauthority";
|
xauthority = "/run/user/${uid}/gdm/Xauthority";
|
||||||
display = "DISPLAY=:0.0";
|
display = "DISPLAY=:0.0";
|
||||||
env = "${bus} XAUTHORITY=${xauthority} ${display}";
|
env = "${bus} XAUTHORITY=${xauthority} ${display}";
|
||||||
gdbus = "${env} gdbus";
|
# Run a command in the appropriate user environment
|
||||||
su = command: "su - ${user.name} -c '${env} ${command}'";
|
run = command: "su - ${user.name} -c '${bus} ${command}'";
|
||||||
|
|
||||||
# Call javascript in gnome shell, returns a tuple (success, output), where
|
# Call javascript in gnome shell, returns a tuple (success, output), where
|
||||||
# `success` is true if the dbus call was successful and output is what the
|
# `success` is true if the dbus call was successful and output is what the
|
||||||
# javascript evaluates to.
|
# javascript evaluates to.
|
||||||
eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval";
|
eval = command: run "gdbus call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval ${command}";
|
||||||
|
|
||||||
# False when startup is done
|
# False when startup is done
|
||||||
startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp";
|
startingUp = eval "Main.layoutManager._startingUp";
|
||||||
|
|
||||||
# Start Console
|
# Start Console
|
||||||
launchConsole = su "${bus} gapplication launch org.gnome.Console";
|
launchConsole = run "gapplication launch org.gnome.Console";
|
||||||
|
|
||||||
# Hopefully Console's wm class
|
# Hopefully Console's wm class
|
||||||
wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class";
|
wmClass = eval "global.display.focus_window.wm_class";
|
||||||
in ''
|
in ''
|
||||||
with subtest("Login to GNOME Xorg with GDM"):
|
with subtest("Login to GNOME Xorg with GDM"):
|
||||||
machine.wait_for_x()
|
machine.wait_for_x()
|
||||||
|
@ -40,25 +40,25 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
|||||||
|
|
||||||
testScript = { nodes, ... }: let
|
testScript = { nodes, ... }: let
|
||||||
# Keep line widths somewhat manageable
|
# Keep line widths somewhat manageable
|
||||||
user = nodes.machine.config.users.users.alice;
|
user = nodes.machine.users.users.alice;
|
||||||
uid = toString user.uid;
|
uid = toString user.uid;
|
||||||
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
|
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
|
||||||
gdbus = "${bus} gdbus";
|
# Run a command in the appropriate user environment
|
||||||
su = command: "su - ${user.name} -c '${command}'";
|
run = command: "su - ${user.name} -c '${bus} ${command}'";
|
||||||
|
|
||||||
# Call javascript in gnome shell, returns a tuple (success, output), where
|
# Call javascript in gnome shell, returns a tuple (success, output), where
|
||||||
# `success` is true if the dbus call was successful and output is what the
|
# `success` is true if the dbus call was successful and output is what the
|
||||||
# javascript evaluates to.
|
# javascript evaluates to.
|
||||||
eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval";
|
eval = command: run "gdbus call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval ${command}";
|
||||||
|
|
||||||
# False when startup is done
|
# False when startup is done
|
||||||
startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp";
|
startingUp = eval "Main.layoutManager._startingUp";
|
||||||
|
|
||||||
# Start Console
|
# Start Console
|
||||||
launchConsole = su "${bus} gapplication launch org.gnome.Console";
|
launchConsole = run "gapplication launch org.gnome.Console";
|
||||||
|
|
||||||
# Hopefully Console's wm class
|
# Hopefully Console's wm class
|
||||||
wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class";
|
wmClass = eval "global.display.focus_window.wm_class";
|
||||||
in ''
|
in ''
|
||||||
with subtest("Login to GNOME with GDM"):
|
with subtest("Login to GNOME with GDM"):
|
||||||
# wait for gdm to start
|
# wait for gdm to start
|
||||||
|
Loading…
Reference in New Issue
Block a user