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}
172 csum
="`${sed} -e '/^From /d' \
173 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
174 -e '/^\[-- Message/d' | ${cksum}`";
175 if [ "${csum}" = "${s}" ]; then
179 printf 'error: checksum mismatch (got %s)\n' "${csum}"
184 ( "${SNAIL}" ${ARGS} -X'echo $features' -Xx | ${grep} +${1} ) >/dev/null 2>&1
188 # Basic (easily testable) behaviour tests
190 __behave_x_opt_input_command_stack
195 # FIXME __behave_alias
197 # FIXME __behave_mlist
199 have_feat smime && __behave_smime
202 __behave_x_opt_input_command_stack() {
203 ${rm} -f "${BODY}" "${MBOX}"
204 ${cat} <<- '__EOT' > "${BODY}"
212 echo "define mac1 {";\
213 echo " echo mac1-1";\
215 echo " echo mac1-2";\
217 echo " echo mac1-3";\
220 echo "define mac2 {";\
221 echo " echo mac2-1";\
223 echo " echo mac2-2";\
228 echo "wysh source \"\
241 # The -X option supports multiline arguments, and those can internally use
242 # reverse solidus newline escaping. And all -X options are joined...
244 < "${BODY}" "${SNAIL}" ${ARGS} \
258 wysh source '${APO}'\
259 echo "define mac1 {";\
260 echo " echo mac1-1";\
262 echo " echo mac1-2";\
264 echo " echo mac1-3";\
267 echo "define mac2 {";\
268 echo " echo mac2-1";\
270 echo " echo mac2-2";\
275 echo "wysh source \"\
288 ' > "${MBOX}" 2>/dev/null
289 cksum_test behave:x_opt_input_command_stack "${MBOX}" '270940651 240'
293 # Nestable conditions test
294 ${rm} -f "${BODY}" "${MBOX}"
295 ${cat} <<- '__EOT' > "${BODY}"
314 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
315 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
316 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
318 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
319 echo a$'\u0041\u41\u0C1\U00000041\U41'c
342 echo a$'b\U0000000'dt
343 echo a$'b\U00000000'du
353 if [ -z "${UTF8_LOCALE}" ]; then
354 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
356 < "${BODY}" DIET=CURD TIED= \
357 LC_ALL=${UTF8_LOCALE} "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
373 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
374 #aCURDbc${DIET}d${TIED}e
375 #a${DIET}b${TIED}cCURDde
404 cksum_test behave:wysh_unicode "${MBOX}" '475805847 317'
407 < "${BODY}" DIET=CURD TIED= "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
423 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
424 #aCURDbc${DIET}d${TIED}e
425 #a${DIET}b${TIED}cCURDde
454 cksum_test behave:wysh_c "${MBOX}" '1473887148 321'
455 ${rm} -f "${BODY}" "${MBOX}"
459 # Nestable conditions test
461 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
483 if $dietcurd == 'yoho'
488 if $dietcurd != 'yoho'
549 if $dietcurd == 'yohu'
551 elif $dietcurd == 'yoha'
553 elif $dietcurd == 'yohe'
555 elif $dietcurd == 'yoho'
557 if $dietcurd == 'yohu'
559 elif $dietcurd == 'yoha'
561 elif $dietcurd == 'yohe'
563 elif $dietcurd == 'yoho'
565 if $dietcurd == 'yohu'
567 elif $dietcurd == 'yoha'
569 elif $dietcurd == 'yohe'
571 elif $dietcurd == 'yoho'
582 # integer conversion, <..>..
685 set diet=abc curd=abc
691 set diet=abc curd=abcd
697 # 1. Shitty grouping capabilities as of today
698 unset diet curd ndefined
699 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
705 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
710 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
715 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
720 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
725 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
731 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
736 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
741 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
746 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
751 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
756 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
761 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
766 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
771 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
776 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
782 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
788 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
793 # 2. Shitty grouping capabilities as of today
794 unset diet curd ndefined
795 if [ false || false || true ] && [ false || true ] && yes
800 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
805 if [ 1 || 0 || 0 || 0 ]
810 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
815 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
820 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
825 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
830 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
835 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
840 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
845 if 1 || 0 || 0 || 0 && 0
850 if 1 || 0 || 0 || 0 && 1
855 if 0 || 0 || 0 || 1 && 0
860 if 0 || 0 || 0 || 1 && 1
865 if 0 || 0 || 0 || 1 && 0 || 1 && 0
870 if 0 || 0 || 0 || 1 && 0 || 1 && 1
876 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
881 if $diet == 'yo' && $curd == 'ho' && $ndefined
887 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
892 if $diet == 'yo' && $curd == 'ho' && $ndefined
897 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
902 # Some more en-braced variables
904 if ${diet} == ${curd}
909 if ${diet} != ${curd}
925 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
930 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
935 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
940 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
945 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
950 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
955 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
960 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
965 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
971 if ! 0 && ! ! 1 && ! ! ! 0 && 3
976 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
981 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
986 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
991 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
996 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1001 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1006 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1011 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1017 cksum_test behave:if-normal "${MBOX}" '557629289 631'
1019 if have_feat regex; then
1021 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1023 if $dietcurd =~ '^yo.*'
1028 if $dietcurd =~ '^yoho.+'
1033 if $dietcurd !~ '.*ho$'
1038 if $dietcurd !~ '.+yoho$'
1043 if [ $dietcurd !~ '.+yoho$' ]
1048 if ! [ $dietcurd =~ '.+yoho$' ]
1053 if ! ! [ $dietcurd !~ '.+yoho$' ]
1058 if ! [ ! [ $dietcurd !~ '.+yoho$' ] ]
1063 if [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1068 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1073 if ! ! ! $dietcurd !~ '.+yoho$'
1078 if ! ! ! $dietcurd =~ '.+yoho$'
1083 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1088 set diet=abc curd='^abc$'
1094 set diet=abc curd='^abcd$'
1101 cksum_test behave:if-regex "${MBOX}" '439960016 81'
1105 __behave_localopts() {
1106 # Nestable conditions test
1108 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1123 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1128 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1129 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1138 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1140 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1146 #gv1 lv1 lv2 lv3 gv2, t2
1154 #gv1 lv1 lv2 lv3 gv2, t2
1157 #active trouble: gv1 gv2,
1159 cksum_test behave:localopts "${MBOX}" '1936527193 192'
1162 __behave_smime() { # FIXME add test/ dir, unroll tests therein, regular enable!
1163 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1164 ${cat} <<-_EOT > ./t.conf
1167 default_keyfile = keyfile.pem
1168 distinguished_name = req_distinguished_name
1169 attributes = req_attributes
1173 [ req_distinguished_name ]
1180 emailAddress = test@localhost
1185 openssl req -x509 -nodes -days 3650 -config ./t.conf \
1186 -newkey rsa:1024 -keyout ./tkey.pem -out ./tcert.pem >/dev/null 2>&1
1188 ${cat} ./tkey.pem ./tcert.pem > ./tpair.pem
1190 printf "behave:s/mime:sign/verify: "
1191 echo bla | "${SNAIL}" ${ARGS} \
1192 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1193 -Ssmime-sign -Sfrom=test@localhost \
1194 -s 'S/MIME test' ./VERIFY
1195 printf 'verify\nx\n' |
1196 "${SNAIL}" ${ARGS} \
1197 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1198 -Ssmime-sign -Sfrom=test@localhost \
1199 -Sbatch-exit-on-error -R \
1200 -f ./VERIFY >/dev/null 2>&1
1201 if [ $? -eq 0 ]; then
1205 printf 'error: verification failed\n'
1206 ${rm} -f ./VERIFY ./tkey.pem ./tcert.pem ./tpair.pem
1211 # (signing +) encryption / decryption
1212 ${cat} <<-_EOT > ./tsendmail.sh
1214 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > .
/ENCRYPT
1216 chmod 0755 .
/tsendmail.sh
1218 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1220 "${SNAIL}" ${ARGS} \
1221 -Ssmime-force-encryption \
1222 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1223 -Smta=.
/tsendmail.sh \
1224 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1225 -Ssmime-sign -Sfrom=test@localhost \
1226 -s 'S/MIME test' recei@ver.com
1228 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
1229 "${SNAIL}" ${ARGS} \
1230 -Ssmime-force-encryption \
1231 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1232 -Smta=.
/tsendmail.sh \
1233 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1234 -Ssmime-sign -Sfrom=test@localhost \
1235 -Sbatch-exit-on-error -R \
1236 -f .
/ENCRYPT
>/dev
/null
2>&1
1237 if [ $?
-eq 0 ]; then
1241 printf 'error: decryption+verification failed\n'
1243 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1245 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1246 < .
/DECRYPT
> .
/ENCRYPT
1247 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
1250 printf "behave:s/mime:encrypt/decrypt: "
1251 echo bla |
"${SNAIL}" ${ARGS} \
1252 -Ssmime-force-encryption \
1253 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1254 -Smta=.
/tsendmail.sh \
1255 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1256 -Sfrom=test@localhost \
1257 -s 'S/MIME test' recei@ver.com
1258 printf 'decrypt ./DECRYPT\nx\n' |
"${SNAIL}" ${ARGS} \
1259 -Ssmime-force-encryption \
1260 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1261 -Smta=.
/tsendmail.sh \
1262 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1263 -Sfrom=test@localhost \
1264 -Sbatch-exit-on-error -R \
1265 -f .
/ENCRYPT
>/dev
/null
2>&1
1266 if [ $?
-eq 0 ]; then
1270 printf 'error: decryption failed\n'
1273 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1274 < .
/DECRYPT
> .
/ENCRYPT
1275 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
1277 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
1278 .
/tkey.pem .
/tcert.pem .
/tpair.pem
1282 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1283 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1284 # Note we unfortunately need to place some statements without proper
1285 # indentation because of continuation problems
1287 ${rm} -f "${BODY}" "${MBOX}"
1289 # MIME encoding (QP) stress message body
1291 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1292 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1293 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
1294 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
1295 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
1296 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
1297 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
1298 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
1299 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
1300 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
1301 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
1302 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
1303 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
1304 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
1305 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
1306 "auf den zeilen vorher.
\r\n"\
1307 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
1309 "Die letzte Zeile war nur ein Punkt.
\r\n"\
1311 "Das waren deren zwei.
\r\n"\
1313 "Die letzte Zeile war ein Leerschritt.
\n"\
1314 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
1317 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
1319 "Das waren deren zwei. ditto.
\n"\
1321 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
1322 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
1323 "auf den zeilen vorher.
\n"\
1325 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
1326 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
1328 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1330 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1332 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1334 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1336 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1338 "QP am Zeilenende über soft-nl hinweg
\n"\
1339 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1341 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1343 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1345 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1347 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
1349 "Die letzte Zeile war ein Leerschritt.
\n"\
1353 # MIME encoding (QP) stress message subject
1354 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
1355 adadaddsssssssddddddddddddddddddddd\
1356 ddddddddddddddddddddddddddddddddddd\
1357 ddddddddddddddddddddddddddddddddddd\
1358 dddddddddddddddddddd Hallelulja? Od\
1359 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1360 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1361 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1362 fffffffffffffffffffffffffffffffffff\
1363 fffffffffffffffffffff ggggggggggggg\
1364 ggggggggggggggggggggggggggggggggggg\
1365 ggggggggggggggggggggggggggggggggggg\
1366 ggggggggggggggggggggggggggggggggggg\
1369 # Three tests for MIME encodign and (a bit) content classification.
1370 # At the same time testing -q FILE, < FILE and -t FILE
1373 < "${BODY}" "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1374 -a "${BODY}" -s "${SUB}" "${MBOX}"
1375 cksum_test content
:001 "${MBOX}" '2886124440 6413'
1378 < /dev
/null
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1379 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
1380 cksum_test content:002 "${MBOX}" '2886124440 6413'
1383 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1385 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
1386 cksum_test content:003 "${MBOX}" '2886124440 6413'
1388 # Test for [260e19d] (Juergen Daubert)
1390 echo body | "${SNAIL}" ${ARGS} "${MBOX}"
1391 cksum_test content:004 "${MBOX}" '4004005686 49'
1393 # Sending of multiple mails in a single invocation
1395 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
1396 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
1398 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI}
1399 cksum_test content
:005 "${MBOX}" '2157252578 260'
1403 # "Test for" [d6f316a] (Gavin Troy)
1405 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
1406 "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="${cat}" > "${BODY}"
1407 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1408 cksum_test content:006 "${MBOX}" '2273863401 83'
1410 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1413 for(i = 0; i < 10000; ++i)
1415 #printf "\xF0\x90\x87\x90"
1416 }' | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
1417 cksum_test content:007 "${MBOX}" '1754234717 61767'
1419 ## Test some more corner cases for header bodies (as good as we can today) ##
1423 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1424 -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̲' \
1426 cksum_test content
:008 "${MBOX}" '4279661351 326'
1428 # Single word (overlong line split -- bad standard! Requires injection of
1429 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1431 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1432 echo |
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1433 cksum_test content
:009 "${MBOX}" '223283022 1669'
1435 # Combination of encoded words, space and tabs of varying sort
1437 echo |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1438 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
1439 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
1440 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
1441 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
1442 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
1444 cksum_test content:010 "${MBOX}" '2637105063 542'
1446 # Overlong multibyte sequence that must be forcefully split
1447 # todo This works even before v15.0, but only by accident
1449 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1450 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1451 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1452 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1454 cksum_test content
:011 "${MBOX}" '979048840 610'
1458 echo |
"${SNAIL}" ${ARGS} \
1459 -s "1-1 B2 B3 B4 B5 B6 B\
1460 1-2 B2 B3 B4 B5 B6 B\
1461 1-3 B2 B3 B4 B5 B6 B\
1462 1-4 B2 B3 B4 B5 B6 B\
1463 1-5 B2 B3 B4 B5 B6 B\
1464 1-6 B2 B3 B4 B5 B6 " \
1466 cksum_test content
:012 "${MBOX}" '1497528261 248'
1468 # Leading and trailing WS
1470 echo |
"${SNAIL}" ${ARGS} \
1471 -s " 2-1 B2 B3 B4 B5 B6 B\
1472 1-2 B2 B3 B4 B5 B6 B\
1473 1-3 B2 B3 B4 B5 B6 B\
1474 1-4 B2 B3 B4 B5 B6 " \
1476 cksum_test content
:013 "${MBOX}" '1588208111 187'
1478 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1479 # have a (better) test framework materialize a quick shot
1483 : > 'diet\ is \curd.txt'
1484 : > 'diet "is" curd.txt'
1486 : > 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
1487 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1488 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1489 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1490 echo bla |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1491 -a "ma
'ger.txt" -a "mä'ger.txt
" \
1492 -a 'diet\ is \curd.txt' -a 'diet "is
" curd.txt' \
1494 -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 \
1495 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1496 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1497 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1499 ${rm} -f "ma
'ger.txt" "mä'ger.txt
" 'diet\ is \curd.txt' \
1500 'diet "is
" curd.txt' höde-tröge.txt \
1501 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 \
1502 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1503 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1504 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1505 cksum_test content:14 "${MBOX}" '589846634 2491'
1507 printf "Resend
${BODY}\nx\n" | "${SNAIL}" ${ARGS} -f "${MBOX}"
1508 cksum_test content:14-2 "${MBOX}" '589846634 2491'
1510 ${rm} -f "${BODY}" "${MBOX}"
1514 if have_feat devel
; then
1515 ARGS
="${ARGS} -Smemdebug"
1522 if [ -z "${CHECK_ONLY}" ]; then
1528 [ ${ESTAT} -eq 0 ] && echo Ok ||
echo >&2 'Errors occurred'