unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Edmondson <dme@dme.org>, <notmuch@notmuchmail.org>
Subject: Re: [PATCH 2/3] test: Add `test_emacs_expect_t'.
Date: Thu, 19 Jan 2012 12:32:21 +0200	[thread overview]
Message-ID: <yf662g8asp6.fsf@taco2.nixu.fi> (raw)
In-Reply-To: <cunzkdk57yj.fsf@hotblack-desiato.hh.sledj.net>

On Thu, 19 Jan 2012 09:59:16 +0000, David Edmondson <dme@dme.org> wrote:
> On Wed, 18 Jan 2012 16:55:59 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > > +	# Report success/failure.
> > > +	if ! test_skip "$test_subtest_name"
> > > +	then
> > > +		if [ "$result" == t ]
> > 
> > 		if [ "$result" = t ]
> > 
> > to be compatible with POSIX and consistent with rest code.
> 
> I'm happy to change this.

As your older patch has been marked obsolete and this really is the
only place where there is == in comparison code please do that change.

> > > +			test_failure_ "$test_subtest_name" "$(eval printf ${result})"
> > 
> > This added 'eval' made me investigate further... running 
> > 
> > emacsclient --eval '(print (concat "a" "b" "\t" "c" "\n" "z"))'
> > 
> > outputs "ab	c\nz" (tab between 'ab' and 'c', quotes (") around
> > the whole output and newlines as "\n" (even '\r' is converted)).
> > 
> > If emacs tests run via test_emacs_expect_t wrote their output 
> > to ${output} directly above code could be much cleaner in many
> > places. Environment variable could be used for the file name.
> 
> I'm reluctant to change this just to avoid calling eval.

Consider the following:

$ emacsclient --eval '(print "$(echo rm -rf /); echo `date +%Y`")'
"$(echo rm -rf /); echo `date +%Y`"

x='"$(echo rm -rf /); echo `date +%Y`"'

$echo $x
"$(echo rm -rf /); echo `date +%Y`"

$echo $(eval printf $x)
rm -rf /; echo 2012

x='"$(echo rm /); echo `date +%Y`"'

$(eval printf $x)
rm: cannot remove `/;': No such file or directory
rm: cannot remove `2012': No such file or directory

one just needs to make sure there is no $:s and `: in 
the output... hmm, nor ';' ...NOR '&':s ...

I am not absolutely sure this might actually happen
but surely I'm not sure it would not...

... The suggestion having environment variable would
now work, but what about

test_emacs "(setq test-output-file \"${output}\") $1"


Tomi

PS:

this needs to be changed:
	emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
to
	emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $*)"
then
	test_emacs   "(setq test-output-file \"${output}\")"   "$1"

would be safe

  reply	other threads:[~2012-01-19 10:32 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 12:52 emacs based tests, version 3 David Edmondson
2012-01-17 12:52 ` [PATCH 1/4] test: Add `test_emacs_expect_t' David Edmondson
2012-01-17 13:09   ` Dmitry Kurochkin
2012-01-17 13:24     ` David Edmondson
2012-01-17 14:07     ` [PATCH 1/3] test: Don't return the result of checking for running emacs to the tester David Edmondson
2012-01-17 14:07       ` [PATCH 2/3] test: Add `test_emacs_expect_t' David Edmondson
2012-01-17 14:26         ` Dmitry Kurochkin
2012-01-17 14:35           ` David Edmondson
2012-01-17 14:43             ` Dmitry Kurochkin
     [not found]         ` <87zkdmwfi7.fsf@gmail.com>
2012-01-17 15:09           ` David Edmondson
2012-01-18  9:09             ` Tomi Ollila
2012-01-18 14:55         ` Tomi Ollila
2012-01-19  9:59           ` David Edmondson
2012-01-19 10:32             ` Tomi Ollila [this message]
2012-01-19 10:42               ` David Edmondson
2012-01-19 11:01                 ` Tomi Ollila
2012-01-19 12:54                   ` [PATCH 1/3] test: Don't return the result of checking for running emacs to the tester David Edmondson
2012-01-19 12:54                     ` [PATCH 2/3] test: Add `test_emacs_expect_t' David Edmondson
2012-01-23 11:47                       ` David Edmondson
2012-01-23 16:45                       ` Dmitry Kurochkin
2012-01-19 12:54                     ` [PATCH 3/3] test: Add address cleaning tests David Edmondson
2012-01-23 17:26                       ` Dmitry Kurochkin
2012-01-23 16:32                     ` [PATCH 1/3] test: Don't return the result of checking for running emacs to the tester Dmitry Kurochkin
2012-01-17 14:07       ` [PATCH 3/3] test: Add address cleaning tests David Edmondson
2012-01-17 14:20       ` [PATCH 1/3] test: Don't return the result of checking for running emacs to the tester Dmitry Kurochkin
2012-01-17 14:37         ` David Edmondson
2012-01-17 14:51           ` Dmitry Kurochkin
2012-01-23 18:05   ` [PATCH 1/4 v42] " David Edmondson
2012-01-23 18:05     ` [PATCH 2/4 v42] test: Add `test_emacs_expect_t' David Edmondson
2012-01-24 15:24       ` Dmitry Kurochkin
2012-01-23 18:05     ` [PATCH 3/4 v42] test: Add more helpers for emacs tests David Edmondson
2012-01-24 15:45       ` Dmitry Kurochkin
2012-01-24 15:54         ` David Edmondson
2012-01-23 18:05     ` [PATCH 4/4 v42] test: Add address cleaning tests David Edmondson
2012-01-24 15:35       ` Dmitry Kurochkin
2012-01-24 15:20     ` [PATCH 1/4 v42] test: Don't return the result of checking for running emacs to the tester Dmitry Kurochkin
2012-01-24 16:14   ` [PATCH 0/4 v43] emacs test helpers David Edmondson
2012-01-24 16:14     ` [PATCH 1/4 v43] test: Don't return the result of checking for running emacs to the tester David Edmondson
2012-01-24 16:14     ` [PATCH 2/4 v43] test: Add `test_emacs_expect_t' David Edmondson
2012-01-24 16:14     ` [PATCH 3/4 v43] test: Add more helpers for emacs tests David Edmondson
2012-01-24 16:14     ` [PATCH 4/4 v43] test: Add address cleaning tests David Edmondson
2012-01-24 16:19     ` [PATCH 0/4 v43] emacs test helpers Dmitry Kurochkin
2012-01-24 20:13     ` Tomi Ollila
2012-01-25 11:33     ` David Bremner
2012-01-17 12:52 ` [PATCH 2/4] test: Add address cleaning tests David Edmondson
2012-01-17 13:11   ` Dmitry Kurochkin
2012-01-17 13:23     ` David Edmondson
2012-01-17 12:52 ` [PATCH 3/4] emacs: Avoid `mail-header-parse-address' in `notmuch-show-clean-address' David Edmondson
2012-01-17 12:52 ` [PATCH 4/4] emacs: Another special case for `notmuch-show-clean-address' David Edmondson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yf662g8asp6.fsf@taco2.nixu.fi \
    --to=tomi.ollila@iki.fi \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).