summaryrefslogtreecommitdiffstats
path: root/debian/tests/basic
blob: ac641a11d29d24ef0574f62a0ee99e81f3dc2160 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh

set -e

runandshow() {
	count=0
	printf '===============\n%s: running ' $0
	for i in "$@" ; do
		printf "argv[%i]=[%s] " "$count" "$i"
		count=$(($count+1))
	done
	echo
	"$@"
}

shouldfail() {
if runandshow "$@"; then
	echo ... should have failed
	exit 1
else
	:
fi
}

exim=/usr/sbin/exim4


runandshow $exim -bV
runandshow $exim -bt postmaster@localhost

# Since example.com is not a local domain delivery should fail with the
# default dc_eximconfig_configtype=local
shouldfail $exim -bt invalid@example.com
runandshow $exim -be \
	'${lookup{exim4.conf.template}dsearch{/etc/exim4}{$value}fail}'
rc="$($exim -be \
	'${lookup{exim4.conf.template}dsearch{/etc/exim4}{$value}fail}')"
if [ "$rc" != "exim4.conf.template" ]; then
	echo wrong expansion result $rc
	false
fi

runandshow $exim -be \
	'${run{/bin/echo -n foo}{success}{error}} runrc[$runrc] value[$value]'
rc="$($exim -be \
	'${run{/bin/echo -n foo}{success}{error}} runrc[$runrc] value[$value]')"
if [ "$rc" != "success runrc[0] value[foo]" ]; then
	echo wrong expansion result $rc
	false
fi

runandshow swaks -s localhost -tlso -q ehlo
runandshow swaks -s localhost -tlso -f root@localhost -t postmaster@localhost \
       -q rcpt
shouldfail swaks -s localhost -tlso -f root@localhost \
	-t postmaster@localhost \
	--h-From 'From: Invalid Syntax <root@localhost'
shouldfail swaks -s localhost -tlso -f root@localhost \
	-t postmaster@localhost \
	--body `dirname $0`/long-header.msg