2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
5 ARGS
='-:/ -# -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
11 if ( command -v command ) >/dev
/null
2>&1; then :; else
18 MAKE
="${MAKE:-`command -v make`}"
19 awk=${awk:-`command -v awk`}
20 cat=${cat:-`command -v cat`}
21 cksum=${cksum:-`command -v cksum`}
22 rm=${rm:-`command -v rm`}
23 sed=${sed:-`command -v sed`}
24 grep=${grep:-`command -v grep`}
26 if [ -z "${UTF8_LOCALE}" ]; then
28 if command -v locale
>/dev
/null
2>&1; then
29 UTF8_LOCALE
=`(locale -a | ${grep} -i utf8 | uniq) 2>/dev/null`
35 export SNAIL ARGS CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
37 LC_ALL
=C LANG
=C ADDARG_UNI
=-Sttycharset=UTF-8
39 # Wed Oct 2 01:50:07 UTC 1996
40 SOURCE_DATE_EPOCH
=844221007
42 export LC_ALL LANG ADDARG_UNI TZ SOURCE_DATE_EPOCH
44 # Problem: force $SHELL to be a real shell. It seems some testing environments
45 # use nologin(?), but we need a real shell for command execution
46 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
47 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
55 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
61 [ "${1}" = --check-only ] || usage
62 [ ${#} -gt 2 ] && usage
63 [ ${#} -eq 2 ] && SNAIL
="${2}"
64 [ -x "${SNAIL}" ] || usage
69 # Test all configs TODO doesn't cover all *combinations*, stupid!
73 NOTME["OPT_AUTOCC"] = 1
74 NOTME["OPT_DEBUG"] = 1
75 NOTME["OPT_DEVEL"] = 1
76 NOTME["OPT_NOEXTMD5"] = 1
77 NOTME["OPT_NOALLOCA"] = 1
78 NOTME["OPT_NOMEMDBG"] = 1
83 sub(/^[[:space:]]*/, "")
84 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
85 # does not seem to be a compliant escape for =
87 $1 = substr($1, 1, index($1, "=") - 1)
93 # Doing this completely sequentially and not doing make distclean in
94 # between runs should effectively result in lesser compilations.
95 # It is completely dumb nonetheless... TODO
96 for (j = 1; j < i; ++j) {
97 for (k = 1; k < j; ++k)
99 for (k = j; k < i; ++k)
101 printf "OPT_AUTOCC=1\n"
103 for (j = 1; j < i; ++j) {
104 for (k = 1; k < j; ++k)
106 for (k = j; k < i; ++k)
108 printf "OPT_AUTOCC=1\n"
111 for (j = 1; j < i; ++j) {
112 for (k = 1; k < j; ++k)
114 for (k = j; k < i; ++k)
116 printf "OPT_AUTOCC=1\n"
117 printf "OPT_DEBUG=1\n"
119 for (j = 1; j < i; ++j) {
120 for (k = 1; k < j; ++k)
122 for (k = j; k < i; ++k)
124 printf "OPT_AUTOCC=1\n"
125 printf "OPT_DEBUG=1\n"
128 printf "CONFIG=NULL OPT_AUTOCC=0\n"
129 printf "CONFIG=NULL OPT_AUTOCC=1\n"
130 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
131 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
132 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
133 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
134 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
135 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
136 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
137 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
138 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
139 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
140 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
141 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
142 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
143 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
146 printf "\n\n##########\n$c\n"
147 printf "\n\n##########\n$c\n" >&2
155 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
156 # cksum(1) of the resulting data and compare against the checksum $3
158 tid
=${1} f=${2} s=${3}
161 csum
="`${sed} -e '/^From /d' \
162 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
163 -e '/^\[-- Message/d' | ${cksum}`";
164 if [ "${csum}" = "${s}" ]; then
168 printf 'error: checksum mismatch (got %s)\n' "${csum}"
173 ( echo 'feat' |
"${SNAIL}" ${ARGS} | ${grep} ${1} ) >/dev/null 2>&1
177 # Basic (easily testable) behaviour tests
183 # FIXME __behave_alias
185 # FIXME __behave_mlist
187 have_feat SSL/TLS && have_feat S/MIME && __behave_smime
191 # Nestable conditions test
192 ${rm} -f "${BODY}" "${MBOX}"
193 ${cat} <<- '__EOT' > "${BODY}"
212 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
213 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
214 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
216 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
217 echo a$'\u0041\u41\u0C1\U00000041\U41'c
240 echo a$'b\U0000000'dt
241 echo a$'b\U00000000'du
251 if [ -z "${UTF8_LOCALE}" ]; then
252 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
254 < "${BODY}" DIET=CURD TIED= \
255 LC_ALL=${UTF8_LOCALE} "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
271 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
272 #aCURDbc${DIET}d${TIED}e
273 #a${DIET}b${TIED}cCURDde
302 cksum_test behave:wysh_unicode "${MBOX}" '475805847 317'
305 < "${BODY}" DIET=CURD TIED= "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
321 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
322 #aCURDbc${DIET}d${TIED}e
323 #a${DIET}b${TIED}cCURDde
352 cksum_test behave:wysh_c "${MBOX}" '1473887148 321'
353 ${rm} -f "${BODY}" "${MBOX}"
357 # Nestable conditions test
359 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
381 if $dietcurd == 'yoho'
386 if $dietcurd != 'yoho'
447 if $dietcurd == 'yohu'
449 elif $dietcurd == 'yoha'
451 elif $dietcurd == 'yohe'
453 elif $dietcurd == 'yoho'
455 if $dietcurd == 'yohu'
457 elif $dietcurd == 'yoha'
459 elif $dietcurd == 'yohe'
461 elif $dietcurd == 'yoho'
463 if $dietcurd == 'yohu'
465 elif $dietcurd == 'yoha'
467 elif $dietcurd == 'yohe'
469 elif $dietcurd == 'yoho'
480 # integer conversion, <..>..
583 set diet=abc curd=abc
589 set diet=abc curd=abcd
595 # 1. Shitty grouping capabilities as of today
596 unset diet curd ndefined
597 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
603 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
608 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
613 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
618 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
623 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
629 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
634 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
639 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
644 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
649 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
654 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
659 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
664 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
669 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
674 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
680 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
686 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
691 # 2. Shitty grouping capabilities as of today
692 unset diet curd ndefined
693 if [ false || false || true ] && [ false || true ] && yes
698 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
703 if [ 1 || 0 || 0 || 0 ]
708 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
713 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
718 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
723 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
728 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
733 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
738 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
743 if 1 || 0 || 0 || 0 && 0
748 if 1 || 0 || 0 || 0 && 1
753 if 0 || 0 || 0 || 1 && 0
758 if 0 || 0 || 0 || 1 && 1
763 if 0 || 0 || 0 || 1 && 0 || 1 && 0
768 if 0 || 0 || 0 || 1 && 0 || 1 && 1
774 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
779 if $diet == 'yo' && $curd == 'ho' && $ndefined
785 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
790 if $diet == 'yo' && $curd == 'ho' && $ndefined
795 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
800 # Some more en-braced variables
802 if ${diet} == ${curd}
807 if ${diet} != ${curd}
823 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
828 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
833 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
838 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
843 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
848 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
853 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
858 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
863 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
869 if ! 0 && ! ! 1 && ! ! ! 0 && 3
874 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
879 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
884 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
889 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
894 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
899 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
904 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
909 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
915 cksum_test behave:if-normal "${MBOX}" '557629289 631'
917 if have_feat REGEX; then
919 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
921 if $dietcurd =~ '^yo.*'
926 if $dietcurd =~ '^yoho.+'
931 if $dietcurd !~ '.*ho$'
936 if $dietcurd !~ '.+yoho$'
941 if [ $dietcurd !~ '.+yoho$' ]
946 if ! [ $dietcurd =~ '.+yoho$' ]
951 if ! ! [ $dietcurd !~ '.+yoho$' ]
956 if ! [ ! [ $dietcurd !~ '.+yoho$' ] ]
961 if [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
966 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
971 if ! ! ! $dietcurd !~ '.+yoho$'
976 if ! ! ! $dietcurd =~ '.+yoho$'
981 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
986 set diet=abc curd='^abc$'
992 set diet=abc curd='^abcd$'
999 cksum_test behave:if-regex "${MBOX}" '439960016 81'
1003 __behave_localopts() {
1004 # Nestable conditions test
1006 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1021 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1026 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1027 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1036 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1038 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1044 #gv1 lv1 lv2 lv3 gv2, t2
1052 #gv1 lv1 lv2 lv3 gv2, t2
1055 #/dev/null: 0 messages
1056 #active trouble: gv1 gv2,
1057 #/dev/null: 0 messages
1059 cksum_test behave:localopts "${MBOX}" '2679576177 236'
1062 __behave_smime() { # FIXME add test/ dir, unroll tests therein, regular enable!
1063 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1064 ${cat} <<-_EOT > ./t.conf
1067 default_keyfile = keyfile.pem
1068 distinguished_name = req_distinguished_name
1069 attributes = req_attributes
1073 [ req_distinguished_name ]
1080 emailAddress = test@localhost
1085 openssl req -x509 -nodes -days 3650 -config ./t.conf \
1086 -newkey rsa:1024 -keyout ./tkey.pem -out ./tcert.pem >/dev/null 2>&1
1088 ${cat} ./tkey.pem ./tcert.pem > ./tpair.pem
1090 printf "behave:s/mime:sign/verify: "
1091 echo bla | "${SNAIL}" ${ARGS} \
1092 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1093 -Ssmime-sign -Sfrom=test@localhost \
1094 -s 'S/MIME test' ./VERIFY
1095 printf 'verify\nx\n' |
1096 "${SNAIL}" ${ARGS} \
1097 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1098 -Ssmime-sign -Sfrom=test@localhost \
1099 -Sbatch-exit-on-error -R \
1100 -f ./VERIFY >/dev/null 2>&1
1101 if [ $? -eq 0 ]; then
1105 printf 'error: verification failed\n'
1106 ${rm} -f ./VERIFY ./tkey.pem ./tcert.pem ./tpair.pem
1111 # (signing +) encryption / decryption
1112 ${cat} <<-_EOT > ./tsendmail.sh
1114 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > .
/ENCRYPT
1116 chmod 0755 .
/tsendmail.sh
1118 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1120 "${SNAIL}" ${ARGS} \
1121 -Ssmime-force-encryption \
1122 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1123 -Smta=.
/tsendmail.sh \
1124 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1125 -Ssmime-sign -Sfrom=test@localhost \
1126 -s 'S/MIME test' recei@ver.com
1128 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
1129 "${SNAIL}" ${ARGS} \
1130 -Ssmime-force-encryption \
1131 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1132 -Smta=.
/tsendmail.sh \
1133 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1134 -Ssmime-sign -Sfrom=test@localhost \
1135 -Sbatch-exit-on-error -R \
1136 -f .
/ENCRYPT
>/dev
/null
2>&1
1137 if [ $?
-eq 0 ]; then
1141 printf 'error: decryption+verification failed\n'
1143 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1145 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1146 < .
/DECRYPT
> .
/ENCRYPT
1147 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
1150 printf "behave:s/mime:encrypt/decrypt: "
1151 echo bla |
"${SNAIL}" ${ARGS} \
1152 -Ssmime-force-encryption \
1153 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1154 -Smta=.
/tsendmail.sh \
1155 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1156 -Sfrom=test@localhost \
1157 -s 'S/MIME test' recei@ver.com
1158 printf 'decrypt ./DECRYPT\nx\n' |
"${SNAIL}" ${ARGS} \
1159 -Ssmime-force-encryption \
1160 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1161 -Smta=.
/tsendmail.sh \
1162 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1163 -Sfrom=test@localhost \
1164 -Sbatch-exit-on-error -R \
1165 -f .
/ENCRYPT
>/dev
/null
2>&1
1166 if [ $?
-eq 0 ]; then
1170 printf 'error: decryption failed\n'
1173 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1174 < .
/DECRYPT
> .
/ENCRYPT
1175 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
1177 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
1178 .
/tkey.pem .
/tcert.pem .
/tpair.pem
1182 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1183 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1184 # Note we unfortunately need to place some statements without proper
1185 # indentation because of continuation problems
1187 ${rm} -f "${BODY}" "${MBOX}"
1189 # MIME encoding (QP) stress message body
1191 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1192 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1193 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
1194 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
1195 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
1196 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
1197 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
1198 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
1199 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
1200 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
1201 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
1202 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
1203 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
1204 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
1205 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
1206 "auf den zeilen vorher.
\r\n"\
1207 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
1209 "Die letzte Zeile war nur ein Punkt.
\r\n"\
1211 "Das waren deren zwei.
\r\n"\
1213 "Die letzte Zeile war ein Leerschritt.
\n"\
1214 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
1217 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
1219 "Das waren deren zwei. ditto.
\n"\
1221 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
1222 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
1223 "auf den zeilen vorher.
\n"\
1225 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
1226 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
1228 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1230 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1232 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1234 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1236 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1238 "QP am Zeilenende über soft-nl hinweg
\n"\
1239 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1241 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1243 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1245 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1247 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
1249 "Die letzte Zeile war ein Leerschritt.
\n"\
1253 # MIME encoding (QP) stress message subject
1254 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
1255 adadaddsssssssddddddddddddddddddddd\
1256 ddddddddddddddddddddddddddddddddddd\
1257 ddddddddddddddddddddddddddddddddddd\
1258 dddddddddddddddddddd Hallelulja? Od\
1259 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1260 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1261 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1262 fffffffffffffffffffffffffffffffffff\
1263 fffffffffffffffffffff ggggggggggggg\
1264 ggggggggggggggggggggggggggggggggggg\
1265 ggggggggggggggggggggggggggggggggggg\
1266 ggggggggggggggggggggggggggggggggggg\
1269 # Three tests for MIME encodign and (a bit) content classification.
1270 # At the same time testing -q FILE, < FILE and -t FILE
1273 < "${BODY}" "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1274 -a "${BODY}" -s "${SUB}" "${MBOX}"
1275 cksum_test content
:001 "${MBOX}" '2886124440 6413'
1278 < /dev
/null
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1279 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
1280 cksum_test content:002 "${MBOX}" '2886124440 6413'
1283 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1285 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
1286 cksum_test content:003 "${MBOX}" '2886124440 6413'
1288 # Test for [260e19d] (Juergen Daubert)
1290 echo body | "${SNAIL}" ${ARGS} "${MBOX}"
1291 cksum_test content:004 "${MBOX}" '4004005686 49'
1293 # Sending of multiple mails in a single invocation
1295 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
1296 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
1298 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI}
1299 cksum_test content
:005 "${MBOX}" '2157252578 260'
1303 # "Test for" [d6f316a] (Gavin Troy)
1305 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
1306 "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="${cat}" > "${BODY}"
1307 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1308 cksum_test content:006 "${MBOX}" '2273863401 83'
1310 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1313 for(i = 0; i < 10000; ++i)
1315 #printf "\xF0\x90\x87\x90"
1316 }' | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
1317 cksum_test content:007 "${MBOX}" '1754234717 61767'
1319 ## Test some more corner cases for header bodies (as good as we can today) ##
1323 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1324 -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̲' \
1326 cksum_test content
:008 "${MBOX}" '4279661351 326'
1328 # Single word (overlong line split -- bad standard! Requires injection of
1329 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1331 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1332 echo |
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1333 cksum_test content
:009 "${MBOX}" '223283022 1669'
1335 # Combination of encoded words, space and tabs of varying sort
1337 echo |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1338 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
1339 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
1340 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
1341 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
1342 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
1344 cksum_test content:010 "${MBOX}" '2637105063 542'
1346 # Overlong multibyte sequence that must be forcefully split
1347 # todo This works even before v15.0, but only by accident
1349 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1350 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1351 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1352 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1354 cksum_test content
:011 "${MBOX}" '979048840 610'
1358 echo |
"${SNAIL}" ${ARGS} \
1359 -s "1-1 B2 B3 B4 B5 B6 B\
1360 1-2 B2 B3 B4 B5 B6 B\
1361 1-3 B2 B3 B4 B5 B6 B\
1362 1-4 B2 B3 B4 B5 B6 B\
1363 1-5 B2 B3 B4 B5 B6 B\
1364 1-6 B2 B3 B4 B5 B6 " \
1366 cksum_test content
:012 "${MBOX}" '1497528261 248'
1368 # Leading and trailing WS
1370 echo |
"${SNAIL}" ${ARGS} \
1371 -s " 2-1 B2 B3 B4 B5 B6 B\
1372 1-2 B2 B3 B4 B5 B6 B\
1373 1-3 B2 B3 B4 B5 B6 B\
1374 1-4 B2 B3 B4 B5 B6 " \
1376 cksum_test content
:013 "${MBOX}" '1588208111 187'
1378 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1379 # have a (better) test framework materialize a quick shot
1383 : > 'diet\ is \curd.txt'
1384 : > 'diet "is" curd.txt'
1386 : > 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
1387 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1388 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1389 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1390 echo bla |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1391 -a "ma
'ger.txt" -a "mä'ger.txt
" \
1392 -a 'diet\ is \curd.txt' -a 'diet "is
" curd.txt' \
1394 -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 \
1395 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1396 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1397 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1399 ${rm} -f "ma
'ger.txt" "mä'ger.txt
" 'diet\ is \curd.txt' \
1400 'diet "is
" curd.txt' höde-tröge.txt \
1401 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 \
1402 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1403 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1404 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1405 cksum_test content:14 "${MBOX}" '589846634 2491'
1407 printf "Resend
${BODY}\nx\n" | "${SNAIL}" ${ARGS} -f "${MBOX}"
1408 cksum_test content:14-2 "${MBOX}" '589846634 2491'
1410 ${rm} -f "${BODY}" "${MBOX}"
1414 if have_feat DEVEL
; then
1415 ARGS
="${ARGS} -Smemdebug"
1422 if [ -z "${CHECK_ONLY}" ]; then
1428 [ ${ESTAT} -eq 0 ] && echo Ok ||
echo >&2 'Errors occurred'