2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
5 ARGS
='-n# -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
10 MAKE
="${MAKE:-`command -v make`}"
11 awk=${awk:-`command -v awk`}
12 cat=${cat:-`command -v cat`}
13 cksum=${cksum:-`command -v cksum`}
14 rm=${rm:-`command -v rm`}
15 sed=${sed:-`command -v sed`}
16 grep=${grep:-`command -v grep`}
20 export SNAIL ARGS CONF BODY MBOX MAKE
awk cat cksum rm sed grep
22 # NOTE! UnixWare 7.1.4 gives ISO-10646-Minimum-European-Subset for
23 # nl_langinfo(CODESET), then, so also overwrite ttycharset.
24 # (In addition this setup allows us to succeed on TinyCore 4.4 that has no
25 # other locales than C/POSIX installed by default!)
27 LC_ALL
=${LC} LANG
=${LC}
29 export LC_ALL LANG ttycharset
31 # Problem: force $SHELL to be a real shell. It seems some testing environments
32 # use nologin(?), but we need a real shell for command execution
33 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
34 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
42 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
48 [ "${1}" = --check-only ] || usage
49 [ ${#} -gt 2 ] && usage
50 [ ${#} -eq 2 ] && SNAIL
="${2}"
51 [ -x "${SNAIL}" ] || usage
56 # Test all configs TODO doesn't cover all *combinations*, stupid!
60 NOTME["WANT_AUTOCC"] = 1
61 NOTME["WANT_DEBUG"] = 1
62 NOTME["WANT_NOEXTMD5"] = 1
63 NOTME["WANT_NOALLOCA"] = 1
64 NOTME["WANT_DEVEL"] = 1
65 NOTME["WANT_NYD2"] = 1
68 /^[[:space:]]*WANT_/ {
69 sub(/^[[:space:]]*/, "")
70 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
71 # does not seem to be a compliant escape for =
73 $1 = substr($1, 1, index($1, "=") - 1)
79 # Doing this completely sequentially and not doing make distclean in
80 # between runs should effectively result in lesser compilations.
81 # It is completely dumb nonetheless... TODO
82 for (j = 1; j < i; ++j) {
83 for (k = 1; k < j; ++k)
85 for (k = j; k < i; ++k)
87 printf "WANT_AUTOCC=1\n"
89 for (j = 1; j < i; ++j) {
90 for (k = 1; k < j; ++k)
92 for (k = j; k < i; ++k)
94 printf "WANT_AUTOCC=1\n"
97 for (j = 1; j < i; ++j) {
98 for (k = 1; k < j; ++k)
100 for (k = j; k < i; ++k)
102 printf "WANT_AUTOCC=1\n"
103 printf "WANT_DEBUG=1\n"
105 for (j = 1; j < i; ++j) {
106 for (k = 1; k < j; ++k)
108 for (k = j; k < i; ++k)
110 printf "WANT_AUTOCC=1\n"
111 printf "WANT_DEBUG=1\n"
114 printf "CONFIG=NULL WANT_AUTOCC=0\n"
115 printf "CONFIG=NULL WANT_AUTOCC=1\n"
116 printf "CONFIG=NULLI WANT_AUTOCC=0\n"
117 printf "CONFIG=NULLI WANT_AUTOCC=1\n"
118 printf "CONFIG=MINIMAL WANT_AUTOCC=0\n"
119 printf "CONFIG=MINIMAL WANT_AUTOCC=1\n"
120 printf "CONFIG=MEDIUM WANT_AUTOCC=0\n"
121 printf "CONFIG=MEDIUM WANT_AUTOCC=1\n"
122 printf "CONFIG=NETSEND WANT_AUTOCC=0\n"
123 printf "CONFIG=NETSEND WANT_AUTOCC=1\n"
124 printf "CONFIG=MAXIMAL WANT_AUTOCC=0\n"
125 printf "CONFIG=MAXIMAL WANT_AUTOCC=1\n"
126 printf "CONFIG=DEVEL WANT_AUTOCC=0\n"
127 printf "CONFIG=DEVEL WANT_AUTOCC=1\n"
128 printf "CONFIG=ODEVEL WANT_AUTOCC=0\n"
129 printf "CONFIG=ODEVEL WANT_AUTOCC=1\n"
132 printf "\n\n##########\n$c\n"
133 printf "\n\n##########\n$c\n" >&2
141 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
142 # cksum(1) of the resulting data and compare against the checksum $3
144 tid
=${1} f=${2} s=${3}
146 csum
="`${sed} -e '/^From /d' -e '/^Date: /d' \
147 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
148 -e '/^\[-- Message/d' | ${cksum}`";
149 if [ "${csum}" = "${s}" ]; then
153 printf 'error: checksum mismatch (got %s)\n' "${csum}"
160 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} |
166 # Basic (easily testable) behaviour tests
170 printf 'echo +nix\nset folder=/\necho +nix\nset nofolder\necho +nix\nx' |
171 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} > "${MBOX}"
172 cksum_test behave
:001 "${MBOX}" '4214021069 15'
174 # POSIX: setting *noprompt*/prompt='' shall prevent prompting TODO
175 # TODO for this to be testable we need a way to echo a variable
176 # TODO or to force echo of the prompt
180 # FIXME __behave_alias
182 # FIXME __behave_mlist
184 have_feat SSL
/TLS
&& have_feat S
/MIME
&& __behave_smime
188 # Nestable conditions test
190 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
212 if $dietcurd == 'yoho'
217 if $dietcurd != 'yoho'
278 if $dietcurd == 'yohu'
280 elif $dietcurd == 'yoha'
282 elif $dietcurd == 'yohe'
284 elif $dietcurd == 'yoho'
286 if $dietcurd == 'yohu'
288 elif $dietcurd == 'yoha'
290 elif $dietcurd == 'yohe'
292 elif $dietcurd == 'yoho'
294 if $dietcurd == 'yohu'
296 elif $dietcurd == 'yoha'
298 elif $dietcurd == 'yohe'
300 elif $dietcurd == 'yoho'
311 # integer conversion, <..>..
414 set diet=abc curd=abc
420 set diet=abc curd=abcd
426 # 1. Shitty grouping capabilities as of today
427 unset diet curd ndefined
428 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
434 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
439 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
444 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
449 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
454 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
460 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
465 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
470 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
475 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
480 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
485 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
490 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
495 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
500 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
505 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
511 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
517 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
522 # 2. Shitty grouping capabilities as of today
523 unset diet curd ndefined
524 if [ false || false || true ] && [ false || true ] && yes
529 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
534 if [ 1 || 0 || 0 || 0 ]
539 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
544 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
549 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
554 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
559 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
564 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
569 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
574 if 1 || 0 || 0 || 0 && 0
579 if 1 || 0 || 0 || 0 && 1
584 if 0 || 0 || 0 || 1 && 0
589 if 0 || 0 || 0 || 1 && 1
594 if 0 || 0 || 0 || 1 && 0 || 1 && 0
599 if 0 || 0 || 0 || 1 && 0 || 1 && 1
605 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
610 if $diet == 'yo' && $curd == 'ho' && $ndefined
616 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
621 if $diet == 'yo' && $curd == 'ho' && $ndefined
626 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
631 # Some more en-braced variables
633 if ${diet} == ${curd}
638 if ${diet} != ${curd}
654 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
659 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
664 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
669 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
674 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
679 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
684 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
689 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
694 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
700 if ! 0 && ! ! 1 && ! ! ! 0 && 3
705 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
710 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
715 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
720 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
725 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
730 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
735 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
740 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
746 cksum_test behave:if-normal "${MBOX}" '557629289 631'
748 if have_feat REGEX; then
750 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
752 if $dietcurd =~
'^yo.*'
757 if $dietcurd =~
'^yoho.+'
762 if $dietcurd !~
'.*ho$'
767 if $dietcurd !~
'.+yoho$'
772 if [ $dietcurd !~
'.+yoho$' ]
777 if ! [ $dietcurd =~
'.+yoho$' ]
782 if ! ! [ $dietcurd !~
'.+yoho$' ]
787 if ! [ ! [ $dietcurd !~
'.+yoho$' ] ]
792 if [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
797 if ! [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
802 if ! ! ! $dietcurd !~
'.+yoho$'
807 if ! ! ! $dietcurd =~
'.+yoho$'
812 if ! [ ! ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
817 set diet
=abc curd
='^abc$'
823 set diet
=abc curd
='^abcd$'
830 cksum_test behave
:if-regex
"${MBOX}" '439960016 81'
834 __behave_smime
() { # FIXME add test/ dir, unroll tests therein, regular enable!
835 printf 'behave:s/mime: .. generating test key and certificate ..\n'
836 ${cat} <<-_EOT > ./t.conf
839 default_keyfile = keyfile.pem
840 distinguished_name = req_distinguished_name
841 attributes = req_attributes
845 [ req_distinguished_name ]
852 emailAddress = test@localhost
857 openssl req
-x509 -nodes -days 3650 -config .
/t.conf \
858 -newkey rsa
:1024 -keyout .
/tkey.pem
-out .
/tcert.pem
>/dev
/null
2>&1
860 ${cat} .
/tkey.pem .
/tcert.pem
> .
/tpair.pem
862 printf "behave:s/mime:sign/verify: "
864 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
865 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
866 -Ssmime-sign -Sfrom=test@localhost \
867 -s 'S/MIME test' .
/VERIFY
869 printf 'verify\nx\n' |
870 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
871 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
872 -Ssmime-sign -Sfrom=test@localhost \
873 -Sbatch-exit-on-error -R \
874 -f .
/VERIFY
>/dev
/null
2>&1
875 if [ $?
-eq 0 ]; then
879 printf 'error: verification failed\n'
880 ${rm} -f .
/VERIFY .
/tkey.pem .
/tcert.pem .
/tpair.pem
885 # (signing +) encryption / decryption
886 ${cat} <<-_EOT > ./tsendmail.sh
888 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./ENCRYPT
890 chmod 0755 .
/tsendmail.sh
892 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
894 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
895 -Ssmime-force-encryption \
896 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
897 -Ssendmail=.
/tsendmail.sh \
898 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
899 -Ssmime-sign -Sfrom=test@localhost \
900 -s 'S/MIME test' recei@ver.com
902 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
903 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
904 -Ssmime-force-encryption \
905 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
906 -Ssendmail=.
/tsendmail.sh \
907 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
908 -Ssmime-sign -Sfrom=test@localhost \
909 -Sbatch-exit-on-error -R \
910 -f .
/ENCRYPT
>/dev
/null
2>&1
911 if [ $?
-eq 0 ]; then
915 printf 'error: decryption+verification failed\n'
917 ${sed} -e '/^X-Decoding-Date/d' \
919 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
920 < .
/DECRYPT
> .
/ENCRYPT
921 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
924 printf "behave:s/mime:encrypt/decrypt: "
926 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
927 -Ssmime-force-encryption \
928 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
929 -Ssendmail=.
/tsendmail.sh \
930 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
931 -Sfrom=test@localhost \
932 -s 'S/MIME test' recei@ver.com
933 printf 'decrypt ./DECRYPT\nx\n' |
934 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
935 -Ssmime-force-encryption \
936 -Ssmime-encrypt-recei@ver.com
=.
/tpair.pem \
937 -Ssendmail=.
/tsendmail.sh \
938 -Ssmime-ca-file=.
/tcert.pem
-Ssmime-sign-cert=.
/tpair.pem \
939 -Sfrom=test@localhost \
940 -Sbatch-exit-on-error -R \
941 -f .
/ENCRYPT
>/dev
/null
2>&1
942 if [ $?
-eq 0 ]; then
946 printf 'error: decryption failed\n'
949 ${sed} -e '/^X-Decoding-Date/d' \
950 < .
/DECRYPT
> .
/ENCRYPT
951 cksum_test
".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
953 ${rm} -f .
/tsendmail.sh .
/ENCRYPT .
/DECRYPT \
954 .
/tkey.pem .
/tcert.pem .
/tpair.pem
958 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
959 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
960 # Note we unfortunately need to place some statements without proper
961 # indentation because of continuation problems
963 ${rm} -f "${BODY}" "${MBOX}"
965 # MIME encoding (QP) stress message body
967 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
968 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
969 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
970 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
971 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
972 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
973 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
974 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
975 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
976 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
977 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
978 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
979 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
980 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
981 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
982 "auf den zeilen vorher.
\r\n"\
983 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
985 "Die letzte Zeile war nur ein Punkt.
\r\n"\
987 "Das waren deren zwei.
\r\n"\
989 "Die letzte Zeile war ein Leerschritt.
\n"\
990 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
993 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
995 "Das waren deren zwei. ditto.
\n"\
997 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
998 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
999 "auf den zeilen vorher.
\n"\
1001 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
1002 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
1004 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1006 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1008 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1010 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1012 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
1014 "QP am Zeilenende über soft-nl hinweg
\n"\
1015 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1017 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1019 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1021 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
1023 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
1025 "Die letzte Zeile war ein Leerschritt.
\n"\
1029 # MIME encoding (QP) stress message subject
1030 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
1031 adadaddsssssssddddddddddddddddddddd\
1032 ddddddddddddddddddddddddddddddddddd\
1033 ddddddddddddddddddddddddddddddddddd\
1034 dddddddddddddddddddd Hallelulja? Od\
1035 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1036 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1037 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1038 fffffffffffffffffffffffffffffffffff\
1039 fffffffffffffffffffff ggggggggggggg\
1040 ggggggggggggggggggggggggggggggggggg\
1041 ggggggggggggggggggggggggggggggggggg\
1042 ggggggggggggggggggggggggggggggggggg\
1045 # Three tests for MIME encodign and (a bit) content classification.
1046 # At the same time testing -q FILE, < FILE and -t FILE
1048 # TODO Note: because of our weird putline() handling in <-> collect.c
1050 < "${BODY}" MAILRC=/dev/null \
1051 "${SNAIL}" -nSstealthmua -Sexpandaddr -a "${BODY}" -s "${SUB}" "${MBOX}"
1052 cksum_test content:001-0 "${MBOX}" '3310338268 6375'
1055 < "${BODY}" MAILRC=/dev/null \
1056 "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -s "${SUB}" "${MBOX}"
1057 cksum_test content:001 "${MBOX}" '62505451 6374'
1060 < /dev/null MAILRC=/dev/null \
1061 "${SNAIL}" ${ARGS} -a "${BODY}" -s "${SUB}" \
1062 -q "${BODY}" "${MBOX}"
1063 cksum_test content:002 "${MBOX}" '3310338268 6375'
1066 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
1068 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -t
1069 cksum_test content:003 "${MBOX}" '62505451 6374'
1071 # Test for [260e19d] (Juergen Daubert)
1073 echo body | MAILRC=/dev/null "${SNAIL}" ${ARGS} "${MBOX}"
1074 cksum_test content:004 "${MBOX}" '3729232114 11'
1076 # Sending of multiple mails in a single invocation
1078 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
1079 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
1081 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS}
1082 cksum_test content:005 "${MBOX}" '773028641 184'
1086 # "Test
for" [d6f316a] (Gavin Troy)
1088 printf "m
${MBOX}\n~s subject1
\nEmail body
\n~.
\nfi
${MBOX}\np
\nx
\n" |
1089 MAILRC=/dev/null "${SNAIL}" ${ARGS} \
1090 -Spipe-text/plain="${cat}" > "${BODY}"
1091 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1092 cksum_test content
:006 "${MBOX}" '654030565 45'
1094 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1095 # TODO Note: because of our weird putline() handling in <-> collect.c
1097 LC_ALL
=C
${awk} 'BEGIN{
1098 for(i = 0; i < 10000; ++i)
1100 #printf "\xF0\x90\x87\x90"
1102 MAILRC
=/dev
/null
"${SNAIL}" -nSstealthmua -Sexpandaddr \
1103 -s TestSubject
"${MBOX}"
1104 cksum_test content
:007-0 "${MBOX}" '2747333583 61729'
1107 LC_ALL
=C
${awk} 'BEGIN{
1108 for(i = 0; i < 10000; ++i)
1110 #printf "\xF0\x90\x87\x90"
1112 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s TestSubject "${MBOX}"
1113 cksum_test content
:007 "${MBOX}" '3343002941 61728'
1115 ## Test some more corner cases for header bodies (as good as we can today) ##
1120 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1121 -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̲' \
1123 cksum_test content
:008 "${MBOX}" '3872015771 288'
1125 # Single word (overlong line split -- bad standard! Requires injection of
1126 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1128 i
=`LC_ALL=C ${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1129 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1130 cksum_test content
:009 "${MBOX}" '2048460448 1631'
1132 # Combination of encoded words, space and tabs of varying sort
1134 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1135 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
1136 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
1137 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
1138 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
1139 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
1141 cksum_test content
:010 "${MBOX}" '1272213842 504'
1143 # Overlong multibyte sequence that must be forcefully split
1144 # todo This works even before v15.0, but only by accident
1146 echo | MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1147 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1148 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1149 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1151 cksum_test content
:011 "${MBOX}" '2972351879 572'
1156 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1157 -s "1-1 B2 B3 B4 B5 B6 B\
1158 1-2 B2 B3 B4 B5 B6 B\
1159 1-3 B2 B3 B4 B5 B6 B\
1160 1-4 B2 B3 B4 B5 B6 B\
1161 1-5 B2 B3 B4 B5 B6 B\
1162 1-6 B2 B3 B4 B5 B6 " \
1164 cksum_test content
:012 "${MBOX}" '2467265470 210'
1166 # Leading and trailing WS
1169 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} \
1170 -s " 2-1 B2 B3 B4 B5 B6 B\
1171 1-2 B2 B3 B4 B5 B6 B\
1172 1-3 B2 B3 B4 B5 B6 B\
1173 1-4 B2 B3 B4 B5 B6 " \
1175 cksum_test content
:013 "${MBOX}" '4119922611 149'
1177 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1178 # have a (better) test framework materialize a quick shot
1182 : > 'diet\ is \curd.txt'
1183 : > diet
\"is
\" curd.txt
1185 : > 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
1186 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1187 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1188 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1190 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -Snodot \
1191 -a "ma'ger.txt" -a "mä'ger.txt" \
1192 -a 'diet\\\ is\ \\curd.txt' -a diet
\"is
\" curd.txt \
1194 -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 \
1195 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1196 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1197 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1199 ${rm} -f "ma'ger.txt" "mä'ger.txt" 'diet\ is \curd.txt' \
1200 diet
\"is
\" curd.txt höde-tröge.txt \
1201 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 \
1202 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1203 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1204 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1205 cksum_test content
:14 "${MBOX}" '1106643854 2453'
1207 printf "Resend ${BODY}\nx\n" |
1208 MAILRC
=/dev
/null
"${SNAIL}" ${ARGS} -f "${MBOX}"
1209 cksum_test content
:14-2 "${MBOX}" '1106643854 2453'
1211 ${rm} -f "${BODY}" "${MBOX}"
1215 if have_feat DEVEL; then
1216 ARGS="${ARGS} -Smemdebug"
1223 if [ -z "${CHECK_ONLY}" ]; then
1229 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'