unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: David Bremner <david@tethera.net>,
	notmuch@notmuchmail.org, Ralph Seichter <abbot@monksofcool.net>
Subject: Re: [PATCH 2/2] test: replace use of gdb with LD_PRELOAD shims in T070-insert.sh
Date: Mon, 10 Jun 2019 01:47:40 +0300	[thread overview]
Message-ID: <8736kipe9f.fsf@fifthhorseman.net> (raw)
In-Reply-To: <20190526130854.8348-3-david@tethera.net>

[-- Attachment #1: Type: text/plain, Size: 3209 bytes --]

On Sun 2019-05-26 10:08:54 -0300, David Bremner wrote:
> This removes the dependency of this test script on gdb, and
> considerably speeds up the running of the tests.

This series looks good to me.  I've tested it with moreutils parallel
installed, and it reduces total CPU time for the parallel test suite
from ~76 seconds of CPU to ~56 seconds, a > %25 reduction in CPU cost
for the whole test suite, despite touching only one test.  This is
awesome work.

I also like the elegance of the proposed change.  It would be great to
see it extended to the rest of our test suite's dependency on GDB if we
can do it. (T050, T060, and T380 i think)

Details on my profiling:

On the current master (bc396c967c7cd8e7a109858e428d7bf97173f7a7),
without these changes applied, the whole test suite consumes this much
CPU on my 4-core intel i5-2540M (2.60GHz):

real	0m33.106s
user	1m1.150s
sys	0m14.998s

On the same machine, with the pair of patches applied, the whole test
suite consumes this:

real	0m27.557s
user	0m44.172s
sys	0m12.018s

Caveat: i don't know how well LD_PRELOAD works on non-GNU/Linux
platforms, and we're not using LD_PRELOAD elsewhere in the test suite
yet.  Perhaps Ralph Seichter (explicitly cc'ed above) could comment on
how it'll affect homebrew?  Do we need to consider a variant for
platforms that can't do LD_PRELOAD?

One nit-pick below:

> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index 48165caa..ab26ecd4 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -2,8 +2,6 @@
>  test_description='"notmuch insert"'
>  . $(dirname "$0")/test-lib.sh || exit 1
>  
> -test_require_external_prereq gdb
> -
>  # subtests about file permissions assume that we're working with umask
>  # 022 by default.
>  umask 022
> @@ -246,50 +244,38 @@ test_expect_code 1 "notmuch insert $gen_msg_filename 2>&1"
>  notmuch config set new.tags $OLDCONFIG
>  
>  # DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass.
> +gen_insert_msg
>  
> -for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
> -    READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do
> -cat <<EOF > index-file-$code.gdb
> -set breakpoint pending on
> -set logging file index-file-$code.log
> -set logging on
> -break notmuch_database_index_file
> -commands
> -return NOTMUCH_STATUS_$code
> -continue
> -end
> -run
> +# pregenerate all of the test shims
> +for code in  FILE_NOT_EMAIL READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR OUT_OF_MEMORY XAPIAN_EXCEPTION; do
> +    make_shim shim-$code <<EOF
> +#include <notmuch.h>
> +#include <stdio.h>
> +notmuch_status_t
> +notmuch_database_index_file (notmuch_database_t *notmuch,
> +                             const char *filename,
> +                             notmuch_indexopts_t *indexopts,
> +                             notmuch_message_t **message_ret)
> +{
> +  return NOTMUCH_STATUS_$code;
> +}
>  EOF
>  done
>  
> -gen_insert_msg
> -

Why put the shim generation below gen_insert_msg?  If it were above, it
would make the comment about DUPLICATE_MESSAGE_ID less confusing, and
the changeset could be shorter.

          --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2019-06-10 11:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-26 13:08 start to replace dependence of test suite on gdb with LD_PRELOAD shims David Bremner
2019-05-26 13:08 ` [PATCH 1/2] test: provide machinery to make and use test_shims David Bremner
2019-06-25 21:05   ` Tomi Ollila
2019-06-25 23:33     ` Daniel Kahn Gillmor
2019-05-26 13:08 ` [PATCH 2/2] test: replace use of gdb with LD_PRELOAD shims in T070-insert.sh David Bremner
2019-06-09 22:47   ` Daniel Kahn Gillmor [this message]
2019-06-10 21:34     ` Ralph Seichter
2019-06-14 11:16       ` David Bremner
2019-06-24 18:22         ` Daniel Kahn Gillmor
2019-06-24 18:44           ` Tomi Ollila
2019-06-24 20:12             ` Daniel Kahn Gillmor
2019-06-24 19:56           ` Ralph Seichter
2019-06-10  0:52   ` Daniel Kahn Gillmor
2019-06-10  0:53     ` [PATCH v2 " Daniel Kahn Gillmor
2019-06-16 11:35       ` Tomi Ollila
2019-06-16 16:38         ` Daniel Kahn Gillmor
2019-06-26 16:23 ` v3 of test speedup by replacing gdb with LD_PRELOAD Daniel Kahn Gillmor
2019-06-26 16:23   ` [PATCH v3 1/2] test: provide machinery to make and use test_shims Daniel Kahn Gillmor
2019-06-26 16:23   ` [PATCH v3 2/2] test: replace use of gdb with LD_PRELOAD shims in T070-insert.sh Daniel Kahn Gillmor
2019-06-26 19:06   ` v3 of test speedup by replacing gdb with LD_PRELOAD Tomi Ollila
2019-06-29 19:14     ` 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=8736kipe9f.fsf@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=abbot@monksofcool.net \
    --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).