Skip to content

Commit

Permalink
Copy tests from Makefile to GNUmakefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluhm committed Jan 3, 2025
1 parent b56ac7c commit 9bef875
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
57 changes: 54 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ install:
install -c -m 555 -s udpbench -D -t ${DESTDIR}${BINDIR}
install -c -m 444 udpbench.1 -D -t ${DESTDIR}${MANDIR}1

.PHONY: test test-localhost test-localhost6 test-mmsg test-repeat
test: test-localhost test-localhost6 test-mmsg test-repeat

TEST =
TEST += localhost
test-localhost:
@echo -e '\n==== $@ ===='
./udpbench -p0 -t3 recv 127.0.0.1 >out & \
Expand All @@ -29,6 +28,7 @@ test-localhost:
wait $$!
grep '^recv:' out

TEST += localhost6
test-localhost6:
@echo -e '\n==== $@ ===='
./udpbench -p0 -t3 recv ::1 >out & \
Expand All @@ -38,6 +38,7 @@ test-localhost6:
wait $$!
grep '^recv:' out

TEST += mmsg
test-mmsg:
@echo -e '\n==== $@ ===='
./udpbench -m1024 -p0 -t3 recv 127.0.0.1 >out & \
Expand All @@ -47,6 +48,7 @@ test-mmsg:
wait $$!
grep '^recv:' out

TEST += repeat
test-repeat:
@echo -e '\n==== $@ ===='
./udpbench -N1 -p0 -t3 recv 127.0.0.1 >out & \
Expand All @@ -55,3 +57,52 @@ test-repeat:
./udpbench -N1 -p$$port -t1 send 127.0.0.1 || exit 1; \
wait $$!
grep '^recv:' out

TEST += mcast
test-mcast:
@echo -e '\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

TEST += mcast6
test-mcast6:
@echo -e '\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

TEST += mcast-repeat
test-mcast-repeat:
@echo -e '\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

TEST += mcast6-repeat
test-mcast6-repeat:
@echo -e '\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

.PHONY: test $(patsubst %,test-%,$(TEST))
test: $(patsubst %,test-%,$(TEST))
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test-mcast6-repeat:
grep -q 'sockname: ff04::123 ' out
grep -q 'sockname: ff04::124 ' out

.PHONY: ${TEST:S/^/test-/}
.PHONY: test ${TEST:S/^/test-/}
test: ${TEST:S/^/test-/}

.include <bsd.prog.mk>

0 comments on commit 9bef875

Please sign in to comment.