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}
67 export MH_LIB_DIR=${MH_INST_DIR}${auxexecdir}
69 if [ -z "${srcdir}" ]; then
70 echo "srcdir not set; aborting"
78 if [ ! -d ${MH_INST_DIR}${bindir} ]; then
79 (cd ${MH_OBJ_DIR} && make DESTDIR=${MH_INST_DIR} install) || exit 1
83 trap "rm -rf $MH_TEST_DIR/Mail; exit \$status" 0
85 mkdir $MH_TEST_DIR/Mail || exit 1
86 cat > $MH <<EOF || exit 1
87 Path: ${MH_TEST_DIR}/Mail
88 mhlproc: ${MH_LIB_DIR}/mhl
91 for f in MailAliases components digestcomps distcomps forwcomps mhl.body \
92 mhl.digest mhl.format mhl.forward mhl.headers mhl.reply \
93 mhn.defaults rcvdistcomps replcomps replgroupcomps scan.MMDDYY \
94 scan.YYYYMMDD scan.default scan.mailx scan.nomime scan.size \
95 scan.time scan.timely scan.unseen
97 cp ${MH_INST_DIR}${sysconfdir}/${f} ${MH_TEST_DIR}/Mail || exit 1
100 folder -create +inbox > /dev/null
101 # create 10 basic messages
102 for i in 1 2 3 4 5 6 7 8 9 10;
104 cat > $MH_TEST_DIR/Mail/inbox/$i <<EOF || exit 1
105 From: Test$i <test$i@example.com>
106 To: Some User <user@example.com>
107 Date: Fri, 29 Sep 2006 00:00:00
108 Subject: Testing message $i
110 This is message number $i