aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-11-23 12:52:53 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-12-07 07:24:48 +0100
commitd491a4099b8db6199225812562b4dfc315accc6d (patch)
tree100461242e3b4f5838b10c9c28cb04750dfa5e4d /util.h
parentb86afe3559c0bd3d24bc6fed7c60466cf141224c (diff)
downloadpasst-d491a4099b8db6199225812562b4dfc315accc6d.tar
passt-d491a4099b8db6199225812562b4dfc315accc6d.tar.gz
passt-d491a4099b8db6199225812562b4dfc315accc6d.tar.bz2
passt-d491a4099b8db6199225812562b4dfc315accc6d.tar.lz
passt-d491a4099b8db6199225812562b4dfc315accc6d.tar.xz
passt-d491a4099b8db6199225812562b4dfc315accc6d.tar.zst
passt-d491a4099b8db6199225812562b4dfc315accc6d.zip
test: Make handling of shell prompts with escapes a little more reliable
When using the old-style "pane" methods of executing commands during the tests, we need to scan the shell output for prompts in order to tell when commands have finished. This is inherently unreliable because commands could output things that look like prompts, and prompts might not look like we expect them to. The only way to really fix this is to use a better way of dispatching commands, like the newer "context" system. However, it's awkward to convert everything to "context" right at the moment, so we're still relying on some tests that do work most of the time. It is, however, particularly sensitive to fancy coloured prompts using escape sequences. Currently we try to handle this by stripping actual ESC characters with tr, then looking for some common variants. We can do a bit better: instead strip all escape sequences using sed before looking for our prompt. Or, at least, any one using [a-zA-Z] as the terminating character. Strictly speaking ANSI escapes can be terminated by any character in 0x40..0x7e, which isn't easily expressed in a regexp. This should capture all common ones, though. With this transformation we can simplify the list of patterns we then look for as a prompt, removing some redundant variants. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
0 files changed, 0 insertions, 0 deletions