2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
5 ARGS
='-n# -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
10 MAKE
="${MAKE:-`command -v make`}"
11 awk=${awk:-`command -v awk`}
12 cat=${cat:-`command -v cat`}
13 cksum=${cksum:-`command -v cksum`}
14 rm=${rm:-`command -v rm`}
15 sed=${sed:-`command -v sed`}
16 grep=${grep:-`command -v grep`}
20 export SNAIL ARGS CONF BODY MBOX MAKE
awk cat cksum rm sed grep
22 # NOTE! UnixWare 7.1.4 gives ISO-10646-Minimum-European-Subset for
23 # nl_langinfo(CODESET), then, so also overwrite ttycharset.
24 # (In addition this setup allows us to succeed on TinyCore 4.4 that has no
25 # other locales than C/POSIX installed by default!)
27 LC_ALL
=${LC} LANG
=${LC}
29 export LC_ALL LANG ttycharset
34 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
40 [ "${1}" = --check-only ] || usage
41 [ ${#} -gt 2 ] && usage
42 [ ${#} -eq 2 ] && SNAIL
="${2}"
43 [ -x "${SNAIL}" ] || usage
48 # Test all configs TODO doesn't cover all *combinations*, stupid!
52 /^[[:space:]]*WANT_/ {
53 sub(/^[[:space:]]*/, "")
54 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
55 # does not seem to be a compliant escape for =
57 $1 = substr($1, 1, index($1, "=") - 1)
58 if ($1 == "WANT_AUTOCC")
63 for (j = 1; j < i; ++j) {
64 for (k = 1; k < j; ++k)
66 for (k = j; k < i; ++k)
68 printf "WANT_AUTOCC=1\n"
70 for (k = 1; k < j; ++k)
72 for (k = j; k < i; ++k)
74 printf "WANT_AUTOCC=1\n"
77 printf "CONFIG=NULL WANT_AUTOCC=0\n"
78 printf "CONFIG=NULL WANT_AUTOCC=1\n"
79 printf "CONFIG=NULLI WANT_AUTOCC=0\n"
80 printf "CONFIG=NULLI WANT_AUTOCC=1\n"
81 printf "CONFIG=MINIMAL WANT_AUTOCC=0\n"
82 printf "CONFIG=MINIMAL WANT_AUTOCC=1\n"
83 printf "CONFIG=MEDIUM WANT_AUTOCC=0\n"
84 printf "CONFIG=MEDIUM WANT_AUTOCC=1\n"
85 printf "CONFIG=NETSEND WANT_AUTOCC=0\n"
86 printf "CONFIG=NETSEND WANT_AUTOCC=1\n"
87 printf "CONFIG=MAXIMAL WANT_AUTOCC=0\n"
88 printf "CONFIG=MAXIMAL WANT_AUTOCC=1\n"
89 printf "CONFIG=DEVEL WANT_AUTOCC=0\n"
90 printf "CONFIG=DEVEL WANT_AUTOCC=1\n"
91 printf "CONFIG=ODEVEL WANT_AUTOCC=0\n"
92 printf "CONFIG=ODEVEL WANT_AUTOCC=1\n"
95 printf "\n\n##########\n$c\n"
96 printf "\n\n##########\n$c\n" >&2
104 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
105 # cksum(1) of the resulting data and compare against the checksum $3
107 tid
=${1} f=${2} s=${3}
109 csum
="`${sed} -e '/^From /d' -e '/^Date: /d' \
110 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
111 -e '/^\[-- Message/d' | ${cksum}`";
112 if [ "${csum}" = "${s}" ]; then
116 printf 'error: checksum mismatch (got %s)\n' "${csum}"
123 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} |
129 # Basic (easily testable) behaviour tests
133 printf 'echo +nix\nset folder=/\necho +nix\nset nofolder\necho +nix\nx' |
134 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} > "${MBOX}"
135 cksum_test behave
:001 "${MBOX}" '4214021069 15'
137 # POSIX: setting *noprompt*/prompt='' shall prevent prompting TODO
138 # TODO for this to be testable we need a way to echo a variable
139 # TODO or to force echo of the prompt
143 # FIXME __behave_alias
145 # FIXME __behave_mlist
147 have_feat SSL
/TLS
&& have_feat S
/MIME
&& __behave_smime
151 # Nestable conditions test
153 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
175 if $dietcurd == 'yoho'
180 if $dietcurd != 'yoho'
241 if $dietcurd == 'yohu'
243 elif $dietcurd == 'yoha'
245 elif $dietcurd == 'yohe'
247 elif $dietcurd == 'yoho'
249 if $dietcurd == 'yohu'
251 elif $dietcurd == 'yoha'
253 elif $dietcurd == 'yohe'
255 elif $dietcurd == 'yoho'
257 if $dietcurd == 'yohu'
259 elif $dietcurd == 'yoha'
261 elif $dietcurd == 'yohe'
263 elif $dietcurd == 'yoho'
274 # integer conversion, <..>..
377 set diet=abc curd=abc
383 set diet=abc curd=abcd
389 # 1. Shitty grouping capabilities as of today
390 unset diet curd ndefined
391 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
397 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
402 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
407 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
412 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
417 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
423 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
428 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
433 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
438 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
443 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
448 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
453 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
458 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
463 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
468 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
474 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
480 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
485 # 2. Shitty grouping capabilities as of today
486 unset diet curd ndefined
487 if [ false || false || true ] && [ false || true ] && yes
492 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
497 if [ 1 || 0 || 0 || 0 ]
502 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
507 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
512 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
517 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
522 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
527 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
532 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
537 if 1 || 0 || 0 || 0 && 0
542 if 1 || 0 || 0 || 0 && 1
547 if 0 || 0 || 0 || 1 && 0
552 if 0 || 0 || 0 || 1 && 1
557 if 0 || 0 || 0 || 1 && 0 || 1 && 0
562 if 0 || 0 || 0 || 1 && 0 || 1 && 1
568 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
573 if $diet == 'yo' && $curd == 'ho' && $ndefined
579 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
584 if $diet == 'yo' && $curd == 'ho' && $ndefined
589 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
595 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
600 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
605 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
610 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
615 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
620 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
625 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
630 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
635 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
641 if ! 0 && ! ! 1 && ! ! ! 0 && 3
646 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
651 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
656 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
661 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
666 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
671 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
676 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
681 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
687 cksum_test behave:if-normal "${MBOX}" '3542193361 607'
689 if have_feat REGEX; then
691 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
693 if $dietcurd =~
'^yo.*'
698 if $dietcurd =~
'^yoho.+'
703 if $dietcurd !~
'.*ho$'
708 if $dietcurd !~
'.+yoho$'
713 if [ $dietcurd !~
'.+yoho$' ]
718 if ! [ $dietcurd =~
'.+yoho$' ]
723 if ! ! [ $dietcurd !~
'.+yoho$' ]
728 if ! [ ! [ $dietcurd !~
'.+yoho$' ] ]
733 if [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
738 if ! [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
743 if ! ! ! $dietcurd !~
'.+yoho$'
748 if ! ! ! $dietcurd =~
'.+yoho$'
753 if ! [ ! ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
758 set diet
=abc curd
='^abc$'
764 set diet
=abc curd
='^abcd$'
771 cksum_test behave
:if-regex
"${MBOX}" '439960016 81'
775 __behave_smime
() { # FIXME add test/ dir, unroll tests therein, regular enable!
776 printf 'behave:s/mime: .. generating test key and certificate ..\n'
777 ${cat} <<-_EOT > ./t.conf
780 default_keyfile = keyfile.pem
781 distinguished_name = req_distinguished_name
782 attributes = req_attributes
786 [ req_distinguished_name ]
793 emailAddress = test@localhost
798 openssl req
-x509 -nodes -days 3650 -config .
/t.conf \
799 -newkey rsa
:1024 -keyout .
/tkey.pem
-out .
/tcert.pem
>/dev
/null
2>&1
801 ${cat} .
/tkey.pem .
/tcert.pem
> .
/tpair.pem
803 printf "behave:s/mime:sign/verify: "
805 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
806 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
807 -Ssmime-sign -Sfrom=test@localhost \
808 -s 'S/MIME test' .
/VERIFY
810 printf 'verify\nx\n' |
811 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
812 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
813 -Ssmime-sign -Sfrom=test@localhost \
814 -Sbatch-exit-on-error -R \
815 -f .
/VERIFY
>/dev
/null
2>&1
816 if [ $?
-eq 0 ]; then
820 printf 'error: verification failed\n'
821 ${rm} -f .
/VERIFY .
/tkey.pem .
/tcert.pem .
/tpair.pem
826 # (signing +) encryption / decryption
827 ${cat} <<-_EOT > ./tsendmail.sh
829 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./ENCRYPT
831 chmod 0755 .
/tsendmail.sh
833 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
835 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
836 -Ssmime-force-encryption \
837 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
838 -Ssendmail=.
/tsendmail.sh \
839 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
840 -Ssmime-sign -Sfrom=test@localhost \
841 -s 'S/MIME test' recei@ver.com
843 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
844 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
845 -Ssmime-force-encryption \
846 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
847 -Ssendmail=.
/tsendmail.sh \
848 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
849 -Ssmime-sign -Sfrom=test@localhost \
850 -Sbatch-exit-on-error -R \
851 -f .
/ENCRYPT
>/dev
/null
2>&1
852 if [ $?
-eq 0 ]; then
856 printf 'error: decryption+verification failed\n'
858 ${sed} -e '/^X-Decoding-Date/d' \
860 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
861 < .
/DECRYPT
> .
/ENCRYPT
862 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2838023744 515'
865 printf "behave:s/mime:encrypt/decrypt: "
867 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
868 -Ssmime-force-encryption \
869 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
870 -Ssendmail=.
/tsendmail.sh \
871 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
872 -Sfrom=test@localhost \
873 -s 'S/MIME test' recei@ver.com
874 printf 'decrypt ./DECRYPT\nx\n' |
875 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
876 -Ssmime-force-encryption \
877 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
878 -Ssendmail=.
/tsendmail.sh \
879 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
880 -Sfrom=test@localhost \
881 -Sbatch-exit-on-error -R \
882 -f .
/ENCRYPT
>/dev
/null
2>&1
883 if [ $?
-eq 0 ]; then
887 printf 'error: decryption failed\n'
890 ${sed} -e '/^X-Decoding-Date/d' \
891 < .
/DECRYPT
> .
/ENCRYPT
892 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2279047916 300'
894 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
895 .
/tkey.pem .
/tcert.pem .
/tpair.pem
899 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
900 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
901 # Note we unfortunately need to place some statements without proper
902 # indentation because of continuation problems
904 ${rm} -f "${BODY}" "${MBOX}"
906 # MIME encoding (QP) stress message body
908 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
909 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
910 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
911 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
912 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
913 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
914 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
915 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
916 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
917 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
918 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
919 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
920 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
921 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
922 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
923 "auf den zeilen vorher.
\r\n"\
924 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
926 "Die letzte Zeile war nur ein Punkt.
\r\n"\
928 "Das waren deren zwei.
\r\n"\
930 "Die letzte Zeile war ein Leerschritt.
\n"\
931 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
934 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
936 "Das waren deren zwei. ditto.
\n"\
938 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
939 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
940 "auf den zeilen vorher.
\n"\
942 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
943 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
945 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
947 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
949 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
951 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
953 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
955 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
957 "Die letzte Zeile war ein Leerschritt.
\n"\
961 # MIME encoding (QP) stress message subject
962 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
963 adadaddsssssssddddddddddddddddddddd\
964 ddddddddddddddddddddddddddddddddddd\
965 ddddddddddddddddddddddddddddddddddd\
966 dddddddddddddddddddd Hallelulja? Od\
967 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
968 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
969 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
970 fffffffffffffffffffffffffffffffffff\
971 fffffffffffffffffffff ggggggggggggg\
972 ggggggggggggggggggggggggggggggggggg\
973 ggggggggggggggggggggggggggggggggggg\
974 ggggggggggggggggggggggggggggggggggg\
977 # Three tests for MIME encodign and (a bit) content classification.
978 # At the same time testing -q FILE, < FILE and -t FILE
980 # TODO Note: because of our weird putline() handling in <-> collect.c
982 < "${BODY}" MAILRC=/dev/null \
983 "${SNAIL}" -nSstealthmua -Sexpandaddr -a "${BODY}" -s "${SUB}" "${MBOX}"
984 cksum_test content:001-0 "${MBOX}" '3498258986 5631'
987 < "${BODY}" MAILRC=/dev/null \
988 "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -s "${SUB}" "${MBOX}"
989 cksum_test content:001 "${MBOX}" '3916146590 5630'
992 < /dev/null MAILRC=/dev/null \
993 "${SNAIL}" ${ARGS} -a "${BODY}" -s "${SUB}" \
994 -q "${BODY}" "${MBOX}"
995 cksum_test content:002 "${MBOX}" '3498258986 5631'
998 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1000 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -t
1001 cksum_test content:003 "${MBOX}" '3916146590 5630'
1003 # Test for [260e19d] (Juergen Daubert)
1005 echo body | MAILRC=/dev/null "${SNAIL}" ${ARGS} "${MBOX}"
1006 cksum_test content:004 "${MBOX}" '4140682175 72'
1008 # Sending of multiple mails in a single invocation
1010 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n.
\n" &&
1011 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n.
\n" &&
1013 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS}
1014 cksum_test content:005 "${MBOX}" '3503215815 245'
1018 # "Test
for" [d6f316a] (Gavin Troy)
1020 printf "m
${MBOX}\n~s subject1
\nEmail body
\n.
\nfi
${MBOX}\np
\nx
\n" |
1021 MAILRC=/dev/null "${SNAIL}" ${ARGS} \
1022 -Spipe-text/plain="${cat}" > "${BODY}"
1023 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1024 cksum_test content
:006 "${MBOX}" '11112309 106'
1026 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1027 # TODO Note: because of our weird putline() handling in <-> collect.c
1029 LC_ALL
=C
${awk} 'BEGIN{
1030 for(i = 0; i < 10000; ++i)
1032 #printf "\xF0\x90\x87\x90"
1034 MAILRC
=/dev
/null
"${SNAIL}" -nSstealthmua -Sexpandaddr \
1035 -s TestSubject
"${MBOX}"
1036 cksum_test content
:007-0 "${MBOX}" '2747333583 61729'
1039 LC_ALL
=C
${awk} 'BEGIN{
1040 for(i = 0; i < 10000; ++i)
1042 #printf "\xF0\x90\x87\x90"
1044 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s TestSubject "${MBOX}"
1045 cksum_test content
:007 "${MBOX}" '3343002941 61728'
1047 ## Test some more corner cases for header bodies (as good as we can today) ##
1052 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1053 -s 'a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲' \
1055 cksum_test content
:008 "${MBOX}" '3872015771 288'
1057 # Single word (overlong line split -- bad standard! Requires injection of
1058 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1060 i
=`LC_ALL=C ${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1061 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1062 cksum_test content
:009 "${MBOX}" '2048460448 1631'
1064 # Combination of encoded words, space and tabs of varying sort
1066 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1067 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
1068 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
1069 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
1070 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
1071 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
1073 cksum_test content
:010 "${MBOX}" '1272213842 504'
1075 # Overlong multibyte sequence that must be forcefully split
1076 # todo This works even before v15.0, but only by accident
1078 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1079 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1080 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1081 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1083 cksum_test content
:011 "${MBOX}" '2972351879 572'
1088 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1089 -s "1-1 B2 B3 B4 B5 B6 B\
1090 1-2 B2 B3 B4 B5 B6 B\
1091 1-3 B2 B3 B4 B5 B6 B\
1092 1-4 B2 B3 B4 B5 B6 B\
1093 1-5 B2 B3 B4 B5 B6 B\
1094 1-6 B2 B3 B4 B5 B6 " \
1096 cksum_test content
:012 "${MBOX}" '1276108207 271'
1098 # Leading and trailing WS
1101 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1102 -s " 2-1 B2 B3 B4 B5 B6 B\
1103 1-2 B2 B3 B4 B5 B6 B\
1104 1-3 B2 B3 B4 B5 B6 B\
1105 1-4 B2 B3 B4 B5 B6 " \
1107 cksum_test content
:013 "${MBOX}" '3677630181 210'
1109 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1110 # have a (better) test framework materialize a quick shot
1114 : > 'diet\ is \curd.txt'
1115 : > diet
\"is
\" curd.txt
1117 : > höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt
1118 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1119 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1120 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1122 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -Snodot \
1123 -a "ma'ger.txt" -a "mä'ger.txt" \
1124 -a 'diet\\\ is\ \\curd.txt' -a diet
\"is
\" curd.txt \
1126 -a höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt \
1127 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1128 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1129 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1131 ${rm} -f "ma'ger.txt" "mä'ger.txt" 'diet\ is \curd.txt' \
1132 diet
\"is
\" curd.txt höde-tröge.txt \
1133 höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt \
1134 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1135 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1136 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1137 cksum_test content
:14 "${MBOX}" '1106643854 2453'
1139 printf "Resend ${BODY}\nx\n" |
1140 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -f "${MBOX}"
1141 cksum_test content
:14-2 "${MBOX}" '1106643854 2453'
1143 ${rm} -f "${BODY}" "${MBOX}"
1147 if have_feat DEVEL; then
1148 ARGS="${ARGS} -Smemdebug"
1155 if [ -z "${CHECK_ONLY}" ]; then
1161 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'