2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
5 ARGS
='-:/ -# -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
10 #UTF8_LOCALE= autodetected unless set
12 if ( command -v command ) >/dev
/null
2>&1; then :; else
19 MAKE
="${MAKE:-`command -v make`}"
20 awk=${awk:-`command -v awk`}
21 cat=${cat:-`command -v cat`}
22 cksum=${cksum:-`command -v cksum`}
23 rm=${rm:-`command -v rm`}
24 sed=${sed:-`command -v sed`}
25 grep=${grep:-`command -v grep`}
29 export SNAIL ARGS CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
31 LC_ALL
=C LANG
=C ADDARG_UNI
=-Sttycharset=UTF-8
33 # Wed Oct 2 01:50:07 UTC 1996
34 SOURCE_DATE_EPOCH
=844221007
36 export LC_ALL LANG ADDARG_UNI TZ SOURCE_DATE_EPOCH
38 # Problem: force $SHELL to be a real shell. It seems some testing environments
39 # use nologin(?), but we need a real shell for command execution
40 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
41 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
46 if [ -z "${UTF8_LOCALE}" ]; then
48 if command -v locale
>/dev
/null
2>&1; then
49 UTF8_LOCALE
=`locale -a | { m=
51 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
53 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
67 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
73 [ "${1}" = --check-only ] || usage
74 [ ${#} -gt 2 ] && usage
75 [ ${#} -eq 2 ] && SNAIL
="${2}"
76 [ -x "${SNAIL}" ] || usage
81 # Test all configs TODO doesn't cover all *combinations*, stupid!
85 NOTME["OPT_AUTOCC"] = 1
86 NOTME["OPT_DEBUG"] = 1
87 NOTME["OPT_DEVEL"] = 1
88 NOTME["OPT_NOEXTMD5"] = 1
89 NOTME["OPT_NOALLOCA"] = 1
90 NOTME["OPT_NOMEMDBG"] = 1
95 sub(/^[[:space:]]*/, "")
96 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
97 # does not seem to be a compliant escape for =
99 $1 = substr($1, 1, index($1, "=") - 1)
105 # Doing this completely sequentially and not doing make distclean in
106 # between runs should effectively result in lesser compilations.
107 # It is completely dumb nonetheless... TODO
108 for (j = 1; j < i; ++j) {
109 for (k = 1; k < j; ++k)
111 for (k = j; k < i; ++k)
113 printf "OPT_AUTOCC=1\n"
115 for (j = 1; j < i; ++j) {
116 for (k = 1; k < j; ++k)
118 for (k = j; k < i; ++k)
120 printf "OPT_AUTOCC=1\n"
123 for (j = 1; j < i; ++j) {
124 for (k = 1; k < j; ++k)
126 for (k = j; k < i; ++k)
128 printf "OPT_AUTOCC=1\n"
129 printf "OPT_DEBUG=1\n"
131 for (j = 1; j < i; ++j) {
132 for (k = 1; k < j; ++k)
134 for (k = j; k < i; ++k)
136 printf "OPT_AUTOCC=1\n"
137 printf "OPT_DEBUG=1\n"
140 printf "CONFIG=NULL OPT_AUTOCC=0\n"
141 printf "CONFIG=NULL OPT_AUTOCC=1\n"
142 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
143 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
144 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
145 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
146 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
147 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
148 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
149 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
150 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
151 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
152 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
153 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
154 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
155 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
158 printf "\n\n##########\n$c\n"
159 printf "\n\n##########\n$c\n" >&2
167 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
168 # cksum(1) of the resulting data and compare against the checksum $3
170 tid
=${1} f=${2} s=${3}
173 csum
="`${sed} -e '/^From /d' \
174 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
175 -e '/^\[-- Message/d' | ${cksum}`";
176 if [ "${csum}" = "${s}" ]; then
180 printf 'error: checksum mismatch (got %s)\n' "${csum}"
185 ( "${SNAIL}" ${ARGS} -Xversion -Xx | ${grep} ${1} ) >/dev/null 2>&1
189 # Basic (easily testable) behaviour tests
195 # FIXME __behave_alias
197 # FIXME __behave_mlist
199 have_feat +smime && __behave_smime
203 # Nestable conditions test
204 ${rm} -f "${BODY}" "${MBOX}"
205 ${cat} <<- '__EOT' > "${BODY}"
224 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
225 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
226 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
228 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
229 echo a$'\u0041\u41\u0C1\U00000041\U41'c
252 echo a$'b\U0000000'dt
253 echo a$'b\U00000000'du
263 if [ -z "${UTF8_LOCALE}" ]; then
264 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
266 < "${BODY}" DIET=CURD TIED= \
267 LC_ALL=${UTF8_LOCALE} "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
283 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
284 #aCURDbc${DIET}d${TIED}e
285 #a${DIET}b${TIED}cCURDde
314 cksum_test behave:wysh_unicode "${MBOX}" '475805847 317'
317 < "${BODY}" DIET=CURD TIED= "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
333 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
334 #aCURDbc${DIET}d${TIED}e
335 #a${DIET}b${TIED}cCURDde
364 cksum_test behave:wysh_c "${MBOX}" '1473887148 321'
365 ${rm} -f "${BODY}" "${MBOX}"
369 # Nestable conditions test
371 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
393 if $dietcurd == 'yoho'
398 if $dietcurd != 'yoho'
459 if $dietcurd == 'yohu'
461 elif $dietcurd == 'yoha'
463 elif $dietcurd == 'yohe'
465 elif $dietcurd == 'yoho'
467 if $dietcurd == 'yohu'
469 elif $dietcurd == 'yoha'
471 elif $dietcurd == 'yohe'
473 elif $dietcurd == 'yoho'
475 if $dietcurd == 'yohu'
477 elif $dietcurd == 'yoha'
479 elif $dietcurd == 'yohe'
481 elif $dietcurd == 'yoho'
492 # integer conversion, <..>..
595 set diet=abc curd=abc
601 set diet=abc curd=abcd
607 # 1. Shitty grouping capabilities as of today
608 unset diet curd ndefined
609 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
615 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
620 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
625 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
630 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
635 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
641 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
646 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
651 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
656 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
661 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
666 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
671 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
676 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
681 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
686 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
692 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
698 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
703 # 2. Shitty grouping capabilities as of today
704 unset diet curd ndefined
705 if [ false || false || true ] && [ false || true ] && yes
710 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
715 if [ 1 || 0 || 0 || 0 ]
720 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
725 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
730 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
735 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
740 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
745 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
750 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
755 if 1 || 0 || 0 || 0 && 0
760 if 1 || 0 || 0 || 0 && 1
765 if 0 || 0 || 0 || 1 && 0
770 if 0 || 0 || 0 || 1 && 1
775 if 0 || 0 || 0 || 1 && 0 || 1 && 0
780 if 0 || 0 || 0 || 1 && 0 || 1 && 1
786 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
791 if $diet == 'yo' && $curd == 'ho' && $ndefined
797 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
802 if $diet == 'yo' && $curd == 'ho' && $ndefined
807 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
812 # Some more en-braced variables
814 if ${diet} == ${curd}
819 if ${diet} != ${curd}
835 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
840 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
845 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
850 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
855 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
860 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
865 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
870 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
875 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
881 if ! 0 && ! ! 1 && ! ! ! 0 && 3
886 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
891 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
896 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
901 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
906 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
911 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
916 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
921 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
927 cksum_test behave:if-normal "${MBOX}" '557629289 631'
929 if have_feat +regex; then
931 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
933 if $dietcurd =~ '^yo.*'
938 if $dietcurd =~ '^yoho.+'
943 if $dietcurd !~ '.*ho$'
948 if $dietcurd !~ '.+yoho$'
953 if [ $dietcurd !~ '.+yoho$' ]
958 if ! [ $dietcurd =~ '.+yoho$' ]
963 if ! ! [ $dietcurd !~ '.+yoho$' ]
968 if ! [ ! [ $dietcurd !~ '.+yoho$' ] ]
973 if [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
978 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
983 if ! ! ! $dietcurd !~ '.+yoho$'
988 if ! ! ! $dietcurd =~ '.+yoho$'
993 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
998 set diet=abc curd='^abc$'
1004 set diet=abc curd='^abcd$'
1011 cksum_test behave:if-regex "${MBOX}" '439960016 81'
1015 __behave_localopts() {
1016 # Nestable conditions test
1018 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1033 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1038 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1039 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1048 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1050 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1056 #gv1 lv1 lv2 lv3 gv2, t2
1064 #gv1 lv1 lv2 lv3 gv2, t2
1067 #/dev/null: 0 messages
1068 #active trouble: gv1 gv2,
1069 #/dev/null: 0 messages
1071 cksum_test behave:localopts "${MBOX}" '2679576177 236'
1074 __behave_smime() { # FIXME add test/ dir, unroll tests therein, regular enable!
1075 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1076 ${cat} <<-_EOT > ./t.conf
1079 default_keyfile = keyfile.pem
1080 distinguished_name = req_distinguished_name
1081 attributes = req_attributes
1085 [ req_distinguished_name ]
1092 emailAddress = test@localhost
1097 openssl req -x509 -nodes -days 3650 -config ./t.conf \
1098 -newkey rsa:1024 -keyout ./tkey.pem -out ./tcert.pem >/dev/null 2>&1
1100 ${cat} ./tkey.pem ./tcert.pem > ./tpair.pem
1102 printf "behave:s/mime:sign/verify: "
1103 echo bla | "${SNAIL}" ${ARGS} \
1104 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1105 -Ssmime-sign -Sfrom=test@localhost \
1106 -s 'S/MIME test' ./VERIFY
1107 printf 'verify\nx\n' |
1108 "${SNAIL}" ${ARGS} \
1109 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1110 -Ssmime-sign -Sfrom=test@localhost \
1111 -Sbatch-exit-on-error -R \
1112 -f ./VERIFY >/dev/null 2>&1
1113 if [ $? -eq 0 ]; then
1117 printf 'error: verification failed\n'
1118 ${rm} -f ./VERIFY ./tkey.pem ./tcert.pem ./tpair.pem
1123 # (signing +) encryption / decryption
1124 ${cat} <<-_EOT > ./tsendmail.sh
1126 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > .
/ENCRYPT
1128 chmod 0755 .
/tsendmail.sh
1130 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1132 "${SNAIL}" ${ARGS} \
1133 -Ssmime-force-encryption \
1134 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1135 -Smta=.
/tsendmail.sh \
1136 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1137 -Ssmime-sign -Sfrom=test@localhost \
1138 -s 'S/MIME test' recei@ver.com
1140 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
1141 "${SNAIL}" ${ARGS} \
1142 -Ssmime-force-encryption \
1143 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1144 -Smta=.
/tsendmail.sh \
1145 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1146 -Ssmime-sign -Sfrom=test@localhost \
1147 -Sbatch-exit-on-error -R \
1148 -f .
/ENCRYPT
>/dev
/null
2>&1
1149 if [ $?
-eq 0 ]; then
1153 printf 'error: decryption+verification failed\n'
1155 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1157 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1158 < .
/DECRYPT
> .
/ENCRYPT
1159 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
1162 printf "behave:s/mime:encrypt/decrypt: "
1163 echo bla |
"${SNAIL}" ${ARGS} \
1164 -Ssmime-force-encryption \
1165 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1166 -Smta=.
/tsendmail.sh \
1167 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1168 -Sfrom=test@localhost \
1169 -s 'S/MIME test' recei@ver.com
1170 printf 'decrypt ./DECRYPT\nx\n' |
"${SNAIL}" ${ARGS} \
1171 -Ssmime-force-encryption \
1172 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1173 -Smta=.
/tsendmail.sh \
1174 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1175 -Sfrom=test@localhost \
1176 -Sbatch-exit-on-error -R \
1177 -f .
/ENCRYPT
>/dev
/null
2>&1
1178 if [ $?
-eq 0 ]; then
1182 printf 'error: decryption failed\n'
1185 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1186 < .
/DECRYPT
> .
/ENCRYPT
1187 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
1189 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
1190 .
/tkey.pem .
/tcert.pem .
/tpair.pem
1194 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1195 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1196 # Note we unfortunately need to place some statements without proper
1197 # indentation because of continuation problems
1199 ${rm} -f "${BODY}" "${MBOX}"
1201 # MIME encoding (QP) stress message body
1203 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1204 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1205 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
1206 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
1207 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
1208 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
1209 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
1210 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
1211 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
1212 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
1213 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
1214 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
1215 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
1216 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
1217 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
1218 "auf den zeilen vorher.
\r\n"\
1219 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
1221 "Die letzte Zeile war nur ein Punkt.
\r\n"\
1223 "Das waren deren zwei.
\r\n"\
1225 "Die letzte Zeile war ein Leerschritt.
\n"\
1226 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
1229 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
1231 "Das waren deren zwei. ditto.
\n"\
1233 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
1234 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
1235 "auf den zeilen vorher.
\n"\
1237 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
1238 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
1240 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1242 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1244 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1246 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1248 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1250 "QP am Zeilenende über soft-nl hinweg
\n"\
1251 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1253 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1255 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1257 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1259 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
1261 "Die letzte Zeile war ein Leerschritt.
\n"\
1265 # MIME encoding (QP) stress message subject
1266 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
1267 adadaddsssssssddddddddddddddddddddd\
1268 ddddddddddddddddddddddddddddddddddd\
1269 ddddddddddddddddddddddddddddddddddd\
1270 dddddddddddddddddddd Hallelulja? Od\
1271 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1272 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1273 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1274 fffffffffffffffffffffffffffffffffff\
1275 fffffffffffffffffffff ggggggggggggg\
1276 ggggggggggggggggggggggggggggggggggg\
1277 ggggggggggggggggggggggggggggggggggg\
1278 ggggggggggggggggggggggggggggggggggg\
1281 # Three tests for MIME encodign and (a bit) content classification.
1282 # At the same time testing -q FILE, < FILE and -t FILE
1285 < "${BODY}" "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1286 -a "${BODY}" -s "${SUB}" "${MBOX}"
1287 cksum_test content
:001 "${MBOX}" '2886124440 6413'
1290 < /dev
/null
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1291 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
1292 cksum_test content:002 "${MBOX}" '2886124440 6413'
1295 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1297 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
1298 cksum_test content:003 "${MBOX}" '2886124440 6413'
1300 # Test for [260e19d] (Juergen Daubert)
1302 echo body | "${SNAIL}" ${ARGS} "${MBOX}"
1303 cksum_test content:004 "${MBOX}" '4004005686 49'
1305 # Sending of multiple mails in a single invocation
1307 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
1308 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
1310 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI}
1311 cksum_test content
:005 "${MBOX}" '2157252578 260'
1315 # "Test for" [d6f316a] (Gavin Troy)
1317 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
1318 "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="${cat}" > "${BODY}"
1319 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1320 cksum_test content:006 "${MBOX}" '2273863401 83'
1322 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1325 for(i = 0; i < 10000; ++i)
1327 #printf "\xF0\x90\x87\x90"
1328 }' | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
1329 cksum_test content:007 "${MBOX}" '1754234717 61767'
1331 ## Test some more corner cases for header bodies (as good as we can today) ##
1335 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1336 -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̲' \
1338 cksum_test content
:008 "${MBOX}" '4279661351 326'
1340 # Single word (overlong line split -- bad standard! Requires injection of
1341 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1343 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1344 echo |
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1345 cksum_test content
:009 "${MBOX}" '223283022 1669'
1347 # Combination of encoded words, space and tabs of varying sort
1349 echo |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1350 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
1351 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
1352 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
1353 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
1354 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
1356 cksum_test content:010 "${MBOX}" '2637105063 542'
1358 # Overlong multibyte sequence that must be forcefully split
1359 # todo This works even before v15.0, but only by accident
1361 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1362 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1363 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1364 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1366 cksum_test content
:011 "${MBOX}" '979048840 610'
1370 echo |
"${SNAIL}" ${ARGS} \
1371 -s "1-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 B\
1375 1-5 B2 B3 B4 B5 B6 B\
1376 1-6 B2 B3 B4 B5 B6 " \
1378 cksum_test content
:012 "${MBOX}" '1497528261 248'
1380 # Leading and trailing WS
1382 echo |
"${SNAIL}" ${ARGS} \
1383 -s " 2-1 B2 B3 B4 B5 B6 B\
1384 1-2 B2 B3 B4 B5 B6 B\
1385 1-3 B2 B3 B4 B5 B6 B\
1386 1-4 B2 B3 B4 B5 B6 " \
1388 cksum_test content
:013 "${MBOX}" '1588208111 187'
1390 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1391 # have a (better) test framework materialize a quick shot
1395 : > 'diet\ is \curd.txt'
1396 : > 'diet "is" curd.txt'
1398 : > 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
1399 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1400 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1401 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1402 echo bla |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1403 -a "ma
'ger.txt" -a "mä'ger.txt
" \
1404 -a 'diet\ is \curd.txt' -a 'diet "is
" curd.txt' \
1406 -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 \
1407 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1408 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1409 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1411 ${rm} -f "ma
'ger.txt" "mä'ger.txt
" 'diet\ is \curd.txt' \
1412 'diet "is
" curd.txt' höde-tröge.txt \
1413 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 \
1414 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1415 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1416 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1417 cksum_test content:14 "${MBOX}" '589846634 2491'
1419 printf "Resend
${BODY}\nx\n" | "${SNAIL}" ${ARGS} -f "${MBOX}"
1420 cksum_test content:14-2 "${MBOX}" '589846634 2491'
1422 ${rm} -f "${BODY}" "${MBOX}"
1426 if have_feat
+devel
; then
1427 ARGS
="${ARGS} -Smemdebug"
1434 if [ -z "${CHECK_ONLY}" ]; then
1440 [ ${ESTAT} -eq 0 ] && echo Ok ||
echo >&2 'Errors occurred'