From 2707c06a0fc587a68096a3ec6f054ba4f0d7e7c7 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Mon, 23 May 2022 20:38:54 -0300 Subject: [PATCH] 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. --- configure | 16 ++++++++++++++++ test/test-lib.sh | 13 +++++++++++++ 2 files changed, 29 insertions(+) diff --git a/configure b/configure index 30fee6ab..5247e05a 100755 --- a/configure +++ b/configure @@ -1566,9 +1566,17 @@ cat > sh.config < OUTPUT } +test_private_C () { + local exec_file test_file + exec_file="test${test_count}" + test_file="${exec_file}.c" + echo '#include ' > ${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"