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
31 # Problem: force $SHELL to be a real shell. It seems some testing environments
32 # use nologin(?), but we need a real shell for command execution
33 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
34 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
42 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
48 [ "${1}" = --check-only ] || usage
49 [ ${#} -gt 2 ] && usage
50 [ ${#} -eq 2 ] && SNAIL
="${2}"
51 [ -x "${SNAIL}" ] || usage
56 # Test all configs TODO doesn't cover all *combinations*, stupid!
60 NOTME["WANT_AUTOCC"] = 1
61 NOTME["WANT_DEBUG"] = 1
62 NOTME["WANT_DEVEL"] = 1
63 NOTME["WANT_NOEXTMD5"] = 1
64 NOTME["WANT_NOALLOCA"] = 1
65 NOTME["WANT_NOMEMDBG"] = 1
66 NOTME["WANT_NYD2"] = 1
69 /^[[:space:]]*WANT_/ {
70 sub(/^[[:space:]]*/, "")
71 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
72 # does not seem to be a compliant escape for =
74 $1 = substr($1, 1, index($1, "=") - 1)
80 # Doing this completely sequentially and not doing make distclean in
81 # between runs should effectively result in lesser compilations.
82 # It is completely dumb nonetheless... TODO
83 for (j = 1; j < i; ++j) {
84 for (k = 1; k < j; ++k)
86 for (k = j; k < i; ++k)
88 printf "WANT_AUTOCC=1\n"
90 for (j = 1; j < i; ++j) {
91 for (k = 1; k < j; ++k)
93 for (k = j; k < i; ++k)
95 printf "WANT_AUTOCC=1\n"
98 for (j = 1; j < i; ++j) {
99 for (k = 1; k < j; ++k)
101 for (k = j; k < i; ++k)
103 printf "WANT_AUTOCC=1\n"
104 printf "WANT_DEBUG=1\n"
106 for (j = 1; j < i; ++j) {
107 for (k = 1; k < j; ++k)
109 for (k = j; k < i; ++k)
111 printf "WANT_AUTOCC=1\n"
112 printf "WANT_DEBUG=1\n"
115 printf "CONFIG=NULL WANT_AUTOCC=0\n"
116 printf "CONFIG=NULL WANT_AUTOCC=1\n"
117 printf "CONFIG=NULLI WANT_AUTOCC=0\n"
118 printf "CONFIG=NULLI WANT_AUTOCC=1\n"
119 printf "CONFIG=MINIMAL WANT_AUTOCC=0\n"
120 printf "CONFIG=MINIMAL WANT_AUTOCC=1\n"
121 printf "CONFIG=MEDIUM WANT_AUTOCC=0\n"
122 printf "CONFIG=MEDIUM WANT_AUTOCC=1\n"
123 printf "CONFIG=NETSEND WANT_AUTOCC=0\n"
124 printf "CONFIG=NETSEND WANT_AUTOCC=1\n"
125 printf "CONFIG=MAXIMAL WANT_AUTOCC=0\n"
126 printf "CONFIG=MAXIMAL WANT_AUTOCC=1\n"
127 printf "CONFIG=DEVEL WANT_AUTOCC=0\n"
128 printf "CONFIG=DEVEL WANT_AUTOCC=1\n"
129 printf "CONFIG=ODEVEL WANT_AUTOCC=0\n"
130 printf "CONFIG=ODEVEL WANT_AUTOCC=1\n"
133 printf "\n\n##########\n$c\n"
134 printf "\n\n##########\n$c\n" >&2
142 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
143 # cksum(1) of the resulting data and compare against the checksum $3
145 tid
=${1} f=${2} s=${3}
147 csum
="`${sed} -e '/^From /d' -e '/^Date: /d' \
148 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
149 -e '/^\[-- Message/d' | ${cksum}`";
150 if [ "${csum}" = "${s}" ]; then
154 printf 'error: checksum mismatch (got %s)\n' "${csum}"
161 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} |
167 # Basic (easily testable) behaviour tests
171 printf 'echo +nix\nset folder=/\necho +nix\nset nofolder\necho +nix\nx' |
172 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} > "${MBOX}"
173 cksum_test behave
:001 "${MBOX}" '4214021069 15'
175 # POSIX: setting *noprompt*/prompt='' shall prevent prompting TODO
176 # TODO for this to be testable we need a way to echo a variable
177 # TODO or to force echo of the prompt
181 # FIXME __behave_alias
183 # FIXME __behave_mlist
185 have_feat SSL
/TLS
&& have_feat S
/MIME
&& __behave_smime
189 # Nestable conditions test
191 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
213 if $dietcurd == 'yoho'
218 if $dietcurd != 'yoho'
279 if $dietcurd == 'yohu'
281 elif $dietcurd == 'yoha'
283 elif $dietcurd == 'yohe'
285 elif $dietcurd == 'yoho'
287 if $dietcurd == 'yohu'
289 elif $dietcurd == 'yoha'
291 elif $dietcurd == 'yohe'
293 elif $dietcurd == 'yoho'
295 if $dietcurd == 'yohu'
297 elif $dietcurd == 'yoha'
299 elif $dietcurd == 'yohe'
301 elif $dietcurd == 'yoho'
312 # integer conversion, <..>..
415 set diet=abc curd=abc
421 set diet=abc curd=abcd
427 # 1. Shitty grouping capabilities as of today
428 unset diet curd ndefined
429 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
435 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
440 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
445 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
450 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
455 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
461 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
466 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
471 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
476 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
481 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
486 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
491 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
496 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
501 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
506 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
512 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
518 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
523 # 2. Shitty grouping capabilities as of today
524 unset diet curd ndefined
525 if [ false || false || true ] && [ false || true ] && yes
530 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
535 if [ 1 || 0 || 0 || 0 ]
540 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
545 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
550 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
555 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
560 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
565 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
570 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
575 if 1 || 0 || 0 || 0 && 0
580 if 1 || 0 || 0 || 0 && 1
585 if 0 || 0 || 0 || 1 && 0
590 if 0 || 0 || 0 || 1 && 1
595 if 0 || 0 || 0 || 1 && 0 || 1 && 0
600 if 0 || 0 || 0 || 1 && 0 || 1 && 1
606 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
611 if $diet == 'yo' && $curd == 'ho' && $ndefined
617 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
622 if $diet == 'yo' && $curd == 'ho' && $ndefined
627 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
632 # Some more en-braced variables
634 if ${diet} == ${curd}
639 if ${diet} != ${curd}
655 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
660 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
665 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
670 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
675 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
680 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
685 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
690 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
695 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
701 if ! 0 && ! ! 1 && ! ! ! 0 && 3
706 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
711 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
716 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
721 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
726 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
731 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
736 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
741 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
747 cksum_test behave:if-normal "${MBOX}" '557629289 631'
749 if have_feat REGEX; then
751 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
753 if $dietcurd =~
'^yo.*'
758 if $dietcurd =~
'^yoho.+'
763 if $dietcurd !~
'.*ho$'
768 if $dietcurd !~
'.+yoho$'
773 if [ $dietcurd !~
'.+yoho$' ]
778 if ! [ $dietcurd =~
'.+yoho$' ]
783 if ! ! [ $dietcurd !~
'.+yoho$' ]
788 if ! [ ! [ $dietcurd !~
'.+yoho$' ] ]
793 if [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
798 if ! [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
803 if ! ! ! $dietcurd !~
'.+yoho$'
808 if ! ! ! $dietcurd =~
'.+yoho$'
813 if ! [ ! ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
818 set diet
=abc curd
='^abc$'
824 set diet
=abc curd
='^abcd$'
831 cksum_test behave
:if-regex
"${MBOX}" '439960016 81'
835 __behave_smime
() { # FIXME add test/ dir, unroll tests therein, regular enable!
836 printf 'behave:s/mime: .. generating test key and certificate ..\n'
837 ${cat} <<-_EOT > ./t.conf
840 default_keyfile = keyfile.pem
841 distinguished_name = req_distinguished_name
842 attributes = req_attributes
846 [ req_distinguished_name ]
853 emailAddress = test@localhost
858 openssl req
-x509 -nodes -days 3650 -config .
/t.conf \
859 -newkey rsa
:1024 -keyout .
/tkey.pem
-out .
/tcert.pem
>/dev
/null
2>&1
861 ${cat} .
/tkey.pem .
/tcert.pem
> .
/tpair.pem
863 printf "behave:s/mime:sign/verify: "
865 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
866 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
867 -Ssmime-sign -Sfrom=test@localhost \
868 -s 'S/MIME test' .
/VERIFY
870 printf 'verify\nx\n' |
871 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
872 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
873 -Ssmime-sign -Sfrom=test@localhost \
874 -Sbatch-exit-on-error -R \
875 -f .
/VERIFY
>/dev
/null
2>&1
876 if [ $?
-eq 0 ]; then
880 printf 'error: verification failed\n'
881 ${rm} -f .
/VERIFY .
/tkey.pem .
/tcert.pem .
/tpair.pem
886 # (signing +) encryption / decryption
887 ${cat} <<-_EOT > ./tsendmail.sh
889 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./ENCRYPT
891 chmod 0755 .
/tsendmail.sh
893 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
895 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
896 -Ssmime-force-encryption \
897 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
898 -Ssendmail=.
/tsendmail.sh \
899 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
900 -Ssmime-sign -Sfrom=test@localhost \
901 -s 'S/MIME test' recei@ver.com
903 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
904 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
905 -Ssmime-force-encryption \
906 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
907 -Ssendmail=.
/tsendmail.sh \
908 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
909 -Ssmime-sign -Sfrom=test@localhost \
910 -Sbatch-exit-on-error -R \
911 -f .
/ENCRYPT
>/dev
/null
2>&1
912 if [ $?
-eq 0 ]; then
916 printf 'error: decryption+verification failed\n'
918 ${sed} -e '/^X-Decoding-Date/d' \
920 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
921 < .
/DECRYPT
> .
/ENCRYPT
922 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
925 printf "behave:s/mime:encrypt/decrypt: "
927 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
928 -Ssmime-force-encryption \
929 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
930 -Ssendmail=.
/tsendmail.sh \
931 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
932 -Sfrom=test@localhost \
933 -s 'S/MIME test' recei@ver.com
934 printf 'decrypt ./DECRYPT\nx\n' |
935 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
936 -Ssmime-force-encryption \
937 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
938 -Ssendmail=.
/tsendmail.sh \
939 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
940 -Sfrom=test@localhost \
941 -Sbatch-exit-on-error -R \
942 -f .
/ENCRYPT
>/dev
/null
2>&1
943 if [ $?
-eq 0 ]; then
947 printf 'error: decryption failed\n'
950 ${sed} -e '/^X-Decoding-Date/d' \
951 < .
/DECRYPT
> .
/ENCRYPT
952 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
954 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
955 .
/tkey.pem .
/tcert.pem .
/tpair.pem
959 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
960 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
961 # Note we unfortunately need to place some statements without proper
962 # indentation because of continuation problems
964 ${rm} -f "${BODY}" "${MBOX}"
966 # MIME encoding (QP) stress message body
968 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
969 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
970 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
971 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
972 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
973 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
974 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
975 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
976 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
977 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
978 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
979 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
980 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
981 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
982 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
983 "auf den zeilen vorher.
\r\n"\
984 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
986 "Die letzte Zeile war nur ein Punkt.
\r\n"\
988 "Das waren deren zwei.
\r\n"\
990 "Die letzte Zeile war ein Leerschritt.
\n"\
991 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
994 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
996 "Das waren deren zwei. ditto.
\n"\
998 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
999 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
1000 "auf den zeilen vorher.
\n"\
1002 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
1003 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
1005 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1007 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1009 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1011 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1013 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1015 "QP am Zeilenende über soft-nl hinweg
\n"\
1016 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1018 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1020 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1022 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1024 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
1026 "Die letzte Zeile war ein Leerschritt.
\n"\
1030 # MIME encoding (QP) stress message subject
1031 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
1032 adadaddsssssssddddddddddddddddddddd\
1033 ddddddddddddddddddddddddddddddddddd\
1034 ddddddddddddddddddddddddddddddddddd\
1035 dddddddddddddddddddd Hallelulja? Od\
1036 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1037 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1038 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1039 fffffffffffffffffffffffffffffffffff\
1040 fffffffffffffffffffff ggggggggggggg\
1041 ggggggggggggggggggggggggggggggggggg\
1042 ggggggggggggggggggggggggggggggggggg\
1043 ggggggggggggggggggggggggggggggggggg\
1046 # Three tests for MIME encodign and (a bit) content classification.
1047 # At the same time testing -q FILE, < FILE and -t FILE
1049 # TODO Note: because of our weird putline() handling in <-> collect.c
1051 < "${BODY}" MAILRC=/dev/null \
1052 "${SNAIL}" -nSstealthmua -Sexpandaddr -a "${BODY}" -s "${SUB}" "${MBOX}"
1053 cksum_test content:001-0 "${MBOX}" '3310338268 6375'
1056 < "${BODY}" MAILRC=/dev/null \
1057 "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -s "${SUB}" "${MBOX}"
1058 cksum_test content:001 "${MBOX}" '62505451 6374'
1061 < /dev/null MAILRC=/dev/null \
1062 "${SNAIL}" ${ARGS} -a "${BODY}" -s "${SUB}" \
1063 -q "${BODY}" "${MBOX}"
1064 cksum_test content:002 "${MBOX}" '3310338268 6375'
1067 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1069 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -t
1070 cksum_test content:003 "${MBOX}" '62505451 6374'
1072 # Test for [260e19d] (Juergen Daubert)
1074 echo body | MAILRC=/dev/null "${SNAIL}" ${ARGS} "${MBOX}"
1075 cksum_test content:004 "${MBOX}" '3729232114 11'
1077 # Sending of multiple mails in a single invocation
1079 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
1080 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
1082 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS}
1083 cksum_test content:005 "${MBOX}" '773028641 184'
1087 # "Test
for" [d6f316a] (Gavin Troy)
1089 printf "m
${MBOX}\n~s subject1
\nEmail body
\n~.
\nfi
${MBOX}\np
\nx
\n" |
1090 MAILRC=/dev/null "${SNAIL}" ${ARGS} \
1091 -Spipe-text/plain="${cat}" > "${BODY}"
1092 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1093 cksum_test content
:006 "${MBOX}" '654030565 45'
1095 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1096 # TODO Note: because of our weird putline() handling in <-> collect.c
1098 LC_ALL
=C
${awk} 'BEGIN{
1099 for(i = 0; i < 10000; ++i)
1101 #printf "\xF0\x90\x87\x90"
1103 MAILRC
=/dev
/null
"${SNAIL}" -nSstealthmua -Sexpandaddr \
1104 -s TestSubject
"${MBOX}"
1105 cksum_test content
:007-0 "${MBOX}" '2747333583 61729'
1108 LC_ALL
=C
${awk} 'BEGIN{
1109 for(i = 0; i < 10000; ++i)
1111 #printf "\xF0\x90\x87\x90"
1113 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s TestSubject "${MBOX}"
1114 cksum_test content
:007 "${MBOX}" '3343002941 61728'
1116 ## Test some more corner cases for header bodies (as good as we can today) ##
1121 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1122 -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̲' \
1124 cksum_test content
:008 "${MBOX}" '3872015771 288'
1126 # Single word (overlong line split -- bad standard! Requires injection of
1127 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1129 i
=`LC_ALL=C ${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1130 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1131 cksum_test content
:009 "${MBOX}" '2048460448 1631'
1133 # Combination of encoded words, space and tabs of varying sort
1135 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1136 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
1137 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
1138 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
1139 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
1140 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
1142 cksum_test content
:010 "${MBOX}" '1272213842 504'
1144 # Overlong multibyte sequence that must be forcefully split
1145 # todo This works even before v15.0, but only by accident
1147 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1148 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1149 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1150 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1152 cksum_test content
:011 "${MBOX}" '2972351879 572'
1157 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1158 -s "1-1 B2 B3 B4 B5 B6 B\
1159 1-2 B2 B3 B4 B5 B6 B\
1160 1-3 B2 B3 B4 B5 B6 B\
1161 1-4 B2 B3 B4 B5 B6 B\
1162 1-5 B2 B3 B4 B5 B6 B\
1163 1-6 B2 B3 B4 B5 B6 " \
1165 cksum_test content
:012 "${MBOX}" '2467265470 210'
1167 # Leading and trailing WS
1170 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1171 -s " 2-1 B2 B3 B4 B5 B6 B\
1172 1-2 B2 B3 B4 B5 B6 B\
1173 1-3 B2 B3 B4 B5 B6 B\
1174 1-4 B2 B3 B4 B5 B6 " \
1176 cksum_test content
:013 "${MBOX}" '4119922611 149'
1178 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1179 # have a (better) test framework materialize a quick shot
1183 : > 'diet\ is \curd.txt'
1184 : > diet
\"is
\" curd.txt
1186 : > 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
1187 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1188 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1189 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1191 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -Snodot \
1192 -a "ma'ger.txt" -a "mä'ger.txt" \
1193 -a 'diet\\\ is\ \\curd.txt' -a diet
\"is
\" curd.txt \
1195 -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 \
1196 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1197 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1198 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1200 ${rm} -f "ma'ger.txt" "mä'ger.txt" 'diet\ is \curd.txt' \
1201 diet
\"is
\" curd.txt höde-tröge.txt \
1202 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 \
1203 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1204 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1205 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1206 cksum_test content
:14 "${MBOX}" '1106643854 2453'
1208 printf "Resend ${BODY}\nx\n" |
1209 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -f "${MBOX}"
1210 cksum_test content
:14-2 "${MBOX}" '1106643854 2453'
1212 ${rm} -f "${BODY}" "${MBOX}"
1216 if have_feat DEVEL; then
1217 ARGS="${ARGS} -Smemdebug"
1224 if [ -z "${CHECK_ONLY}" ]; then
1230 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'