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 #active trouble: gv1 gv2,
1069 cksum_test behave:localopts "${MBOX}" '1936527193 192'
1072 __behave_smime() { # FIXME add test/ dir, unroll tests therein, regular enable!
1073 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1074 ${cat} <<-_EOT > ./t.conf
1077 default_keyfile = keyfile.pem
1078 distinguished_name = req_distinguished_name
1079 attributes = req_attributes
1083 [ req_distinguished_name ]
1090 emailAddress = test@localhost
1095 openssl req -x509 -nodes -days 3650 -config ./t.conf \
1096 -newkey rsa:1024 -keyout ./tkey.pem -out ./tcert.pem >/dev/null 2>&1
1098 ${cat} ./tkey.pem ./tcert.pem > ./tpair.pem
1100 printf "behave:s/mime:sign/verify: "
1101 echo bla | "${SNAIL}" ${ARGS} \
1102 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1103 -Ssmime-sign -Sfrom=test@localhost \
1104 -s 'S/MIME test' ./VERIFY
1105 printf 'verify\nx\n' |
1106 "${SNAIL}" ${ARGS} \
1107 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1108 -Ssmime-sign -Sfrom=test@localhost \
1109 -Sbatch-exit-on-error -R \
1110 -f ./VERIFY >/dev/null 2>&1
1111 if [ $? -eq 0 ]; then
1115 printf 'error: verification failed\n'
1116 ${rm} -f ./VERIFY ./tkey.pem ./tcert.pem ./tpair.pem
1121 # (signing +) encryption / decryption
1122 ${cat} <<-_EOT > ./tsendmail.sh
1124 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > .
/ENCRYPT
1126 chmod 0755 .
/tsendmail.sh
1128 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1130 "${SNAIL}" ${ARGS} \
1131 -Ssmime-force-encryption \
1132 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1133 -Smta=.
/tsendmail.sh \
1134 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1135 -Ssmime-sign -Sfrom=test@localhost \
1136 -s 'S/MIME test' recei@ver.com
1138 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
1139 "${SNAIL}" ${ARGS} \
1140 -Ssmime-force-encryption \
1141 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1142 -Smta=.
/tsendmail.sh \
1143 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1144 -Ssmime-sign -Sfrom=test@localhost \
1145 -Sbatch-exit-on-error -R \
1146 -f .
/ENCRYPT
>/dev
/null
2>&1
1147 if [ $?
-eq 0 ]; then
1151 printf 'error: decryption+verification failed\n'
1153 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1155 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1156 < .
/DECRYPT
> .
/ENCRYPT
1157 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
1160 printf "behave:s/mime:encrypt/decrypt: "
1161 echo bla |
"${SNAIL}" ${ARGS} \
1162 -Ssmime-force-encryption \
1163 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1164 -Smta=.
/tsendmail.sh \
1165 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1166 -Sfrom=test@localhost \
1167 -s 'S/MIME test' recei@ver.com
1168 printf 'decrypt ./DECRYPT\nx\n' |
"${SNAIL}" ${ARGS} \
1169 -Ssmime-force-encryption \
1170 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1171 -Smta=.
/tsendmail.sh \
1172 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1173 -Sfrom=test@localhost \
1174 -Sbatch-exit-on-error -R \
1175 -f .
/ENCRYPT
>/dev
/null
2>&1
1176 if [ $?
-eq 0 ]; then
1180 printf 'error: decryption failed\n'
1183 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1184 < .
/DECRYPT
> .
/ENCRYPT
1185 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
1187 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
1188 .
/tkey.pem .
/tcert.pem .
/tpair.pem
1192 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1193 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1194 # Note we unfortunately need to place some statements without proper
1195 # indentation because of continuation problems
1197 ${rm} -f "${BODY}" "${MBOX}"
1199 # MIME encoding (QP) stress message body
1201 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1202 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1203 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
1204 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
1205 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
1206 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
1207 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
1208 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
1209 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
1210 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
1211 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
1212 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
1213 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
1214 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
1215 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
1216 "auf den zeilen vorher.
\r\n"\
1217 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
1219 "Die letzte Zeile war nur ein Punkt.
\r\n"\
1221 "Das waren deren zwei.
\r\n"\
1223 "Die letzte Zeile war ein Leerschritt.
\n"\
1224 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
1227 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
1229 "Das waren deren zwei. ditto.
\n"\
1231 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
1232 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
1233 "auf den zeilen vorher.
\n"\
1235 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
1236 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
1238 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
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 "QP am Zeilenende über soft-nl hinweg
\n"\
1249 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
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 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
1259 "Die letzte Zeile war ein Leerschritt.
\n"\
1263 # MIME encoding (QP) stress message subject
1264 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
1265 adadaddsssssssddddddddddddddddddddd\
1266 ddddddddddddddddddddddddddddddddddd\
1267 ddddddddddddddddddddddddddddddddddd\
1268 dddddddddddddddddddd Hallelulja? Od\
1269 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1270 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1271 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1272 fffffffffffffffffffffffffffffffffff\
1273 fffffffffffffffffffff ggggggggggggg\
1274 ggggggggggggggggggggggggggggggggggg\
1275 ggggggggggggggggggggggggggggggggggg\
1276 ggggggggggggggggggggggggggggggggggg\
1279 # Three tests for MIME encodign and (a bit) content classification.
1280 # At the same time testing -q FILE, < FILE and -t FILE
1283 < "${BODY}" "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1284 -a "${BODY}" -s "${SUB}" "${MBOX}"
1285 cksum_test content
:001 "${MBOX}" '2886124440 6413'
1288 < /dev
/null
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1289 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
1290 cksum_test content:002 "${MBOX}" '2886124440 6413'
1293 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1295 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
1296 cksum_test content:003 "${MBOX}" '2886124440 6413'
1298 # Test for [260e19d] (Juergen Daubert)
1300 echo body | "${SNAIL}" ${ARGS} "${MBOX}"
1301 cksum_test content:004 "${MBOX}" '4004005686 49'
1303 # Sending of multiple mails in a single invocation
1305 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
1306 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
1308 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI}
1309 cksum_test content
:005 "${MBOX}" '2157252578 260'
1313 # "Test for" [d6f316a] (Gavin Troy)
1315 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
1316 "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="${cat}" > "${BODY}"
1317 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1318 cksum_test content:006 "${MBOX}" '2273863401 83'
1320 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1323 for(i = 0; i < 10000; ++i)
1325 #printf "\xF0\x90\x87\x90"
1326 }' | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
1327 cksum_test content:007 "${MBOX}" '1754234717 61767'
1329 ## Test some more corner cases for header bodies (as good as we can today) ##
1333 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1334 -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̲' \
1336 cksum_test content
:008 "${MBOX}" '4279661351 326'
1338 # Single word (overlong line split -- bad standard! Requires injection of
1339 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1341 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1342 echo |
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1343 cksum_test content
:009 "${MBOX}" '223283022 1669'
1345 # Combination of encoded words, space and tabs of varying sort
1347 echo |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1348 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
1349 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
1350 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
1351 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
1352 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
1354 cksum_test content:010 "${MBOX}" '2637105063 542'
1356 # Overlong multibyte sequence that must be forcefully split
1357 # todo This works even before v15.0, but only by accident
1359 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1360 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1361 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1362 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1364 cksum_test content
:011 "${MBOX}" '979048840 610'
1368 echo |
"${SNAIL}" ${ARGS} \
1369 -s "1-1 B2 B3 B4 B5 B6 B\
1370 1-2 B2 B3 B4 B5 B6 B\
1371 1-3 B2 B3 B4 B5 B6 B\
1372 1-4 B2 B3 B4 B5 B6 B\
1373 1-5 B2 B3 B4 B5 B6 B\
1374 1-6 B2 B3 B4 B5 B6 " \
1376 cksum_test content
:012 "${MBOX}" '1497528261 248'
1378 # Leading and trailing WS
1380 echo |
"${SNAIL}" ${ARGS} \
1381 -s " 2-1 B2 B3 B4 B5 B6 B\
1382 1-2 B2 B3 B4 B5 B6 B\
1383 1-3 B2 B3 B4 B5 B6 B\
1384 1-4 B2 B3 B4 B5 B6 " \
1386 cksum_test content
:013 "${MBOX}" '1588208111 187'
1388 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1389 # have a (better) test framework materialize a quick shot
1393 : > 'diet\ is \curd.txt'
1394 : > 'diet "is" curd.txt'
1396 : > 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
1397 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1398 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1399 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1400 echo bla |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1401 -a "ma
'ger.txt" -a "mä'ger.txt
" \
1402 -a 'diet\ is \curd.txt' -a 'diet "is
" curd.txt' \
1404 -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 \
1405 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1406 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1407 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1409 ${rm} -f "ma
'ger.txt" "mä'ger.txt
" 'diet\ is \curd.txt' \
1410 'diet "is
" curd.txt' höde-tröge.txt \
1411 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 \
1412 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1413 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1414 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1415 cksum_test content:14 "${MBOX}" '589846634 2491'
1417 printf "Resend
${BODY}\nx\n" | "${SNAIL}" ${ARGS} -f "${MBOX}"
1418 cksum_test content:14-2 "${MBOX}" '589846634 2491'
1420 ${rm} -f "${BODY}" "${MBOX}"
1424 if have_feat
+devel
; then
1425 ARGS
="${ARGS} -Smemdebug"
1432 if [ -z "${CHECK_ONLY}" ]; then
1438 [ ${ESTAT} -eq 0 ] && echo Ok ||
echo >&2 'Errors occurred'