1 # Common helper routines for test shell scripts -- intended to be sourced by them
5 #### The following exported variables are set by "make check". Ensure
6 #### that they are set here so that individual tests can be run
7 #### outside of make. Requires that MH_OBJ_DIR be set on entry.
8 test -z "$MH_TEST_DIR" && MH_TEST_DIR="$MH_OBJ_DIR/test/testdir"
9 test -z "$prefix" && prefix=@prefix@
10 test -z "$datarootdir" && datarootdir=@datarootdir@
11 test -z "$exec_prefix" && exec_prefix=@exec_prefix@
12 test -z "$auxexecdir" && auxexecdir="@libdir@"
13 test -z "$bindir" && bindir="@bindir@"
14 test -z "$mandir" && mandir="@mandir@"
15 test -z "$sysconfdir" && sysconfdir="@sysconfdir@"
16 export MH_TEST_DIR auxexecdir bindir mandir sysconfdir
18 test -z "$MH_INST_DIR" && MH_INST_DIR=${MH_TEST_DIR}/inst
24 @MD5SUM@ $* | @MD5FMT@
30 echo "$Test $0 SKIP ($WHY)"
34 # portable implementation of 'which' utility
45 if [ -f "$D/$PROG" ] && [ -x "$D/$PROG" ]; then
46 printf '%s\n' "$D/$PROG"
55 if [ -z "$(findprog $1)" ]; then
56 test_skip "missing $1"
60 # Some stuff for doing silly progress indicators
66 RANGE="$(($LAST - $FIRST))"
67 PROG="$(($THIS - $FIRST))"
68 # this automatically rounds to nearest integer
69 PERC="$(((100 * $PROG) / $RANGE))"
70 # note \r so next update will overwrite
71 printf "%3d%%\r" $PERC
81 export MH=${MH_TEST_DIR}/Mail/.mh_profile
82 export MHMTSCONF=${MH_INST_DIR}${sysconfdir}/mts.conf
83 export PATH=${MH_INST_DIR}${bindir}:${PATH}
84 export MH_LIB_DIR=${MH_INST_DIR}${auxexecdir}
89 if [ ! -d ${MH_INST_DIR}${bindir} ]; then
90 (cd ${MH_OBJ_DIR} && make DESTDIR=${MH_INST_DIR} install) || exit 1
94 trap "rm -rf $MH_TEST_DIR/Mail; exit \$status" 0
96 mkdir $MH_TEST_DIR/Mail || exit 1
97 cat > $MH <<EOF || exit 1
98 Path: ${MH_TEST_DIR}/Mail
99 mhlproc: ${MH_LIB_DIR}/mhl
102 for f in MailAliases components digestcomps distcomps forwcomps mhl.body \
103 mhl.digest mhl.format mhl.forward mhl.headers mhl.reply \
104 mhn.defaults rcvdistcomps replcomps replgroupcomps scan.MMDDYY \
105 scan.YYYYMMDD scan.default scan.mailx scan.nomime scan.size \
106 scan.time scan.timely scan.unseen
108 cp ${MH_INST_DIR}${sysconfdir}/${f} ${MH_TEST_DIR}/Mail || exit 1
111 folder -create +inbox > /dev/null
112 # create 10 basic messages
113 for i in 1 2 3 4 5 6 7 8 9 10;
115 cat > $MH_TEST_DIR/Mail/inbox/$i <<EOF || exit 1
116 From: Test$i <test$i@example.com>
117 To: Some User <user@example.com>
118 Date: Fri, 29 Sep 2006 00:00:00
119 Subject: Testing message $i
121 This is message number $i