unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>
Subject: Re: [PATCH] test: Fix race condition in T568-lib-thread.sh
Date: Mon, 15 Feb 2021 22:24:29 +0200	[thread overview]
Message-ID: <m2blclaxky.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <20210215005555.4038380-1-david@tethera.net>

On Sun, Feb 14 2021, David Bremner wrote:

> The assignment of thread-ids is (apparently) non-deterministic in a
> way that mostly seems to show up on multicore machines. In my tests
> the number is different from that previously assumed by this test
> about 15% of the time on a 50 thread (25 core) Xeon.
>
> Since message id's are fixed, use a message known to be in the thread
> of interest to pick out the correct thread-id.

LGTM.

Tomi


> ---
>  test/T568-lib-thread.sh | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh
> index ac13d986..088e66dd 100755
> --- a/test/T568-lib-thread.sh
> +++ b/test/T568-lib-thread.sh
> @@ -8,6 +8,11 @@ add_email_corpus
>  test_begin_subtest "building database"
>  test_expect_success "NOTMUCH_NEW"
>  
> +test_begin_subtest "finding thread"
> +THREAD=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
> +count=$(notmuch count $THREAD)
> +test_expect_equal "$count" "7"
> +
>  cat <<'EOF' > c_tail
>     if (stat) {
>         const char *stat_str = notmuch_database_status_string (db);
> @@ -30,7 +35,7 @@ int main (int argc, char** argv)
>     notmuch_thread_t *thread = NULL;
>     notmuch_threads_t *threads = NULL;
>     notmuch_query_t *query = NULL;
> -   const char *id = "thread:0000000000000009";
> +   const char *id = "${THREAD}";
>  
>     stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg);
>     if (stat != NOTMUCH_STATUS_SUCCESS) {
> @@ -52,10 +57,11 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
>          printf("%d\n%s\n", thread != NULL, id2);
>      }
>  EOF
> +thread_num=${THREAD#thread:}
>  cat <<EOF > EXPECTED
>  == stdout ==
>  1
> -0000000000000009
> +${thread_num}
>  == stderr ==
>  EOF
>  test_expect_equal_file EXPECTED OUTPUT
> -- 
> 2.30.0
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

      reply	other threads:[~2021-02-15 20:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15  0:55 [PATCH] test: Fix race condition in T568-lib-thread.sh David Bremner
2021-02-15 20:24 ` Tomi Ollila [this message]

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=m2blclaxky.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=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).