2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
5 ARGS
='-n# -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
11 MAKE
="${MAKE:-`command -v make`}"
12 awk=${awk:-`command -v awk`}
13 cat=${cat:-`command -v cat`}
14 cksum=${cksum:-`command -v cksum`}
15 rm=${rm:-`command -v rm`}
16 sed=${sed:-`command -v sed`}
17 grep=${grep:-`command -v grep`}
21 export SNAIL ARGS CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
23 # NOTE! UnixWare 7.1.4 gives ISO-10646-Minimum-European-Subset for
24 # nl_langinfo(CODESET), then, so also overwrite ttycharset.
25 # (In addition this setup allows us to succeed on TinyCore 4.4 that has no
26 # other locales than C/POSIX installed by default!)
28 LC_ALL
=${LC} LANG
=${LC}
30 export LC_ALL LANG ttycharset
32 # Problem: force $SHELL to be a real shell. It seems some testing environments
33 # use nologin(?), but we need a real shell for command execution
34 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
35 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
43 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
49 [ "${1}" = --check-only ] || usage
50 [ ${#} -gt 2 ] && usage
51 [ ${#} -eq 2 ] && SNAIL
="${2}"
52 [ -x "${SNAIL}" ] || usage
57 # Test all configs TODO doesn't cover all *combinations*, stupid!
61 NOTME["WANT_AUTOCC"] = 1
62 NOTME["WANT_DEBUG"] = 1
63 NOTME["WANT_DEVEL"] = 1
64 NOTME["WANT_NOEXTMD5"] = 1
65 NOTME["WANT_NOALLOCA"] = 1
66 NOTME["WANT_NOMEMDBG"] = 1
67 NOTME["WANT_NYD2"] = 1
70 /^[[:space:]]*WANT_/ {
71 sub(/^[[:space:]]*/, "")
72 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
73 # does not seem to be a compliant escape for =
75 $1 = substr($1, 1, index($1, "=") - 1)
81 # Doing this completely sequentially and not doing make distclean in
82 # between runs should effectively result in lesser compilations.
83 # It is completely dumb nonetheless... TODO
84 for (j = 1; j < i; ++j) {
85 for (k = 1; k < j; ++k)
87 for (k = j; k < i; ++k)
89 printf "WANT_AUTOCC=1\n"
91 for (j = 1; j < i; ++j) {
92 for (k = 1; k < j; ++k)
94 for (k = j; k < i; ++k)
96 printf "WANT_AUTOCC=1\n"
99 for (j = 1; j < i; ++j) {
100 for (k = 1; k < j; ++k)
102 for (k = j; k < i; ++k)
104 printf "WANT_AUTOCC=1\n"
105 printf "WANT_DEBUG=1\n"
107 for (j = 1; j < i; ++j) {
108 for (k = 1; k < j; ++k)
110 for (k = j; k < i; ++k)
112 printf "WANT_AUTOCC=1\n"
113 printf "WANT_DEBUG=1\n"
116 printf "CONFIG=NULL WANT_AUTOCC=0\n"
117 printf "CONFIG=NULL WANT_AUTOCC=1\n"
118 printf "CONFIG=NULLI WANT_AUTOCC=0\n"
119 printf "CONFIG=NULLI WANT_AUTOCC=1\n"
120 printf "CONFIG=MINIMAL WANT_AUTOCC=0\n"
121 printf "CONFIG=MINIMAL WANT_AUTOCC=1\n"
122 printf "CONFIG=MEDIUM WANT_AUTOCC=0\n"
123 printf "CONFIG=MEDIUM WANT_AUTOCC=1\n"
124 printf "CONFIG=NETSEND WANT_AUTOCC=0\n"
125 printf "CONFIG=NETSEND WANT_AUTOCC=1\n"
126 printf "CONFIG=MAXIMAL WANT_AUTOCC=0\n"
127 printf "CONFIG=MAXIMAL WANT_AUTOCC=1\n"
128 printf "CONFIG=DEVEL WANT_AUTOCC=0\n"
129 printf "CONFIG=DEVEL WANT_AUTOCC=1\n"
130 printf "CONFIG=ODEVEL WANT_AUTOCC=0\n"
131 printf "CONFIG=ODEVEL WANT_AUTOCC=1\n"
134 printf "\n\n##########\n$c\n"
135 printf "\n\n##########\n$c\n" >&2
143 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
144 # cksum(1) of the resulting data and compare against the checksum $3
146 tid
=${1} f=${2} s=${3}
148 csum
="`${sed} -e '/^From /d' -e '/^Date: /d' \
149 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
150 -e '/^\[-- Message/d' | ${cksum}`";
151 if [ "${csum}" = "${s}" ]; then
155 printf 'error: checksum mismatch (got %s)\n' "${csum}"
162 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} |
168 # Basic (easily testable) behaviour tests
174 # FIXME __behave_alias
176 # FIXME __behave_mlist
178 have_feat SSL
/TLS
&& have_feat S
/MIME
&& __behave_smime
182 # Nestable conditions test
183 ${rm} -f "${BODY}" "${MBOX}"
184 ${cat} <<- '__EOT' > "${BODY}"
203 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
204 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
205 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
207 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
208 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
231 echo a$
'b\U0000000'dt
232 echo a$
'b\U00000000'du
242 < "${BODY}" MAILRC
=/dev
/null \
243 DIET
=CURD TIED
= "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
259 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
260 #aCURDbc${DIET}d${TIED}e
261 #a${DIET}b${TIED}cCURDde
290 cksum_test behave
:wysh_unicode
"${MBOX}" '475805847 317'
291 < "${BODY}" MAILRC
=/dev
/null LC_ALL
=C \
292 DIET
=CURD TIED
= "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
308 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
309 #aCURDbc${DIET}d${TIED}e
310 #a${DIET}b${TIED}cCURDde
339 cksum_test behave
:wysh_c
"${MBOX}" '1473887148 321'
340 ${rm} -f "${BODY}" "${MBOX}"
344 # Nestable conditions test
346 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
368 if $dietcurd == 'yoho'
373 if $dietcurd != 'yoho'
434 if $dietcurd == 'yohu'
436 elif $dietcurd == 'yoha'
438 elif $dietcurd == 'yohe'
440 elif $dietcurd == 'yoho'
442 if $dietcurd == 'yohu'
444 elif $dietcurd == 'yoha'
446 elif $dietcurd == 'yohe'
448 elif $dietcurd == 'yoho'
450 if $dietcurd == 'yohu'
452 elif $dietcurd == 'yoha'
454 elif $dietcurd == 'yohe'
456 elif $dietcurd == 'yoho'
467 # integer conversion, <..>..
570 set diet
=abc curd
=abc
576 set diet
=abc curd
=abcd
582 # 1. Shitty grouping capabilities as of today
583 unset diet curd ndefined
584 if [ [ false
] ||
[ false
] ||
[ true
] ] && [ [ false
] ||
[ true
] ] && \
590 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
595 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
600 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
605 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
610 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
616 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
621 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
626 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
631 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
636 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
641 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
646 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
651 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
656 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
661 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
667 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
673 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
678 # 2. Shitty grouping capabilities as of today
679 unset diet curd ndefined
680 if [ false || false || true
] && [ false || true
] && yes
685 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
690 if [ 1 ||
0 ||
0 ||
0 ]
695 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
700 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
705 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
710 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
715 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
720 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
725 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
730 if 1 ||
0 ||
0 ||
0 && 0
735 if 1 ||
0 ||
0 ||
0 && 1
740 if 0 ||
0 ||
0 ||
1 && 0
745 if 0 ||
0 ||
0 ||
1 && 1
750 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
755 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
761 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
766 if $diet == 'yo' && $curd == 'ho' && $ndefined
772 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
777 if $diet == 'yo' && $curd == 'ho' && $ndefined
782 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
787 # Some more en-braced variables
789 if ${diet} == ${curd}
794 if ${diet} != ${curd}
810 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
815 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
820 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
825 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
830 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
835 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
840 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
845 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
850 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
856 if ! 0 && ! ! 1 && ! ! ! 0 && 3
861 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
866 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
871 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
876 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
881 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
886 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
891 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
896 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
902 cksum_test behave
:if-normal
"${MBOX}" '557629289 631'
904 if have_feat REGEX
; then
906 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
908 if $dietcurd =~ '^yo.*'
913 if $dietcurd =~ '^yoho.+'
918 if $dietcurd !~ '.*ho$'
923 if $dietcurd !~ '.+yoho$'
928 if [ $dietcurd !~ '.+yoho$' ]
933 if ! [ $dietcurd =~ '.+yoho$' ]
938 if ! ! [ $dietcurd !~ '.+yoho$' ]
943 if ! [ ! [ $dietcurd !~ '.+yoho$' ] ]
948 if [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
953 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
958 if ! ! ! $dietcurd !~ '.+yoho$'
963 if ! ! ! $dietcurd =~ '.+yoho$'
968 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
973 set diet=abc curd='^abc$'
979 set diet=abc curd='^abcd$'
986 cksum_test behave:if-regex "${MBOX}" '439960016 81'
990 __behave_localopts() {
991 # Nestable conditions test
993 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
1008 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1013 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1022 echo active trouble
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1024 echo active null
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1026 cksum_test behave
:localopts
"${MBOX}" '660843351 231'
1029 __behave_smime
() { # FIXME add test/ dir, unroll tests therein, regular enable!
1030 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1031 ${cat} <<-_EOT > ./t.conf
1034 default_keyfile = keyfile.pem
1035 distinguished_name = req_distinguished_name
1036 attributes = req_attributes
1040 [ req_distinguished_name ]
1047 emailAddress = test@localhost
1052 openssl req
-x509 -nodes -days 3650 -config .
/t.conf \
1053 -newkey rsa
:1024 -keyout .
/tkey.pem
-out .
/tcert.pem
>/dev
/null
2>&1
1055 ${cat} .
/tkey.pem .
/tcert.pem
> .
/tpair.pem
1057 printf "behave:s/mime:sign/verify: "
1059 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1060 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1061 -Ssmime-sign -Sfrom=test@localhost \
1062 -s 'S/MIME test' .
/VERIFY
1064 printf 'verify\nx\n' |
1065 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1066 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1067 -Ssmime-sign -Sfrom=test@localhost \
1068 -Sbatch-exit-on-error -R \
1069 -f .
/VERIFY
>/dev
/null
2>&1
1070 if [ $?
-eq 0 ]; then
1074 printf 'error: verification failed\n'
1075 ${rm} -f .
/VERIFY .
/tkey.pem .
/tcert.pem .
/tpair.pem
1080 # (signing +) encryption / decryption
1081 ${cat} <<-_EOT > ./tsendmail.sh
1083 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./ENCRYPT
1085 chmod 0755 .
/tsendmail.sh
1087 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1089 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1090 -Ssmime-force-encryption \
1091 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1092 -Ssendmail=.
/tsendmail.sh \
1093 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1094 -Ssmime-sign -Sfrom=test@localhost \
1095 -s 'S/MIME test' recei@ver.com
1097 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
1098 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1099 -Ssmime-force-encryption \
1100 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1101 -Ssendmail=.
/tsendmail.sh \
1102 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1103 -Ssmime-sign -Sfrom=test@localhost \
1104 -Sbatch-exit-on-error -R \
1105 -f .
/ENCRYPT
>/dev
/null
2>&1
1106 if [ $?
-eq 0 ]; then
1110 printf 'error: decryption+verification failed\n'
1112 ${sed} -e '/^X-Decoding-Date/d' \
1114 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1115 < .
/DECRYPT
> .
/ENCRYPT
1116 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
1119 printf "behave:s/mime:encrypt/decrypt: "
1121 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1122 -Ssmime-force-encryption \
1123 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1124 -Ssendmail=.
/tsendmail.sh \
1125 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1126 -Sfrom=test@localhost \
1127 -s 'S/MIME test' recei@ver.com
1128 printf 'decrypt ./DECRYPT\nx\n' |
1129 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1130 -Ssmime-force-encryption \
1131 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
1132 -Ssendmail=.
/tsendmail.sh \
1133 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
1134 -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 failed\n'
1144 ${sed} -e '/^X-Decoding-Date/d' \
1145 < .
/DECRYPT
> .
/ENCRYPT
1146 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
1148 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
1149 .
/tkey.pem .
/tcert.pem .
/tpair.pem
1153 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1154 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1155 # Note we unfortunately need to place some statements without proper
1156 # indentation because of continuation problems
1158 ${rm} -f "${BODY}" "${MBOX}"
1160 # MIME encoding (QP) stress message body
1162 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1163 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1164 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
1165 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
1166 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
1167 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
1168 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
1169 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
1170 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
1171 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
1172 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
1173 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
1174 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
1175 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
1176 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
1177 "auf den zeilen vorher.
\r\n"\
1178 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
1180 "Die letzte Zeile war nur ein Punkt.
\r\n"\
1182 "Das waren deren zwei.
\r\n"\
1184 "Die letzte Zeile war ein Leerschritt.
\n"\
1185 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
1188 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
1190 "Das waren deren zwei. ditto.
\n"\
1192 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
1193 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
1194 "auf den zeilen vorher.
\n"\
1196 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
1197 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
1199 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1201 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1203 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1205 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1207 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1209 "QP am Zeilenende über soft-nl hinweg
\n"\
1210 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1212 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1214 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1216 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1218 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
1220 "Die letzte Zeile war ein Leerschritt.
\n"\
1224 # MIME encoding (QP) stress message subject
1225 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
1226 adadaddsssssssddddddddddddddddddddd\
1227 ddddddddddddddddddddddddddddddddddd\
1228 ddddddddddddddddddddddddddddddddddd\
1229 dddddddddddddddddddd Hallelulja? Od\
1230 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1231 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1232 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1233 fffffffffffffffffffffffffffffffffff\
1234 fffffffffffffffffffff ggggggggggggg\
1235 ggggggggggggggggggggggggggggggggggg\
1236 ggggggggggggggggggggggggggggggggggg\
1237 ggggggggggggggggggggggggggggggggggg\
1240 # Three tests for MIME encodign and (a bit) content classification.
1241 # At the same time testing -q FILE, < FILE and -t FILE
1243 # TODO Note: because of our weird putline() handling in <-> collect.c
1245 < "${BODY}" MAILRC=/dev/null \
1246 "${SNAIL}" -nSstealthmua -Sexpandaddr -a "${BODY}" -s "${SUB}" "${MBOX}"
1247 cksum_test content:001-0 "${MBOX}" '3310338268 6375'
1250 < "${BODY}" MAILRC=/dev/null \
1251 "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -s "${SUB}" "${MBOX}"
1252 cksum_test content:001 "${MBOX}" '62505451 6374'
1255 < /dev/null MAILRC=/dev/null \
1256 "${SNAIL}" ${ARGS} -a "${BODY}" -s "${SUB}" \
1257 -q "${BODY}" "${MBOX}"
1258 cksum_test content:002 "${MBOX}" '3310338268 6375'
1261 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1263 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -t
1264 cksum_test content:003 "${MBOX}" '62505451 6374'
1266 # Test for [260e19d] (Juergen Daubert)
1268 echo body | MAILRC=/dev/null "${SNAIL}" ${ARGS} "${MBOX}"
1269 cksum_test content:004 "${MBOX}" '3729232114 11'
1271 # Sending of multiple mails in a single invocation
1273 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
1274 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
1276 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS}
1277 cksum_test content:005 "${MBOX}" '773028641 184'
1281 # "Test
for" [d6f316a] (Gavin Troy)
1283 printf "m
${MBOX}\n~s subject1
\nEmail body
\n~.
\nfi
${MBOX}\np
\nx
\n" |
1284 MAILRC=/dev/null "${SNAIL}" ${ARGS} \
1285 -Spipe-text/plain="${cat}" > "${BODY}"
1286 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1287 cksum_test content
:006 "${MBOX}" '654030565 45'
1289 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1290 # TODO Note: because of our weird putline() handling in <-> collect.c
1292 LC_ALL
=C
${awk} 'BEGIN{
1293 for(i = 0; i < 10000; ++i)
1295 #printf "\xF0\x90\x87\x90"
1297 MAILRC
=/dev
/null
"${SNAIL}" -nSstealthmua -Sexpandaddr \
1298 -s TestSubject
"${MBOX}"
1299 cksum_test content
:007-0 "${MBOX}" '2747333583 61729'
1302 LC_ALL
=C
${awk} 'BEGIN{
1303 for(i = 0; i < 10000; ++i)
1305 #printf "\xF0\x90\x87\x90"
1307 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s TestSubject "${MBOX}"
1308 cksum_test content
:007 "${MBOX}" '3343002941 61728'
1310 ## Test some more corner cases for header bodies (as good as we can today) ##
1315 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1316 -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̲' \
1318 cksum_test content
:008 "${MBOX}" '3872015771 288'
1320 # Single word (overlong line split -- bad standard! Requires injection of
1321 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1323 i
=`LC_ALL=C ${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1324 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1325 cksum_test content
:009 "${MBOX}" '2048460448 1631'
1327 # Combination of encoded words, space and tabs of varying sort
1329 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1330 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
1331 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
1332 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
1333 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
1334 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
1336 cksum_test content
:010 "${MBOX}" '1272213842 504'
1338 # Overlong multibyte sequence that must be forcefully split
1339 # todo This works even before v15.0, but only by accident
1341 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1342 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1343 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1344 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1346 cksum_test content
:011 "${MBOX}" '2972351879 572'
1351 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1352 -s "1-1 B2 B3 B4 B5 B6 B\
1353 1-2 B2 B3 B4 B5 B6 B\
1354 1-3 B2 B3 B4 B5 B6 B\
1355 1-4 B2 B3 B4 B5 B6 B\
1356 1-5 B2 B3 B4 B5 B6 B\
1357 1-6 B2 B3 B4 B5 B6 " \
1359 cksum_test content
:012 "${MBOX}" '2467265470 210'
1361 # Leading and trailing WS
1364 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1365 -s " 2-1 B2 B3 B4 B5 B6 B\
1366 1-2 B2 B3 B4 B5 B6 B\
1367 1-3 B2 B3 B4 B5 B6 B\
1368 1-4 B2 B3 B4 B5 B6 " \
1370 cksum_test content
:013 "${MBOX}" '4119922611 149'
1372 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1373 # have a (better) test framework materialize a quick shot
1377 : > 'diet\ is \curd.txt'
1378 : > diet
\"is
\" curd.txt
1380 : > 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
1381 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1382 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1383 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1385 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -Snodot \
1386 -a "ma'ger.txt" -a "mä'ger.txt" \
1387 -a 'diet\\\ is\ \\curd.txt' -a diet
\"is
\" curd.txt \
1389 -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 \
1390 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1391 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1392 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1394 ${rm} -f "ma'ger.txt" "mä'ger.txt" 'diet\ is \curd.txt' \
1395 diet
\"is
\" curd.txt höde-tröge.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 cksum_test content
:14 "${MBOX}" '1106643854 2453'
1402 printf "Resend ${BODY}\nx\n" |
1403 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -f "${MBOX}"
1404 cksum_test content
:14-2 "${MBOX}" '1106643854 2453'
1406 ${rm} -f "${BODY}" "${MBOX}"
1410 if have_feat DEVEL; then
1411 ARGS="${ARGS} -Smemdebug"
1418 if [ -z "${CHECK_ONLY}" ]; then
1424 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'