kumquat-buildroot/support
Brandon Maier 4b19a190a2 support/testing/infra/emulator.py: fix qemu prompt detection
The qemu.run() method can break when a command happens to output the
string "# " to stdout. This is because qemu.run() detects when a command
has completed by searching for the shell prompt, which by default is
"# ". It then captures everything before the "# " as the commands
output, causing the rest of output to be lost.

Instead use the pexpect libraries REPLWrapper to handle running
commands. It has hooks to set a custom prompt and avoid some other
pitfalls of wrapping a shell.

We unfortunately can't reuse replwrap._repl_sh directly, because it
tries to spawn a command while we already have a qemu started. So we
need to copy that code into _repl_sh_child. While we're at it, also
define our own prompt strings.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
[Arnout:
 - Make all arguments to _repl_sh_spawn non-optional.
 - Move non_printable_insert to a local variable instead of an argument,
   we don't need to override it.
 - Copy the comment from _repl_sh that explains why non_printable_insert
   is needed.
 - Add a comment about timeouts.
 - Rename spawn to child (we don't actually spawn anything so this felt
   more natural, even though the class
 - Use single quotes instead of triple quotes, and explicitly escape the
   nested quotes.
]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>

(cherry picked from commit 0cad947b964be5612a182413da136fcf0dc5a1f2)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-10-11 17:03:20 +02:00
..
config-fragments support/config-fragments: fix bootlin-x86-i686-musl 2024-06-03 17:52:06 +02:00
dependencies support/dependencies/dependencies.sh: libopenssl needs perl bigint on s390x 2024-03-03 13:13:40 +01:00
docker support/docker: add qemu-system-misc for riscv runtime tests 2023-08-24 23:20:26 +02:00
download support/download/check-hash: accept hash files without terminating \n 2024-08-20 19:20:00 +02:00
gnuconfig
kconfig kconfig/lxdialog: fix check() with GCC14 2024-05-15 15:18:09 +02:00
legal-info
libtool
misc support/misc/Vagrantfile: support libvirt provider 2024-09-19 10:33:20 +02:00
scripts support/scripts/mkusers: accept user tables without terminating \n 2024-08-20 19:18:10 +02:00
testing support/testing/infra/emulator.py: fix qemu prompt detection 2024-10-11 17:03:20 +02:00