]> diplodocus.org Git - nmh/blob - test/locking/test-spoollocking
pending-release-notes: add mhshow's "-prefer", and mh-format's %(kibi/kilo)
[nmh] / test / locking / test-spoollocking
1 #!/bin/sh
2 ######################################################
3 #
4 # Test the locking of nmh spool file
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 testmessage="$MH_TEST_DIR/testmessage"
20
21 cat > "$testmessage" <<EOM
22 Received: From somewhere
23 From: No Such User <nosuch@example.com>
24 To: Some Other User <someother@example.com>
25 Subject: Hello, how are you?
26 Date: Sun, 17 Dec 2006 12:13:14 -0500
27
28 This is a test; will it work?
29 EOM
30
31 #
32 # invoke "inc" for each locking algorithm
33 #
34
35 mv -f ${MHMTSCONF} ${MHMTSCONF}.backup
36
37 for locktype in $supported_locks
38 do
39 sed -e '/^spoollocking:/d' < ${MHMTSCONF}.backup > ${MHMTSCONF}
40
41 echo "spoollocking: $locktype" >> ${MHMTSCONF}
42
43 run_test "inc -notruncate -width 80 -file $testmessage" \
44 "Incorporating new mail into inbox...
45
46 11+ 12/17 No Such User Hello, how are you?<<This is a test; will it work
47 $testmessage not zero'd"
48
49 rmm 11
50 done
51
52 #### Restore mts.conf so subsequent tests use expected spoollocking.
53 mv -f ${MHMTSCONF}.backup ${MHMTSCONF}
54
55 rm -f "$testmessage"
56
57 exit ${failed:-0}