getpass() nmh_getpass()
+--------------
+nmh test suite
+--------------
+
+The nmh test suite is run through the Makefile, with "make check"
+or "make distcheck".
+
+To enable the use of valgrind, where available, set the environment
+variable NMH_VALGRIND to a non-null value. However, a separate
+environment variable, VALGRIND_ME, triggers the use of valgrind in
+test/inc/test-eom-align because it greatly extends the duration of
+that test.
+
+In the nmh test suite, nmh programs to be tested should be invoked
+through the run_test or run_prog shell functions defined in
+test/common.sh.
+
-------------
releasing nmh
-------------
-([no]p)reserve
EOF
-anno -help >"$actual" 2>&1
+run_prog anno -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
folder -fast 1 >/dev/null
-printf 'Nmh-test' | anno >/dev/null
+printf 'Nmh-test' | run_prog anno >/dev/null
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -component
-anno -component Nmh-test
+run_prog anno -component Nmh-test
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check +folder
-anno -component Nmh-test +inbox
+run_prog anno -component Nmh-test +inbox
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check msg
folder -fast 2 >/dev/null
-anno 1 -component Nmh-test
+run_prog anno 1 -component Nmh-test
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# Hard link the message and verify that the new one doesn't get annotated.
cp "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.copy"
ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
- anno 8 -component Nmh-test -noinplace
+ run_prog anno 8 -component Nmh-test -noinplace
mv -f "${MH_TEST_DIR}/Mail/inbox/8.copy" "${MH_TEST_DIR}/Mail/inbox/8"
check "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" \
'keep first'
# check -inplace
# Hard link the message and verify that the new one does get annotated.
ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
- anno 8 -component Nmh-test -noinplace -inplace
+ run_prog anno 8 -component Nmh-test -noinplace -inplace
check "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
fi
# check -nodate. Without -text, it doesn't change the message.
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "$expected-nodate"
-anno 1 -component Nmh-test -nodate
+run_prog anno 1 -component Nmh-test -nodate
cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
check "$expected-nodate" "$actual"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -date
-anno 1 -component Nmh-test -nodate -date
+run_prog anno 1 -component Nmh-test -nodate -date
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -draft.
cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/draft"
-anno -draft -component Nmh-test
+run_prog anno -draft -component Nmh-test
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/draft" >"$actual"
check "$expected" "$actual"
rm "${MH_TEST_DIR}/Mail/draft"
# check -append
awk 'NR==6{print "Nmh-test:"}1' <"${MH_TEST_DIR}/Mail/inbox/1" >"$expected"
-anno 1 -component Nmh-test -append
+run_prog anno 1 -component Nmh-test -append
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -list
printf 'Nmh-test: test of anno -list\n' >"$expected"
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
-anno 1 -component Nmh-test -nodate -text 'test of anno -list'
+run_prog anno 1 -component Nmh-test -nodate -text 'test of anno -list'
run_test 'anno 1 -component Nmh-test -list' 'test of anno -list'
# check -text
check "$expected" "${MH_TEST_DIR}/Mail/inbox/1"
# check -list -number
printf 'Nmh-test: test of anno -list -number\n' >"$expected"
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
-anno 1 -component Nmh-test -nodate -text 'test of anno -list -number'
+run_prog anno 1 -component Nmh-test -nodate -text 'test of anno -list -number'
run_test 'anno 1 -component Nmh-test -list -number' \
'1 test of anno -list -number'
check "$expected" "${MH_TEST_DIR}/Mail/inbox/1"
# check -delete
cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
-anno 1 -component Nmh-test
-anno 1 -component Nmh-test -delete
+run_prog anno 1 -component Nmh-test
+run_prog anno 1 -component Nmh-test -delete
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -delete -number
printf 'Nmh-test: 1\nNmh-test: 3\n' >"$expected"
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
-anno 1 -component Nmh-test -nodate -text 3
-anno 1 -component Nmh-test -nodate -text 2
-anno 1 -component Nmh-test -nodate -text 1
-anno 1 -component Nmh-test -delete -number 2
+run_prog anno 1 -component Nmh-test -nodate -text 3
+run_prog anno 1 -component Nmh-test -nodate -text 2
+run_prog anno 1 -component Nmh-test -nodate -text 1
+run_prog anno 1 -component Nmh-test -delete -number 2
cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
check "$expected" "$actual"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -delete -all
cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
-anno 1 -component Nmh-test -nodate -text 3
-anno 1 -component Nmh-test -nodate -text 2
-anno 1 -component Nmh-test -nodate -text 1
-anno 1 -component Nmh-test -delete -number all
+run_prog anno 1 -component Nmh-test -nodate -text 3
+run_prog anno 1 -component Nmh-test -nodate -text 2
+run_prog anno 1 -component Nmh-test -nodate -text 1
+run_prog anno 1 -component Nmh-test -delete -number all
cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
check "$expected" "$actual"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -preserve
touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/1"
ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
-anno 1 -component Nmh-test -preserve
-anno 1 -component Nmh-test -preserve -delete
+run_prog anno 1 -component Nmh-test -preserve
+run_prog anno 1 -component Nmh-test -preserve -delete
ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls2"
check "$actual-ls1" "$actual-ls2"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -nopreserve
touch -t '2012100100.00' "${MH_TEST_DIR}/Mail/inbox/1"
ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
-anno 1 -component Nmh-test -preserve -nopreserve
-anno 1 -component Nmh-test -preserve -nopreserve -delete
+run_prog anno 1 -component Nmh-test -preserve -nopreserve
+run_prog anno 1 -component Nmh-test -preserve -nopreserve -delete
ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls2"
set +e
diff "$actual-ls1" "$actual-ls2" >/dev/null
cat >"$expected" <<EOF
11 12/18 foo@example.edu test<<This is a multi-part message in MIME forma
EOF
-scan -width 80 last > "$actual" 2>&1
+run_prog scan -width 80 last > "$actual" 2>&1
check "$expected" "$actual"
# check show (mhl)
I am a stupid spammer.
EOF
-show last > "$actual" 2>&1
+run_prog show last > "$actual" 2>&1
check "$expected" "$actual"
# check mhshow
I am a stupid spammer.
EOF
-mhshow -nopause last > "$actual" 2>&1
+run_prog mhshow -nopause last > "$actual" 2>&1
check "$expected" "$actual"
# check m_getfld() handling of empty header field
??Format error (message 12) in component 2
EOF
-scan -width 13 last >"$actual" 2>"$actual_err"
+run_prog scan -width 13 last >"$actual" 2>"$actual_err"
check "$expected" "$actual"
check "$expected_err" "$actual_err"
13 01/15
EOF
-scan -width 13 last >"$actual" 2>"$actual_err"
+run_prog scan -width 13 last >"$actual" 2>"$actual_err"
check "$expected" "$actual"
# Cygwin has a BUFSIZ of 1024 so the error message gets truncated.
# Deal with that by grepping to verify that scan showed the proper error.
??Format error (message 14) in component 2
EOF
-scan -width 13 last >"$actual" 2>"$actual_err"
+run_prog scan -width 13 last >"$actual" 2>"$actual_err"
check "$expected" "$actual"
check "$expected_err" "$actual_err"
End of all messages
EOF
-burst 11 || exit
+run_prog burst 11 || exit
run_test 'scan -width 80 11-last' \
" 11 09/29 Test Burst Messag Test digest<<------- Message one From: Mister Bu
End of all messages
EOF
-burst 14 || exit
+run_prog burst 14 || exit
run_test 'scan -width 80 14-last' \
" 14 09/29 Test Burst Messag Test digest<<This is a preamble ------- Message
EOF
-burst 11
+run_prog burst 11
run_test 'scan -width 80 11-last' \
" 11 09/29 Test Burst Messag Test MIME digest<<From: Mister Burster <burst2@e
------- =_aaaaaaaaaa0--
EOF
-burst 14 || exit
+run_prog burst 14 || exit
run_test 'scan -width 80 14-last' \
" 14 09/29 Test Burst Messag Test digest<<This is a preamble ------- =_aaaaaa
#### check() requires two arguments, each the name of a file to be
#### diff'ed.
-#### If the same, the second file is removed. And the first file is
-#### removed unless there's an optional argument with a value of
-#### 'keep first'.
+#### If the contents are same, the second file is removed. And the
+#### first file is removed unless there's an optional argument with
+#### a value of 'keep first'.
#### If different, global variable "failed" is incremented.
#### If there's an optional 'ignore space' argument, spacing differences
#### will not be considered signficant, emulating GNU diff -w. It
fi
}
+
+#### Shortcut to enable use of valgrind: set NMH_VALGRIND environment
+#### variable (to anything) so run_* will use valgrind.
+if [ "${NMH_VALGRIND}" -a -z "${NMH_TEST_PREFIX}" ]; then
+ NMH_TEST_PREFIX="valgrind --quiet --error-exitcode=1 \
+ --suppressions=$MH_OBJ_DIR/test/valgrind.supp"
+fi
+
+#### Run test under another program by setting NMH_TEST_PREFIX
+#### environment variable to, e.g., 'valgrind --quiet'.
+run_prog() {
+ case $1 in
+ #### Don't run valgrind on shell built-in.
+ eval\ *) "$@" ;;
+ *) ${NMH_TEST_PREFIX} "$@" ;;
+ esac
+}
+
+
#### run_test() requires two arguments, the first is a program and
#### arguments, the second is its expected one-line output string.
#### If the actual output does not match that string:
#### if there is an optional third argument, it is used in the error message.
run_test() {
set +e
- actual_output=`$1 2>&1`
+ case $1 in
+ #### Don't run valgrind on shell built-in.
+ eval\ *) actual_output=`$1 2>&1` ;;
+ *) actual_output=`${NMH_TEST_PREFIX} $1 2>&1` ;;
+ esac
set -e
if test x"$actual_output" != x"$2"; then
echo "$0: ${3:-\"$1\"} expected:" 1>&2
--------
EOF
+run_prog \
comp -editor true -form "${form}" -from "${from}" -to "${to1}" -to "${to2}" \
-cc "${cc1}" -cc "${cc2}" -cc "${cc3}" -cc "${cc4}" -fcc "${fcc1}" \
-fcc "${fcc2}" -subject "${subject}" -width 60 -nowhatnowproc || exit 1
# arguments: dist switches
test_dist ()
{
- printf 'send\n' | dist "$@" >/dev/null
+ printf 'send\n' | run_prog dist "$@" >/dev/null
# fakesendmail drops the message and any cc's into this mbox.
mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
setup_test
-folder -create +testfolder > /dev/null
+run_prog folder -create +testfolder > /dev/null
if [ -d "$MH_TEST_DIR/Mail/testfolder" ]; then
:
else
exit 1
fi
-rmf +testfolder > /dev/null
+run_prog rmf +testfolder > /dev/null
if [ -d "$MH_TEST_DIR/Mail/testfolder" ]; then
# Test failed
exit 1
printf 'y\n' >Mail/yes
# check with no switches
-packf <Mail/yes
+run_prog packf <Mail/yes
inc +inbox2 -file msgbox <Mail/yes >/dev/null
rm -f msgbox .msgbox.map
for i in `pick +inbox`; do
rmm +inbox2 -unlink `pick +inbox2`
# check +folder
-packf +inbox <Mail/yes
+run_prog packf +inbox <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox .msgbox.map
for i in `pick +inbox`; do
rmm +inbox2 -unlink `pick +inbox2`
# check msgs
-packf +inbox 1 2 3 <Mail/yes
+run_prog packf +inbox 1 2 3 <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox .msgbox.map
for i in `pick +inbox2`; do
rmm +inbox2 -unlink `pick +inbox2`
# check -file
-packf +inbox -file msgbox2 <Mail/yes
+run_prog packf +inbox -file msgbox2 <Mail/yes
inc +inbox2 -file msgbox2 >/dev/null
for i in `pick +inbox2`; do
diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
rmm +inbox2 -unlink `pick +inbox2`
# check append to existing mbox file
-packf +inbox -file msgbox2 <Mail/yes
+run_prog packf +inbox -file msgbox2 <Mail/yes
inc +inbox2 -file msgbox2 >/dev/null
rm -f msgbox2 .msgbox2.map
for i in `pick +inbox2`; do
rmm +inbox2 -unlink `pick +inbox2`
# check -mbox
-packf +inbox -mbox <Mail/yes
+run_prog packf +inbox -mbox <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox .msgbox.map
for i in `pick +inbox2`; do
rmm +inbox2 -unlink `pick +inbox2`
# check -mmdf
-packf +inbox -mmdf <Mail/yes
+run_prog packf +inbox -mmdf <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox .msgbox.map
for i in `pick +inbox2`; do
rmm +inbox2 -unlink `pick +inbox2`
# check append to existing mmdf file
-packf +inbox -mmdf <Mail/yes
+run_prog packf +inbox -mmdf <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox .msgbox.map
for i in `pick +inbox2`; do
setup_test
-folder -create +testfolder > /dev/null
-folder -create +testfolder/folder1 > /dev/null
-folder -create +testfolder/folder2 > /dev/null
+run_prog folder -create +testfolder > /dev/null
+run_prog folder -create +testfolder/folder1 > /dev/null
+run_prog folder -create +testfolder/folder2 > /dev/null
run_test 'folder -recurse +testfolder' 'testfolder+ has no messages ; (others).
testfolder/folder1 has no messages.
-help
EOF
-sortm -help >"$actual" 2>&1
+run_prog sortm -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
12 09/29 Test11 Re: common subject<<This is message number 11 >>
EOF
-sortm
+run_prog sortm
scan >"$actual"
check "$expected" "$actual"
EOF
refile first +inbox; folder -pack >/dev/null
-sortm +inbox
+run_prog sortm +inbox
scan >"$actual"
check "$expected" "$actual"
EOF
refile first +inbox; folder -pack >/dev/null
-sortm -verbose >"$actual"
+run_prog sortm -verbose >"$actual"
scan >>"$actual"
check "$expected" "$actual"
EOF
refile first +inbox; folder -pack >/dev/null
-sortm -verbose -noverbose >"$actual"
+run_prog sortm -verbose -noverbose >"$actual"
scan >>"$actual"
check "$expected" "$actual"
EOF
refile first +inbox; folder -pack >/dev/null
-sortm first last
+run_prog sortm first last
scan >"$actual"
check "$expected" "$actual"
12+ 09/29 Test1 Testing message 1<<This is message number 1 >>
EOF
-sortm -datefield Alt-Date 1 11
+run_prog sortm -datefield Alt-Date 1 11
scan >"$actual"
check "$expected" "$actual"
12+ 09/29 Test1 Testing message 1<<This is message number 1 >>
EOF
-sortm -textfield subject
+run_prog sortm -textfield subject
scan >"$actual"
check "$expected" "$actual"
12+ 09/29 Test1 Testing message 1<<This is message number 1 >>
EOF
-sortm -textfield subject -limit 0 -nolimit
+run_prog sortm -textfield subject -limit 0 -nolimit
scan >"$actual"
check "$expected" "$actual"
EOF
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 0
+run_prog sortm -textfield subject -limit 0
scan >"$actual"
check "$expected" "$actual"
EOF
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield from -limit 0
+run_prog sortm -textfield from -limit 0
scan >"$actual"
check "$expected" "$actual"
EOF
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 10
+run_prog sortm -textfield subject -limit 10
scan >"$actual"
check "$expected" "$actual"
EOF
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 60
+run_prog sortm -textfield subject -limit 60
scan >"$actual"
check "$expected" "$actual"
EOF
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 60 -notextfield
+run_prog sortm -textfield subject -limit 60 -notextfield
scan >"$actual"
check "$expected" "$actual"
EOF
refile first +inbox; folder -pack >/dev/null
-sortm -noall -all
+run_prog sortm -noall -all
scan >"$actual"
check "$expected" "$actual"
sed -e 's/Sep//' $MH_TEST_DIR/Mail/inbox/7 > $MH_TEST_DIR/Mail/inbox/14
set +e
-sortm -check >"$actual" 2>&1
+run_prog sortm -check >"$actual" 2>&1
set -e
check "$expected" "$actual"
setup_test
-output=`folder -total +inbox`
+output=`run_prog folder -total +inbox`
if test x"$output" != x'TOTAL = 10 messages in 1 folder.' ; then
exit 1
fi
-help
EOF
-$dp -help >"$actual" 2>&1
+run_prog $dp -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
Sun, 01 Jul 2012 00:00:00
EOF
-$dp 'Sun Jul 1 2012' > "$actual" 2>&1
+run_prog $dp 'Sun Jul 1 2012' > "$actual" 2>&1
check "$expected" "$actual"
# check with two valid dates
Mon, 02 Jul 2012 00:00:00
EOF
-$dp 'Sun Jul 1 2012' 'Mon Jul 2 2012' > "$actual" 2>&1
+run_prog $dp 'Sun Jul 1 2012' 'Mon Jul 2 2012' > "$actual" 2>&1
check "$expected" "$actual"
# check with invalid date
cat >"$expected_err" <<EOF
EOF
-$dp 'not a date' > "$actual" 2> "$actual_err"
+run_prog $dp 'not a date' > "$actual" 2> "$actual_err"
check "$expected" "$actual"
check "$expected_err" "$actual_err"
Sun
EOF
-$dp -form "$form" 'Jul 1 2012' >$actual 2>&1
+run_prog $dp -form "$form" 'Jul 1 2012' >$actual 2>&1
check $expected $actual
rm -f "$form"
Sun
EOF
-$dp -format '%(day{text})' 'Jul 1 2012' >$actual 2>&1
+run_prog $dp -format '%(day{text})' 'Jul 1 2012' >$actual 2>&1
check $expected $actual
# check -width
Sun, 01 Jul 2012
EOF
-$dp -width 17 'Sun Jul 1 2012' > "$actual" 2>&1
+run_prog $dp -width 17 'Sun Jul 1 2012' > "$actual" 2>&1
check "$expected" "$actual"
DONE
EOF
-$fmtdump >$actual 2>&1
+run_prog $fmtdump >$actual 2>&1
check $expected $actual 'keep first'
# check -form
-$fmtdump -form "$MH_TEST_DIR/Mail/scan.default" >$actual 2>&1
+run_prog $fmtdump -form "$MH_TEST_DIR/Mail/scan.default" >$actual 2>&1
check $expected $actual
# check -format
L0: DONE
EOF
-$fmtdump -format '%<(lit 1234567890)%(strlen)%>' >$actual 2>&1
+run_prog $fmtdump -format '%<(lit 1234567890)%(strlen)%>' >$actual 2>&1
check $expected $actual
# We can use "ap" to get the output of format commands
-testoutput=`${MH_LIB_DIR}/ap -format "%(localmbox)" ignore`
+testoutput=`run_prog ${MH_LIB_DIR}/ap -format "%(localmbox)" ignore`
if [ x"${testname}" != x"${testoutput}" ]; then
echo "Expected ${testname}, got ${testoutput}"
#### Local-Mailbox profile component, which we don't use in the test
#### suite, or the user's login name. ap will escape (quote) it if
#### needed.
-user=`${MH_LIB_DIR}/ap -format '%(me)' 0`
+user=`run_prog ${MH_LIB_DIR}/ap -format '%(me)' 0`
host=`${MH_OBJ_DIR}/test/getcanon`
-output=`${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}"`
+output=`run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}"`
run_test "echo $output" 1 "Basic user test"
-output=`${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}@${host}"`
+output=`run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}@${host}"`
run_test "echo $output" 1 "Basic user@host test"
run_test "${MH_LIB_DIR}/ap -format %(mymbox{text}) nosuchuser@nosuchhost.blah" \
0 "Basic non-matching test"
mv -f ${MH}.new ${MH}
echo "Local-Mailbox: ${myname}" >> ${MH}
-run_test "echo `${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
+run_test "echo \
+ `run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
1 "Local-Mailbox test"
-output=`${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}@${host}"`
+output=`run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}@${host}"`
run_test "echo $output" 0 "Local-mailbox overriding user@host test"
# Add an Alternate-Mailbox. This caused ismymbox() to lose the
# Local-Mailbox, Bug #36635: -nocc me doesn't account for
# Alternate-Mailboxes.
printf 'Alternate-Mailboxes: user@example.com\n' >> $MH
-run_test "echo `${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
+run_test "echo \
+ `run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
1 "Local-Mailbox with Alternate-Mailbox test"
exit $failed
setup_test
-actual=`${MH_LIB_DIR}/ap -format "%-30(friendly{text})<<End of test" "No Such User <nosuch@user.com>"`
+actual=`run_prog ${MH_LIB_DIR}/ap -format "%-30(friendly{text})<<End of test" "No Such User <nosuch@user.com>"`
expected=" No Such User<<End of test"
##########123456789012345678901234567890
********************************************
EOF
-forw -editor true -from "${from}" -to "${to1}" -to "${to2}" \
+run_prog forw -editor true -from "${from}" -to "${to1}" -to "${to2}" \
-cc "${cc1}" -cc "${cc2}" -cc "${cc3}" -cc "${cc4}" -fcc "${fcc1}" \
-fcc "${fcc2}" -width 60 -issue 3 -volume 2 -nowhatnowproc \
-digest digest-test +inbox 1-6 || exit 1
********************************************
EOF
-forw -editor true -from "${from}" -nowhatnowproc -digest digest-test \
+run_prog forw -editor true -from "${from}" -nowhatnowproc -digest digest-test \
-subject "This is a test" +inbox 7-8 || exit 1
check "${expected}" "${actual}"
------- End of Forwarded Message
EOF
+run_prog \
forw -editor true -form "${form}" -from "${from}" -to "${to1}" -to "${to2}" \
-cc "${cc1}" -cc "${cc2}" -cc "${cc3}" -cc "${cc4}" -fcc "${fcc1}" \
-fcc "${fcc2}" -subject "${subject}" -width 60 -nowhatnowproc 1 || exit 1
Date: Wed, 16 Jan 2013 20:33:58 -0600
EOF
-inc -file "$MH_TEST_DIR/mess" >/dev/null
+run_prog inc -file "$MH_TEST_DIR/mess" >/dev/null
check "$expected" `mhpath last` || rmm last
rm -f "$MH_TEST_DIR/mess"
-help
EOF
-msgchk -help | head -9 >"$actual" 2>&1
+run_prog msgchk -help | head -9 >"$actual" 2>&1
check "$expected" "$actual"
# check -version
You have new mail waiting; last read on
EOF
-msgchk | sed -e 's/last read on.*/last read on/' >"$actual"
+run_prog msgchk | sed -e 's/last read on.*/last read on/' >"$actual"
check "$expected" "$actual"
# check -date
You have new mail waiting; last read on
EOF
-msgchk -nodate -date | sed -e 's/last read on.*/last read on/' >"$actual"
+run_prog msgchk -nodate -date | sed -e 's/last read on.*/last read on/' \
+ >"$actual"
check "$expected" "$actual"
# check -nodate
# check -nonotify all, when there is mail
run_test 'msgchk -nonotify nomail -nonotify all -nodate' ''
-inc -silent
+run_prog inc -silent
# check -notify mail, when there is no mail
run_test 'msgchk -notify mail -nodate' "You don't have any mail waiting"
# check -check, with nmh already installed
run_test "install-mh -check" ''
# make sure exit status is 0
-install-mh -check
+run_prog install-mh -check
run_test "echo $?" '0'
# Remove the nmh installation so that install-mh can install.
run_test "install-mh -check" ''
# make sure exit status is 1
set +e
-install-mh -check
+run_prog install-mh -check
run_test "echo $?" '1'
set -e
n
n
$installpath
-y" | install-mh >/dev/null
+y" | run_prog install-mh >/dev/null
if [ -f $MH_TEST_DIR/Mail/context -a -f $MH_TEST_DIR/Mail/.mh_profile ]; then
- install-mh -check
+ run_prog install-mh -check
else
failed=`expr ${failed:-0} + 1`
fi
HOME=$MH_TEST_DIR install-mh -auto >/dev/null
if [ -f $MH_TEST_DIR/Mail/context -a -f $MH_TEST_DIR/Mail/.mh_profile ]; then
- install-mh -check
+ run_prog install-mh -check
else
failed=`expr ${failed:-0} + 1`
fi
echo "datalocking: $locktype" >> ${MH}
- mark 2 4 6 -sequence test -add
+ run_prog mark 2 4 6 -sequence test -add
run_test 'mark -list' 'cur: 1
test: 2 4 6'
- mark all -sequence test -delete
+ run_prog mark all -sequence test -delete
done
------- =_aaaaaaaaaa0--
EOF
mkdraft
-mhbuild $draft
+run_prog mhbuild $draft
check $expected $draft
test ${failed:-0} -eq 0 && rm "$draftorig"
------- =_aaaaaaaaaa0--
EOF
mkdraft
-mhbuild -rfc934 $draft
+run_prog mhbuild -rfc934 $draft
check $expected $draft
test ${failed:-0} -eq 0 && rm "$draftorig"
This is a test
EOF
-mhbuild "${testname}.basic.actual"
+run_prog mhbuild "${testname}.basic.actual"
check "${testname}.basic.actual" "${testname}.basic.expected" 'keep first'
This is a test
EOF
-mhbuild -headerencoding base64 "${testname}.basic.actual"
+run_prog mhbuild -headerencoding base64 "${testname}.basic.actual"
check "${testname}.basic.actual" "${testname}.basic.expected" 'keep first'
This is a test
EOF
-mhbuild "${testname}.autopick.actual"
+run_prog mhbuild "${testname}.autopick.actual"
check "${testname}.autopick.actual" "${testname}.autopick.expected" 'keep first'
This is a test of a very long subject line.
EOF
-mhbuild "${testname}.longsubject1.actual"
+run_prog mhbuild "${testname}.longsubject1.actual"
check "${testname}.longsubject1.actual" "${testname}.longsubject1.expected" 'keep first'
This is a test of a very long subject line using base64.
EOF
-mhbuild "${testname}.longsubject2.actual"
+run_prog mhbuild "${testname}.longsubject2.actual"
check "${testname}.longsubject2.actual" "${testname}.longsubject2.expected" 'keep first'
This is another long test.
EOF
-mhbuild "${testname}.longsubject3.actual"
+run_prog mhbuild "${testname}.longsubject3.actual"
check "${testname}.longsubject3.actual" "${testname}.longsubject3.expected" 'keep first'
This is another long test.
EOF
-mhbuild "${testname}.longsubject4.actual"
+run_prog mhbuild "${testname}.longsubject4.actual"
check "${testname}.longsubject4.actual" "${testname}.longsubject4.expected" 'keep first'
This is important information
EOF
-mhbuild "${testname}.basicemail1.actual"
+run_prog mhbuild "${testname}.basicemail1.actual"
check "${testname}.basicemail1.actual" "${testname}.basicemail1.expected" 'keep first'
This is important information
EOF
-mhbuild "${testname}.basicemail2.actual"
+run_prog mhbuild "${testname}.basicemail2.actual"
check "${testname}.basicemail2.actual" "${testname}.basicemail2.expected" 'keep first'
This is important information
EOF
-mhbuild "${testname}.basicemail3.actual"
+run_prog mhbuild "${testname}.basicemail3.actual"
check "${testname}.basicemail3.actual" "${testname}.basicemail3.expected" 'keep first'
This is important information
EOF
-mhbuild "${testname}.basicemail4.actual"
+run_prog mhbuild "${testname}.basicemail4.actual"
check "${testname}.basicemail4.actual" "${testname}.basicemail4.expected" 'keep first'
This is a lot of people on this email!
EOF
-mhbuild "${testname}.complexemail1.actual"
+run_prog mhbuild "${testname}.complexemail1.actual"
check "${testname}.complexemail1.actual" "${testname}.complexemail1.expected" 'keep first'
# argument: expected output
test_attachment ()
{
- send -draft -mts sendmail/pipe
+ run_prog send -draft -mts sendmail/pipe
# fakesendmail drops the message and any cc's into this mbox.
mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
-help
EOF
-mhfixmsg -help >"$actual" 2>&1
+run_prog mhfixmsg -help >"$actual" 2>&1
check "$expected" "$actual"
>"$expected.err"
#### lynx inserts multiple blank lines, so squeeze them.
- mhfixmsg last -outfile - -verbose 2>"$actual.err" | squeeze_lines >"$actual"
+ run_prog mhfixmsg last -outfile - -verbose 2>"$actual.err" | \
+ squeeze_lines >"$actual"
check "$expected" "$actual" 'ignore space'
check "$expected.err" "$actual.err"
else
>"$expected.err"
#### lynx inserts multiple blank lines, so squeeze them.
- mhfixmsg last -outfile - -verbose 2>"$actual.err" | squeeze_lines >"$actual"
+ run_prog mhfixmsg last -outfile - -verbose 2>"$actual.err" | \
+ squeeze_lines >"$actual"
check "$expected" "$actual" 'ignore space'
check "$expected.err" "$actual.err"
else
printf '%s\n' 'mhfixmsg: 12, insert text/plain part' >"$expected.err"
#### lynx inserts multiple blank lines, so squeeze them.
- mhfixmsg last -nodecode -outfile - -verbose 2>"$actual.err" | \
+ run_prog mhfixmsg last -nodecode -outfile - -verbose 2>"$actual.err" | \
squeeze_lines >"$actual"
check "$expected" "$actual" 'ignore space'
check "$expected.err" "$actual.err"
------- =_aaaaaaaaaa0--
EOF
-mhfixmsg last -outfile "$actual"
+run_prog mhfixmsg last -outfile "$actual"
check "$expected" "$actual"
This is additional content after the last subpart of the multipart.
EOF
-mhfixmsg last -outfile "$actual"
+run_prog mhfixmsg last -outfile "$actual"
check "$expected" "$actual"
cp -p `mhpath last` "$expected"
set +e
-mhfixmsg last
+run_prog mhfixmsg last
set -e
check `mhpath last` "$expected" 'keep first'
#### lynx inserts multiple blank lines, so squeeze them.
#### Truncate to avoid comparing the html portion because it can
#### get reformatted.
- mhfixmsg last -outfile - | squeeze_lines | head -22 >"$actual"
+ run_prog mhfixmsg last -outfile - | squeeze_lines | head -22 >"$actual"
check "$expected" "$actual" 'ignore space'
else
cp -p "$MH_TEST_DIR/Mail/inbox/15" "$MH_TEST_DIR/Mail/inbox/15.backup"
EOF
set +e
-mhfixmsg last -textcodeset utf-8 -outfile "$actual" 2>"$actual.err"
+run_prog mhfixmsg last -textcodeset utf-8 -outfile "$actual" 2>"$actual.err"
if grep "mhfixmsg: Can't convert .* to .* without iconv" "$actual.err" \
>/dev/null; then
echo "$0: skipping -textcodeset check because nmh was built without iconv"
# check that message is not output when fed through stdin
-mhfixmsg -file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
+run_prog mhfixmsg -file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
check "$expected" "$actual"
if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
"$actual.err" >/dev/null; then
if [ $can_reformat_texthtml -eq 1 ]; then
#### lynx inserts multiple blank lines, so squeeze them.
- mhfixmsg last -outfile - | squeeze_lines >"$actual"
+ run_prog mhfixmsg last -outfile - | squeeze_lines >"$actual"
check "$expected" "$actual" 'ignore space'
else
rm -f "$expected"
\r
EOF
-mhfixmsg last -outfile "$actual"
+run_prog mhfixmsg last -outfile "$actual"
check "$expected" "$actual"
if [ $can_reformat_texthtml -eq 1 ]; then
#### lynx inserts multiple blank lines, so squeeze them.
- mhfixmsg last -replacetextplain -outfile - | squeeze_lines > "$actual"
+ run_prog mhfixmsg last -replacetextplain -outfile - | \
+ squeeze_lines > "$actual"
check "$expected" "$actual" 'ignore space'
else
rm -f "$expected"
------=_Part_876302--
EOF
-mhfixmsg last -replacetextplain -noreplacetextplain -outfile "$actual"
+run_prog mhfixmsg last -replacetextplain -noreplacetextplain -outfile "$actual"
check "$expected" "$actual"
msg part type/subtype size description
5 text/plain 25
EOF
-mhlist > $actual 2>&1
+run_prog mhlist > $actual 2>&1
check $expected $actual 'keep first'
# check -noheaders
run_test 'mhlist 5 -noheaders' ' 5 text/plain 25'
# check -headers
-mhlist -noheaders -headers > $actual 2>&1
+run_prog mhlist -noheaders -headers > $actual 2>&1
check $expected $actual 'keep first'
# check with folder and current message
-mhlist +inbox > $actual 2>&1
+run_prog mhlist +inbox > $actual 2>&1
check $expected $actual 'keep first'
# check with specified message
-mhlist 5 > $actual 2>&1
+run_prog mhlist 5 > $actual 2>&1
check $expected $actual 'keep first'
# check -file
-mhlist -file "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
+run_prog mhlist -file "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
check $expected $actual
# check -file -
msg part type/subtype size description
0 text/plain 25
EOF
-mhlist -file - < "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
+run_prog mhlist -file - < "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
check $expected $actual
# check message number greater than highest
2 text/plain 25
8 text/plain 25
EOF
-mhlist 2 8 > $actual 2>&1
+run_prog mhlist 2 8 > $actual 2>&1
check $expected $actual
# Write message with a text/plain subpart.
--1--
EOF
-mhlist last > $actual 2>&1
+run_prog mhlist last > $actual 2>&1
check $expected $actual
cp $MH_TEST_DIR/Mail/.mh_profile $expected
# -all adds current folder
echo 'Current-Folder: '`folder -f` >>$expected
-mhparam -all >$actual
+run_prog mhparam -all >$actual
check $expected $actual 'keep first'
# check -all with a component
echo 'mhparam: profile-components ignored with -all' >$expected_err
-mhparam -all path >$actual 2>$actual_err
+run_prog mhparam -all path >$actual 2>$actual_err
check $expected $actual 'keep first'
check $expected_err $actual_err
# check -all with -components
echo 'mhparam: -components ignored with -all' >$expected_err
-mhparam -all -components >$actual 2>$actual_err
+run_prog mhparam -all -components >$actual 2>$actual_err
check $expected $actual
check $expected_err $actual_err
${MH_LIB_DIR}
EOF
-mhparam -nocomponent \
+run_prog mhparam -nocomponent \
context \
mh-sequences \
buildmimeproc \
-help
EOF
-mhpath -help > $actual 2>&1
+run_prog mhpath -help > $actual 2>&1
check $expected $actual
# check -version
$MH_TEST_DIR/Mail/inbox/9
$MH_TEST_DIR/Mail/inbox/10
EOF
-mhpath all > $actual 2>&1
+run_prog mhpath all > $actual 2>&1
check $expected $actual
# check message number greater than highest
$MH_TEST_DIR/Mail/inbox/9
$MH_TEST_DIR/Mail/inbox/10
EOF
-mhpath 1-99999 > $actual 2>&1
+run_prog mhpath 1-99999 > $actual 2>&1
check $expected $actual
# check new
$MH_TEST_DIR/Mail/inbox/10
$MH_TEST_DIR/Mail/inbox/11
EOF
-mhpath first last new > $actual 2>&1
+run_prog mhpath first last new > $actual 2>&1
check $expected $actual
# check invalid message list using names
$MH_TEST_DIR/Mail/inbox/3
$MH_TEST_DIR/Mail/inbox/4
EOF
-mhpath first:2 > $actual 2>&1
+run_prog mhpath first:2 > $actual 2>&1
check $expected $actual
# check reference to non-existant messages
$MH_TEST_DIR/Mail/inbox/1
$MH_TEST_DIR/Mail/inbox/2
EOF
-mhpath 1 2 > $actual 2>&1
+run_prog mhpath 1 2 > $actual 2>&1
check $expected $actual
This is a test
EOF
-mhshow -nopause $msgnum > $actual 2>&1
+run_prog mhshow -nopause $msgnum > $actual 2>&1
check "$expected" "$actual"
exit $failed
part text/plain 34
This is a test; this is the body.
EOF
-mhshow -nopause $msgnum > $actual 2>&1
+run_prog mhshow -nopause $msgnum > $actual 2>&1
check "$expected" "$actual"
exit $failed
This is the text/plain part.
EOF
-mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1
+run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1
check "$expected" "$actual"
# check a boundary condition in m_getfld(): its internal message
This is the text/plain part.
EOF
-mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1
+run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1
check "$expected" "$actual"
# check a boundary condition in m_getfld(): its internal message
This is the text/plain part.
EOF
-mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1
+run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1
check "$expected" "$actual"
=l
=\b ^H (backspace) character, probably erased = in diff output
EOF
-mhshow -nopause $msgnum > $actual 2>&1
+run_prog mhshow -nopause $msgnum > $actual 2>&1
check "$expected" "$actual"
exit $failed
EOF
# check it
-mhshow -part 1.1 -form mhl.null -nopause $msgnum > $actual 2>&1
+run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum > $actual 2>&1
check "$expected" "$actual"
exit $failed
check $expected 5.txt 'keep first'
# check -file -
-stored_contents=`mhstore -file - < $MH_TEST_DIR/Mail/inbox/5 2>&1 | \
+stored_contents=`run_prog mhstore -file - < $MH_TEST_DIR/Mail/inbox/5 2>&1 | \
sed 's/.*as file //'`
check $expected $stored_contents 'keep first'
# check -outfile
-mhstore 5 -outfile "$actual" 2>&1 | grep -v '^storing' && \
+run_prog mhstore 5 -outfile "$actual" 2>&1 | grep -v '^storing' && \
echo unexpected output from test-mhstore check -outfile >&2
check $expected "$actual" 'keep first'
# check -outfile -
echo 'storing message 5 to stdout' >>"$expected"
-mhstore 5 -outfile - >"$actual" 2>&1
+run_prog mhstore 5 -outfile - >"$actual" 2>&1
check $expected "$actual"
# check message number greater than highest
cat > $expected <<EOF
new: must specify sequences or set Unseen-Sequence
EOF
-new > $actual 2>&1
+run_prog new > $actual 2>&1
check $expected $actual
# test with no desired messages
cat > $expected <<EOF
total 0.
EOF
-new aseq > $actual 2>&1
+run_prog new aseq > $actual 2>&1
check $expected $actual 'keep first'
-new -folders $folders aseq > $actual 2>&1
+run_prog new -folders $folders aseq > $actual 2>&1
check $expected $actual
# test fnext/fprev with no desired messages
cat /dev/null > $expected
-fnext aseq > $actual 2>&1
+run_prog fnext aseq > $actual 2>&1
check $expected $actual 'keep first'
-fprev aseq > $actual 2>&1
+run_prog fprev aseq > $actual 2>&1
check $expected $actual
# add 1 desired message in each folder
inbox 1.* 1
total 3.
EOF
-new aseq > $actual 2>&1
+run_prog new aseq > $actual 2>&1
check $expected $actual
# test with .folders
foo2 1. 1
total 2.
EOF
-new -folders $folders aseq > $actual 2>&1
+run_prog new -folders $folders aseq > $actual 2>&1
check $expected $actual
# add 2 desired messages to another sequence in each folder
inbox 3.* 1 3-4
total 9.
EOF
-new aseq bseq > $actual 2>&1
+run_prog new aseq bseq > $actual 2>&1
check $expected $actual 'keep first'
# set aseq bseq as unseen
echo 'Unseen-Sequence: aseq bseq' >> $MH
-new > $actual 2>&1
+run_prog new > $actual 2>&1
check $expected $actual
# test unseen
3 09/29 Test3 Testing message 3<<This is message number 3 >>
4 09/29 Test4 Testing message 4<<This is message number 4 >>
EOF
-unseen > $actual 2>&1
+run_prog unseen > $actual 2>&1
check $expected $actual
# test fnext with the current folder not in the list
echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail/context
echo 'inbox 1 3-4' > $expected
-fnext -folders $folders > $actual 2>&1
+run_prog fnext -folders $folders > $actual 2>&1
check $expected $actual
# test fprev with the current folder not in the list
echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail/context
echo 'inbox 1 3-4' > $expected
-fprev -folders $folders > $actual 2>&1
+run_prog fprev -folders $folders > $actual 2>&1
check $expected $actual
# test fnext with current folder in the middle of the list
echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail/context
echo 'inbox 1 3-4' > $expected
-fnext > $actual 2>&1
+run_prog fnext > $actual 2>&1
check $expected $actual
# test fprev with current folder in the middle of the list
echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail/context
echo 'foo1 1 3-4' > $expected
-fprev > $actual 2>&1
+run_prog fprev > $actual 2>&1
check $expected $actual
# test fprev with current folder at the beginning of the list
echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail/context
echo 'inbox 1 3-4' > $expected
-fprev > $actual 2>&1
+run_prog fprev > $actual 2>&1
check $expected $actual
# test fnext with current folder at the end of the list
echo 'Current-Folder: inbox' > $MH_TEST_DIR/Mail/context
echo 'foo1 1 3-4' > $expected
-fnext > $actual 2>&1
+run_prog fnext > $actual 2>&1
check $expected $actual
# test fnext with no current folder
rm $MH_TEST_DIR/Mail/context
echo 'foo1 1 3-4' > $expected
-fnext > $actual 2>&1
+run_prog fnext > $actual 2>&1
check $expected $actual
# test fnext with only one folder in the list
inbox
EOF
echo 'inbox 1 3-4' > $expected
-fnext -folders $folders > $actual 2>&1
+run_prog fnext -folders $folders > $actual 2>&1
check $expected $actual
exit $failed
11'
# Test MHPDEBUG.
-MHPDEBUG=1 pick -not -lbrace -subject NoMatch -and -subject message.3 -rbrace \
- >/dev/null 2>"$actual"
+# Don't use run_prog here because it loses the environment setting.
+MHPDEBUG=1 pick -not -lbrace -subject NoMatch -and -subject message.3 \
+ -rbrace >/dev/null 2>"$actual"
cat >"$expected" <<EOF
NOT
| AND
# Produce 0 if no messages match and standard output is not a tty.
# Note that there is an error message on stderr, but it's redirected
# to /dev/null here.
-echo `pick -subject message.3 -and -from Test4 >"$actual" 2>/dev/null` \
+echo \
+ `run_prog pick -subject message.3 -and -from Test4 >"$actual" 2>/dev/null` \
>/dev/null
cat >"$expected" <<EOF
0
# output is a tty. To test that even when run with stdout
# detached, write directly to /dev/tty. Can't capture the
# output so hopefully the user will notice it.
- pick -subject message.3 -and -from Test4 >/dev/tty 2>/dev/null
+ run_prog pick -subject message.3 -and -from Test4 >/dev/tty 2>/dev/null
fi
# Also, check that the exit status is 1.
-pick -subject message.3 -and -from Test4 >/dev/null 2>&1
+run_prog pick -subject message.3 -and -from Test4 >/dev/null 2>&1
run_test "echo $?" '1'
set -e
run_test 'pick -to user@example.com -nolist' '11 hits'
# Test -after.
-pick -after '28 Sep 2008 00:00:00' >"$actual" 2>&1
+run_prog pick -after '28 Sep 2008 00:00:00' >"$actual" 2>&1
cat >"$expected" <<EOF
11
EOF
# Invert exit status so execution doesn't terminate due to -e.
set +e
-pick -after '29 Sep 2008 00:00:00' >"$actual" 2>/dev/null
+run_prog pick -after '29 Sep 2008 00:00:00' >"$actual" 2>/dev/null
set -e
cat >"$expected" <<EOF
0
check "$expected" "$actual"
# Test -before. While -after doesn't include the specified date, -before does.
-pick -before '29 Sep 2008 00:00:01' last:3 >"$actual" 2>&1
+run_prog pick -before '29 Sep 2008 00:00:01' last:3 >"$actual" 2>&1
cat >"$expected" <<EOF
9
10
11
EOF
check "$expected" "$actual"
-pick -before '28 Sep 2008 00:00:00:' last:3 >"$actual" 2>&1
+run_prog pick -before '28 Sep 2008 00:00:00:' last:3 >"$actual" 2>&1
cat >"$expected" <<EOF
9
10
EOF
check "$expected" "$actual"
set +e
-pick -before '28 Sep 2006 00:00:00' last:3 >"$actual" 2>/dev/null
+run_prog pick -before '28 Sep 2006 00:00:00' last:3 >"$actual" 2>/dev/null
set -e
cat >"$expected" <<EOF
0
# Test -datefield.
set +e
-pick -datefield date -after '29 Sep 2008 00:00:00' >"$actual" 2>/dev/null
+run_prog pick -datefield date -after '29 Sep 2008 00:00:00' \
+ >"$actual" 2>/dev/null
set -e
cat >"$expected" <<EOF
0
EOF
check "$expected" "$actual"
-pick -datefield delivery-date -after '29 Sep 2008 00:00:00' >"$actual" 2>&1
+run_prog pick -datefield delivery-date -after '29 Sep 2008 00:00:00' \
+ >"$actual" 2>&1
cat >"$expected" <<EOF
11
EOF
echo 12 >"$expected"
-pick -subject 'multi-line header field' 12 >"$actual" 2>&1
+run_prog pick -subject 'multi-line header field' 12 >"$actual" 2>&1
check "$expected" "$actual"
# Test MIME-encoded header.
echo 13 >"$expected"
set +e
-LC_CTYPE=en_US.UTF-8 pick -subject foobar 13 >"$actual" 2>&1
+LC_CTYPE=en_US.UTF-8 run_prog pick -subject foobar 13 >"$actual" 2>&1
set -e
check "$expected" "$actual"
# Nothing should to go stdout.
cat /dev/null > $expected_out
-pick -a > $actual_out 2> $actual_err
+run_prog pick -a > $actual_out 2> $actual_err
check "$expected_err" "$actual_err"
check "$expected_out" "$actual_out"
test_messageid ()
{
msgid_style="$1"
- send -draft -mts sendmail/pipe -msgid -messageid "$msgid_style"
+ run_prog send -draft -mts sendmail/pipe -msgid -messageid "$msgid_style"
shift
# fakesendmail drops the message and any cc's into this mbox.
# remaining arguments: expected output(s)
test_sendmail ()
{
- send -draft -mts "$1"
+ run_prog send -draft -mts "$1"
shift
# fakesendmail drops the message and any cc's into this mbox.
test_alias ()
{
if [ "$1" = 'sendmail/smtp' ]; then
- send -draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail/smtp
+ run_prog send -draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail/smtp
# fakesendmail drops the message and any cc's into this mbox.
mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
elif [ "$1" = 'sendmail/pipe' ]; then
set +e
- send -draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail/pipe \
- >"${testname}.actual" 2>&1
+ run_prog send -draft -alias "${MH_TEST_DIR}/Mail/aliases" \
+ -mts sendmail/pipe >"${testname}.actual" 2>&1
if [ $? -eq 0 ]; then
printf '%s: sendmail/pipe should have failed but didn'"'"'t\n' "$0"
else
test_post ()
{ pid=`"${MH_OBJ_DIR}/test/fakesmtp" "$1" $localport`
- send -draft -server 127.0.0.1 -port $localport $3 || exit 1
+ run_prog send -draft -server 127.0.0.1 -port $localport $3 || exit 1
#
# It's hard to calculate the exact Date: header post is going to
if [ "$argstyle" = 'new' ]; then
(cd "$MH_TEST_DIR" &&
- sendfiles "$@" -to recipient@example.com -subject "sendfiles test" \
- "$testfile" >/dev/null 2>&1)
+ run_prog sendfiles "$@" -to recipient@example.com \
+ -subject "sendfiles test" "$testfile" >/dev/null 2>&1)
elif [ "$argstyle" = 'old' ]; then
(cd "$MH_TEST_DIR" &&
- sendfiles "$@" recipient@example.com "sendfiles test" \
+ run_prog sendfiles "$@" recipient@example.com "sendfiles test" \
"$testfile" >/dev/null 2>&1)
fi
Can use PERSON environment variable instead of -from switch.
EOF
-sendfiles -help >"$actual" 2>&1
+run_prog sendfiles -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
-help
EOF
-prompter -help >$actual 2>&1
+run_prog prompter -help >$actual 2>&1
check $expected $actual
# check -version
EOF
printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
- prompter $MH_TEST_DIR/prompter-file > /dev/null
+ run_prog prompter $MH_TEST_DIR/prompter-file >/dev/null
check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
EOF
printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n.\n' | \
- prompter -doteof $MH_TEST_DIR/prompter-file > /dev/null
+ run_prog prompter -doteof $MH_TEST_DIR/prompter-file >/dev/null
check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
EOF
printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
- prompter -doteof -nodoteof $MH_TEST_DIR/prompter-file > /dev/null
+ run_prog prompter -doteof -nodoteof $MH_TEST_DIR/prompter-file >/dev/null
check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
message body
EOF
-printf 'appendage\n' >> "$expected"
+printf 'appendage\n' >>"$expected"
printf 'recipient@example.com\ncc@example.com\n+outbox\nappendage\n' | \
- prompter -noprepend $MH_TEST_DIR/prompter-file > /dev/null
+ run_prog prompter -noprepend $MH_TEST_DIR/prompter-file >/dev/null
check "$expected" "$MH_TEST_DIR/prompter-file"
EOF
printf 'recipient@example.com\ncc@example.com\n+outbox\nprependage\n' | \
- prompter -noprepend -prepend $MH_TEST_DIR/prompter-file > /dev/null
+ run_prog prompter -noprepend -prepend $MH_TEST_DIR/prompter-file >/dev/null
check "$MH_TEST_DIR/prompter-file" "$expected" 'keep first'
--------
EOF
-prompter -rapid $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
+run_prog prompter -rapid $MH_TEST_DIR/prompter-file >"$actual" </dev/null
check "$expected" "$actual"
--------
EOF
-prompter -rapid -norapid $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
+run_prog prompter -rapid -norapid $MH_TEST_DIR/prompter-file \
+ >"$actual" </dev/null
check "$expected" "$actual"
EOF
printf 'woot woot\n' | \
- prompter -erase '\15' -kill '\7f' $MH_TEST_DIR/prompter-file > "$actual"
+ run_prog prompter -erase '\15' -kill '\7f' $MH_TEST_DIR/prompter-file >"$actual"
check "$expected" "$actual"
--------
EOF
-prompter -nobody -body $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
+run_prog prompter -nobody -body $MH_TEST_DIR/prompter-file >"$actual" \
+ </dev/null
check "$expected" "$actual"
Resent-fcc: +outbox
EOF
-prompter -nobody $MH_TEST_DIR/prompter-file > /dev/null
+run_prog prompter -nobody $MH_TEST_DIR/prompter-file >/dev/null
check "$expected" "$MH_TEST_DIR/prompter-file"
-help
EOF
-$rcvdist -help >"$actual" 2>&1
+run_prog $rcvdist -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
# arguments: rcvdist switches
test_rcvdist ()
{
- $rcvdist "$@"
+ run_prog $rcvdist "$@"
# fakesendmail drops the message and any cc's into this mbox.
mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
-help
EOF
-$rcvpack -help >"$actual" 2>&1
+run_prog $rcvpack -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
run_test "$rcvpack" 'rcvpack: rcvpack [switches] file'
# check mbox creation
-$rcvpack <${MH_TEST_DIR}/Mail/inbox/1 ${MH_TEST_DIR}/Mail/mbox
+run_prog $rcvpack <${MH_TEST_DIR}/Mail/inbox/1 ${MH_TEST_DIR}/Mail/mbox
inc -file ${MH_TEST_DIR}/Mail/mbox -silent
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -mbox
-$rcvpack -mmdf -mbox <${MH_TEST_DIR}/Mail/inbox/1 ${MH_TEST_DIR}/Mail/mbox2
+run_prog $rcvpack -mmdf -mbox ${MH_TEST_DIR}/Mail/mbox2 \
+ <${MH_TEST_DIR}/Mail/inbox/1
# Filter out "From " lines because their timestamps can differ by a second.
grep -v '^From ' "${MH_TEST_DIR}/Mail/mbox" >"${MH_TEST_DIR}/Mail/mbox-filt"
grep -v '^From ' "${MH_TEST_DIR}/Mail/mbox2" >"${MH_TEST_DIR}/Mail/mbox2-filt"
check "${MH_TEST_DIR}/Mail/mbox-filt" "${MH_TEST_DIR}/Mail/mbox2-filt"
# check append to existing mbox file
-$rcvpack <${MH_TEST_DIR}/Mail/inbox/2 ${MH_TEST_DIR}/Mail/mbox
+run_prog $rcvpack <${MH_TEST_DIR}/Mail/inbox/2 ${MH_TEST_DIR}/Mail/mbox
inc -file ${MH_TEST_DIR}/Mail/mbox -silent
check "${MH_TEST_DIR}/Mail/inbox/2" "${MH_TEST_DIR}/Mail/inbox/12" 'keep first'
# check -mmdf
-$rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/3 ${MH_TEST_DIR}/Mail/mmdf
+run_prog $rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/3 ${MH_TEST_DIR}/Mail/mmdf
inc -file ${MH_TEST_DIR}/Mail/mmdf -silent
check "${MH_TEST_DIR}/Mail/inbox/3" "${MH_TEST_DIR}/Mail/inbox/12" 'keep first'
# check append to existing mmdf file
-$rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/4 ${MH_TEST_DIR}/Mail/mmdf
+run_prog $rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/4 ${MH_TEST_DIR}/Mail/mmdf
inc -file ${MH_TEST_DIR}/Mail/mmdf -silent
check "${MH_TEST_DIR}/Mail/inbox/4" "${MH_TEST_DIR}/Mail/inbox/13" 'keep first'
-help
EOF
-$rcvstore -help >$actual 2>&1
+run_prog $rcvstore -help >$actual 2>&1
check $expected $actual
# check -version
rcvstore: empty file
EOF
-$rcvstore </dev/null >$actual 2>&1
+run_prog $rcvstore </dev/null >$actual 2>&1
check $expected $actual
# check with no switches
cat >$expected <<EOF
EOF
-$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check + of existing folder
-$rcvstore +inbox <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore +inbox <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check + of new folder
-$rcvstore +newfolder <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore +newfolder <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/newfolder/1" \
'keep first'
EOF
set +e
-$rcvstore +newfolder -nocreate <${MH_TEST_DIR}/Mail/inbox/1 >$actual \
+run_prog $rcvstore +newfolder -nocreate <${MH_TEST_DIR}/Mail/inbox/1 >$actual \
2>$actual_err
set -e
check $expected $actual 'keep first'
check $expected_err $actual_err
# check -create
-$rcvstore +newfolder -nocreate -create <${MH_TEST_DIR}/Mail/inbox/1 \
+run_prog $rcvstore +newfolder -nocreate -create <${MH_TEST_DIR}/Mail/inbox/1 \
>$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/newfolder/1" \
# check addition to unseen sequence
printf 'Unseen-Sequence: unseen\n' >> $MH
-$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence unseen -list' 'unseen: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
rmm 11
# check -nounseen
-$rcvstore -nounseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -nounseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence unseen -list' 'unseen: '
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -unseen
-$rcvstore -nounseen -unseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -nounseen -unseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence unseen -list' 'unseen: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -sequence
-$rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence newseq -list' 'newseq: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check that default is -nozero
mark -sequence newseq all
-$rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence newseq -list' 'newseq: 1-11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -zero
mark -sequence newseq all
-$rcvstore -sequence newseq -zero <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -sequence newseq -zero \
+ <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence newseq -list' 'newseq: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -nozero
mark -sequence newseq all
-$rcvstore -seq newseq -zero -nozero <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -seq newseq -zero -nozero \
+ <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence newseq -list' 'newseq: 1-11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check that default is -public
-$rcvstore -sequence pubseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -sequence pubseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence pubseq -list' 'pubseq: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -nopublic
-$rcvstore -sequence privseq -nopublic <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore -sequence privseq -nopublic \
+ <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence privseq -nopublic -list' 'privseq (private): 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -public
-$rcvstore -sequence pubseq -nopublic -public <${MH_TEST_DIR}/Mail/inbox/1 \
- >$actual 2>&1
+run_prog $rcvstore -sequence pubseq -nopublic -public \
+ <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence pubseq -public -list' 'pubseq: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check default Msg-Protect
msgprot=`mhparam msgprot`
-$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test "find ${MH_TEST_DIR}/Mail/inbox/11 -perm $msgprot" \
"${MH_TEST_DIR}/Mail/inbox/11"
# check Msg-Protect profile entry
msgprot=640
printf 'Msg-Protect: %s\n' "$msgprot" >>$MH
-$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual
run_test "find ${MH_TEST_DIR}/Mail/inbox/11 -perm $msgprot" \
"${MH_TEST_DIR}/Mail/inbox/11"
-help
EOF
-$rcvtty -help >"$actual" 2>&1
+run_prog $rcvtty -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
# any of their ttys.
cat >"$expected" <<EOF
EOF
-$rcvtty <${MH_TEST_DIR}/Mail/inbox/1 -biff >"$actual" 2>&1
+run_prog $rcvtty <${MH_TEST_DIR}/Mail/inbox/1 -biff >"$actual" 2>&1
check "$expected" "$actual"
cd $MH_TEST_DIR
-folder -create +other -fast >/dev/null
-folder -create +another -fast >/dev/null
+run_prog folder -create +other -fast >/dev/null
+run_prog folder -create +another -fast >/dev/null
# check with no options and no current message
run_test 'refile' 'refile: no folder specified'
# check with current message
-folder +inbox 4 >/dev/null
+run_prog folder +inbox 4 >/dev/null
run_test 'refile +other' ''
run_test 'folders -noheader' \
'another has no messages.
TOTAL = 10 messages in 3 folders.'
# check with specified message
-folder +inbox 5 >/dev/null
+run_prog folder +inbox 5 >/dev/null
run_test 'refile 5 +other' ''
run_test 'folders -noheader' \
'another has no messages.
# check message number greater than highest
run_test 'refile 11 +other' "refile: message 11 doesn't exist"
-folder -f +another >/dev/null
+run_prog folder -f +another >/dev/null
# check -src
run_test 'refile 9 -src +inbox +other' ''
> This is message number 1
EOF
-repl -editor true -format -form $form -group -nocc me -nowhatnowproc 1 || exit 1
+run_prog repl -editor true -format -form $form -group -nocc me \
+ -nowhatnowproc 1 || exit 1
check "$expected" "$actual"
> This is a new test message
EOF
-repl -editor true -cc cc -format -form $form -width 72 -nowhatnowproc 11 \
- || exit 1
+run_prog repl -editor true -cc cc -format -form $form -width 72 \
+ -nowhatnowproc 11 || exit 1
check "$expected" "$actual"
-nofmtproc
EOF
-repl -help >$actual 2>&1
+run_prog repl -help >$actual 2>&1
check $expected $actual
# check -version
--------
EOF
-repl -cc me -editor true -nowhatnowproc 1
+run_prog repl -cc me -editor true -nowhatnowproc 1
check $expected $actual
# check -nocc me
--------
EOF
-repl -cc me -nocc me -editor true -nowhatnowproc 1
+run_prog repl -cc me -nocc me -editor true -nowhatnowproc 1
check $expected $actual
# check -cc me with Local- and Alternate-Mailbox addtions, Bug #36635:
--------
EOF
-repl -cc me -editor true -nowhatnowproc 1
+run_prog repl -cc me -editor true -nowhatnowproc 1
check $expected $actual
--------
EOF
-repl -cc me -nocc me -editor true -nowhatnowproc 1
+run_prog repl -cc me -nocc me -editor true -nowhatnowproc 1
check $expected $actual
--------
EOF
-repl -cc to -editor true -nowhatnowproc 11
+run_prog repl -cc to -editor true -nowhatnowproc 11
check $expected $actual
> This is message number 1
EOF
-repl -editor true -format -form $form -nowhatnowproc 1 || exit 1
+run_prog repl -editor true -format -form $form -nowhatnowproc 1 || exit 1
check "$expected" "$actual"
10 09/29 Test10 Testing message 10<<This is message number 10 >>
EOF
-scan +inbox -width 80 >"$actual" || exit 1
+run_prog scan +inbox -width 80 >"$actual" || exit 1
check "$expected" "$actual"
# check highlighting
printf 'Unseen-Sequence: unseen\n' >> $MH
mark -sequence cur 5
mark -sequence unseen 10
-scan -form scan.highlighted -width 80 >"$actual" || exit 1
+run_prog scan -form scan.highlighted -width 80 >"$actual" || exit 1
check "$expected" "$actual"
exit 1
fi
-scan -width 80 +inbox 11 > $actual || exit 1
+run_prog scan -width 80 +inbox 11 > $actual || exit 1
check "$expected" "$actual"
#
EOF
if test "$ICONV_ENABLED" -eq 1; then
+ # Don't use run_prog here because it loses those environment settings.
LC_CTYPE=ISO-8859-1 MM_CHARSET=ISO-8859-1 scan -width 75 last >"$actual"
check "$expected" "$actual"
fi
echo "Unsupported width for U+2019: $width"
fi
-LC_CTYPE=en_US.UTF-8 MM_CHARSET=UTF-8 scan -width 75 last >"$actual"
+LC_CTYPE=en_US.UTF-8 MM_CHARSET=UTF-8 run_prog scan -width 75 last >"$actual"
check "$expected" "$actual"
# Check large number of sequences.
for i in 1 2 3 4 5; do
for j in 0 1 2 3 4 5 6 7 8 9; do
- mark $i -seq seq$i${j}0 -seq seq$i${j}1 -seq seq$i${j}2 -seq seq$i${j}3 \
- -seq seq$i${j}4 -seq seq$i${j}5 -seq seq$i${j}6 -seq seq$i${j}7 \
- -seq seq$i${j}8 -seq seq$i${j}9
+ run_prog mark $i -seq seq$i${j}0 -seq seq$i${j}1 -seq seq$i${j}2 \
+ -seq seq$i${j}3 -seq seq$i${j}4 -seq seq$i${j}5 \
+ -seq seq$i${j}6 -seq seq$i${j}7 -seq seq$i${j}8 \
+ -seq seq$i${j}9
run_test "pick seq$i${j}0 seq$i${j}1 seq$i${j}2 seq$i${j}3 seq$i${j}4 \
seq$i${j}5 seq$i${j}6 seq$i${j}7 seq$i${j}8 seq$i${j}9" $i
done
-help
EOF
-$slocal -help >"$actual" 2>&1
+run_prog $slocal -help >"$actual" 2>&1
check "$expected" "$actual"
# check -version
EOF
chmod go-w "$md"
-$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1
+run_prog $slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1
check "$MH_TEST_DIR/Mail/inbox/1" "$actual" 'keep first'
if [ ${failed:-0} -eq 1 ]; then
printf "\nRerunning failed basic slocal command with -verbose -debug to help
diagnose test failure . . .\n\n"
- $slocal -verbose -debug -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1
+ run_prog $slocal -verbose -debug -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/1
exit 1
fi
# check -debug
-$slocal -debug -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \
+run_prog $slocal -debug -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \
>"$actual2" 2>&1
run_test "grep ^retrieving $actual2" 'retrieving message from stdin'
# check -verbose
-$slocal -verbose -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \
- >"$actual2" 2>&1
+run_prog $slocal -verbose -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1
run_test "grep ^delivering $actual2" "delivering to pipe \"$tee\", success."
# check -noverbose
-$slocal -verbose -noverbose -maildelivery "$md" $mbox \
+run_prog $slocal -verbose -noverbose -maildelivery "$md" $mbox \
<"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1
run_test "grep ^delivering $actual2" ''
rm -f "$actual2"
From test2@example.com qpipe A "$tee $actual"
EOF
-$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/2
+run_prog $slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/2
check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
# check R and ?
From test3@example.com qpipe ? "$tee $actual2"
EOF
-$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/3
+run_prog $slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/3
check "$MH_TEST_DIR/Mail/inbox/3" "$actual" 'keep first'
check "$MH_TEST_DIR/Mail/inbox/3" "$actual2" 'keep first'
From test4@example.com qpipe N "$tee $actual2"
EOF
-$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/4
+run_prog $slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/4
check "$MH_TEST_DIR/Mail/inbox/4" "$actual" 'keep first'
check "$MH_TEST_DIR/Mail/inbox/4" "$actual2" 'keep first'
default 1 qpipe A "$tee $actual2"
EOF
-$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/5
+run_prog $slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/5
check "$MH_TEST_DIR/Mail/inbox/5" "$actual" 'keep first'
check "$MH_TEST_DIR/Mail/inbox/5" "$actual2" 'keep first'
addr "$me" qpipe A "$tee $actual"
EOF
-$slocal -addr "$me" -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/6
+run_prog $slocal -addr "$me" -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/6
check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
# check -info
* - qpipe A "\$(info) $actual"
EOF
-$slocal -info $tee -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/7
+run_prog $slocal -info $tee -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/7
check "$MH_TEST_DIR/Mail/inbox/7" "$actual" 'keep first'
# check -sender, which is compared with "source"
source "$me" qpipe A "$tee $actual"
EOF
-$slocal -sender "$me" -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/8
+run_prog $slocal -sender "$me" -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/8
check "$MH_TEST_DIR/Mail/inbox/8" "$actual" 'keep first'
# check -user
* - qpipe A "$tee $actual"
EOF
-$slocal -user "$me" -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/9
+run_prog $slocal -user "$me" -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/9
check "$MH_TEST_DIR/Mail/inbox/9" "$actual" 'keep first'
# check -mailbox
cat >"$md" <<EOF
EOF
-$slocal -mailbox "$actual" -maildelivery "$md" <"$MH_TEST_DIR"/Mail/inbox/10
+run_prog $slocal -mailbox "$actual" -maildelivery "$md" \
+ <"$MH_TEST_DIR"/Mail/inbox/10
inc -file "$actual" -silent -truncate
rm -f "$actual"
check "$MH_TEST_DIR/Mail/inbox/10" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
# check -file
-$slocal -mailbox "$actual" -maildelivery "$md" -file "$MH_TEST_DIR"/Mail/inbox/1
+run_prog $slocal -mailbox "$actual" -maildelivery "$md" \
+ -file "$MH_TEST_DIR"/Mail/inbox/1
inc -file "$actual" -silent -truncate
rm -f "$actual"
check "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
* - qpipe A "$tee $actual"
EOF
-$slocal -suppressdup -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/2
+run_prog $slocal -suppressdup -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/2
check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
-$slocal -suppressdup -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/2
+run_prog $slocal -suppressdup -maildelivery "$md" $mbox \
+ <"$MH_TEST_DIR"/Mail/inbox/2
if [ -f "$actual" ]; then
echo $0: check -suppressdup failed
failed=`expr ${failed:-0} + 1`
fi
# check -nosuppressdup
-$slocal -suppress -nosuppressdup -maildelivery "$md" $mbox \
+run_prog $slocal -suppress -nosuppressdup -maildelivery "$md" $mbox \
<"$MH_TEST_DIR"/Mail/inbox/2
check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
--- /dev/null
+{
+ Invalid free in valgrind/vgpreload_memcheck-amd64-linux.so
+ Memcheck:Free
+ fun:free
+ fun:__libc_freeres
+ fun:_vgnU_freeres
+ fun:__run_exit_handlers
+ fun:exit
+}
+
+{
+ Syscall param sendmsg(msg.msg_name) points to uninitialised byte(s)
+ Memcheck:Param
+ sendmsg(msg.msg_name)
+ fun:__sendmsg_nocancel
+ fun:readline
+ fun:getans_via_readline
+}
#
set +e
-whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''`
+whatnowtest=`echo cd | TERM=dumb run_prog whatnow -prompt ''`
set -e
case ${whatnowtest} in
# whatnow's exit status is always 1 so that is not a failure
set +e
echo "attach $testname_quoted" | \
- TERM=dumb whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
-echo "alist" | TERM=dumb whatnow -attach foo -noedit -prompt '' \
+ TERM=dumb run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr \
+ >> $actual
+echo "alist" | TERM=dumb run_prog whatnow -attach foo -noedit -prompt '' \
2>> $actualerr >> $actual
echo "detach $testname_quoted" | \
TERM=dumb whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
-echo "alist" | TERM=dumb whatnow -attach foo -noedit -prompt '' \
+echo "alist" | TERM=dumb run_prog whatnow -attach foo -noedit -prompt '' \
2>> $actualerr >> $actual
set -e
#
set +e
-whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''`
+whatnowtest=`echo cd | TERM=dumb run_prog whatnow -prompt ''`
set -e
case ${whatnowtest} in
# ||true to ignore whatnow's exit status
# watch the quoting -- shell and printf and then the shell run inside whatnow
printf 'cd %s/foo\\'"'"'s\\ bar\npwd\n' "$MH_TEST_DIR" | \
- TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
+ TERM=dumb run_prog whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || \
+ true
check "$expectederr" "$actualerr"
check "$expected" "$actual"
#
set +e
-whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''`
+whatnowtest=`echo cd | TERM=dumb run_prog whatnow -prompt ''`
set -e
case ${whatnowtest} in
EOF
# NB use of sort as the order of output of ls is not guaranteed
-echo 'ls' | TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" | \
+echo 'ls' | TERM=dumb run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \
sort > "$actual"
check "$expectederr" "$actualerr" 'keep first'
# /bin/sh sets SHELL, which bash does.
unset SHELL
-echo 'ls' | TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" | \
+echo 'ls' | TERM=dumb run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \
sort > "$actual"
check "$expectederr" "$actualerr"
-help
EOF
-whom -help | head -10 >$actual 2>&1
+run_prog whom -help | head -10 >$actual 2>&1
check $expected $actual
# check -version