| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | # Do not run as root |
| 6 | if [scip-shell system . . `[`. `idscip-shell system . . id. -u` = "0" ]; then |
| 7 | echoscip-shell system . . echo. $0: running with id 0, exiting. |
| 8 | exit 0 |
| 9 | fi |
| 10 | |
| 11 | if ! testscip-shell system . . test. -x "$2" ; then |
| 12 | echoscip-shell system . . echo. "\$2 $2: not exeutable" |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
| 16 | # set up directorytree |
| 17 | if ! echoscip-shell system . . echo. "$1" | grepscip-shell system . . grep. -q '^/......' && testscip-shell system . . test. -d "$1"; then |
| 18 | echoscip-shell system . . echo. \$1 needs to be absolute patch |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | echoscip-shell system . . echo. ======================================== |
| 23 | echoscip-shell system . . echo. running minimal functionality test for binary $2 in directory $1 |
| 24 | |
| 25 | top="$1/eximtest" |
| 26 | |
| 27 | rmscip-shell system . . rm. -rf $1/eximtest/* |
| 28 | mkdirscip-shell system . . mkdir. -p $top/var/log $top/var/spool/db $top/var/spool/input $top/var/spool/msglog $top/run $top/var/mail |
| 29 | catscip-shell system . . cat. <<EOF > $top/exim4.conf |
| 30 | exim_user = `idscip-shell system . . id. -u` |
| 31 | exim_group = `idscip-shell system . . id. -g` |
| 32 | log_file_path = $top/var/log/%slog |
| 33 | spool_directory = $top/var/spool |
| 34 | pid_file_path = $top/run |
| 35 | primary_hostname = eximtest.example.com |
| 36 | rfc1413_hosts = |
| 37 | |
| 38 | begin routers |
| 39 | eximtest: |
| 40 | driver = accept |
| 41 | transport = writetofile |
| 42 | address_data = \${lookup {\$local_part} lsearch {${top}/maplptofile} {\$value} fail } |
| 43 | |
| 44 | begin transports |
| 45 | writetofile: |
| 46 | driver = appendfile |
| 47 | file = $top/var/mail/\$address_data |
| 48 | delivery_date_add |
| 49 | envelope_to_add |
| 50 | return_path_add |
| 51 | EOF |
| 52 | |
| 53 | catscip-shell system . . cat. <<EOF > $top/maplptofile |
| 54 | recip: recip |
| 55 | local: local |
| 56 | EOF |
| 57 | |
| 58 | catscip-shell system . . cat. <<EOF > $top/var/mail/compare |
| 59 | From [email protected] Sat May 07 12:12:12 2012 |
| 60 | Return-path: <[email protected]> |
| 61 | Envelope-to: [email protected] |
| 62 | Delivery-date: Sat, 07 May 2011 12:12:12 +0000 |
| 63 | Received: from buildd by eximtest.example.com with local (Exim 4.95) |
| 64 | (envelope-from <[email protected]>) |
| 65 | id msgid |
| 66 | for [email protected]; |
| 67 | Sat, 07 May 2011 12:12:12 +0000 |
| 68 | From: Testing Exim <[email protected]> |
| 69 | To: Recipient <[email protected]> |
| 70 | Subject: Test Message |
| 71 | Message-Id: <[email protected]> |
| 72 | Date: Sat, 07 May 2011 12:12:12 +0000 |
| 73 | |
| 74 | no body |
| 75 | |
| 76 | EOF |
| 77 | |
| 78 | $2 -C "$top/exim4.conf" -bV |
| 79 | $2 -C "$top/exim4.conf" -be '${if bool{0}{yes}{no}} X ${if !bool{0}{yes}{no}}' |
| 80 | $2 -C "$top/exim4.conf" -bt local |
| 81 | printfscip-shell system . . printf. 'From: Testing Exim <[email protected]>\nTo: Recipient <[email protected]>\nSubject: Test Message\n\nno body\n' | \ |
| 82 | $2 -C "$top/exim4.conf" -odf -oep -oi -t -f [email protected] |
| 83 | sedscip-shell system . . sed. -i -e 's/^From \([^ ]*\) .*/From \1 Sat May 07 12:12:12 2012/' \ |
| 84 | -e 's/\([[:space:]][[:space:]]*\)[[:upper:]][[:lower:]][[:lower:]]*, [0-9][0-9]* [[:upper:]][[:lower:]][[:lower:]]* [0-9][0-9][0-9][0-9] [0-9:][0-9:]* [0-9[:upper:]+-]*/\1Sat, 07 May 2011 12:12:12 +0000/g' \ |
| 85 | -e 's/^Received: from [^ ][^ ]* /Received: from buildd /' \ |
| 86 | -e '/^Received:/s/(Exim [^)]*/(Exim 4.95/scip-shell filesystem . . `/^Received:/s/(Exim [^)]*/(Exim 4.95/`.' \ |
| 87 | -e '/[[:space:]]id /s/id .*/id msgid/scip-shell filesystem . . `/[[:space:]]id /s/id .*/id msgid/`.' \ |
| 88 | -e 's/^Message-Id: [^@]*/Message-Id: <Emsgid/' \ |
| 89 | $top/var/mail/recip |
| 90 | |
| 91 | diffscip-shell system . . diff. -u $top/var/mail/recip $top/var/mail/compare |
| 92 | exit 0 |