unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>
Subject: [PATCH 3/4] test: ignore debugging messages
Date: Sun, 16 May 2021 11:10:14 -0300	[thread overview]
Message-ID: <20210516141015.3516582-4-david@tethera.net> (raw)
In-Reply-To: <20210516141015.3516582-1-david@tethera.net>

Previously building with "-DDEBUG" broke the test suite in several places.
---
 test/T300-encoding.sh   | 12 ++++++------
 test/T310-emacs.sh      |  1 -
 test/T450-emacs-show.sh |  1 -
 test/test-lib.sh        | 23 +++++++++++++++--------
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/test/T300-encoding.sh b/test/T300-encoding.sh
index 1e9d2a3d..6fcd10c5 100755
--- a/test/T300-encoding.sh
+++ b/test/T300-encoding.sh
@@ -31,18 +31,18 @@ test_expect_equal "$output" "thread:0000000000000002   2001-01-05 [1/1] Notmuch
 
 test_begin_subtest "RFC 2047 encoded word with spaces"
 add_message '[subject]="=?utf-8?q?encoded word with spaces?="'
-output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
-test_expect_equal "$output" "thread:0000000000000003   2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)"
+output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded words back to back"
 add_message '[subject]="=?utf-8?q?encoded-words-back?==?utf-8?q?to-back?="'
-output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
-test_expect_equal "$output" "thread:0000000000000004   2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)"
+output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded words without space before or after"
 add_message '[subject]="=?utf-8?q?encoded?=word without=?utf-8?q?space?=" '
-output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
-test_expect_equal "$output" "thread:0000000000000005   2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)"
+output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)"
 
 test_begin_subtest "Mislabeled Windows-1252 encoding"
 add_message '[content-type]="text/plain; charset=iso-8859-1"'                           \
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 851ef64e..dad09b11 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -1058,7 +1058,6 @@ End of search results.
 === MESSAGES ===
 YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
 === ERROR ===
-[XXX]
 YYY/notmuch_fail exited with status 1
 command: YYY/notmuch_fail search --format\=sexp --format-version\=4 --sort\=newest-first tag\:inbox
 exit status: 1"
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index bd76d378..52353bf4 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -190,7 +190,6 @@ test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES E
 === MESSAGES ===
 This is an error (see *Notmuch errors* for more details)
 === ERROR ===
-[XXX]
 This is an error
 command: YYY/notmuch_fail show --format\\=sexp --format-version\\=4 --decrypt\\=true --exclude\\=false \\' \\* \\'
 exit status: 1
diff --git a/test/test-lib.sh b/test/test-lib.sh
index d46bb4c3..69d9583c 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -637,6 +637,11 @@ print(msg.as_string(False))
 ' "$@"
 }
 
+notmuch_debug_sanitize ()
+{
+    grep -v '^D.:'
+}
+
 notmuch_exception_sanitize ()
 {
     perl -pe 's/(A Xapian exception occurred at .*[.]cc?):([0-9]*)/\1:XXX/'
@@ -644,7 +649,7 @@ notmuch_exception_sanitize ()
 
 notmuch_search_sanitize ()
 {
-    perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
+    notmuch_debug_sanitize | perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
 }
 
 notmuch_search_files_sanitize ()
@@ -664,10 +669,11 @@ notmuch_show_sanitize ()
 }
 notmuch_show_sanitize_all ()
 {
-    sed \
-	-e 's| filename:.*| filename:XXXXX|' \
-	-e 's| id:[^ ]* | id:XXXXX |' | \
-	notmuch_date_sanitize
+    notmuch_debug_sanitize |
+	sed \
+	    -e 's| filename:.*| filename:XXXXX|' \
+	    -e 's| id:[^ ]* | id:XXXXX |' | \
+            notmuch_date_sanitize
 }
 
 notmuch_json_show_sanitize ()
@@ -688,9 +694,10 @@ notmuch_emacs_error_sanitize ()
     shift
     for file in "$@"; do
 	echo "=== $file ==="
-	cat "$file"
+	notmuch_debug_sanitize < "$file"
     done | sed \
-	-e 's/^\[.*\]$/[XXX]/' \
+	-e '/^$/d' \
+	-e '/^\[.*\]$/d' \
 	-e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
 }
 
@@ -1133,7 +1140,7 @@ test_C () {
     echo "== stdout ==" > OUTPUT.stdout
     echo "== stderr ==" > OUTPUT.stderr
     ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
-    notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr | notmuch_exception_sanitize > OUTPUT
+    notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr | notmuch_exception_sanitize | notmuch_debug_sanitize > OUTPUT
 }
 
 make_shim () {
-- 
2.30.2

  parent reply	other threads:[~2021-05-16 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16 14:10 Fixes for building with -DDEBUG David Bremner
2021-05-16 14:10 ` [PATCH 1/4] bindings/ruby: unexport CFLAGS when building David Bremner
2021-05-16 18:56   ` Tomi Ollila
2021-05-16 14:10 ` [PATCH 2/4] lib/thread: add common prefix to debug messages, join lines David Bremner
2021-05-16 14:10 ` David Bremner [this message]
2021-05-16 14:10 ` [PATCH 4/4] test: quiet some extra debugging output David Bremner
2021-05-16 14:23 ` Fixes for building with -DDEBUG David Bremner
2021-05-23 11:13 ` David Bremner

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=20210516141015.3516582-4-david@tethera.net \
    --to=david@tethera.net \
    --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).