Re: [PATCH] test: add known broken test for duplicate thread-id terms

Subject: Re: [PATCH] test: add known broken test for duplicate thread-id terms

Date: Mon, 17 May 2021 10:12:31 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc: David Bremner

From: Tomi Ollila


On Sat, May 15 2021, David Bremner wrote:

> According to my bijection, this bug has been present since commit
> 411675a6ce in 2017. It is apparently harmless for regular use, but
> does make notmuch crash when compiled with -DDEBUG_DATABASE_SANITY.
> ---
>  test/T670-duplicate-mid.sh | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/test/T670-duplicate-mid.sh b/test/T670-duplicate-mid.sh
> index 4e5672ab..3fd59ca5 100755
> --- a/test/T670-duplicate-mid.sh
> +++ b/test/T670-duplicate-mid.sh
> @@ -2,10 +2,27 @@
>  test_description="duplicate message ids"
>  . $(dirname "$0")/test-lib.sh || exit 1
>  
> +test_require_external_prereq xapian-delve
> +
>  add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1'
>  add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2'
>  
>  add_message '[id]="duplicate"' '[subject]="message 0" [filename]=copy0'
> +
> +test_begin_subtest 'at most 1 thread-id per xapian document'
> +test_subtest_known_broken
> +db=${MAIL_DIR}/.notmuch/xapian
> +cp /dev/null OUTPUT.raw
> +for doc in $(xapian-delve -1 -t '' "$db" | grep '^[1-9]'); do
> +    xapian-delve -1 -r "$doc"  "$db" | grep '^G' | wc -l >> OUTPUT.raw
> +done

for doc in $(xapian-delve -1 -t '' "$db" | grep '^[1-9]'); do
    xapian-delve -1 -r "$doc" "$db" | grep -c '^G'
done > OUTPUT.raw

will do (w/o cp /dev/null OUTPUT.raw) (also NOTE SPACING !!! >;D)


> +sort -u < OUTPUT.raw > OUTPUT
> +cat <<EOF > EXPECTED
> +0
> +1
> +EOF
> +test_expect_equal_file EXPECTED OUTPUT
> +
>  test_begin_subtest 'search: first indexed subject preserved'
>  cat <<EOF > EXPECTED
>  thread:XXX   2001-01-05 [1/1(3)] Notmuch Test Suite; message 1 (inbox unread)
> -- 
> 2.30.2
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: