]> diplodocus.org Git - nmh/blobdiff - test/slocal/test-slocal
Fixed problem with m_getfld() with long headers reported by
[nmh] / test / slocal / test-slocal
index 40e3ee3289df4dfe0fd388491cb5ef0907cd03ec..db6c945b39a4c19fcd83aa5b308ede54977e6810 100755 (executable)
@@ -73,64 +73,72 @@ fi
 # So, it would put the message in the user's inbox, not the
 # test inbox.  slocal also freopens stdout and stderr to
 # /dev/null, so we can't view them to verify simulated delivery.
 # So, it would put the message in the user's inbox, not the
 # test inbox.  slocal also freopens stdout and stderr to
 # /dev/null, so we can't view them to verify simulated delivery.
-cat >$md  <<EOF
-* 1 qpipe A "$tee $actual"
+cat >"$md"  <<EOF
+* - qpipe A "$tee $actual"
 EOF
 EOF
+chmod go-w "$md"
 
 
-$slocal -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/1
+$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1
 check "$MH_TEST_DIR/Mail/inbox/1" "$actual" 'keep first'
 
 check "$MH_TEST_DIR/Mail/inbox/1" "$actual" 'keep first'
 
+if [ ${failed:-0} -eq 1 ]; then
+  printf "\nRerunning failed basic slocal command with -verbose -debug to help
+    diagnose test failure . . .\n\n"
+  $slocal -verbose -debug -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1
+  exit 1
+fi
+
 # check -debug
 # check -debug
-$slocal -debug -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \
+$slocal -debug -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \
   >"$actual2" 2>&1
 run_test "grep ^retrieving $actual2" 'retrieving message from stdin'
 
 # check -verbose
   >"$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 \
+$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
   >"$actual2" 2>&1
 run_test "grep ^delivering $actual2" "delivering to pipe \"$tee\", success."
 
 # check -noverbose
-$slocal -verbose -noverbose -maildelivery $md $mbox \
+$slocal -verbose -noverbose -maildelivery "$md" $mbox \
   <"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1
 run_test "grep ^delivering $actual2" ''
 rm -f "$actual2"
 
 # check match of From
   <"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1
 run_test "grep ^delivering $actual2" ''
 rm -f "$actual2"
 
 # check match of From
-cat >$md  <<EOF
+cat >"$md"  <<EOF
 From test2@example.com qpipe A "$tee $actual"
 EOF
 
 From test2@example.com qpipe A "$tee $actual"
 EOF
 
-$slocal -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/2
+$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/2
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
 
 # check R and ?
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
 
 # check R and ?
-cat >$md  <<EOF
+cat >"$md"  <<EOF
 From test3@example.com qpipe R "$tee $actual"
 From test3@example.com qpipe ? "$tee $actual2"
 EOF
 
 From test3@example.com qpipe R "$tee $actual"
 From test3@example.com qpipe ? "$tee $actual2"
 EOF
 
-$slocal -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/3
+$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/3
 check "$MH_TEST_DIR/Mail/inbox/3" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/3" "$actual2" 'keep first'
 
 # check R and N
 check "$MH_TEST_DIR/Mail/inbox/3" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/3" "$actual2" 'keep first'
 
 # check R and N
-cat >$md  <<EOF
+cat >"$md"  <<EOF
 From test4@example.com qpipe R "$tee $actual"
 From test4@example.com qpipe N "$tee $actual2"
 EOF
 
 From test4@example.com qpipe R "$tee $actual"
 From test4@example.com qpipe N "$tee $actual2"
 EOF
 
-$slocal -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/4
+$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/4
 check "$MH_TEST_DIR/Mail/inbox/4" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/4" "$actual2" 'keep first'
 
 # check default
 check "$MH_TEST_DIR/Mail/inbox/4" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/4" "$actual2" 'keep first'
 
 # check default
-cat >$md  <<EOF
+cat >"$md"  <<EOF
 From test5@example.com qpipe R "$tee $actual"
 default 1 qpipe A "$tee $actual2"
 EOF
 
 From test5@example.com qpipe R "$tee $actual"
 default 1 qpipe A "$tee $actual2"
 EOF
 
-$slocal -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/5
+$slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/5
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual2" 'keep first'
 
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual2" 'keep first'
 
@@ -139,68 +147,68 @@ check "$MH_TEST_DIR/Mail/inbox/5" "$actual2" 'keep first'
 me=`"$MH_LIB_DIR"/ap -format '%(me)' 0`
 
 # check -addr
 me=`"$MH_LIB_DIR"/ap -format '%(me)' 0`
 
 # check -addr
-cat >$md  <<EOF
+cat >"$md"  <<EOF
 addr "$me" qpipe A "$tee $actual"
 EOF
 
 addr "$me" qpipe A "$tee $actual"
 EOF
 
-$slocal -addr "$me" -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/6
+$slocal -addr "$me" -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/6
 check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
 
 # check -info
 check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
 
 # check -info
-cat >$md  <<EOF
-* 1 qpipe A "\$(info) $actual"
+cat >"$md"  <<EOF
+* - qpipe A "\$(info) $actual"
 EOF
 
 EOF
 
-$slocal -info $tee -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/7
+$slocal -info $tee -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/7
 check "$MH_TEST_DIR/Mail/inbox/7" "$actual" 'keep first'
 
 # check -sender, which is compared with "source"
 check "$MH_TEST_DIR/Mail/inbox/7" "$actual" 'keep first'
 
 # check -sender, which is compared with "source"
-cat >$md  <<EOF
+cat >"$md"  <<EOF
 source "$me" qpipe A "$tee $actual"
 EOF
 
 source "$me" qpipe A "$tee $actual"
 EOF
 
-$slocal -sender "$me" -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/8
+$slocal -sender "$me" -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/8
 check "$MH_TEST_DIR/Mail/inbox/8" "$actual" 'keep first'
 
 # check -user
 check "$MH_TEST_DIR/Mail/inbox/8" "$actual" 'keep first'
 
 # check -user
-cat >$md  <<EOF
-* 1 qpipe A "$tee $actual"
+cat >"$md"  <<EOF
+* - qpipe A "$tee $actual"
 EOF
 
 EOF
 
-$slocal -user "$me" -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/9
+$slocal -user "$me" -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/9
 check "$MH_TEST_DIR/Mail/inbox/9" "$actual" 'keep first'
 
 # check -mailbox
 check "$MH_TEST_DIR/Mail/inbox/9" "$actual" 'keep first'
 
 # check -mailbox
-cat >$md  <<EOF
+cat >"$md"  <<EOF
 EOF
 
 EOF
 
-$slocal -mailbox "$actual" -maildelivery $md <"$MH_TEST_DIR"/Mail/inbox/10
+$slocal -mailbox "$actual" -maildelivery "$md" <"$MH_TEST_DIR"/Mail/inbox/10
 inc -file "$actual" -silent -truncate
 rm -f "$actual"
 check "$MH_TEST_DIR/Mail/inbox/10" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
 
 # check -file
 inc -file "$actual" -silent -truncate
 rm -f "$actual"
 check "$MH_TEST_DIR/Mail/inbox/10" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
 
 # check -file
-$slocal -mailbox "$actual" -maildelivery $md -file "$MH_TEST_DIR"/Mail/inbox/1
+$slocal -mailbox "$actual" -maildelivery "$md" -file "$MH_TEST_DIR"/Mail/inbox/1
 inc -file "$actual" -silent -truncate
 rm -f "$actual"
 check "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
 
 # check -suppressdup
 inc -file "$actual" -silent -truncate
 rm -f "$actual"
 check "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
 
 # check -suppressdup
-cat >$md  <<EOF
-* 1 qpipe A "$tee $actual"
+cat >"$md"  <<EOF
+* - qpipe A "$tee $actual"
 EOF
 
 EOF
 
-$slocal -suppressdup -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/2
+$slocal -suppressdup -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/2
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
 
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
 
-$slocal -suppressdup -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/2
+$slocal -suppressdup -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/2
 if [ -f "$actual" ]; then
   echo $0: check -suppressdup failed
   failed=`expr ${failed:-0} + 1`
 fi
 
 # check -nosuppressdup
 if [ -f "$actual" ]; then
   echo $0: check -suppressdup failed
   failed=`expr ${failed:-0} + 1`
 fi
 
 # check -nosuppressdup
-$slocal -suppress -nosuppressdup -maildelivery $md $mbox \
+$slocal -suppress -nosuppressdup -maildelivery "$md" $mbox \
   <"$MH_TEST_DIR"/Mail/inbox/2
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
 
   <"$MH_TEST_DIR"/Mail/inbox/2
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'