[PATCH] test: avoid hanging older gdb under GNU timeout and moreutils parallel

David Bremner david at tethera.net
Mon May 20 19:32:20 PDT 2019


Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:

>
> A marginally cleaner patch be to consistently use gdb with either one
> of:
>
>  * -tty /dev/null
>  * < /dev/null
>
> in all of T050, T060, and T070.  But T070 can't use "< /dev/null"
> because it needs stdin.  And when i tried to use "-tty /dev/null" in
> T050 and T060, i got test suite failures that i wasn't able to
> understand.
>

I don't have any understanding to offer, but I wonder if most/all of our
use of gdb could be replaced by writing simple shim libraries and using
LD_PRELOAD.  I did a quick proof of concept (at end) for one of the tests in
T070-insert.sh. This would require switching at least some of the test
to use the notmuch-shared binary. 

I don't know if relying on LD_PRELOAD is particularly portable. Various
linux distros should be OK, and a quick look at the FreeBSD docs suggest
it might be ok. MacOS would probably need some extra work, as
usual. OTOH, I'm not sure how well (if at all) the gdb based tests work
on MacOS.

In practice the following would presumably be generated by the test
script.

/* gcc -Wall -O2 -fpic -shared -ldl -o shim.so shim.c */
/* LD_PRELOAD=../shim.sh ../../notmuch-shared --config=./notmuch-config insert < foo */
#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)
{
    printf("calling notmuch_database_index_file\n");
    return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
}





More information about the notmuch mailing list