-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
119 lines (105 loc) · 3.21 KB
/
Makefile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
PROG= udpbench
WARNINGS= yes
BINDIR?= /usr/local/bin
MANDIR?= /usr/local/man/man
VERSION= 1.13
CLEANFILES= udpbench-${VERSION}.tar.gz*
.PHONY: dist udpbench-${VERSION}.tar.gz
dist: udpbench-${VERSION}.tar.gz
gpg --armor --detach-sign udpbench-${VERSION}.tar.gz
@echo ${.OBJDIR}/udpbench-${VERSION}.tar.gz
udpbench-${VERSION}.tar.gz:
rm -rf udpbench-${VERSION}
mkdir udpbench-${VERSION}
.for f in README LICENSE Changes Makefile GNUmakefile udpbench.c udpbench.1
cp ${.CURDIR}/$f udpbench-${VERSION}/
.endfor
tar -czvf $@ udpbench-${VERSION}
rm -rf udpbench-${VERSION}
CLEANFILES+= out
TEST =
TEST += localhost
test-localhost:
@echo '\n==== $@ ===='
./udpbench -p0 -t3 recv 127.0.0.1 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out`; \
./udpbench -p$$port -t1 send 127.0.0.1 || exit 1; \
wait $$!
grep -q 'recv: syscalls ' out
TEST += localhost6
test-localhost6:
@echo '\n==== $@ ===='
./udpbench -p0 -t3 recv ::1 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out`; \
./udpbench -p$$port -t1 send ::1 || exit 1; \
wait $$!
grep -q 'recv: syscalls ' out
TEST += mmsg
test-mmsg:
@echo '\n==== $@ ===='
./udpbench -m1024 -p0 -t3 recv 127.0.0.1 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out`; \
./udpbench -m1024 -p$$port -t1 send 127.0.0.1 || exit 1; \
wait $$!
grep -q 'recv: syscalls ' out
TEST += repeat
test-repeat:
@echo '\n==== $@ ===='
./udpbench -N1 -p0 -t3 recv 127.0.0.1 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out`; \
./udpbench -N1 -p$$port -t1 send 127.0.0.1 || exit 1; \
wait $$!
grep -q 'recv: syscalls ' out
TEST += mcast
test-mcast:
@echo '\n==== $@ ===='
./udpbench -I127.0.0.1 -p0 -t3 recv 224.0.0.123 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out`; \
./udpbench -I127.0.0.1 -L1 -T0 -p$$port -t1 \
send 224.0.0.123 || exit 1; \
wait $$!
grep -q 'sockname: 224.0.0.123 ' out
grep -q 'recv: syscalls ' out
TEST += mcast6
test-mcast6:
@echo '\n==== $@ ===='
./udpbench -Ilo0 -p0 -t3 recv ff04::123 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out`; \
./udpbench -Ilo0 -L1 -T0 -p$$port -t1 \
send ff04::123 || exit 1; \
wait $$!
grep -q 'sockname: ff04::123 ' out
grep -q 'recv: syscalls ' out
TEST += mcast-repeat
test-mcast-repeat:
@echo '\n==== $@ ===='
./udpbench -N2 -I127.0.0.1 -p0 -t3 recv 224.0.0.123 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out | sort -u`; \
./udpbench -N2 -I127.0.0.1 -L1 -T0 -p$$port -t1 \
send 224.0.0.123 || exit 1; \
wait $$!
grep -q 'sockname: 224.0.0.123 ' out
grep -q 'sockname: 224.0.0.124 ' out
grep -q 'recv: syscalls ' out
TEST += mcast6-repeat
test-mcast6-repeat:
@echo '\n==== $@ ===='
./udpbench -N2 -Ilo0 -p0 -t3 recv ff04::123 | tee out & \
sleep 1; \
port=`awk '/^sockname:/{print $$3}' out | sort -u`; \
./udpbench -N2 -Ilo0 -L1 -T0 -p$$port -t1 \
send ff04::123 || exit 1; \
wait $$!
grep -q 'sockname: ff04::123 ' out
grep -q 'sockname: ff04::124 ' out
grep -q 'recv: syscalls ' out
.PHONY: test ${TEST:S/^/test-/}
test: ${TEST:S/^/test-/}
.include <bsd.prog.mk>