[PATCH 8/9] test: check if emacs is available in the beginning of test_emacs

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Thu Nov 17 03:13:40 PST 2011


On Thu, 17 Nov 2011 11:43:36 +0200, Tomi Ollila <tomi.ollila at iki.fi> wrote:
> On Thu, 17 Nov 2011 05:56:25 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> > Unfortunately, this is needed to avoid the emacs waiting loop.
> > ---
> 
> >  test/test-lib.sh |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> [ context reduced ]
> 
> > diff --git a/test/test-lib.sh b/test/test-lib.sh
> > index 840c86c..5bd5bd6 100755
> > --- a/test/test-lib.sh
> > +++ b/test/test-lib.sh
> 
> I have to patch the full set to my clone of the repo and do 
> fuller review, but until that...
> 
> >  test_emacs () {
> > +	# test dependencies beforehand to avoid the waiting loop below
> > +	which emacs >/dev/null || emacs || return
> > +	which emacsclient >/dev/null || emacsclient || return
> > +
> 
> If emacs not found using which (what happened to hash), then try
> to execute emacs (??) and if that fails return.
> 
> Same thing with emacsclient.
> 
> In case of emacs: DISPLAY set, TERM=dumb -- emacs starts interactively
> on my desktop; grep DISPLAY test/* yields nothing. (maybe we should unset
> DISPLAY for tests ?). And, if DISPLAY unset, emacs exits with nonzero
> value, making || return happen anyway.
> 
> ... and this is tested every time test_emacs() is executed...
> 

Either you did not apply other patches, or I made some stupid mistake.

I am not very happy with the above lines.  They feel hackish.  Perhaps
others would suggest something better.

Here is a more detailed explanation of what they do (or should do):

  which emacs || # check that emacs binary exists  (hash would succeed
                 # for functions)
  emacs || # if the binary does not exist, run the "replacement"
           # function which would register the missing dependency
  return # and return with an error

Regards,
  Dmitry

> >  	if [ -z "$EMACS_SERVER" ]; then
> >  		server_name="notmuch-test-suite-$$"
> > -- 
> > 1.7.7.2
> 
> Tomi


More information about the notmuch mailing list