aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-05-23 20:38:54 -0300
committerDavid Bremner <david@tethera.net>2022-06-25 12:55:02 -0300
commit2707c06a0fc587a68096a3ec6f054ba4f0d7e7c7 (patch)
treed635b49929cd8ce74e1d1e31e8b1f83e12949b1c /test
parentbfcf9a6c102af9232b6d2e720f919ff1c9b431f8 (diff)
test: define test_private_C
When testing error handling, it is sometimes difficult to cover a particular error path deterministically. Introduce a test function to allow calling lower level functions directly.
Diffstat (limited to 'test')
-rw-r--r--test/test-lib.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 59b6079d..75a62214 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -872,6 +872,19 @@ test_C () {
notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr | notmuch_exception_sanitize | notmuch_debug_sanitize > OUTPUT
}
+test_private_C () {
+ local exec_file test_file
+ exec_file="test${test_count}"
+ test_file="${exec_file}.c"
+ echo '#include <notmuch-private.h>' > ${test_file}
+ cat >> ${test_file}
+ ${TEST_CC} ${TEST_CFLAGS} -I${NOTMUCH_SRCDIR}/test -I${NOTMUCH_SRCDIR}/lib -I${NOTMUCH_SRCDIR}/util -I${NOTMUCH_SRCDIR}/compat ${NOTMUCH_GMIME_CFLAGS} -o ${exec_file} ${test_file} ${NOTMUCH_BUILDDIR}/lib/libnotmuch.a ${NOTMUCH_GMIME_LDFLAGS} ${NOTMUCH_XAPIAN_LDFLAGS} ${NOTMUCH_BUILDDIR}/util/libnotmuch_util.a ${NOTMUCH_SFSEXP_LDFLAGS} ${NOTMUCH_BUILDDIR}/parse-time-string/libparse-time-string.a -ltalloc -lstdc++
+ echo "== stdout ==" > OUTPUT.stdout
+ echo "== stderr ==" > OUTPUT.stderr
+ ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
+ notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr | notmuch_exception_sanitize | notmuch_debug_sanitize > OUTPUT
+}
+
make_shim () {
local base_name test_file shim_file
base_name="$1"