From 8eee01e4806aeec7bcc77f6bdea2e3b6fef739ed Mon Sep 17 00:00:00 2001 From: ccicnce113424 Date: Tue, 10 Feb 2026 09:20:34 +0800 Subject: [PATCH] nixosTests.kmscon: improve term test --- nixos/tests/kmscon.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nixos/tests/kmscon.nix b/nixos/tests/kmscon.nix index 28f2cdd1c3d3..cb20274c6ece 100644 --- a/nixos/tests/kmscon.nix +++ b/nixos/tests/kmscon.nix @@ -33,12 +33,18 @@ with subtest("ensure we can open a tty"): machine.wait_for_text("machine login:") + machine.send_chars("alice\n") machine.wait_for_text("Password:") + machine.send_chars("foobar\n") machine.wait_for_text("alice@machine") - machine.send_chars("echo $TERM\n") - machine.wait_for_text("xterm-256color") + + machine.send_chars("echo $TERM | tee /tmp/term.txt\n") + machine.wait_until_succeeds("test -s /tmp/term.txt") + term = machine.succeed("cat /tmp/term.txt").strip() + assert term == "xterm-256color", f"Unexpected TERM value: {term!r}" + machine.screenshot("tty.png") ''; }