2019-12-13 23:47:15 +03:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
|
|
name = "zsh-history";
|
2021-01-10 22:08:30 +03:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-01-18 23:23:49 +03:00
|
|
|
maintainers = [ ];
|
2019-12-13 23:47:15 +03: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 07:22:03 +03:00
|
|
|
default.wait_until_tty_matches("1", "login: ")
|
2019-12-13 23:47:15 +03:00
|
|
|
default.send_chars("root\n")
|
2022-06-04 07:22:03 +03:00
|
|
|
default.wait_until_tty_matches("1", r"\nroot@default\b")
|
2019-12-13 23:47:15 +03:00
|
|
|
|
|
|
|
# Generate some history
|
|
|
|
default.send_chars("echo foobar\n")
|
2022-06-04 07:22:03 +03:00
|
|
|
default.wait_until_tty_matches("1", "foobar")
|
2019-12-13 23:47:15 +03:00
|
|
|
|
|
|
|
# Ensure that command was recorded in history
|
|
|
|
default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
|
|
|
|
'';
|
|
|
|
})
|