mk-conf.sh, mk-mk.in: diversify..
[s-mailx.git] / cc-test.sh
blob1b13e61c61e6fe00a0775381a782ded820f144bb
1 #!/bin/sh -
2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
4 SNAIL=./s-nail
5 ARGS='-n# -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
6 CONF=./make.rc
7 BODY=./.cc-body.txt
8 MBOX=./.cc-test.mbox
9 MAIL=/dev/null
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`}
19 ## -- >8 -- 8< -- ##
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!)
27 LC=en_US.UTF-8
28 LC_ALL=${LC} LANG=${LC}
29 ttycharset=UTF-8
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!'
36 SHELL=/bin/sh
37 export SHELL
40 ESTAT=0
42 usage() {
43 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
44 exit 1
47 CHECK_ONLY=
48 [ ${#} -gt 0 ] && {
49 [ "${1}" = --check-only ] || usage
50 [ ${#} -gt 2 ] && usage
51 [ ${#} -eq 2 ] && SNAIL="${2}"
52 [ -x "${SNAIL}" ] || usage
53 CHECK_ONLY=1
56 # cc_all_configs()
57 # Test all configs TODO doesn't cover all *combinations*, stupid!
58 cc_all_configs() {
59 < ${CONF} ${awk} '
60 BEGIN {
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
68 i = 0
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 =
74 #sub(/=.*$/, "")
75 $1 = substr($1, 1, index($1, "=") - 1)
76 if (NOTME[$1])
77 next
78 data[i++] = $1
80 END {
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)
86 printf data[k] "=1 "
87 for (k = j; k < i; ++k)
88 printf data[k] "=0 "
89 printf "WANT_AUTOCC=1\n"
91 for (j = 1; j < i; ++j) {
92 for (k = 1; k < j; ++k)
93 printf data[k] "=0 "
94 for (k = j; k < i; ++k)
95 printf data[k] "=1 "
96 printf "WANT_AUTOCC=1\n"
98 # With debug
99 for (j = 1; j < i; ++j) {
100 for (k = 1; k < j; ++k)
101 printf data[k] "=1 "
102 for (k = j; k < i; ++k)
103 printf data[k] "=0 "
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)
109 printf data[k] "=0 "
110 for (k = j; k < i; ++k)
111 printf data[k] "=1 "
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"
133 ' | while read c; do
134 printf "\n\n##########\n$c\n"
135 printf "\n\n##########\n$c\n" >&2
136 sh -c "${MAKE} ${c}"
137 t_all
138 done
139 ${MAKE} distclean
142 # cksum_test()
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
145 cksum_test() {
146 tid=${1} f=${2} s=${3}
147 printf "${tid}: "
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
152 printf 'ok\n'
153 else
154 ESTAT=1
155 printf 'error: checksum mismatch (got %s)\n' "${csum}"
159 have_feat() {
161 echo 'feat' |
162 MAILRC=/dev/null "${SNAIL}" ${ARGS} |
163 ${grep} ${1}
164 ) >/dev/null 2>&1
167 # t_behave()
168 # Basic (easily testable) behaviour tests
169 t_behave() {
170 __behave_wysh
171 __behave_ifelse
172 __behave_localopts
174 # FIXME __behave_alias
176 # FIXME __behave_mlist
178 have_feat SSL/TLS && have_feat S/MIME && __behave_smime
181 __behave_wysh() {
182 # Nestable conditions test
183 ${rm} -f "${BODY}" "${MBOX}"
184 ${cat} <<- '__EOT' > "${BODY}"
186 echo abcd
187 echo a'b'c'd'
188 echo a"b"c"d"
189 echo a$'b'c$'d'
190 echo 'abcd'
191 echo "abcd"
192 echo $'abcd'
193 echo a\ b\ c\ d
194 echo a 'b c' d
195 echo a "b c" d
196 echo a $'b c' d
198 echo 'a$`"\'
199 echo "a\$\`'\"\\"
200 echo $'a\$`\'\"\\'
201 echo $'a\$`\'"\\'
202 # DIET=CURD TIED=
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
209 echo a$'\377'c
210 echo a$'\0377'c
211 echo a$'\400'c
212 echo a$'\0400'c
213 echo a$'\U1100001'c
215 echo a$'b\0c'd
216 echo a$'b\00c'de
217 echo a$'b\000c'df
218 echo a$'b\0000c'dg
219 echo a$'b\x0c'dh
220 echo a$'b\x00c'di
221 echo a$'b\u0'dj
222 echo a$'b\u00'dk
223 echo a$'b\u000'dl
224 echo a$'b\u0000'dm
225 echo a$'b\U0'dn
226 echo a$'b\U00'do
227 echo a$'b\U000'dp
228 echo a$'b\U0000'dq
229 echo a$'b\U00000'dr
230 echo a$'b\U000000'ds
231 echo a$'b\U0000000'dt
232 echo a$'b\U00000000'du
234 echo a$'\cI'b
235 echo a$'\011'b
236 echo a$'\x9'b
237 echo a$'\u9'b
238 echo a$'\U9'b
239 echo a$'\c@'b c d
240 __EOT
242 < "${BODY}" MAILRC=/dev/null \
243 DIET=CURD TIED= "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
244 #abcd
245 #abcd
246 #abcd
247 #abcd
248 #abcd
249 #abcd
250 #abcd
251 #a b c d
252 #a b c d
253 #a b c d
254 #a b c d
255 #a$`"\
256 #a$`'"\
257 #a$`'"\
258 #a$`'"\
259 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
260 #aCURDbc${DIET}d${TIED}e
261 #a${DIET}b${TIED}cCURDde
262 #aAAAAAAAc
263 #aAAÁAAc
264 #aÿc
265 #aÿc
266 #abd
267 #abde
268 #abdf
269 #abdg
270 #ab\fdh
271 #abdi
272 #abdj
273 #abdk
274 #abdl
275 #abdm
276 #abdn
277 #abdo
278 #abdp
279 #abdq
280 #abdr
281 #abds
282 #abdt
283 #abdu
284 #a b
285 #a b
286 #a b
287 #a b
288 #a b
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}"
293 #abcd
294 #abcd
295 #abcd
296 #abcd
297 #abcd
298 #abcd
299 #abcd
300 #a b c d
301 #a b c d
302 #a b c d
303 #a b c d
304 #a$`"\
305 #a$`'"\
306 #a$`'"\
307 #a$`'"\
308 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
309 #aCURDbc${DIET}d${TIED}e
310 #a${DIET}b${TIED}cCURDde
311 #aAAAAAAAc
312 #aAA\u0C1AAc
313 #aÿc
314 #aÿc
315 #abd
316 #abde
317 #abdf
318 #abdg
319 #ab\fdh
320 #abdi
321 #abdj
322 #abdk
323 #abdl
324 #abdm
325 #abdn
326 #abdo
327 #abdp
328 #abdq
329 #abdr
330 #abds
331 #abdt
332 #abdu
333 #a b
334 #a b
335 #a b
336 #a b
337 #a b
339 cksum_test behave:wysh_c "${MBOX}" '1473887148 321'
340 ${rm} -f "${BODY}" "${MBOX}"
343 __behave_ifelse() {
344 # Nestable conditions test
345 ${rm} -f "${MBOX}"
346 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
347 if 0
348 echo 1.err
349 else
350 echo 1.ok
351 endif
352 if 1
353 echo 2.ok
354 else
355 echo 2.err
356 endif
357 if $dietcurd
358 echo 3.err
359 else
360 echo 3.ok
361 endif
362 set dietcurd=yoho
363 if $dietcurd
364 echo 4.ok
365 else
366 echo 4.err
367 endif
368 if $dietcurd == 'yoho'
369 echo 5.ok
370 else
371 echo 5.err
372 endif
373 if $dietcurd != 'yoho'
374 echo 6.err
375 else
376 echo 6.ok
377 endif
378 # Nesting
379 if faLse
380 echo 7.err1
381 if tRue
382 echo 7.err2
383 if yEs
384 echo 7.err3
385 else
386 echo 7.err4
387 endif
388 echo 7.err5
389 endif
390 echo 7.err6
391 else
392 echo 7.ok7
393 if YeS
394 echo 7.ok8
395 if No
396 echo 7.err9
397 else
398 echo 7.ok9
399 endif
400 echo 7.ok10
401 else
402 echo 7.err11
403 if yeS
404 echo 7.err12
405 else
406 echo 7.err13
407 endif
408 endif
409 echo 7.ok14
410 endif
411 if r
412 echo 8.ok1
413 if R
414 echo 8.ok2
415 else
416 echo 8.err2
417 endif
418 echo 8.ok3
419 else
420 echo 8.err1
421 endif
422 if s
423 echo 9.err1
424 else
425 echo 9.ok1
426 if S
427 echo 9.err2
428 else
429 echo 9.ok2
430 endif
431 echo 9.ok3
432 endif
433 # `elif'
434 if $dietcurd == 'yohu'
435 echo 10.err1
436 elif $dietcurd == 'yoha'
437 echo 10.err2
438 elif $dietcurd == 'yohe'
439 echo 10.err3
440 elif $dietcurd == 'yoho'
441 echo 10.ok1
442 if $dietcurd == 'yohu'
443 echo 10.err4
444 elif $dietcurd == 'yoha'
445 echo 10.err5
446 elif $dietcurd == 'yohe'
447 echo 10.err6
448 elif $dietcurd == 'yoho'
449 echo 10.ok2
450 if $dietcurd == 'yohu'
451 echo 10.err7
452 elif $dietcurd == 'yoha'
453 echo 10.err8
454 elif $dietcurd == 'yohe'
455 echo 10.err9
456 elif $dietcurd == 'yoho'
457 echo 10.ok3
458 else
459 echo 10.err10
460 endif
461 else
462 echo 10.err11
463 endif
464 else
465 echo 10.err12
466 endif
467 # integer conversion, <..>..
468 set dietcurd=10
469 if $dietcurd < 11
470 echo 11.ok1
471 if $dietcurd > 9
472 echo 11.ok2
473 else
474 echo 11.err2
475 endif
476 if $dietcurd == 10
477 echo 11.ok3
478 else
479 echo 11.err3
480 endif
481 if $dietcurd >= 10
482 echo 11.ok4
483 else
484 echo 11.err4
485 endif
486 if $dietcurd <= 10
487 echo 11.ok5
488 else
489 echo 11.err5
490 endif
491 if $dietcurd >= 11
492 echo 11.err6
493 else
494 echo 11.ok6
495 endif
496 if $dietcurd <= 9
497 echo 11.err7
498 else
499 echo 11.ok7
500 endif
501 else
502 echo 11.err1
503 endif
504 set dietcurd=Abc
505 if $dietcurd < aBd
506 echo 12.ok1
507 if $dietcurd > abB
508 echo 12.ok2
509 else
510 echo 12.err2
511 endif
512 if $dietcurd == aBC
513 echo 12.ok3
514 else
515 echo 12.err3
516 endif
517 if $dietcurd >= AbC
518 echo 12.ok4
519 else
520 echo 12.err4
521 endif
522 if $dietcurd <= ABc
523 echo 12.ok5
524 else
525 echo 12.err5
526 endif
527 if $dietcurd >= abd
528 echo 12.err6
529 else
530 echo 12.ok6
531 endif
532 if $dietcurd <= abb
533 echo 12.err7
534 else
535 echo 12.ok7
536 endif
537 else
538 echo 12.err1
539 endif
540 if $dietcurd =@ aB
541 echo 13.ok
542 else
543 echo 13.err
544 endif
545 if $dietcurd =@ bC
546 echo 14.ok
547 else
548 echo 14.err
549 endif
550 if $dietcurd !@ aB
551 echo 15.err
552 else
553 echo 15.ok
554 endif
555 if $dietcurd !@ bC
556 echo 15.err
557 else
558 echo 15.ok
559 endif
560 if $dietcurd =@ Cd
561 echo 16.err
562 else
563 echo 16.ok
564 endif
565 if $dietcurd !@ Cd
566 echo 17.ok
567 else
568 echo 17.err
569 endif
570 set diet=abc curd=abc
571 if $diet == $curd
572 echo 18.ok
573 else
574 echo 18.err
575 endif
576 set diet=abc curd=abcd
577 if $diet != $curd
578 echo 19.ok
579 else
580 echo 19.err
581 endif
582 # 1. Shitty grouping capabilities as of today
583 unset diet curd ndefined
584 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
585 [ yes ]
586 echo 20.ok
587 else
588 echo 20.err
589 endif
590 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
591 echo 21.ok
592 else
593 echo 21.err
594 endif
595 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
596 echo 22.ok
597 else
598 echo 22.err
599 endif
600 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
601 echo 23.ok
602 else
603 echo 23.err
604 endif
605 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
606 echo 24.err
607 else
608 echo 24.ok
609 endif
610 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
611 && [ no ] || [ yes ]
612 echo 25.ok
613 else
614 echo 25.err
615 endif
616 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
617 echo 26.ok
618 else
619 echo 26.err
620 endif
621 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
622 echo 27.err
623 else
624 echo 27.ok
625 endif
626 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
627 echo 28.err
628 else
629 echo 28.ok
630 endif
631 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
632 echo 29.err
633 else
634 echo 29.ok
635 endif
636 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
637 echo 30.err
638 else
639 echo 30.ok
640 endif
641 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
642 echo 31.ok
643 else
644 echo 31.err
645 endif
646 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
647 echo 32.err
648 else
649 echo 32.ok
650 endif
651 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
652 echo 33.ok
653 else
654 echo 33.err
655 endif
656 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
657 echo 34.err
658 else
659 echo 34.ok
660 endif
661 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
662 echo 35.ok
663 else
664 echo 35.err
665 endif
666 set diet=yo curd=ho
667 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
668 echo 36.err
669 else
670 echo 36.ok
671 endif
672 set ndefined
673 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
674 echo 37.ok
675 else
676 echo 37.err
677 endif
678 # 2. Shitty grouping capabilities as of today
679 unset diet curd ndefined
680 if [ false || false || true ] && [ false || true ] && yes
681 echo 40.ok
682 else
683 echo 40.err
684 endif
685 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
686 echo 41.ok
687 else
688 echo 41.err
689 endif
690 if [ 1 || 0 || 0 || 0 ]
691 echo 42.ok
692 else
693 echo 42.err
694 endif
695 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
696 echo 43.ok
697 else
698 echo 43.err
699 endif
700 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
701 echo 44.err
702 else
703 echo 44.ok
704 endif
705 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
706 echo 45.ok
707 else
708 echo 45.err
709 endif
710 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
711 echo 46.ok
712 else
713 echo 46.err
714 endif
715 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
716 echo 47.err
717 else
718 echo 47.ok
719 endif
720 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
721 echo 48.err
722 else
723 echo 48.ok
724 endif
725 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
726 echo 49.err
727 else
728 echo 49.ok
729 endif
730 if 1 || 0 || 0 || 0 && 0
731 echo 50.err
732 else
733 echo 50.ok
734 endif
735 if 1 || 0 || 0 || 0 && 1
736 echo 51.ok
737 else
738 echo 51.err
739 endif
740 if 0 || 0 || 0 || 1 && 0
741 echo 52.err
742 else
743 echo 52.ok
744 endif
745 if 0 || 0 || 0 || 1 && 1
746 echo 53.ok
747 else
748 echo 53.err
749 endif
750 if 0 || 0 || 0 || 1 && 0 || 1 && 0
751 echo 54.err
752 else
753 echo 54.ok
754 endif
755 if 0 || 0 || 0 || 1 && 0 || 1 && 1
756 echo 55.ok
757 else
758 echo 55.err
759 endif
760 set diet=yo curd=ho
761 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
762 echo 56.err
763 else
764 echo 56.ok
765 endif
766 if $diet == 'yo' && $curd == 'ho' && $ndefined
767 echo 57.err
768 else
769 echo 57.ok
770 endif
771 set ndefined
772 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
773 echo 57.ok
774 else
775 echo 57.err
776 endif
777 if $diet == 'yo' && $curd == 'ho' && $ndefined
778 echo 58.ok
779 else
780 echo 58.err
781 endif
782 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
783 echo 59.ok
784 else
785 echo 59.err
786 endif
787 # Some more en-braced variables
788 set diet=yo curd=ho
789 if ${diet} == ${curd}
790 echo 70.err
791 else
792 echo 70.ok
793 endif
794 if ${diet} != ${curd}
795 echo 71.ok
796 else
797 echo 71.err
798 endif
799 if $diet == ${curd}
800 echo 72.err
801 else
802 echo 72.ok
803 endif
804 if ${diet} == $curd
805 echo 73.err
806 else
807 echo 73.ok
808 endif
809 # Unary !
810 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
811 echo 80.ok
812 else
813 echo 80.err
814 endif
815 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
816 echo 81.ok
817 else
818 echo 81.err
819 endif
820 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
821 echo 82.ok
822 else
823 echo 82.err
824 endif
825 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
826 echo 83.err
827 else
828 echo 83.ok
829 endif
830 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
831 echo 84.err
832 else
833 echo 84.ok
834 endif
835 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
836 echo 85.err
837 else
838 echo 85.ok
839 endif
840 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
841 echo 86.err
842 else
843 echo 86.ok
844 endif
845 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
846 echo 87.ok
847 else
848 echo 87.err
849 endif
850 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
851 echo 88.ok
852 else
853 echo 88.err
854 endif
855 # Unary !, odd
856 if ! 0 && ! ! 1 && ! ! ! 0 && 3
857 echo 90.ok
858 else
859 echo 90.err
860 endif
861 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
862 echo 91.ok
863 else
864 echo 91.err
865 endif
866 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
867 echo 92.ok
868 else
869 echo 92.err
870 endif
871 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
872 echo 93.err
873 else
874 echo 93.ok
875 endif
876 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
877 echo 94.ok
878 else
879 echo 94.err
880 endif
881 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
882 echo 95.err
883 else
884 echo 95.ok
885 endif
886 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
887 echo 96.err
888 else
889 echo 96.ok
890 endif
891 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
892 echo 97.ok
893 else
894 echo 97.err
895 endif
896 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
897 echo 98.ok
898 else
899 echo 98.err
900 endif
901 __EOT
902 cksum_test behave:if-normal "${MBOX}" '557629289 631'
904 if have_feat REGEX; then
905 ${rm} -f "${MBOX}"
906 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
907 set dietcurd=yoho
908 if $dietcurd =~ '^yo.*'
909 echo 1.ok
910 else
911 echo 1.err
912 endif
913 if $dietcurd =~ '^yoho.+'
914 echo 2.err
915 else
916 echo 2.ok
917 endif
918 if $dietcurd !~ '.*ho$'
919 echo 3.err
920 else
921 echo 3.ok
922 endif
923 if $dietcurd !~ '.+yoho$'
924 echo 4.ok
925 else
926 echo 4.err
927 endif
928 if [ $dietcurd !~ '.+yoho$' ]
929 echo 5.ok
930 else
931 echo 5.err
932 endif
933 if ! [ $dietcurd =~ '.+yoho$' ]
934 echo 6.ok
935 else
936 echo 6.err
937 endif
938 if ! ! [ $dietcurd !~ '.+yoho$' ]
939 echo 7.ok
940 else
941 echo 7.err
942 endif
943 if ! [ ! [ $dietcurd !~ '.+yoho$' ] ]
944 echo 8.ok
945 else
946 echo 8.err
947 endif
948 if [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
949 echo 9.ok
950 else
951 echo 9.err
952 endif
953 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
954 echo 10.err
955 else
956 echo 10.ok
957 endif
958 if ! ! ! $dietcurd !~ '.+yoho$'
959 echo 11.err
960 else
961 echo 11.ok
962 endif
963 if ! ! ! $dietcurd =~ '.+yoho$'
964 echo 12.ok
965 else
966 echo 12.err
967 endif
968 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
969 echo 13.ok
970 else
971 echo 13.err
972 endif
973 set diet=abc curd='^abc$'
974 if $diet =~ $curd
975 echo 14.ok
976 else
977 echo 14.err
978 endif
979 set diet=abc curd='^abcd$'
980 if $diet !~ $curd
981 echo 15.ok
982 else
983 echo 15.err
984 endif
985 __EOT
986 cksum_test behave:if-regex "${MBOX}" '439960016 81'
990 __behave_localopts() {
991 # Nestable conditions test
992 ${rm} -f "${MBOX}"
993 ${cat} <<- '__EOT' | MAILRC=/dev/null "${SNAIL}" ${ARGS} > "${MBOX}"
994 define t2 {
995 echo in: t2
996 set t2=t2
997 echo $t2
999 define t1 {
1000 echo in: t1
1001 set gv1=gv1
1002 localopts on
1003 set lv1=lv1 lv2=lv2
1004 set lv3=lv3
1005 call t2
1006 localopts off
1007 set gv2=gv2
1008 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1010 define t0 {
1011 echo in: t0
1012 call t1
1013 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1015 account trouble {
1016 echo in: trouble
1017 call t0
1019 call t0
1020 unset gv1 gv2
1021 account trouble
1022 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1023 account null
1024 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1025 __EOT
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
1032 [ req ]
1033 default_bits = 1024
1034 default_keyfile = keyfile.pem
1035 distinguished_name = req_distinguished_name
1036 attributes = req_attributes
1037 prompt = no
1038 output_password =
1040 [ req_distinguished_name ]
1041 C = GB
1042 ST = Over the
1043 L = rainbow
1044 O = S-nail
1045 OU = S-nail.smime
1046 CN = S-nail.test
1047 emailAddress = test@localhost
1049 [ req_attributes ]
1050 challengePassword =
1051 _EOT
1052 openssl req -x509 -nodes -days 3650 -config ./t.conf \
1053 -newkey rsa:1024 -keyout ./tkey.pem -out ./tcert.pem >/dev/null 2>&1
1054 ${rm} -f ./t.conf
1055 ${cat} ./tkey.pem ./tcert.pem > ./tpair.pem
1057 printf "behave:s/mime:sign/verify: "
1058 echo bla |
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
1063 # TODO CHECK
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
1071 printf 'ok\n'
1072 else
1073 ESTAT=1
1074 printf 'error: verification failed\n'
1075 ${rm} -f ./VERIFY ./tkey.pem ./tcert.pem ./tpair.pem
1076 return
1078 ${rm} -rf ./VERIFY
1080 # (signing +) encryption / decryption
1081 ${cat} <<-_EOT > ./tsendmail.sh
1082 #!/bin/sh -
1083 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./ENCRYPT
1084 _EOT
1085 chmod 0755 ./tsendmail.sh
1087 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1088 echo bla |
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
1096 # TODO CHECK
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
1107 printf 'ok\n'
1108 else
1109 ESTAT=1
1110 printf 'error: decryption+verification failed\n'
1112 ${sed} -e '/^X-Decoding-Date/d' \
1113 -e \
1114 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1115 < ./DECRYPT > ./ENCRYPT
1116 cksum_test ".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
1118 ${rm} -f ./DECRYPT
1119 printf "behave:s/mime:encrypt/decrypt: "
1120 echo bla |
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
1138 printf 'ok\n'
1139 else
1140 ESTAT=1
1141 printf 'error: decryption failed\n'
1142 # FALLTHRU
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
1152 # t_content()
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
1157 t_content() {
1158 ${rm} -f "${BODY}" "${MBOX}"
1160 # MIME encoding (QP) stress message body
1161 printf \
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"\
1179 ".\r\n"\
1180 "Die letzte Zeile war nur ein Punkt.\r\n"\
1181 "..\r\n"\
1182 "Das waren deren zwei.\r\n"\
1183 " \r\n"\
1184 "Die letzte Zeile war ein Leerschritt.\n"\
1185 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
1186 "Prösterchen.\r\n"\
1187 ".\n"\
1188 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
1189 "..\n"\
1190 "Das waren deren zwei. ditto.\n"\
1191 "Prösterchen.\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"\
1195 "ditto.\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"\
1198 "\n"\
1199 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1200 "\n"\
1201 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1202 "3\n"\
1203 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1204 "34\n"\
1205 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1206 "345\n"\
1207 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1208 "3456\n"\
1209 "QP am Zeilenende über soft-nl hinweg\n"\
1210 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1211 "ö123\n"\
1212 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1213 "1ö23\n"\
1214 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1215 "12ö3\n"\
1216 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1217 "123ö\n"\
1218 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
1219 " \n"\
1220 "Die letzte Zeile war ein Leerschritt.\n"\
1221 ' '\
1222 > "${BODY}"
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\
1238 gggggggggggggggg"
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
1244 ${rm} -f "${MBOX}"
1245 < "${BODY}" MAILRC=/dev/null \
1246 "${SNAIL}" -nSstealthmua -Sexpandaddr -a "${BODY}" -s "${SUB}" "${MBOX}"
1247 cksum_test content:001-0 "${MBOX}" '3310338268 6375'
1249 ${rm} -f "${MBOX}"
1250 < "${BODY}" MAILRC=/dev/null \
1251 "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -s "${SUB}" "${MBOX}"
1252 cksum_test content:001 "${MBOX}" '62505451 6374'
1254 ${rm} -f "${MBOX}"
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'
1260 ${rm} -f "${MBOX}"
1261 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
1262 ${cat} "${BODY}"
1263 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS} -Snodot -a "${BODY}" -t
1264 cksum_test content:003 "${MBOX}" '62505451 6374'
1266 # Test for [260e19d] (Juergen Daubert)
1267 ${rm} -f "${MBOX}"
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
1272 ${rm} -f "${MBOX}"
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" &&
1275 echo x
1276 ) | MAILRC=/dev/null "${SNAIL}" ${ARGS}
1277 cksum_test content:005 "${MBOX}" '773028641 184'
1279 ## $BODY CHANGED
1281 # "Test for" [d6f316a] (Gavin Troy)
1282 ${rm} -f "${MBOX}"
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
1291 ${rm} -f "${MBOX}"
1292 LC_ALL=C ${awk} 'BEGIN{
1293 for(i = 0; i < 10000; ++i)
1294 printf "\xC3\xBC"
1295 #printf "\xF0\x90\x87\x90"
1296 }' |
1297 MAILRC=/dev/null "${SNAIL}" -nSstealthmua -Sexpandaddr \
1298 -s TestSubject "${MBOX}"
1299 cksum_test content:007-0 "${MBOX}" '2747333583 61729'
1301 ${rm} -f "${MBOX}"
1302 LC_ALL=C ${awk} 'BEGIN{
1303 for(i = 0; i < 10000; ++i)
1304 printf "\xC3\xBC"
1305 #printf "\xF0\x90\x87\x90"
1306 }' |
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) ##
1313 ${rm} -f "${MBOX}"
1314 echo |
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̲' \
1317 "${MBOX}"
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)
1322 ${rm} -f "${MBOX}"
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
1328 ${rm} -f "${MBOX}"
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" \
1335 "${MBOX}"
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
1340 ${rm} -f "${MBOX}"
1341 echo | MAILRC=/dev/null "${SNAIL}" ${ARGS} \
1342 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1343 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1344 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1345 "${MBOX}"
1346 cksum_test content:011 "${MBOX}" '2972351879 572'
1348 # Trailing WS
1349 ${rm} -f "${MBOX}"
1350 echo |
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 " \
1358 "${MBOX}"
1359 cksum_test content:012 "${MBOX}" '2467265470 210'
1361 # Leading and trailing WS
1362 ${rm} -f "${MBOX}"
1363 echo |
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 " \
1369 "${MBOX}"
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
1374 ${rm} -f "${MBOX}"
1375 : > "ma'ger.txt"
1376 : > "mä'ger.txt"
1377 : > 'diet\ is \curd.txt'
1378 : > diet \"is\" curd.txt
1379 : > höde-tröge.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
1384 echo bla |
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 \
1388 -a höde-tröge.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 \
1393 "${MBOX}"
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'
1401 # `resend' test
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}"
1409 t_all() {
1410 if have_feat DEVEL; then
1411 ARGS="${ARGS} -Smemdebug"
1412 export ARGS
1414 t_behave
1415 t_content
1418 if [ -z "${CHECK_ONLY}" ]; then
1419 cc_all_configs
1420 else
1421 t_all
1424 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
1426 exit ${ESTAT}
1427 # s-sh-mode