]> diplodocus.org Git - nmh/blobdiff - test/post/test-sendfiles
Fixed memory corruption in post(1) and inc(1) when using XOAUTH2.
[nmh] / test / post / test-sendfiles
index 64bf2696d2e9d44813311bf49844deca767862a2..22fbe7fea1465911ddca121897663e9187a2cf99 100755 (executable)
@@ -58,14 +58,14 @@ test_sendfiles ()
   # fakesendmail drops the message and any cc's into this mbox.
   mbox="$MH_TEST_DIR"/Mail/fakesendmail.mbox
   inc -silent -file "$mbox"
   # fakesendmail drops the message and any cc's into this mbox.
   mbox="$MH_TEST_DIR"/Mail/fakesendmail.mbox
   inc -silent -file "$mbox"
-  rm -f "$mbox" "$mbox.map"
+  rm -f "$mbox"
 
   mhlist -verbose last | sed -e 's/ *$//' -e 's/\(octet-stream\).*$/\1/' \
     >"$actual"
   (cd $MH_TEST_DIR/tmp  &&
    contents=`mhstore -noauto last 2>&1 | \
              sed -e 's/storing message.*as file //'`  &&
 
   mhlist -verbose last | sed -e 's/ *$//' -e 's/\(octet-stream\).*$/\1/' \
     >"$actual"
   (cd $MH_TEST_DIR/tmp  &&
    contents=`mhstore -noauto last 2>&1 | \
              sed -e 's/storing message.*as file //'`  &&
-   $uncompress "$contents" | tar xpf -  &&  rm -f "$contents")
+   $uncompress <"$contents" | tar xpf -  &&  rm -f "$contents")
 
   rmm last
   check "$testfiledir/$testfile" "$MH_TEST_DIR/tmp/$testfile" \
 
   rmm last
   check "$testfiledir/$testfile" "$MH_TEST_DIR/tmp/$testfile" \
@@ -76,6 +76,7 @@ test_sendfiles ()
 
 
 # check -help
 
 
 # check -help
+start_test "-help"
 cat >"$expected" <<EOF
 Usage: sendfiles [switches] -to recipient -subject subject file1 [file2 ...]
   or
 cat >"$expected" <<EOF
 Usage: sendfiles [switches] -to recipient -subject subject file1 [file2 ...]
   or
@@ -83,16 +84,17 @@ Usage: sendfiles [switches] -to recipient -subject subject file1 [file2 ...]
   switches are:
   -compress [bzip2 | compress | gzip | lzma | none]
   -from <sender>
   switches are:
   -compress [bzip2 | compress | gzip | lzma | none]
   -from <sender>
-  -[delay] <delay> (expressed in seconds)
   -version
   -help
   Can use PERSON environment variable instead of -from switch.
 EOF
 
   -version
   -help
   Can use PERSON environment variable instead of -from switch.
 EOF
 
-run_prog sendfiles -help >"$actual" 2>&1
+#### Skip nmh intro text.
+run_prog sendfiles -help 2>&1 | sed '/^$/,$d' >"$actual"
 check "$expected" "$actual"
 
 # check -version
 check "$expected" "$actual"
 
 # check -version
+start_test "-version"
 case `sendfiles -v` in
   sendfiles\ --*) ;;
   *           ) printf '%s: sendfiles -v generated unexpected output\n' "$0" >&2
 case `sendfiles -v` in
   sendfiles\ --*) ;;
   *           ) printf '%s: sendfiles -v generated unexpected output\n' "$0" >&2
@@ -100,6 +102,7 @@ case `sendfiles -v` in
 esac
 
 # check unknown switch
 esac
 
 # check unknown switch
+start_test "unknown switch"
 run_test 'sendfiles -nonexistent' "Usage: sendfiles [switches] -to recipient \
 -subject subject file1 [file2 ...]
   or
 run_test 'sendfiles -nonexistent' "Usage: sendfiles [switches] -to recipient \
 -subject subject file1 [file2 ...]
   or
@@ -107,12 +110,12 @@ run_test 'sendfiles -nonexistent' "Usage: sendfiles [switches] -to recipient \
   switches are:
   -compress [bzip2 | compress | gzip | lzma | none]
   -from <sender>
   switches are:
   -compress [bzip2 | compress | gzip | lzma | none]
   -from <sender>
-  -[delay] <delay> (expressed in seconds)
   -version
   -help
   Can use PERSON environment variable instead of -from switch."
 
 # check unknown compression method
   -version
   -help
   Can use PERSON environment variable instead of -from switch."
 
 # check unknown compression method
+start_test "unknown compression method"
 run_test 'sendfiles -compress unknown to subject file' \
 'sendfiles: unknown compression method "unknown"'"
 Usage: sendfiles [switches] -to recipient \
 run_test 'sendfiles -compress unknown to subject file' \
 'sendfiles: unknown compression method "unknown"'"
 Usage: sendfiles [switches] -to recipient \
@@ -122,12 +125,12 @@ Usage: sendfiles [switches] -to recipient \
   switches are:
   -compress [bzip2 | compress | gzip | lzma | none]
   -from <sender>
   switches are:
   -compress [bzip2 | compress | gzip | lzma | none]
   -from <sender>
-  -[delay] <delay> (expressed in seconds)
   -version
   -help
   Can use PERSON environment variable instead of -from switch."
 
 # Check basic operation, using specified compression method.
   -version
   -help
   Can use PERSON environment variable instead of -from switch."
 
 # Check basic operation, using specified compression method.
+start_test "basic operation, using specified compression method."
 # Don't check the mhlist output, by not creating an $expected file,
 # because it will vary with compression method and compressed file
 # size.
 # Don't check the mhlist output, by not creating an $expected file,
 # because it will vary with compression method and compressed file
 # size.
@@ -139,6 +142,7 @@ Usage: sendfiles [switches] -to recipient \
 [ "`findprog lzma`" ]      &&  test_sendfiles 'lzma -cd' new -compress lzma
 
 # check with no compression
 [ "`findprog lzma`" ]      &&  test_sendfiles 'lzma -cd' new -compress lzma
 
 # check with no compression
+start_test "with no compression"
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
@@ -149,6 +153,7 @@ EOF
 test_sendfiles cat new -compress none
 
 # check with no compression, -none
 test_sendfiles cat new -compress none
 
 # check with no compression, -none
+start_test "with no compression, -none"
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
@@ -159,6 +164,7 @@ EOF
 test_sendfiles cat new -none
 
 # check old argument style (without -to and -subject)
 test_sendfiles cat new -none
 
 # check old argument style (without -to and -subject)
+start_test "old argument style (without -to and -subject)"
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
@@ -169,6 +175,7 @@ EOF
 test_sendfiles cat old -compress none
 
 # check -from
 test_sendfiles cat old -compress none
 
 # check -from
+start_test "-from"
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
@@ -179,6 +186,7 @@ EOF
 test_sendfiles cat new -compress none -from 'Sender <sender@example.com>'
 
 # check PERSON environment variable
 test_sendfiles cat new -compress none -from 'Sender <sender@example.com>'
 
 # check PERSON environment variable
+start_test "PERSON environment variable"
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
 cat >"$expected" <<EOF
  msg part  type/subtype              size description
   11       application/octet-stream
@@ -188,27 +196,8 @@ EOF
 
 PERSON='Sender <sender@example.com>' test_sendfiles cat new -compress none
 
 
 PERSON='Sender <sender@example.com>' test_sendfiles cat new -compress none
 
-# check -delay, though for a small file it doesn't do anything
-cat >"$expected" <<EOF
- msg part  type/subtype              size description
-  11       application/octet-stream
-            type="tar"
-            (extract with cat | tar xvpf -)
-EOF
-
-test_sendfiles cat new -compress none -delay 5
-
-# check old style -delay, though for a small file it doesn't do anything
-cat >"$expected" <<EOF
- msg part  type/subtype              size description
-  11       application/octet-stream
-            type="tar"
-            (extract with cat | tar xvpf -)
-EOF
-
-test_sendfiles cat new -compress none -5
-
 rm -fr "$MH_TEST_DIR/fakesendmail" "$MH_TEST_DIR/$testfile" "$MH_TEST_DIR/tmp"
 
 
 rm -fr "$MH_TEST_DIR/fakesendmail" "$MH_TEST_DIR/$testfile" "$MH_TEST_DIR/tmp"
 
 
+finish_test
 exit ${failed:-0}
 exit ${failed:-0}