From: David Levine Date: Fri, 18 Jan 2013 02:58:25 +0000 (-0600) Subject: Added test-msg-buffer-boundaries. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/e98c2d0fee3d656633ae897576b3d8d0f0fddfe2?hp=-c Added test-msg-buffer-boundaries. (cherry picked from commit dbd0fa0a56a222bd118fea627eba53e5d9811d01) --- e98c2d0fee3d656633ae897576b3d8d0f0fddfe2 diff --git a/Makefile.am b/Makefile.am index b79e930d..c63b3325 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,8 +61,8 @@ TESTS = test/ali/test-ali test/anno/test-anno \ test/mhlist/test-mhlist test/mhmail/test-mhmail \ test/mhparam/test-mhparam test/mhpath/test-mhpath \ test/mhshow/test-cte-binary test/mhshow/test-qp \ - test/mhshow/test-subpart test/mhstore/test-mhstore \ - test/new/test-basic \ + test/mhshow/test-subpart test/mhshow/test-msg-buffer-boundaries \ + test/mhstore/test-mhstore test/new/test-basic \ test/pick/test-pick test/pick/test-stderr \ test/post/test-post-aliases test/post/test-post-basic \ test/post/test-post-multiple test/post/test-post-bcc \ diff --git a/test/mhshow/test-msg-buffer-boundaries b/test/mhshow/test-msg-buffer-boundaries new file mode 100755 index 00000000..23b49348 --- /dev/null +++ b/test/mhshow/test-msg-buffer-boundaries @@ -0,0 +1,443 @@ +#!/bin/sh +###################################################### +# +# Test m_getfld() with various parts of messages +# falling on buffer boundaries +# +###################################################### + +set -e + +if test -z "${MH_OBJ_DIR}"; then + srcdir=`dirname "$0"`/../.. + MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR +fi + +. "$MH_OBJ_DIR/test/common.sh" + +setup_test + +expected="$MH_TEST_DIR/$$.expected" +actual="$MH_TEST_DIR/$$.actual" + +# check a boundary condition in m_getfld(): its internal message +# buffer holds exactly up to the end of a header field body in a +# message part +msgfile=`mhpath new` +msgnum=`basename $msgfile` +cat >"$msgfile" <"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +# check a boundary condition in m_getfld(): its internal message +# buffer holds exactly up to the end of a header field name in a +# message part +msgfile=`mhpath new` +msgnum=`basename $msgfile` +cat >"$msgfile" <"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +# check a boundary condition in m_getfld(): its internal message +# buffer holds exactly up to the end of a message part boundary +msgfile=`mhpath new` +msgnum=`basename $msgfile` +cat >"$msgfile" <"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + + +exit $failed