2019-12-13 21:47:15 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
|
|
name = "zsh-history";
|
2021-01-10 20:08:30 +01:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-01-18 21:23:49 +01:00
|
|
|
maintainers = [ ];
|
2019-12-13 21:47:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes.default = { ... }: {
|
|
|
|
programs = {
|
|
|
|
zsh.enable = true;
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.zsh-history ];
|
|
|
|
programs.zsh.interactiveShellInit = ''
|
|
|
|
source ${pkgs.zsh-history.out}/share/zsh/init.zsh
|
|
|
|
'';
|
|
|
|
users.users.root.shell = "${pkgs.zsh}/bin/zsh";
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
default.wait_for_unit("multi-user.target")
|
|
|
|
default.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
|
|
|
|
|
|
|
|
# Login
|
2022-06-04 06:22:03 +02:00
|
|
|
default.wait_until_tty_matches("1", "login: ")
|
2019-12-13 21:47:15 +01:00
|
|
|
default.send_chars("root\n")
|
2022-06-04 06:22:03 +02:00
|
|
|
default.wait_until_tty_matches("1", r"\nroot@default\b")
|
2019-12-13 21:47:15 +01:00
|
|
|
|
|
|
|
# Generate some history
|
|
|
|
default.send_chars("echo foobar\n")
|
2022-06-04 06:22:03 +02:00
|
|
|
default.wait_until_tty_matches("1", "foobar")
|
2019-12-13 21:47:15 +01:00
|
|
|
|
|
|
|
# Ensure that command was recorded in history
|
|
|
|
default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
|
|
|
|
'';
|
|
|
|
})
|