mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 01:14:53 +01:00
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.
This commit is contained in:
parent
bfcf9a6c10
commit
2707c06a0f
2 changed files with 29 additions and 0 deletions
16
configure
vendored
16
configure
vendored
|
@ -1566,9 +1566,17 @@ cat > sh.config <<EOF
|
|||
|
||||
NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
|
||||
|
||||
# Flags needed to compile and link against Xapian
|
||||
NOTMUCH_XAPIAN_CXXFLAGS="${xapian_cxxflags}"
|
||||
NOTMUCH_XAPIAN_LDFLAGS="${xapian_ldflags}"
|
||||
|
||||
# Whether to have Xapian retry lock
|
||||
NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${WITH_RETRY_LOCK}
|
||||
|
||||
# Flags needed to compile and link against GMime
|
||||
NOTMUCH_GMIME_CFLAGS="${gmime_cflags}"
|
||||
NOTMUCH_GMIME_LDFLAGS="${gmime_ldflags}"
|
||||
|
||||
# Whether GMime can verify X.509 certificate validity
|
||||
NOTMUCH_GMIME_X509_CERT_VALIDITY=${gmime_x509_cert_validity}
|
||||
|
||||
|
@ -1578,6 +1586,10 @@ NOTMUCH_GMIME_EMITS_ANGLE_BRACKETS=${gmime_emits_angle_brackets}
|
|||
# Whether GMime can verify signatures when decrypting with a session key:
|
||||
NOTMUCH_GMIME_VERIFY_WITH_SESSION_KEY=${gmime_verify_with_session_key}
|
||||
|
||||
# Flags needed to compile and link against zlib
|
||||
NOTMUCH_ZLIB_CFLAGS="${zlib_cflags}"
|
||||
NOTMUCH_ZLIB_LDFLAGS="${zlib_ldflags}"
|
||||
|
||||
# Does the C compiler support the address sanitizer
|
||||
NOTMUCH_HAVE_ASAN=${have_asan}
|
||||
|
||||
|
@ -1614,6 +1626,10 @@ NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest}
|
|||
# Is the sfsexp library available?
|
||||
NOTMUCH_HAVE_SFSEXP=${have_sfsexp}
|
||||
|
||||
# And if so, flags needed at compile/link time for sfsexp
|
||||
NOTMUCH_SFSEXP_CFLAGS="${sfsexp_cflags}"
|
||||
NOTMUCH_SFSEXP_LDFLAGS="${sfsexp_ldflags}"
|
||||
|
||||
# Platform we are run on
|
||||
PLATFORM=${platform}
|
||||
EOF
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue