summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-08-06 07:31:54 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-08-06 07:31:54 +0000
commit73bfa54e557b9f73056261bdf38297bd9adcf181 (patch)
tree68a0593166695606f80b30b9a7e6822152129d60
parente1f1f721d0355f284890f73d03594c4c5290f5aa (diff)
Cleanup the scripts a bit, error out early if not run as root, use
set -x later in the script instead of ksh -x to shorten the output of the tests.
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/Makefile10
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/md5.sh15
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/mrt.sh14
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/network_statement.sh15
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/ovs.sh15
5 files changed, 52 insertions, 17 deletions
diff --git a/regress/usr.sbin/bgpd/integrationtests/Makefile b/regress/usr.sbin/bgpd/integrationtests/Makefile
index ec169e6e1be..8658b26ade2 100644
--- a/regress/usr.sbin/bgpd/integrationtests/Makefile
+++ b/regress/usr.sbin/bgpd/integrationtests/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.5 2019/06/22 08:26:26 claudio Exp $
+# $OpenBSD: Makefile,v 1.6 2019/08/06 07:31:53 claudio Exp $
REGRESS_TARGETS = network_statement md5 ovs mrt
BGPD ?= /usr/sbin/bgpd
@@ -6,15 +6,15 @@ BGPD ?= /usr/sbin/bgpd
CLEANFILES += *.mrt *.out
network_statement:
- ${SUDO} ksh -x ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12
+ ${SUDO} ksh ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12
md5:
- ${SUDO} ksh -x ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12
+ ${SUDO} ksh ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12
ovs:
- ${SUDO} ksh -x ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12
+ ${SUDO} ksh ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12
mrt:
- ${SUDO} ksh -x ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11
+ ${SUDO} ksh ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11
.include <bsd.regress.mk>
diff --git a/regress/usr.sbin/bgpd/integrationtests/md5.sh b/regress/usr.sbin/bgpd/integrationtests/md5.sh
index ad2a562faec..20256680fc5 100644
--- a/regress/usr.sbin/bgpd/integrationtests/md5.sh
+++ b/regress/usr.sbin/bgpd/integrationtests/md5.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: md5.sh,v 1.3 2019/05/29 08:54:53 claudio Exp $
+# $OpenBSD: md5.sh,v 1.4 2019/08/06 07:31:53 claudio Exp $
set -e
@@ -34,12 +34,19 @@ error_notify() {
fi
}
+if [ "$(id -u)" -ne 0 ]; then
+ echo need root privileges >&2
+ exit 1
+fi
+
trap 'error_notify $?' EXIT
echo check if rdomains are busy
for n in ${RDOMAINS}; do
- if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then \
- echo routing domain ${n} is already used >&2; exit 1; fi
+ if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then
+ echo routing domain ${n} is already used >&2
+ exit 1
+ fi
done
echo check if interfaces are busy
@@ -48,6 +55,8 @@ for n in ${PAIRS}; do
( echo interface ${n} is already used >&2; exit 1 )
done
+set -x
+
echo setup
ifconfig ${PAIR1} rdomain ${RDOMAIN1} ${PAIR1IP}/30 up
ifconfig ${PAIR2} rdomain ${RDOMAIN2} ${PAIR2IP}/30 up
diff --git a/regress/usr.sbin/bgpd/integrationtests/mrt.sh b/regress/usr.sbin/bgpd/integrationtests/mrt.sh
index d3b259b3f0a..759088d45c5 100644
--- a/regress/usr.sbin/bgpd/integrationtests/mrt.sh
+++ b/regress/usr.sbin/bgpd/integrationtests/mrt.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: mrt.sh,v 1.2 2019/06/28 05:47:28 claudio Exp $
+# $OpenBSD: mrt.sh,v 1.3 2019/08/06 07:31:53 claudio Exp $
set -e
@@ -21,13 +21,21 @@ error_notify() {
fi
}
+if [ "$(id -u)" -ne 0 ]; then
+ echo need root privileges >&2
+ exit 1
+fi
+
trap 'error_notify $?' EXIT
echo check if rdomains are busy
if /sbin/ifconfig lo${RDOMAIN1} > /dev/null 2>&1; then
- echo routing domain ${RDOMAIN1} is already used >&2; exit 1;
+ echo routing domain ${RDOMAIN1} is already used >&2
+ exit 1
fi
+set -x
+
echo setup
ifconfig mpe${RDOMAIN1} rdomain ${RDOMAIN1} mplslabel 42
ifconfig lo${RDOMAIN1} inet 127.0.0.1/8
@@ -37,7 +45,7 @@ route -T ${RDOMAIN1} exec ${BGPD} \
sleep 2
-pkill -USR1 -T ${RDOMAIN1} -U 0 bgpd
+pkill -USR1 -T ${RDOMAIN1} -u 0 bgpd
sleep 2
diff --git a/regress/usr.sbin/bgpd/integrationtests/network_statement.sh b/regress/usr.sbin/bgpd/integrationtests/network_statement.sh
index 12eff0d9b7e..0b28dcafac6 100644
--- a/regress/usr.sbin/bgpd/integrationtests/network_statement.sh
+++ b/regress/usr.sbin/bgpd/integrationtests/network_statement.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: network_statement.sh,v 1.3 2018/11/07 16:57:59 claudio Exp $
+# $OpenBSD: network_statement.sh,v 1.4 2019/08/06 07:31:53 claudio Exp $
set -e
@@ -42,12 +42,19 @@ error_notify() {
fi
}
+if [ "$(id -u)" -ne 0 ]; then
+ echo need root privileges >&2
+ exit 1
+fi
+
trap 'error_notify $?' EXIT
echo check if rdomains are busy
for n in ${RDOMAINS}; do
- if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then \
- echo routing domain ${n} is already used >&2; exit 1; fi
+ if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then
+ echo routing domain ${n} is already used >&2
+ exit 1
+ fi
done
echo check if interfaces are busy
@@ -56,6 +63,8 @@ for n in ${PAIRS}; do
( echo interface ${n} is already used >&2; exit 1 )
done
+set -x
+
echo setup
ifconfig ${PAIR1} rdomain ${RDOMAIN1} ${PAIR1IP}/30 up
ifconfig ${PAIR2} rdomain ${RDOMAIN2} ${PAIR2IP}/30 up
diff --git a/regress/usr.sbin/bgpd/integrationtests/ovs.sh b/regress/usr.sbin/bgpd/integrationtests/ovs.sh
index 3842fee7ba8..c3329566e83 100644
--- a/regress/usr.sbin/bgpd/integrationtests/ovs.sh
+++ b/regress/usr.sbin/bgpd/integrationtests/ovs.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: ovs.sh,v 1.2 2019/05/29 08:52:50 claudio Exp $
+# $OpenBSD: ovs.sh,v 1.3 2019/08/06 07:31:53 claudio Exp $
set -e
@@ -44,12 +44,19 @@ error_notify() {
fi
}
+if [ "$(id -u)" -ne 0 ]; then
+ echo need root privileges >&2
+ exit 1
+fi
+
trap 'error_notify $?' EXIT
echo check if rdomains are busy
for n in ${RDOMAINS}; do
- if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then \
- echo routing domain ${n} is already used >&2; exit 1; fi
+ if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then
+ echo routing domain ${n} is already used >&2
+ exit 1
+ fi
done
echo check if interfaces are busy
@@ -58,6 +65,8 @@ for n in ${PAIRS}; do
( echo interface ${n} is already used >&2; exit 1 )
done
+set -x
+
echo setup
ifconfig ${PAIR1} rdomain ${RDOMAIN1} ${PAIR1IP}/30 up
ifconfig ${PAIR2} rdomain ${RDOMAIN2} ${PAIR2IP}/30 up