From: Tomi Ollila Date: Sat, 23 Nov 2013 16:36:51 +0000 (+0200) Subject: Re: [PATCH v2] test: replace $PWD with YYY in emacs & emacs-show tests X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9cd4dfc5f2a92492e1a6d74d9c7decf4ddbc8ccd;p=notmuch-archives.git Re: [PATCH v2] test: replace $PWD with YYY in emacs & emacs-show tests --- diff --git a/1d/a1a4ee1a935f9f6fb902053429b36744a5c1d5 b/1d/a1a4ee1a935f9f6fb902053429b36744a5c1d5 new file mode 100644 index 000000000..286145659 --- /dev/null +++ b/1d/a1a4ee1a935f9f6fb902053429b36744a5c1d5 @@ -0,0 +1,163 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 8850F431FD4 + for ; Sat, 23 Nov 2013 08:37:09 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id QWAnlPyt0ik5 for ; + Sat, 23 Nov 2013 08:37:01 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 9EE5F431FD0 + for ; Sat, 23 Nov 2013 08:37:00 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 45C64100030; + Sat, 23 Nov 2013 18:36:51 +0200 (EET) +From: Tomi Ollila +To: david@tethera.net, notmuch@notmuchmail.org +Subject: Re: [PATCH v2] test: replace $PWD with YYY in emacs & emacs-show + tests +In-Reply-To: <1385204476-14360-1-git-send-email-david@tethera.net> +References: + <1385204476-14360-1-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.16+175~g19e97d6 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 23 Nov 2013 16:37:09 -0000 + +On Sat, Nov 23 2013, david@tethera.net wrote: + +> From: David Bremner +> +> When executed command line is written to *Notmuch errors* buffer, +> shell-quote-argument will backslash-escape any char that is not in +> "POSIX filename characters" (i.e. matching "[^-0-9a-zA-Z_./\n]"). +> +> Currently in two emacs tests shell has expanded $PWD as part of +> emacs variable, which will later be fed to #'shell-quote-argument +> and finally written to ERROR file. If $PWD contained non-POSIX +> filename characters, data in ERROR file will not match $PWD when +> later comparing in shell. Therefore, in these two particular cases +> the escaped $PWD is replaced with YYY in ERROR file and expected +> content is adjusted accordingly. +> --- +> +> In this second version, pass the command name to filter as a parameter + +LGTM. + +Tomi + + +> +> test/emacs | 15 ++++++++------- +> test/emacs-show | 10 +++++----- +> test/test-lib.sh | 11 +++++++++++ +> 3 files changed, 24 insertions(+), 12 deletions(-) +> +> diff --git a/test/emacs b/test/emacs +> index 3b3b14d..456435c 100755 +> --- a/test/emacs +> +++ b/test/emacs +> @@ -881,15 +881,16 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\")) +> (with-current-buffer \"*Notmuch errors*\" +> (test-output \"ERROR\")) +> (test-output))" +> -sed -i -e 's/^\[.*\]$/[XXX]/' ERROR +> -test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\ +> + +> +test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES ERROR)" "\ +> +=== OUTPUT === +> End of search results. +> ---- +> -$PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details) +> ---- +> +=== MESSAGES === +> +YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details) +> +=== ERROR === +> [XXX] +> -$PWD/notmuch_fail exited with status 1 +> -command: $PWD/notmuch_fail search --format\=sexp --format-version\=2 --sort\=newest-first tag\:inbox +> +YYY/notmuch_fail exited with status 1 +> +command: YYY/notmuch_fail search --format\=sexp --format-version\=2 --sort\=newest-first tag\:inbox +> exit status: 1" +> +> test_begin_subtest "Search handles subprocess warnings" +> diff --git a/test/emacs-show b/test/emacs-show +> index fb23db4..ec86333 100755 +> --- a/test/emacs-show +> +++ b/test/emacs-show +> @@ -181,14 +181,14 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\")) +> (with-current-buffer \"*Notmuch errors*\" +> (test-output \"ERROR\")) +> (test-output))" +> -sed -i -e 's/^\[.*\]$/[XXX]/' ERROR +> -test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\ +> ---- +> +test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES ERROR)" "\ +> +=== OUTPUT === +> +=== MESSAGES === +> This is an error (see *Notmuch errors* for more details) +> ---- +> +=== ERROR === +> [XXX] +> This is an error +> -command: $PWD/notmuch_fail show --format\\=sexp --format-version\\=1 --exclude\\=false \\' \\* \\' +> +command: YYY/notmuch_fail show --format\\=sexp --format-version\\=1 --exclude\\=false \\' \\* \\' +> exit status: 1 +> stderr: +> This is an error +> diff --git a/test/test-lib.sh b/test/test-lib.sh +> index 2aa4dfc..8611ba5 100644 +> --- a/test/test-lib.sh +> +++ b/test/test-lib.sh +> @@ -628,6 +628,17 @@ notmuch_json_show_sanitize () +> -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g' +> } +> +> +notmuch_emacs_error_sanitize () +> +{ +> + local command=$1 +> + shift +> + for file in "$@"; do +> + echo "=== $file ===" +> + cat "$file" +> + done | sed \ +> + -e 's/^\[.*\]$/[XXX]/' \ +> + -e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|" +> +} +> # End of notmuch helper functions +> +> # Use test_set_prereq to tell that a particular prerequisite is available. +> -- +> 1.8.4.2 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch