From: David Levine Date: Sat, 28 Dec 2013 17:51:01 +0000 (-0600) Subject: Added support for running the test suite with valgrind by setting X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/fa462ef71fbaf819397c59b2c07adf45a04af9f8?hp=44fe0f6d35751a9b6ce98a83c21cfe09189a0d67 Added support for running the test suite with valgrind by setting the NMH_VALGRIND environment variable. To support that, nmh programs that are invoked in the test suite should be run via (the new function) run_prog or run_test. --- diff --git a/docs/README.developers b/docs/README.developers index 86b2f897..76f650dc 100644 --- a/docs/README.developers +++ b/docs/README.developers @@ -162,6 +162,23 @@ OS function nmh-local version to use instead 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 ------------- diff --git a/test/anno/test-anno b/test/anno/test-anno index e4dd39e4..34048d90 100755 --- a/test/anno/test-anno +++ b/test/anno/test-anno @@ -39,7 +39,7 @@ Usage: anno [+folder] [msgs] [switches] -([no]p)reserve EOF -anno -help >"$actual" 2>&1 +run_prog anno -help >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -59,26 +59,26 @@ printf 'Nmh-test:\n' >"$expected" 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" @@ -89,7 +89,7 @@ if [ $hard_links_supported -eq 1 ]; then # 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' @@ -97,33 +97,33 @@ if [ $hard_links_supported -eq 1 ]; then # 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" @@ -131,7 +131,7 @@ 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" @@ -140,7 +140,7 @@ cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${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" @@ -148,8 +148,8 @@ cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${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" @@ -157,20 +157,20 @@ 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" @@ -178,8 +178,8 @@ 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" @@ -187,8 +187,8 @@ 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 diff --git a/test/bad-input/test-header b/test/bad-input/test-header index e993cce8..1bc05f47 100755 --- a/test/bad-input/test-header +++ b/test/bad-input/test-header @@ -37,7 +37,7 @@ EOF cat >"$expected" < "$actual" 2>&1 +run_prog scan -width 80 last > "$actual" 2>&1 check "$expected" "$actual" # check show (mhl) @@ -54,7 +54,7 @@ This is a multi-part message in MIME format. I am a stupid spammer. EOF -show last > "$actual" 2>&1 +run_prog show last > "$actual" 2>&1 check "$expected" "$actual" # check mhshow @@ -71,7 +71,7 @@ This is a multi-part message in MIME format. 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 @@ -85,7 +85,7 @@ scan: eof encountered in field "Received" ??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" @@ -99,7 +99,7 @@ cat >"$expected" <"$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. @@ -134,7 +134,7 @@ scan: eol encountered in field "If a header field name has at least 512 characte ??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" diff --git a/test/burst/test-burst b/test/burst/test-burst index e6545350..938c0b56 100755 --- a/test/burst/test-burst +++ b/test/burst/test-burst @@ -46,7 +46,7 @@ For real. 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 @@ -97,7 +97,7 @@ Will this one work? 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<&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 diff --git a/test/comp/test-comp-format b/test/comp/test-comp-format index f1c25635..f7186617 100755 --- a/test/comp/test-comp-format +++ b/test/comp/test-comp-format @@ -54,6 +54,7 @@ Subject: ${subject} -------- 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 diff --git a/test/dist/test-dist b/test/dist/test-dist index c5182afa..2bb1d30f 100755 --- a/test/dist/test-dist +++ b/test/dist/test-dist @@ -31,7 +31,7 @@ MHMTSCONF="$mts_fakesendmail" # 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 diff --git a/test/folder/test-create b/test/folder/test-create index 59e7c3f9..a0fb5716 100755 --- a/test/folder/test-create +++ b/test/folder/test-create @@ -14,14 +14,14 @@ fi 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 diff --git a/test/folder/test-packf b/test/folder/test-packf index 3e0281f9..ff98cef5 100755 --- a/test/folder/test-packf +++ b/test/folder/test-packf @@ -48,7 +48,7 @@ cd "${MH_TEST_DIR}" || exit 1 printf 'y\n' >Mail/yes # check with no switches -packf /dev/null rm -f msgbox .msgbox.map for i in `pick +inbox`; do @@ -58,7 +58,7 @@ run_test "printf $i" '10' rmm +inbox2 -unlink `pick +inbox2` # check +folder -packf +inbox /dev/null rm -f msgbox .msgbox.map for i in `pick +inbox`; do @@ -68,7 +68,7 @@ run_test "printf $i" '10' rmm +inbox2 -unlink `pick +inbox2` # check msgs -packf +inbox 1 2 3 /dev/null rm -f msgbox .msgbox.map for i in `pick +inbox2`; do @@ -78,7 +78,7 @@ run_test "printf $i" '3' rmm +inbox2 -unlink `pick +inbox2` # check -file -packf +inbox -file msgbox2 /dev/null for i in `pick +inbox2`; do diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" @@ -87,7 +87,7 @@ run_test "printf $i" '10' rmm +inbox2 -unlink `pick +inbox2` # check append to existing mbox file -packf +inbox -file msgbox2 /dev/null rm -f msgbox2 .msgbox2.map for i in `pick +inbox2`; do @@ -102,7 +102,7 @@ run_test "printf $i" '20' rmm +inbox2 -unlink `pick +inbox2` # check -mbox -packf +inbox -mbox /dev/null rm -f msgbox .msgbox.map for i in `pick +inbox2`; do @@ -112,7 +112,7 @@ run_test "printf $i" '10' rmm +inbox2 -unlink `pick +inbox2` # check -mmdf -packf +inbox -mmdf /dev/null rm -f msgbox .msgbox.map for i in `pick +inbox2`; do @@ -122,7 +122,7 @@ run_test "printf $i" '10' rmm +inbox2 -unlink `pick +inbox2` # check append to existing mmdf file -packf +inbox -mmdf /dev/null rm -f msgbox .msgbox.map for i in `pick +inbox2`; do diff --git a/test/folder/test-recurse b/test/folder/test-recurse index 0b974a33..f30b9547 100755 --- a/test/folder/test-recurse +++ b/test/folder/test-recurse @@ -14,9 +14,9 @@ fi 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. diff --git a/test/folder/test-sortm b/test/folder/test-sortm index 0753ecb0..ac0f8421 100755 --- a/test/folder/test-sortm +++ b/test/folder/test-sortm @@ -37,7 +37,7 @@ Usage: sortm [+folder] [msgs] [switches] -help EOF -sortm -help >"$actual" 2>&1 +run_prog sortm -help >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -83,7 +83,7 @@ cat >"$expected" <> EOF -sortm +run_prog sortm scan >"$actual" check "$expected" "$actual" @@ -104,7 +104,7 @@ cat >"$expected" </dev/null -sortm +inbox +run_prog sortm +inbox scan >"$actual" check "$expected" "$actual" @@ -138,7 +138,7 @@ message 1 becomes message 2 EOF refile first +inbox; folder -pack >/dev/null -sortm -verbose >"$actual" +run_prog sortm -verbose >"$actual" scan >>"$actual" check "$expected" "$actual" @@ -159,7 +159,7 @@ cat >"$expected" </dev/null -sortm -verbose -noverbose >"$actual" +run_prog sortm -verbose -noverbose >"$actual" scan >>"$actual" check "$expected" "$actual" @@ -180,7 +180,7 @@ cat >"$expected" </dev/null -sortm first last +run_prog sortm first last scan >"$actual" check "$expected" "$actual" @@ -200,7 +200,7 @@ cat >"$expected" <> EOF -sortm -datefield Alt-Date 1 11 +run_prog sortm -datefield Alt-Date 1 11 scan >"$actual" check "$expected" "$actual" @@ -220,7 +220,7 @@ cat >"$expected" <> EOF -sortm -textfield subject +run_prog sortm -textfield subject scan >"$actual" check "$expected" "$actual" @@ -240,7 +240,7 @@ cat >"$expected" <> EOF -sortm -textfield subject -limit 0 -nolimit +run_prog sortm -textfield subject -limit 0 -nolimit scan >"$actual" check "$expected" "$actual" @@ -261,7 +261,7 @@ cat >"$expected" </dev/null -sortm -textfield subject -limit 0 +run_prog sortm -textfield subject -limit 0 scan >"$actual" check "$expected" "$actual" @@ -282,7 +282,7 @@ cat >"$expected" </dev/null -sortm -textfield from -limit 0 +run_prog sortm -textfield from -limit 0 scan >"$actual" check "$expected" "$actual" @@ -313,7 +313,7 @@ cat >"$expected" </dev/null -sortm -textfield subject -limit 10 +run_prog sortm -textfield subject -limit 10 scan >"$actual" check "$expected" "$actual" @@ -335,7 +335,7 @@ cat >"$expected" </dev/null -sortm -textfield subject -limit 60 +run_prog sortm -textfield subject -limit 60 scan >"$actual" check "$expected" "$actual" @@ -357,7 +357,7 @@ cat >"$expected" </dev/null -sortm -textfield subject -limit 60 -notextfield +run_prog sortm -textfield subject -limit 60 -notextfield scan >"$actual" check "$expected" "$actual" @@ -382,7 +382,7 @@ cat >"$expected" </dev/null -sortm -noall -all +run_prog sortm -noall -all scan >"$actual" check "$expected" "$actual" @@ -394,7 +394,7 @@ EOF 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" diff --git a/test/folder/test-total b/test/folder/test-total index df9c3425..59742484 100755 --- a/test/folder/test-total +++ b/test/folder/test-total @@ -14,7 +14,7 @@ fi 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 diff --git a/test/format/test-dp b/test/format/test-dp index b1a19956..fb3cc917 100755 --- a/test/format/test-dp +++ b/test/format/test-dp @@ -36,7 +36,7 @@ Usage: dp [switches] dates ... -help EOF -$dp -help >"$actual" 2>&1 +run_prog $dp -help >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -57,7 +57,7 @@ cat >"$expected" < "$actual" 2>&1 +run_prog $dp 'Sun Jul 1 2012' > "$actual" 2>&1 check "$expected" "$actual" # check with two valid dates @@ -66,7 +66,7 @@ Sun, 01 Jul 2012 00:00:00 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 @@ -77,7 +77,7 @@ EOF cat >"$expected_err" < "$actual" 2> "$actual_err" +run_prog $dp 'not a date' > "$actual" 2> "$actual_err" check "$expected" "$actual" check "$expected_err" "$actual_err" @@ -91,7 +91,7 @@ cat >"$expected" <$actual 2>&1 +run_prog $dp -form "$form" 'Jul 1 2012' >$actual 2>&1 check $expected $actual rm -f "$form" @@ -100,7 +100,7 @@ cat >"$expected" <$actual 2>&1 +run_prog $dp -format '%(day{text})' 'Jul 1 2012' >$actual 2>&1 check $expected $actual # check -width @@ -108,7 +108,7 @@ cat >"$expected" < "$actual" 2>&1 +run_prog $dp -width 17 'Sun Jul 1 2012' > "$actual" 2>&1 check "$expected" "$actual" diff --git a/test/format/test-fmtdump b/test/format/test-fmtdump index 9ea7178f..c7d89833 100755 --- a/test/format/test-fmtdump +++ b/test/format/test-fmtdump @@ -106,11 +106,11 @@ L10: CHAR '\n' 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 @@ -122,7 +122,7 @@ cat >$expected <' >$actual 2>&1 +run_prog $fmtdump -format '%<(lit 1234567890)%(strlen)%>' >$actual 2>&1 check $expected $actual diff --git a/test/format/test-localmbox b/test/format/test-localmbox index 9fc662f8..e4956410 100755 --- a/test/format/test-localmbox +++ b/test/format/test-localmbox @@ -23,7 +23,7 @@ echo "Local-Mailbox: ${testname}" >> ${MH} # 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}" diff --git a/test/format/test-mymbox b/test/format/test-mymbox index 0221fad2..f71a3c92 100755 --- a/test/format/test-mymbox +++ b/test/format/test-mymbox @@ -17,12 +17,12 @@ setup_test #### 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" @@ -35,17 +35,19 @@ grep -v 'Local-Mailbox: ' ${MH} > ${MH}.new 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 diff --git a/test/format/test-rightjustify b/test/format/test-rightjustify index 2685efd0..f482db4f 100755 --- a/test/format/test-rightjustify +++ b/test/format/test-rightjustify @@ -12,7 +12,7 @@ fi setup_test -actual=`${MH_LIB_DIR}/ap -format "%-30(friendly{text})<"` +actual=`run_prog ${MH_LIB_DIR}/ap -format "%-30(friendly{text})<"` expected=" No Such User<> "$expected" </dev/null +run_prog inc -file "$MH_TEST_DIR/mess" >/dev/null check "$expected" `mhpath last` || rmm last rm -f "$MH_TEST_DIR/mess" diff --git a/test/inc/test-msgchk b/test/inc/test-msgchk index c6850d99..066058b8 100755 --- a/test/inc/test-msgchk +++ b/test/inc/test-msgchk @@ -39,7 +39,7 @@ Usage: msgchk [switches] [users ...] -help EOF -msgchk -help | head -9 >"$actual" 2>&1 +run_prog msgchk -help | head -9 >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -65,7 +65,7 @@ cat >"$expected" <"$actual" +run_prog msgchk | sed -e 's/last read on.*/last read on/' >"$actual" check "$expected" "$actual" # check -date @@ -73,7 +73,8 @@ cat >"$expected" <"$actual" +run_prog msgchk -nodate -date | sed -e 's/last read on.*/last read on/' \ + >"$actual" check "$expected" "$actual" # check -nodate @@ -97,7 +98,7 @@ run_test 'msgchk -nonotify nomail -nodate' 'You have new mail waiting' # 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" diff --git a/test/install-mh/test-install-mh b/test/install-mh/test-install-mh index 5a939617..9798e5ed 100755 --- a/test/install-mh/test-install-mh +++ b/test/install-mh/test-install-mh @@ -26,7 +26,7 @@ run_test "install-mh -auto" 'install-mh: invocation error' # 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. @@ -36,7 +36,7 @@ rm -rf $MH_TEST_DIR/Mail 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 @@ -47,10 +47,10 @@ echo "n 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 @@ -62,7 +62,7 @@ rm -rf $MH_TEST_DIR/Mail 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 diff --git a/test/locking/test-datalocking b/test/locking/test-datalocking index 4c2d1935..e2d7eac4 100755 --- a/test/locking/test-datalocking +++ b/test/locking/test-datalocking @@ -35,12 +35,12 @@ do 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 diff --git a/test/mhbuild/test-forw b/test/mhbuild/test-forw index 7326b51f..771bec0e 100755 --- a/test/mhbuild/test-forw +++ b/test/mhbuild/test-forw @@ -66,7 +66,7 @@ This is message number 2 ------- =_aaaaaaaaaa0-- EOF mkdraft -mhbuild $draft +run_prog mhbuild $draft check $expected $draft test ${failed:-0} -eq 0 && rm "$draftorig" @@ -104,7 +104,7 @@ This is message number 2 ------- =_aaaaaaaaaa0-- EOF mkdraft -mhbuild -rfc934 $draft +run_prog mhbuild -rfc934 $draft check $expected $draft test ${failed:-0} -eq 0 && rm "$draftorig" diff --git a/test/mhbuild/test-header-encode b/test/mhbuild/test-header-encode index fa0031f5..e4883b5a 100755 --- a/test/mhbuild/test-header-encode +++ b/test/mhbuild/test-header-encode @@ -45,7 +45,7 @@ Content-Type: text/plain; charset="us-ascii" This is a test EOF -mhbuild "${testname}.basic.actual" +run_prog mhbuild "${testname}.basic.actual" check "${testname}.basic.actual" "${testname}.basic.expected" 'keep first' @@ -78,7 +78,7 @@ Content-Type: text/plain; charset="us-ascii" 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' @@ -108,7 +108,7 @@ Content-Type: text/plain; charset="us-ascii" This is a test EOF -mhbuild "${testname}.autopick.actual" +run_prog mhbuild "${testname}.autopick.actual" check "${testname}.autopick.actual" "${testname}.autopick.expected" 'keep first' @@ -143,7 +143,7 @@ Content-Type: text/plain; charset="us-ascii" 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' @@ -179,7 +179,7 @@ Content-Type: text/plain; charset="us-ascii" 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' @@ -214,7 +214,7 @@ Content-Type: text/plain; charset="us-ascii" 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' @@ -244,7 +244,7 @@ Content-Type: text/plain; charset="us-ascii" 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' @@ -274,7 +274,7 @@ Content-Type: text/plain; charset="us-ascii" This is important information EOF -mhbuild "${testname}.basicemail1.actual" +run_prog mhbuild "${testname}.basicemail1.actual" check "${testname}.basicemail1.actual" "${testname}.basicemail1.expected" 'keep first' @@ -301,7 +301,7 @@ Content-Type: text/plain; charset="us-ascii" This is important information EOF -mhbuild "${testname}.basicemail2.actual" +run_prog mhbuild "${testname}.basicemail2.actual" check "${testname}.basicemail2.actual" "${testname}.basicemail2.expected" 'keep first' @@ -332,7 +332,7 @@ Content-Type: text/plain; charset="us-ascii" This is important information EOF -mhbuild "${testname}.basicemail3.actual" +run_prog mhbuild "${testname}.basicemail3.actual" check "${testname}.basicemail3.actual" "${testname}.basicemail3.expected" 'keep first' @@ -359,7 +359,7 @@ Content-Type: text/plain; charset="us-ascii" This is important information EOF -mhbuild "${testname}.basicemail4.actual" +run_prog mhbuild "${testname}.basicemail4.actual" check "${testname}.basicemail4.actual" "${testname}.basicemail4.expected" 'keep first' @@ -402,7 +402,7 @@ Content-Type: text/plain; charset="us-ascii" 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' diff --git a/test/mhbuild/test-utf8-body b/test/mhbuild/test-utf8-body index 5539489c..e4a7c4e4 100755 --- a/test/mhbuild/test-utf8-body +++ b/test/mhbuild/test-utf8-body @@ -27,7 +27,7 @@ MHMTSCONF="$mts_fakesendmail" # 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 diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index bbc60f65..317d02b2 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -65,7 +65,7 @@ Usage: mhfixmsg [+folder] [msgs] [switches] -help EOF -mhfixmsg -help >"$actual" 2>&1 +run_prog mhfixmsg -help >"$actual" 2>&1 check "$expected" "$actual" @@ -253,7 +253,8 @@ mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \ >"$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 @@ -334,7 +335,8 @@ mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \ >"$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 @@ -406,7 +408,7 @@ if [ $can_reformat_texthtml -eq 1 ]; then 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" @@ -450,7 +452,7 @@ VGhpcyBpcyBhIHRleHQvcGxhaW4gcGFydC4K ------- =_aaaaaaaaaa0-- EOF -mhfixmsg last -outfile "$actual" +run_prog mhfixmsg last -outfile "$actual" check "$expected" "$actual" @@ -554,7 +556,7 @@ VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K 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" @@ -579,7 +581,7 @@ EOF cp -p `mhpath last` "$expected" set +e -mhfixmsg last +run_prog mhfixmsg last set -e check `mhpath last` "$expected" 'keep first' @@ -670,7 +672,7 @@ if [ $can_reformat_texthtml -eq 1 ]; then #### 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" @@ -718,7 +720,7 @@ vbI9vAo= 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" @@ -761,7 +763,7 @@ check "$MH_TEST_DIR"/Mail/inbox/17 "$MH_TEST_DIR"/Mail/inbox/18 'keep first' # 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 @@ -870,7 +872,7 @@ EOF 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" @@ -963,7 +965,7 @@ There are two CR-LF pairs at the end of this sentence. EOF -mhfixmsg last -outfile "$actual" +run_prog mhfixmsg last -outfile "$actual" check "$expected" "$actual" @@ -1029,7 +1031,8 @@ EOF 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" @@ -1067,7 +1070,7 @@ Content-Disposition: inline ------=_Part_876302-- EOF -mhfixmsg last -replacetextplain -noreplacetextplain -outfile "$actual" +run_prog mhfixmsg last -replacetextplain -noreplacetextplain -outfile "$actual" check "$expected" "$actual" diff --git a/test/mhlist/test-mhlist b/test/mhlist/test-mhlist index b1d59d10..d14475c3 100755 --- a/test/mhlist/test-mhlist +++ b/test/mhlist/test-mhlist @@ -29,26 +29,26 @@ cat > $expected < $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 - @@ -56,7 +56,7 @@ cat > $expected < $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 @@ -68,7 +68,7 @@ cat > $expected < $actual 2>&1 +run_prog mhlist 2 8 > $actual 2>&1 check $expected $actual # Write message with a text/plain subpart. @@ -360,7 +360,7 @@ This is part 2. --1-- EOF -mhlist last > $actual 2>&1 +run_prog mhlist last > $actual 2>&1 check $expected $actual diff --git a/test/mhparam/test-mhparam b/test/mhparam/test-mhparam index a5bb2e78..0dd8e2b2 100755 --- a/test/mhparam/test-mhparam +++ b/test/mhparam/test-mhparam @@ -50,18 +50,18 @@ run_test 'mhparam -nonexistent' 'mhparam: -nonexistent unknown' 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 @@ -102,7 +102,7 @@ $sysconfdir ${MH_LIB_DIR} EOF -mhparam -nocomponent \ +run_prog mhparam -nocomponent \ context \ mh-sequences \ buildmimeproc \ diff --git a/test/mhpath/test-mhpath b/test/mhpath/test-mhpath index a9aeee1a..a4b621b7 100755 --- a/test/mhpath/test-mhpath +++ b/test/mhpath/test-mhpath @@ -28,7 +28,7 @@ Usage: mhpath [+folder] [msgs] [switches] -help EOF -mhpath -help > $actual 2>&1 +run_prog mhpath -help > $actual 2>&1 check $expected $actual # check -version @@ -61,7 +61,7 @@ $MH_TEST_DIR/Mail/inbox/8 $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 @@ -81,7 +81,7 @@ $MH_TEST_DIR/Mail/inbox/8 $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 @@ -93,7 +93,7 @@ $MH_TEST_DIR/Mail/inbox/1 $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 @@ -124,7 +124,7 @@ cat > $expected < $actual 2>&1 +run_prog mhpath first:2 > $actual 2>&1 check $expected $actual # check reference to non-existant messages @@ -132,7 +132,7 @@ cat > $expected < $actual 2>&1 +run_prog mhpath 1 2 > $actual 2>&1 check $expected $actual diff --git a/test/mhshow/test-charset b/test/mhshow/test-charset index 64c9812b..d3e73544 100755 --- a/test/mhshow/test-charset +++ b/test/mhshow/test-charset @@ -48,7 +48,7 @@ part text/plain 10 This is a test EOF -mhshow -nopause $msgnum > $actual 2>&1 +run_prog mhshow -nopause $msgnum > $actual 2>&1 check "$expected" "$actual" exit $failed diff --git a/test/mhshow/test-cte-binary b/test/mhshow/test-cte-binary index 8f582b0a..9c31a657 100755 --- a/test/mhshow/test-cte-binary +++ b/test/mhshow/test-cte-binary @@ -46,7 +46,7 @@ Content-Disposition: inline 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 diff --git a/test/mhshow/test-msg-buffer-boundaries b/test/mhshow/test-msg-buffer-boundaries index 4b28fa60..a05a1b4f 100755 --- a/test/mhshow/test-msg-buffer-boundaries +++ b/test/mhshow/test-msg-buffer-boundaries @@ -157,7 +157,7 @@ part 1.1 text/plain 29 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 @@ -297,7 +297,7 @@ part 1.1 text/plain 29 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 @@ -385,7 +385,7 @@ part 1.1 text/plain 29 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" diff --git a/test/mhshow/test-qp b/test/mhshow/test-qp index 924ee7b2..96b2969d 100755 --- a/test/mhshow/test-qp +++ b/test/mhshow/test-qp @@ -68,7 +68,7 @@ just a newline =l = ^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 diff --git a/test/mhshow/test-subpart b/test/mhshow/test-subpart index eb74acdd..0d152bb3 100755 --- a/test/mhshow/test-subpart +++ b/test/mhshow/test-subpart @@ -56,7 +56,7 @@ This is the text/plain part. 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 diff --git a/test/mhstore/test-mhstore b/test/mhstore/test-mhstore index d1f85427..2dc03571 100755 --- a/test/mhstore/test-mhstore +++ b/test/mhstore/test-mhstore @@ -46,18 +46,18 @@ run_test "mhstore -file $MH_TEST_DIR/Mail/inbox/5" \ 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 diff --git a/test/new/test-basic b/test/new/test-basic index 63f4f806..1fba4609 100755 --- a/test/new/test-basic +++ b/test/new/test-basic @@ -32,23 +32,23 @@ EOF cat > $expected < $actual 2>&1 +run_prog new > $actual 2>&1 check $expected $actual # test with no desired messages cat > $expected < $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 @@ -63,7 +63,7 @@ foo2 1. 1 inbox 1.* 1 total 3. EOF -new aseq > $actual 2>&1 +run_prog new aseq > $actual 2>&1 check $expected $actual # test with .folders @@ -72,7 +72,7 @@ inbox 1.* 1 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 @@ -87,12 +87,12 @@ foo2 3. 1 3-4 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 @@ -113,49 +113,49 @@ cat > $expected <> 4 09/29 Test4 Testing message 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 @@ -163,7 +163,7 @@ cat > $folders < $expected -fnext -folders $folders > $actual 2>&1 +run_prog fnext -folders $folders > $actual 2>&1 check $expected $actual exit $failed diff --git a/test/pick/test-pick b/test/pick/test-pick index e1434dce..85da3440 100755 --- a/test/pick/test-pick +++ b/test/pick/test-pick @@ -77,8 +77,9 @@ run_test 'pick -not -lbrace -subject NoMatch -and -subject message.3 -rbrace' \ 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" <"$actual" 2>/dev/null` \ +echo \ + `run_prog pick -subject message.3 -and -from Test4 >"$actual" 2>/dev/null` \ >/dev/null cat >"$expected" </dev/tty) 2>/dev/null; then # 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 @@ -135,7 +137,7 @@ run_test 'pick -to some -nolist' '11 hits' 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" <"$actual" 2>/dev/null +run_prog pick -after '29 Sep 2008 00:00:00' >"$actual" 2>/dev/null set -e cat >"$expected" <"$actual" 2>&1 +run_prog pick -before '29 Sep 2008 00:00:01' last:3 >"$actual" 2>&1 cat >"$expected" <"$actual" 2>&1 +run_prog pick -before '28 Sep 2008 00:00:00:' last:3 >"$actual" 2>&1 cat >"$expected" <"$actual" 2>/dev/null +run_prog pick -before '28 Sep 2006 00:00:00' last:3 >"$actual" 2>/dev/null set -e cat >"$expected" <"$actual" 2>/dev/null +run_prog pick -datefield date -after '29 Sep 2008 00:00:00' \ + >"$actual" 2>/dev/null set -e cat >"$expected" <"$actual" 2>&1 +run_prog pick -datefield delivery-date -after '29 Sep 2008 00:00:00' \ + >"$actual" 2>&1 cat >"$expected" <"$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. @@ -257,7 +261,7 @@ EOF 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" diff --git a/test/pick/test-stderr b/test/pick/test-stderr index 0cafe7f3..9c1dac3d 100755 --- a/test/pick/test-stderr +++ b/test/pick/test-stderr @@ -28,6 +28,6 @@ EOF # 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" diff --git a/test/post/test-messageid b/test/post/test-messageid index fbed2129..544af668 100755 --- a/test/post/test-messageid +++ b/test/post/test-messageid @@ -55,7 +55,7 @@ MHMTSCONF="$mts_fakesendmail" 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. diff --git a/test/post/test-mts b/test/post/test-mts index 82663231..afcd1319 100755 --- a/test/post/test-mts +++ b/test/post/test-mts @@ -54,7 +54,7 @@ MHMTSCONF="$mts_fakesendmail" # 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. diff --git a/test/post/test-post-aliases b/test/post/test-post-aliases index ee06f288..62c1863b 100755 --- a/test/post/test-post-aliases +++ b/test/post/test-post-aliases @@ -35,7 +35,7 @@ MHMTSCONF="$mts_fakesendmail" 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 @@ -56,8 +56,8 @@ test_alias () 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 diff --git a/test/post/test-post-common.sh b/test/post/test-post-common.sh index 3b1a3d0b..6767d747 100755 --- a/test/post/test-post-common.sh +++ b/test/post/test-post-common.sh @@ -28,7 +28,7 @@ echo "clientname: nosuchhost.example.com" >> ${MHMTSCONF} 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 diff --git a/test/post/test-sendfiles b/test/post/test-sendfiles index af5573ea..c5f08c00 100755 --- a/test/post/test-sendfiles +++ b/test/post/test-sendfiles @@ -47,11 +47,11 @@ test_sendfiles () 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 @@ -89,7 +89,7 @@ Usage: sendfiles [switches] -to recipient -subject subject file1 [file2 ...] 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 diff --git a/test/prompter/test-prompter b/test/prompter/test-prompter index 69eb9dd1..9a25bc06 100755 --- a/test/prompter/test-prompter +++ b/test/prompter/test-prompter @@ -35,7 +35,7 @@ Usage: prompter [switches] file -help EOF -prompter -help >$actual 2>&1 +run_prog prompter -help >$actual 2>&1 check $expected $actual # check -version @@ -70,7 +70,7 @@ Resent-fcc: 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' @@ -83,7 +83,7 @@ Resent-fcc: 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' @@ -96,7 +96,7 @@ Resent-fcc: 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' @@ -110,10 +110,10 @@ Resent-fcc: 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" @@ -138,7 +138,7 @@ message body 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' @@ -154,7 +154,7 @@ Resent-fcc: +outbox -------- EOF -prompter -rapid $MH_TEST_DIR/prompter-file > "$actual" < /dev/null +run_prog prompter -rapid $MH_TEST_DIR/prompter-file >"$actual" "$actual" < /dev/null +run_prog prompter -rapid -norapid $MH_TEST_DIR/prompter-file \ + >"$actual" "$actual" + run_prog prompter -erase '' -kill '' $MH_TEST_DIR/prompter-file >"$actual" check "$expected" "$actual" @@ -215,7 +216,8 @@ message body -------- 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 +run_prog prompter -nobody $MH_TEST_DIR/prompter-file >/dev/null check "$expected" "$MH_TEST_DIR/prompter-file" diff --git a/test/rcv/test-rcvdist b/test/rcv/test-rcvdist index 5e34615e..e69e140e 100755 --- a/test/rcv/test-rcvdist +++ b/test/rcv/test-rcvdist @@ -32,7 +32,7 @@ Usage: rcvdist [switches] [switches for postproc] address ... -help EOF -$rcvdist -help >"$actual" 2>&1 +run_prog $rcvdist -help >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -59,7 +59,7 @@ MHMTSCONF="$mts_fakesendmail" # 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 diff --git a/test/rcv/test-rcvpack b/test/rcv/test-rcvpack index 51deed77..ae2b294c 100755 --- a/test/rcv/test-rcvpack +++ b/test/rcv/test-rcvpack @@ -33,7 +33,7 @@ Usage: rcvpack [switches] file -help EOF -$rcvpack -help >"$actual" 2>&1 +run_prog $rcvpack -help >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -50,29 +50,30 @@ run_test "$rcvpack -nonexistent" 'rcvpack: -nonexistent unknown' 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' diff --git a/test/rcv/test-rcvstore b/test/rcv/test-rcvstore index 82d270d7..6445f69a 100755 --- a/test/rcv/test-rcvstore +++ b/test/rcv/test-rcvstore @@ -38,7 +38,7 @@ Usage: rcvstore [+folder] [switches] -help EOF -$rcvstore -help >$actual 2>&1 +run_prog $rcvstore -help >$actual 2>&1 check $expected $actual # check -version @@ -56,23 +56,23 @@ cat >$expected <$actual 2>&1 +run_prog $rcvstore $actual 2>&1 check $expected $actual # check with no switches cat >$expected <$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' @@ -84,14 +84,14 @@ rcvstore: folder ${MH_TEST_DIR}/Mail/newfolder doesn't exist 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" \ @@ -100,7 +100,7 @@ rmdir "${MH_TEST_DIR}/Mail/newfolder" # 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' @@ -109,59 +109,62 @@ touch "${MH_TEST_DIR}/Mail/inbox/11" 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' @@ -186,7 +189,7 @@ fi # 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" @@ -195,7 +198,7 @@ check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first' # 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" diff --git a/test/rcv/test-rcvtty b/test/rcv/test-rcvtty index 1d0fea8c..f0c58d14 100755 --- a/test/rcv/test-rcvtty +++ b/test/rcv/test-rcvtty @@ -37,7 +37,7 @@ Usage: rcvtty [command ...] -help EOF -$rcvtty -help >"$actual" 2>&1 +run_prog $rcvtty -help >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -54,7 +54,7 @@ esac # any of their ttys. cat >"$expected" <"$actual" 2>&1 +run_prog $rcvtty <${MH_TEST_DIR}/Mail/inbox/1 -biff >"$actual" 2>&1 check "$expected" "$actual" diff --git a/test/refile/test-refile b/test/refile/test-refile index da9242d2..645f4f1c 100755 --- a/test/refile/test-refile +++ b/test/refile/test-refile @@ -21,14 +21,14 @@ actual=$MH_TEST_DIR/$$.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. @@ -38,7 +38,7 @@ other has 1 message (1- 1). 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. @@ -67,7 +67,7 @@ TOTAL = 11 messages in 3 folders.' # 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' '' diff --git a/test/repl/test-if-str b/test/repl/test-if-str index 327f1c92..ecfafb65 100755 --- a/test/repl/test-if-str +++ b/test/repl/test-if-str @@ -40,7 +40,8 @@ Test1 writes: > 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" diff --git a/test/repl/test-multicomp b/test/repl/test-multicomp index ed5f97db..9ead17f2 100755 --- a/test/repl/test-multicomp +++ b/test/repl/test-multicomp @@ -52,8 +52,8 @@ Test1 writes: > 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" diff --git a/test/repl/test-repl b/test/repl/test-repl index 042bf4ef..63d99dde 100755 --- a/test/repl/test-repl +++ b/test/repl/test-repl @@ -55,7 +55,7 @@ Usage: repl: [+folder] [msg] [switches] -nofmtproc EOF -repl -help >$actual 2>&1 +run_prog repl -help >$actual 2>&1 check $expected $actual # check -version @@ -88,7 +88,7 @@ Comments: In-reply-to Test1 -------- EOF -repl -cc me -editor true -nowhatnowproc 1 +run_prog repl -cc me -editor true -nowhatnowproc 1 check $expected $actual # check -nocc me @@ -105,7 +105,7 @@ Comments: In-reply-to Test1 -------- 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: @@ -125,7 +125,7 @@ Comments: In-reply-to Test1 -------- EOF -repl -cc me -editor true -nowhatnowproc 1 +run_prog repl -cc me -editor true -nowhatnowproc 1 check $expected $actual @@ -144,7 +144,7 @@ Comments: In-reply-to Test1 -------- EOF -repl -cc me -nocc me -editor true -nowhatnowproc 1 +run_prog repl -cc me -nocc me -editor true -nowhatnowproc 1 check $expected $actual @@ -175,7 +175,7 @@ Comments: In-reply-to Test11 -------- EOF -repl -cc to -editor true -nowhatnowproc 11 +run_prog repl -cc to -editor true -nowhatnowproc 11 check $expected $actual diff --git a/test/repl/test-trailing-newline b/test/repl/test-trailing-newline index 20d7637d..cd6ef8e5 100755 --- a/test/repl/test-trailing-newline +++ b/test/repl/test-trailing-newline @@ -37,7 +37,7 @@ Test1 writes: > 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" diff --git a/test/scan/test-scan b/test/scan/test-scan index 632c54ba..1e600ec4 100755 --- a/test/scan/test-scan +++ b/test/scan/test-scan @@ -30,7 +30,7 @@ cat >"$expected" <> EOF -scan +inbox -width 80 >"$actual" || exit 1 +run_prog scan +inbox -width 80 >"$actual" || exit 1 check "$expected" "$actual" # check highlighting @@ -50,7 +50,7 @@ EOF 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" diff --git a/test/scan/test-scan-multibyte b/test/scan/test-scan-multibyte index 255adace..db1d3ba7 100755 --- a/test/scan/test-scan-multibyte +++ b/test/scan/test-scan-multibyte @@ -76,7 +76,7 @@ else exit 1 fi -scan -width 80 +inbox 11 > $actual || exit 1 +run_prog scan -width 80 +inbox 11 > $actual || exit 1 check "$expected" "$actual" # @@ -103,6 +103,7 @@ cat >"$expected" <"$actual" check "$expected" "$actual" fi @@ -131,7 +132,7 @@ else 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" diff --git a/test/sequences/test-mark b/test/sequences/test-mark index fb00e513..f1d529e8 100755 --- a/test/sequences/test-mark +++ b/test/sequences/test-mark @@ -120,9 +120,10 @@ run_test 'pick -nolist cur' 'pick: no cur message' # 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 diff --git a/test/slocal/test-slocal b/test/slocal/test-slocal index db6c945b..cadda353 100755 --- a/test/slocal/test-slocal +++ b/test/slocal/test-slocal @@ -42,7 +42,7 @@ Usage: slocal [switches] -help EOF -$slocal -help >"$actual" 2>&1 +run_prog $slocal -help >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -78,28 +78,29 @@ cat >"$md" <"$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" @@ -109,7 +110,7 @@ cat >"$md" <"$md" <"$md" <"$md" <"$md" <"$md" <"$md" <> $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 diff --git a/test/whatnow/test-cd b/test/whatnow/test-cd index 48389cbf..bfa6f4ee 100755 --- a/test/whatnow/test-cd +++ b/test/whatnow/test-cd @@ -32,7 +32,7 @@ actual=$MH_TEST_DIR/$$.actual # set +e -whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''` +whatnowtest=`echo cd | TERM=dumb run_prog whatnow -prompt ''` set -e case ${whatnowtest} in @@ -58,7 +58,8 @@ EOF # ||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" diff --git a/test/whatnow/test-ls b/test/whatnow/test-ls index b70f5936..e23111cc 100755 --- a/test/whatnow/test-ls +++ b/test/whatnow/test-ls @@ -33,7 +33,7 @@ actual=$MH_TEST_DIR/$$.actual # set +e -whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''` +whatnowtest=`echo cd | TERM=dumb run_prog whatnow -prompt ''` set -e case ${whatnowtest} in @@ -58,7 +58,7 @@ cat > $expectederr < "$actualerr" | \ +echo 'ls' | TERM=dumb run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \ sort > "$actual" check "$expectederr" "$actualerr" 'keep first' @@ -68,7 +68,7 @@ check "$expected" "$actual" '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" diff --git a/test/whom/test-whom b/test/whom/test-whom index b53bb086..e7bd78f4 100755 --- a/test/whom/test-whom +++ b/test/whom/test-whom @@ -48,7 +48,7 @@ Usage: whom [switches] [file] -help EOF -whom -help | head -10 >$actual 2>&1 +run_prog whom -help | head -10 >$actual 2>&1 check $expected $actual # check -version