On Fri, Sep 09, 2022 at 05:18:43PM +0200, Stefano Brivio wrote:Nit: On Thu, 8 Sep 2022 11:49:12 +1000 David Gibson <david(a)gibson.dropbear.id.au> wrote:Oops, fixed. I finally got around to changing my emacs config to change sh-basic-offset to 8 by default, so this should be less likely to happen in future. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibsonWe're moving to a new way of the tests dispatching commands to running in contexts (host, guest, namespace, etc.). As we make this transition, though, we still want the user to be able to watch the commands running in a context, as they previously could from the commands issued in the pane. Add a helper to set up a pane to watch a context's log to allow this. In some cases we currently issue commands from several different logical contexts in the same pane, so allow a pane to watch several contexts at once. Also use tail's --retry option to allow starting the watch before we've initialized the context which will be useful in some cases. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- test/lib/term | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/lib/term b/test/lib/term index ddabf8d..fa34873 100755 --- a/test/lib/term +++ b/test/lib/term @@ -241,6 +241,24 @@ pane_status() { return ${__status} } +# pane_watch_context() - Set up pane to watch commands executing in context(s) +# $1: Pane number +# $2: Description (for pane label) +# $@: Context name or names +pane_watch_contexts() { + __pane_number="${1}" + __desc="${2}" + shift 2 + __name="${2}" + + tmux select-pane -t ${__pane_number} -T "${__desc}" + __cmd="tail -f --retry" + for c; do + __cmd="${__cmd} ${LOGDIR}/context_${c}.log"Mixed tab and spaces.