X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=7f8a3a4dd93ace28c3bb4bcb8d64972e92cbe338;hp=616cb674ccd9ee36df8026a87805e28a5730f890;hb=6544a2e3054ee96d8d4efccc51b4bc9e09e23d6c;hpb=11f7e52651d5f16bac0df00a8f51cb141df0675a diff --git a/test/test-lib.sh b/test/test-lib.sh index 616cb674..7f8a3a4d 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 @@ -1056,6 +1058,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}${LD_PRELOAD:+:$LD_PRELOAD} 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