[PATCH] test: run emacs inside tmux if screen is not available

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Wed Jul 20 06:37:35 PDT 2011


Hi Thomas.

On Wed, 20 Jul 2011 14:36:36 +0200, Thomas Jost <schnouki at schnouki.net> wrote:
> Before this change, the test suite reported many failed tests on machines where
> screen is not installed (which is the case of many *BSD systems). This patch
> makes the test suite try to use tmux, another terminal multiplexer, if screen is
> not available.

This is a nice improvement.  But I think we should make it even better :)
There are more terminal emulators besides screen and tmux (dtach comes
to mind).  We need a more general mechanism for trying them.  There
should be a list of commands for running terminal emulators in the order
of preference (I think that is dtach, tmux, screen), and we should try
each one in a loop (this would also avoid repeating the long emacs
command).

Regards,
  Dmitry

> ---
>  test/test-lib.sh |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 0608e42..5851b3d 100755
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -860,12 +860,21 @@ EOF
>  test_emacs () {
>  	if [ -z "$EMACS_SERVER" ]; then
>  		EMACS_SERVER="notmuch-test-suite-$$"
> -		# start a detached screen session with an emacs server
> +		# start a detached screen or tmux session with an emacs server
>  		screen -S "$EMACS_SERVER" -d -m "$TMP_DIRECTORY/run_emacs" \
>  			--no-window-system \
>  			--eval "(setq server-name \"$EMACS_SERVER\")" \
>  			--eval '(server-start)' \
> -			--eval "(orphan-watchdog $$)" || return
> +			--eval "(orphan-watchdog $$)"
> +		if [ "$?" != 0 ]
> +		then
> +			tmux -f /dev/null -L "$EMACS_SERVER" new-session -d "$TMP_DIRECTORY/run_emacs \
> +				--no-window-system \
> +				--eval \"(setq server-name \\\"$EMACS_SERVER\\\")\" \
> +				--eval '(server-start)' \
> +				--eval \"(orphan-watchdog $$)\"" || return
> +		fi
> +
>  		# wait until the emacs server is up
>  		until test_emacs '()' 2>/dev/null; do
>  			sleep 1
> -- 
> 1.7.6
> 


More information about the notmuch mailing list