From 1ee17a6651a1de7343fe2dcd54503b78917dc6af Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Fri, 22 Nov 2013 23:06:29 +0200 Subject: [PATCH] [PATCH] test: replace $PWD with XXX in emacs & emacs-show tests --- 13/a9ade01b40bfd9134019eafa8cfcaa57ac7492 | 115 ++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 13/a9ade01b40bfd9134019eafa8cfcaa57ac7492 diff --git a/13/a9ade01b40bfd9134019eafa8cfcaa57ac7492 b/13/a9ade01b40bfd9134019eafa8cfcaa57ac7492 new file mode 100644 index 000000000..ac2ca34dc --- /dev/null +++ b/13/a9ade01b40bfd9134019eafa8cfcaa57ac7492 @@ -0,0 +1,115 @@ +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 C7A0F431FDB + for ; Fri, 22 Nov 2013 13:06:46 -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 A5MIUgzbD104 for ; + Fri, 22 Nov 2013 13:06:40 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 7EC5A431FCB + for ; Fri, 22 Nov 2013 13:06:40 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 0557B1000D0; Fri, 22 Nov 2013 23:06:30 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH] test: replace $PWD with XXX in emacs & emacs-show tests +Date: Fri, 22 Nov 2013 23:06:29 +0200 +Message-Id: <1385154389-3243-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +Cc: tomi.ollila@iki.fi +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: Fri, 22 Nov 2013 21:06:46 -0000 + +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 writte 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 XXX in ERROR file and expected +content is adjusted accordingly. +--- + +The regexp match replaces anything non-space ([^ ]) up to the command +name with XXX. As test suite generally doesn't support spaces in +directry path this is fine: + +try ln -s notmuch not\ much; cd not\ much; make test + +and see what happens. + + test/emacs | 5 +++-- + test/emacs-show | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/test/emacs b/test/emacs +index 3b3b14d..751d34e 100755 +--- a/test/emacs ++++ b/test/emacs +@@ -881,7 +881,8 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\")) + (with-current-buffer \"*Notmuch errors*\" + (test-output \"ERROR\")) + (test-output))" +-sed -i -e 's/^\[.*\]$/[XXX]/' ERROR ++sed -i -e 's/^\[.*\]$/[XXX]/' \ ++ -e '/^command: / s|[^ ]*/notmuch_fail |XXX/notmuch_fail |' ERROR + test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\ + End of search results. + --- +@@ -889,7 +890,7 @@ $PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details) + --- + [XXX] + $PWD/notmuch_fail exited with status 1 +-command: $PWD/notmuch_fail search --format\=sexp --format-version\=2 --sort\=newest-first tag\:inbox ++command: XXX/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..08de108 100755 +--- a/test/emacs-show ++++ b/test/emacs-show +@@ -181,14 +181,15 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\")) + (with-current-buffer \"*Notmuch errors*\" + (test-output \"ERROR\")) + (test-output))" +-sed -i -e 's/^\[.*\]$/[XXX]/' ERROR ++sed -i -e 's/^\[.*\]$/[XXX]/' \ ++ -e '/^command: / s|[^ ]*/notmuch_fail |XXX/notmuch_fail |' ERROR + test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\ + --- + This is an error (see *Notmuch errors* for more details) + --- + [XXX] + This is an error +-command: $PWD/notmuch_fail show --format\\=sexp --format-version\\=1 --exclude\\=false \\' \\* \\' ++command: XXX/notmuch_fail show --format\\=sexp --format-version\\=1 --exclude\\=false \\' \\* \\' + exit status: 1 + stderr: + This is an error +-- +1.8.4.2 + -- 2.26.2