depot/third_party/nixpkgs/nixos/tests/zsh-history.nix
Default email 3a4df29a92 Project import generated by Copybara.
GitOrigin-RevId: 3d7435c638baffaa826b85459df0fff47f12317d
2022-06-16 19:23:12 +02:00

35 lines
994 B
Nix

import ./make-test-python.nix ({ pkgs, ...} : {
name = "zsh-history";
meta = with pkgs.lib.maintainers; {
maintainers = [ ];
};
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
default.wait_until_tty_matches("1", "login: ")
default.send_chars("root\n")
default.wait_until_tty_matches("1", r"\nroot@default\b")
# Generate some history
default.send_chars("echo foobar\n")
default.wait_until_tty_matches("1", "foobar")
# Ensure that command was recorded in history
default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
'';
})