From 510ab291f61367b991b2522876a532459b9bcd6e Mon Sep 17 00:00:00 2001 From: bluhm Date: Mon, 18 Jul 2016 09:09:24 +0000 Subject: [PATCH] Remote regression tests should not run ssh with -t all the time. This will make it easier to automate them. --- regress/sys/netinet/arp/Makefile | 61 ++++++++++++++++++------------- regress/sys/netinet/pmtu/Makefile | 15 ++++++-- 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/regress/sys/netinet/arp/Makefile b/regress/sys/netinet/arp/Makefile index ac11885306d..1d5a9b45850 100644 --- a/regress/sys/netinet/arp/Makefile +++ b/regress/sys/netinet/arp/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2016/03/30 11:09:56 bluhm Exp $ +# $OpenBSD: Makefile,v 1.7 2016/07/18 09:09:24 bluhm Exp $ # The following ports must be installed: # @@ -51,6 +51,15 @@ regress: @echo fill out these variables for additional tests .endif +.if ! empty (REMOTE_SSH) +.if make (regress) || make (all) +.BEGIN: pf.conf addr.py + @echo + ${SUDO} true + ssh -t ${REMOTE_SSH} ${SUDO} true +.endif +.endif + depend: addr.py # Create python include file containing the addresses. @@ -79,7 +88,7 @@ PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/ clean-arp: @echo '\n======== $@ ========' ${SUDO} arp -da - ssh -t ${REMOTE_SSH} ${SUDO} arp -da + ssh ${REMOTE_SSH} ${SUDO} arp -da # Clear ARP cache and ping all addresses. This ensures that # the IP addresses are configured and all routing table are set up @@ -114,13 +123,13 @@ TARGETS += arp-multicast run-regress-arp-multicast: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request and overwrite entry with multicast ethernet - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ - ssh -t ${REMOTE_SSH} ${SUDO} arp -s ${LOCAL_ADDR} ${LOCAL_MAC} temp + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} ${SUDO} arp -s ${LOCAL_ADDR} ${LOCAL_MAC} temp scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_multicast.py scp ${REMOTE_SSH}:/var/log/messages new.log ssh ${REMOTE_SSH} ${SUDO} arp -an >arp.log - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${LOCAL_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${LOCAL_ADDR} diff old.log new.log | grep '^> ' >diff.log grep 'bsd: arp info overwritten for ${LOCAL_ADDR} by 33:33:33:33:33:33' diff.log grep '^${LOCAL_ADDR} .* 33:33:33:33:33:33 ' arp.log @@ -142,7 +151,7 @@ TARGETS += arp-broadcast run-regress-arp-broadcast: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request with broadcast as sender hardware address - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_broadcast.py scp ${REMOTE_SSH}:/var/log/messages new.log @@ -159,7 +168,7 @@ TARGETS += arp-announcement run-regress-arp-announcement: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Announcement for existing address - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_announcement.py scp ${REMOTE_SSH}:/var/log/messages new.log @@ -177,7 +186,7 @@ TARGETS += arp-gratuitous run-regress-arp-gratuitous: addr.py clean-arp @echo '\n======== $@ ========' @echo Send Gratuitous ARP for existing address - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_gratuitous.py scp ${REMOTE_SSH}:/var/log/messages new.log @@ -196,13 +205,13 @@ TARGETS += arp-permanent run-regress-arp-permanent: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request to change permanent fake address - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ - ssh -t ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${FAKE_MAC} permanent + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${FAKE_MAC} permanent scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_fake.py scp ${REMOTE_SSH}:/var/log/messages new.log ssh ${REMOTE_SSH} ${SUDO} arp -an >arp.log - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} diff old.log new.log | grep '^> ' >diff.log grep 'bsd: arp: attempt to overwrite permanent entry for ${FAKE_ADDR} by ${LOCAL_MAC}' diff.log grep '^${FAKE_ADDR} .* ${FAKE_MAC} .* permanent * $$' arp.log @@ -216,7 +225,7 @@ TARGETS += arp-address run-regress-arp-address: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request to change address on other interface - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_other.py scp ${REMOTE_SSH}:/var/log/messages new.log @@ -236,13 +245,13 @@ TARGETS += arp-temporary run-regress-arp-temporary: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request to change temporary entry on other interface - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ - ssh -t ${REMOTE_SSH} ${SUDO} arp -s ${OTHERFAKE_ADDR} ${FAKE_MAC} temp + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} ${SUDO} arp -s ${OTHERFAKE_ADDR} ${FAKE_MAC} temp scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_otherfake.py scp ${REMOTE_SSH}:/var/log/messages new.log ssh ${REMOTE_SSH} ${SUDO} arp -an >arp.log - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${OTHERFAKE_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${OTHERFAKE_ADDR} diff old.log new.log | grep '^> ' >diff.log grep 'bsd: arp: attempt to overwrite entry for ${OTHERFAKE_ADDR} on .* by ${LOCAL_MAC} on .*' diff.log grep '^${OTHERFAKE_ADDR} .* ${FAKE_MAC} ' arp.log @@ -258,13 +267,13 @@ TARGETS += arp-incomplete run-regress-arp-incomplete: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request filling an incomplete entry on other interface - ssh -t ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ - ssh -t ${REMOTE_SSH} ${SUDO} ping -n -w 1 -c 1 ${OTHERFAKE_ADDR} || true + ssh ${REMOTE_SSH} logger -t "arp-regress[$$$$]" $@ + ssh ${REMOTE_SSH} ${SUDO} ping -n -w 1 -c 1 ${OTHERFAKE_ADDR} || true scp ${REMOTE_SSH}:/var/log/messages old.log ${SUDO} ${PYTHON}arp_otherfake.py scp ${REMOTE_SSH}:/var/log/messages new.log ssh ${REMOTE_SSH} ${SUDO} arp -an >arp.log - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${OTHERFAKE_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${OTHERFAKE_ADDR} diff old.log new.log | grep '^> ' >diff.log grep 'bsd: arp: attempt to add entry for ${OTHERFAKE_ADDR} on .* by ${LOCAL_MAC} on .*' diff.log grep '^${OTHERFAKE_ADDR} .* (incomplete) ' arp.log @@ -277,12 +286,12 @@ TARGETS += arp-proxy run-regress-arp-proxy: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request for fake address that is proxied - ssh -t ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${PROXY_MAC} - ssh -t ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${FAKE_MAC} pub + ssh ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${PROXY_MAC} + ssh ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${FAKE_MAC} pub ${SUDO} ${PYTHON}arp_proxy.py ssh ${REMOTE_SSH} ${SUDO} arp -an >arp.log - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} grep '^${FAKE_ADDR} .* ${FAKE_MAC} .* static * p$$' arp.log # Enter a static ARP entry on the remote machine for a fake address, @@ -294,10 +303,10 @@ TARGETS += arp-nonproxy run-regress-arp-nonproxy: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request for fake address that is not published - ssh -t ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${FAKE_MAC} + ssh ${REMOTE_SSH} ${SUDO} arp -s ${FAKE_ADDR} ${FAKE_MAC} ${SUDO} ${PYTHON}arp_nonproxy.py ssh ${REMOTE_SSH} ${SUDO} arp -an >arp.log - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${FAKE_ADDR} grep '^${FAKE_ADDR} .* ${FAKE_MAC} .* static * $$' arp.log # Publish a proxy ARP entry on the remote machine for a fake address @@ -309,10 +318,10 @@ TARGETS += arp-otherproxy run-regress-arp-otherproxy: addr.py clean-arp @echo '\n======== $@ ========' @echo Send ARP Request for address proxied on another interface - ssh -t ${REMOTE_SSH} ${SUDO} arp -s ${OTHERFAKE_ADDR} ${FAKE_MAC} pub + ssh ${REMOTE_SSH} ${SUDO} arp -s ${OTHERFAKE_ADDR} ${FAKE_MAC} pub ${SUDO} ${PYTHON}arp_otherproxy.py ssh ${REMOTE_SSH} ${SUDO} arp -an >arp.log - ssh -t ${REMOTE_SSH} ${SUDO} arp -d ${OTHERFAKE_ADDR} + ssh ${REMOTE_SSH} ${SUDO} arp -d ${OTHERFAKE_ADDR} grep '^${OTHERFAKE_ADDR} .* ${FAKE_MAC} .* static * p$$' arp.log REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/} diff --git a/regress/sys/netinet/pmtu/Makefile b/regress/sys/netinet/pmtu/Makefile index dfdb4f7a8c1..cc454c460ce 100644 --- a/regress/sys/netinet/pmtu/Makefile +++ b/regress/sys/netinet/pmtu/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1.1.1 2016/07/11 13:15:20 bluhm Exp $ +# $OpenBSD: Makefile,v 1.2 2016/07/18 09:09:24 bluhm Exp $ # The following ports must be installed: # @@ -50,6 +50,15 @@ regress: @echo are empty. Fill out these variables for additional tests. .endif +.if ! empty (REMOTE_SSH) +.if make (regress) || make (all) +.BEGIN: pf.conf addr.py + @echo + ${SUDO} true + ssh -t ${REMOTE_SSH} ${SUDO} true +.endif +.endif + depend: addr.py # Create python include file containing the addresses. @@ -80,7 +89,7 @@ PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.CURDIR}/ reset-route: @echo '\n======== $@ ========' -${SUDO} route -n delete -host ${REMOTE_ADDR} - ssh -t ${REMOTE_SSH} ${SUDO} sh -c "'\ + ssh ${REMOTE_SSH} ${SUDO} sh -c "'\ route -n delete -inet -host ${LOCAL_ADDR};\ route -n delete -inet -net ${FAKE_NET};\ route -n delete -inet -host ${FAKE_NET_ADDR};\ @@ -88,7 +97,7 @@ reset-route: reset-route6: @echo '\n======== $@ ========' -${SUDO} route -n delete -host ${REMOTE_ADDR6} - ssh -t ${REMOTE_SSH} ${SUDO} sh -c "'\ + ssh ${REMOTE_SSH} ${SUDO} sh -c "'\ route -n delete -inet6 -host ${LOCAL_ADDR6};\ route -n delete -inet6 -net ${FAKE_NET6};\ route -n delete -inet6 -host ${FAKE_NET_ADDR6};\ -- 2.20.1