mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
Before this commit, `wait_for_console_text` would read one line every 900ms before trying again to read the next line. This commit fixes that behavior by greedily reading all buffer that is available for match trying to find a match rather than reading one per retry iteration. In effect this moves the loop inside the `console_matches` helper and makes the behavior of `wait_for_console_text` with timeout behave the same way as with timeout. This also provides a test that showcases the problem.
26 lines
510 B
Nix
26 lines
510 B
Nix
{ pkgs, lib, ... }:
|
|
{
|
|
name = "console-timeout";
|
|
|
|
nodes.machine = {
|
|
systemd.services.generate-output.script = ''
|
|
echo "match that"
|
|
sleep 1
|
|
|
|
for i in $(seq 15); do
|
|
echo "line $i"
|
|
done
|
|
|
|
echo "match this"
|
|
'';
|
|
};
|
|
|
|
testScript = ''
|
|
machine.start()
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
machine.systemctl("start generate-output")
|
|
machine.wait_for_console_text("match that")
|
|
machine.wait_for_console_text("match this", timeout=10)
|
|
'';
|
|
}
|