2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
5 ARGS
='-n# -Sstealthmua -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 printf "behave:s/mime:encrypt/decrypt: "
827 ${cat} <<-_EOT > ./tsendmail.sh
829 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./ENCRYPT
831 chmod 0755 .
/tsendmail.sh
834 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
835 -Ssmime-force-encryption \
836 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
837 -Ssendmail=.
/tsendmail.sh \
838 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
839 -Ssmime-sign -Sfrom=test@localhost \
840 -s 'S/MIME test' recei@ver.com
842 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
843 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
844 -Ssmime-force-encryption \
845 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
846 -Ssendmail=.
/tsendmail.sh \
847 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
848 -Ssmime-sign -Sfrom=test@localhost \
849 -Sbatch-exit-on-error -R \
850 -f .
/ENCRYPT
>/dev
/null
2>&1
851 if [ $?
-eq 0 ]; then
855 printf 'error: decryption+verification failed\n'
857 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
858 .
/tkey.pem .
/tcert.pem .
/tpair.pem
862 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
863 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
864 # Note we unfortunately need to place some statements without proper
865 # indentation because of continuation problems
867 ${rm} -f "${BODY}" "${MBOX}"
869 # MIME encoding (QP) stress message body
871 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
872 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
873 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
874 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
875 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
876 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
877 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
878 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
879 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
880 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
881 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
882 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
883 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
884 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
885 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
886 "auf den zeilen vorher.
\r\n"\
887 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
889 "Die letzte Zeile war nur ein Punkt.
\r\n"\
891 "Das waren deren zwei.
\r\n"\
893 "Die letzte Zeile war ein Leerschritt.
\n"\
894 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
897 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
899 "Das waren deren zwei. ditto.
\n"\
901 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
902 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
903 "auf den zeilen vorher.
\n"\
905 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
906 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
908 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
910 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
912 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
914 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
916 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
918 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
920 "Die letzte Zeile war ein Leerschritt.
\n"\
924 # MIME encoding (QP) stress message subject
925 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
926 adadaddsssssssddddddddddddddddddddd\
927 ddddddddddddddddddddddddddddddddddd\
928 ddddddddddddddddddddddddddddddddddd\
929 dddddddddddddddddddd Hallelulja? Od\
930 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
931 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
932 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
933 fffffffffffffffffffffffffffffffffff\
934 fffffffffffffffffffff ggggggggggggg\
935 ggggggggggggggggggggggggggggggggggg\
936 ggggggggggggggggggggggggggggggggggg\
937 ggggggggggggggggggggggggggggggggggg\
940 # Three tests for MIME encodign and (a bit) content classification.
941 # At the same time testing -q FILE, < FILE and -t FILE
943 # TODO Note: because of our weird putline() handling in <-> collect.c
945 < "${BODY}" MAILRC=/dev/null \
946 "${SNAIL}" -nSstealthmua -Sexpandaddr -a "${BODY}" -s "${SUB}" "${MBOX}"
947 cksum_test content:001-0 "${MBOX}" '3498258986 5631'
950 < "${BODY}" MAILRC=/dev/null \
951 "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -s "${SUB}" "${MBOX}"
952 cksum_test content:001 "${MBOX}" '3916146590 5630'
955 < /dev/null MAILRC=/dev/null \
956 "${SNAIL}" ${ARGS} -a "${BODY}" -s "${SUB}" \
957 -q "${BODY}" "${MBOX}"
958 cksum_test content:002 "${MBOX}" '3498258986 5631'
961 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
963 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -t
964 cksum_test content:003 "${MBOX}" '3916146590 5630'
966 # Test for [260e19d] (Juergen Daubert)
968 echo body | MAILRC=/dev/null "${SNAIL}" ${ARGS} "${MBOX}"
969 cksum_test content:004 "${MBOX}" '4140682175 72'
971 # Sending of multiple mails in a single invocation
973 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n.
\n" &&
974 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n.
\n" &&
976 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS}
977 cksum_test content:005 "${MBOX}" '3503215815 245'
981 # "Test
for" [d6f316a] (Gavin Troy)
983 printf "m
${MBOX}\n~s subject1
\nEmail body
\n.
\nfi
${MBOX}\np
\nx
\n" |
984 MAILRC=/dev/null "${SNAIL}" ${ARGS} \
985 -Spipe-text/plain="${cat}" > "${BODY}"
986 ${sed} -e 1d < "${BODY}" > "${MBOX}"
987 cksum_test content
:006 "${MBOX}" '11112309 106'
989 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
990 # TODO Note: because of our weird putline() handling in <-> collect.c
992 LC_ALL
=C
${awk} 'BEGIN{
993 for(i = 0; i < 10000; ++i)
995 #printf "\xF0\x90\x87\x90"
997 MAILRC
=/dev
/null
"${SNAIL}" -nSstealthmua -Sexpandaddr \
998 -s TestSubject
"${MBOX}"
999 cksum_test content
:007-0 "${MBOX}" '2747333583 61729'
1002 LC_ALL
=C
${awk} 'BEGIN{
1003 for(i = 0; i < 10000; ++i)
1005 #printf "\xF0\x90\x87\x90"
1007 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s TestSubject "${MBOX}"
1008 cksum_test content
:007 "${MBOX}" '3343002941 61728'
1010 ## Test some more corner cases for header bodies (as good as we can today) ##
1015 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1016 -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̲' \
1018 cksum_test content
:008 "${MBOX}" '3872015771 288'
1020 # Single word (overlong line split -- bad standard! Requires injection of
1021 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1023 i
=`LC_ALL=C ${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1024 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1025 cksum_test content
:009 "${MBOX}" '2048460448 1631'
1027 # Combination of encoded words, space and tabs of varying sort
1029 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1030 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
1031 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
1032 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
1033 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
1034 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
1036 cksum_test content
:010 "${MBOX}" '1272213842 504'
1038 # Overlong multibyte sequence that must be forcefully split
1039 # todo This works even before v15.0, but only by accident
1041 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1042 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1043 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1044 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1046 cksum_test content
:011 "${MBOX}" '2972351879 572'
1051 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1052 -s "1-1 B2 B3 B4 B5 B6 B\
1053 1-2 B2 B3 B4 B5 B6 B\
1054 1-3 B2 B3 B4 B5 B6 B\
1055 1-4 B2 B3 B4 B5 B6 B\
1056 1-5 B2 B3 B4 B5 B6 B\
1057 1-6 B2 B3 B4 B5 B6 " \
1059 cksum_test content
:012 "${MBOX}" '1276108207 271'
1061 # Leading and trailing WS
1064 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1065 -s " 2-1 B2 B3 B4 B5 B6 B\
1066 1-2 B2 B3 B4 B5 B6 B\
1067 1-3 B2 B3 B4 B5 B6 B\
1068 1-4 B2 B3 B4 B5 B6 " \
1070 cksum_test content
:013 "${MBOX}" '3677630181 210'
1072 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1073 # have a (better) test framework materialize a quick shot
1077 : > 'diet\ is \curd.txt'
1078 : > diet
\"is
\" curd.txt
1080 : > 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
1081 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1082 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1083 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1085 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -Snodot \
1086 -a "ma'ger.txt" -a "mä'ger.txt" \
1087 -a 'diet\\\ is\ \\curd.txt' -a diet
\"is
\" curd.txt \
1089 -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 \
1090 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1091 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1092 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1094 ${rm} -f "ma'ger.txt" "mä'ger.txt" 'diet\ is \curd.txt' \
1095 diet
\"is
\" curd.txt höde-tröge.txt \
1096 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 \
1097 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1098 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1099 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1100 cksum_test content
:14 "${MBOX}" '1106643854 2453'
1102 ${rm} -f "${BODY}" "${MBOX}"
1106 if have_feat DEVEL; then
1107 ARGS="${ARGS} -Smemdebug"
1114 if [ -z "${CHECK_ONLY}" ]; then
1120 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'