1 # Common helper routines for test shell scripts -- intended to be sourced by them
12 echo "$Test $0 SKIP ($WHY)"
16 # portable implementation of 'which' utility
27 if [ -f "$D/$PROG" ] && [ -x "$D/$PROG" ]; then
28 printf '%s\n' "$D/$PROG"
37 if [ -z "$(findprog $1)" ]; then
38 test_skip "missing $1"
42 # Some stuff for doing silly progress indicators
48 RANGE="$(($LAST - $FIRST))"
49 PROG="$(($THIS - $FIRST))"
50 # this automatically rounds to nearest integer
51 PERC="$(((100 * $PROG) / $RANGE))"
52 # note \r so next update will overwrite
53 printf "%3d%%\r" $PERC
63 export MH=${MH_TEST_DIR}/Mail/.mh_profile
64 export MH_INST_DIR=${MH_TEST_DIR}/inst
65 export MHMTSCONF=${MH_INST_DIR}${sysconfdir}/mts.conf
66 export PATH=${MH_INST_DIR}${bindir}:${PATH}
68 if [ -z "${srcdir}" ]; then
69 echo "srcdir not set; aborting"
77 if [ ! -d ${MH_INST_DIR}${bindir} ]; then
78 (cd ${MH_OBJ_DIR} && make DESTDIR=${MH_INST_DIR} install) || exit 1
82 trap "rm -rf $MH_TEST_DIR/Mail; exit \$status" 0
84 mkdir $MH_TEST_DIR/Mail || exit 1
85 cat > $MH <<EOF || exit 1
86 Path: ${MH_TEST_DIR}/Mail
87 mhlproc: ${MH_INST_DIR}${auxexecdir}/mhl
90 for f in MailAliases components digestcomps distcomps forwcomps mhl.body \
91 mhl.digest mhl.format mhl.forward mhl.headers mhl.reply \
92 mhn.defaults rcvdistcomps replcomps replgroupcomps scan.MMDDYY \
93 scan.YYYYMMDD scan.default scan.mailx scan.nomime scan.size \
94 scan.time scan.timely scan.unseen
96 cp ${MH_INST_DIR}${sysconfdir}/${f} ${MH_TEST_DIR}/Mail || exit 1
99 folder -create +inbox > /dev/null
100 # create 10 basic messages
101 for i in 1 2 3 4 5 6 7 8 9 10;
103 cat > $MH_TEST_DIR/Mail/inbox/$i <<EOF || exit 1
104 From: Test$i <test$i@example.com>
105 To: Some User <user@example.com>
106 Date: Fri, 29 Sep 2006 00:00:00
107 Subject: Testing message $i
109 This is message number $i