test: ignore debugging messages

Previously building with "-DDEBUG" broke the test suite in several places.
This commit is contained in:
David Bremner 2021-05-16 09:37:40 -03:00
parent 748352693c
commit 119a41b9ed
4 changed files with 16 additions and 12 deletions

View file

@ -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" test_begin_subtest "RFC 2047 encoded word with spaces"
add_message '[subject]="=?utf-8?q?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) output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
test_expect_equal "$output" "thread:0000000000000003 2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)" 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" test_begin_subtest "RFC 2047 encoded words back to back"
add_message '[subject]="=?utf-8?q?encoded-words-back?==?utf-8?q?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) output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
test_expect_equal "$output" "thread:0000000000000004 2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)" 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" 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?=" ' 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) output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
test_expect_equal "$output" "thread:0000000000000005 2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)" 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" test_begin_subtest "Mislabeled Windows-1252 encoding"
add_message '[content-type]="text/plain; charset=iso-8859-1"' \ add_message '[content-type]="text/plain; charset=iso-8859-1"' \

View file

@ -1059,7 +1059,6 @@ End of search results.
=== MESSAGES === === MESSAGES ===
YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details) YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
=== ERROR === === ERROR ===
[XXX]
YYY/notmuch_fail exited with status 1 YYY/notmuch_fail exited with status 1
command: YYY/notmuch_fail search --format\=sexp --format-version\=4 --sort\=newest-first tag\:inbox command: YYY/notmuch_fail search --format\=sexp --format-version\=4 --sort\=newest-first tag\:inbox
exit status: 1" exit status: 1"

View file

@ -191,7 +191,6 @@ test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES E
=== MESSAGES === === MESSAGES ===
This is an error (see *Notmuch errors* for more details) This is an error (see *Notmuch errors* for more details)
=== ERROR === === ERROR ===
[XXX]
This is an error This is an error
command: YYY/notmuch_fail show --format\\=sexp --format-version\\=4 --decrypt\\=true --exclude\\=false \\' \\* \\' command: YYY/notmuch_fail show --format\\=sexp --format-version\\=4 --decrypt\\=true --exclude\\=false \\' \\* \\'
exit status: 1 exit status: 1

View file

@ -502,12 +502,16 @@ print(msg.as_string(False))
' "$@" ' "$@"
} }
notmuch_debug_sanitize () {
grep -v '^D.:'
}
notmuch_exception_sanitize () { notmuch_exception_sanitize () {
perl -pe 's/(A Xapian exception occurred at .*[.]cc?):([0-9]*)/\1:XXX/' perl -pe 's/(A Xapian exception occurred at .*[.]cc?):([0-9]*)/\1:XXX/'
} }
notmuch_search_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 () { notmuch_search_files_sanitize () {
@ -523,6 +527,7 @@ notmuch_show_sanitize () {
sed -e "$NOTMUCH_SHOW_FILENAME_SQUELCH" sed -e "$NOTMUCH_SHOW_FILENAME_SQUELCH"
} }
notmuch_show_sanitize_all () { notmuch_show_sanitize_all () {
notmuch_debug_sanitize | \
sed \ sed \
-e 's| filename:.*| filename:XXXXX|' \ -e 's| filename:.*| filename:XXXXX|' \
-e 's| id:[^ ]* | id:XXXXX |' | \ -e 's| id:[^ ]* | id:XXXXX |' | \
@ -545,9 +550,10 @@ notmuch_emacs_error_sanitize () {
shift shift
for file in "$@"; do for file in "$@"; do
echo "=== $file ===" echo "=== $file ==="
cat "$file" notmuch_debug_sanitize < "$file"
done | sed \ done | sed \
-e 's/^\[.*\]$/[XXX]/' \ -e '/^$/d' \
-e '/^\[.*\]$/d' \
-e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|" -e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
} }
@ -893,7 +899,7 @@ test_C () {
echo "== stdout ==" > OUTPUT.stdout echo "== stdout ==" > OUTPUT.stdout
echo "== stderr ==" > OUTPUT.stderr echo "== stderr ==" > OUTPUT.stderr
./${exec_file} "$@" 1>>OUTPUT.stdout 2>>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 () { make_shim () {