From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/2] test: provide machinery to make and use test_shims
Date: Sun, 26 May 2019 10:08:53 -0300 [thread overview]
Message-ID: <20190526130854.8348-2-david@tethera.net> (raw)
In-Reply-To: <20190526130854.8348-1-david@tethera.net>
These can be used e.g. to override return values for functions, in
place of the existing scripting of gdb.
---
test/test-lib.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/test/test-lib.sh b/test/test-lib.sh
index ff18fae6..a423b7f4 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -95,6 +95,8 @@ TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient}
TEST_GDB=${TEST_GDB:-gdb}
TEST_CC=${TEST_CC:-cc}
TEST_CFLAGS=${TEST_CFLAGS:-"-g -O0"}
+TEST_SHIM_CFLAGS=${TEST_SHIM_CFLAGS:-"-fpic -shared"}
+TEST_SHIM_LDFLAGS=${TEST_SHIM_LDFLAGS:-"-ldl"}
# Protect ourselves from common misconfiguration to export
# CDPATH into the environment
@@ -1032,6 +1034,20 @@ test_C () {
notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr > OUTPUT
}
+make_shim () {
+ base_name="$1"
+ test_file="${base_name}.c"
+ shim_file="${base_name}.so"
+ cat > ${test_file}
+ ${TEST_CC} ${TEST_CFLAGS} ${TEST_SHIM_CFLAGS} -I${NOTMUCH_SRCDIR}/test -I${NOTMUCH_SRCDIR}/lib -o ${shim_file} ${test_file} ${TEST_SHIM_LDFLAGS}
+}
+
+notmuch_with_shim () {
+ base_name="$1"
+ shift
+ shim_file="${base_name}.so"
+ LD_PRELOAD=./${shim_file} notmuch-shared "$@"
+}
# Creates a script that counts how much time it is executed and calls
# notmuch. $notmuch_counter_command is set to the path to the
--
2.20.1
next prev parent reply other threads:[~2019-05-26 13:08 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 ` David Bremner [this message]
2019-06-25 21:05 ` [PATCH 1/2] test: provide machinery to make and use test_shims 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
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=20190526130854.8348-2-david@tethera.net \
--to=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).