aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_xsk.sh
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2021-02-23 16:23:01 +0000
committerAlexei Starovoitov <ast@kernel.org>2021-02-26 12:08:48 -0800
commitecde60614d5ed60fde1c80b38b71582a3ea2e662 (patch)
tree5eb3a48bcb94852c0ad67c178c1db36112b53e51 /tools/testing/selftests/bpf/test_xsk.sh
parentbpf: Rename fixup_bpf_calls and add some comments (diff)
downloadlinux-dev-ecde60614d5ed60fde1c80b38b71582a3ea2e662.tar.xz
linux-dev-ecde60614d5ed60fde1c80b38b71582a3ea2e662.zip
selftest/bpf: Make xsk tests less verbose
Make the xsk tests less verbose by only printing the essentials. Currently, it is hard to see if the tests passed or not due to all the printouts. Move the extra printouts to a verbose option, if further debugging is needed when a problem arises. To run the xsk tests with verbose output: ./test_xsk.sh -v Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://lore.kernel.org/bpf/20210223162304.7450-2-ciara.loftus@intel.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_xsk.sh')
-rwxr-xr-xtools/testing/selftests/bpf/test_xsk.sh27
1 files changed, 21 insertions, 6 deletions
diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index 88a7483eaae4..f4cedf4c2718 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -71,13 +71,17 @@
#
# Run (full output without color-coding):
# sudo ./test_xsk.sh
+#
+# Run with verbose output:
+# sudo ./test_xsk.sh -v
. xsk_prereqs.sh
-while getopts c flag
+while getopts "cv" flag
do
case "${flag}" in
c) colorconsole=1;;
+ v) verbose=1;;
esac
done
@@ -95,13 +99,17 @@ NS1=af_xdp${VETH1_POSTFIX}
MTU=1500
setup_vethPairs() {
- echo "setting up ${VETH0}: namespace: ${NS0}"
+ if [[ $verbose -eq 1 ]]; then
+ echo "setting up ${VETH0}: namespace: ${NS0}"
+ fi
ip netns add ${NS1}
ip link add ${VETH0} type veth peer name ${VETH1}
if [ -f /proc/net/if_inet6 ]; then
echo 1 > /proc/sys/net/ipv6/conf/${VETH0}/disable_ipv6
fi
- echo "setting up ${VETH1}: namespace: ${NS1}"
+ if [[ $verbose -eq 1 ]]; then
+ echo "setting up ${VETH1}: namespace: ${NS1}"
+ fi
ip link set ${VETH1} netns ${NS1}
ip netns exec ${NS1} ip link set ${VETH1} mtu ${MTU}
ip link set ${VETH0} mtu ${MTU}
@@ -125,7 +133,10 @@ echo "${VETH0}:${VETH1},${NS1}" > ${SPECFILE}
validate_veth_spec_file
-echo "Spec file created: ${SPECFILE}"
+if [[ $verbose -eq 1 ]]; then
+ echo "Spec file created: ${SPECFILE}"
+ VERBOSE_ARG="-v"
+fi
test_status $retval "${TEST_NAME}"
@@ -136,12 +147,16 @@ statusList=()
### TEST 1
TEST_NAME="XSK KSELFTEST FRAMEWORK"
-echo "Switching interfaces [${VETH0}, ${VETH1}] to XDP Generic mode"
+if [[ $verbose -eq 1 ]]; then
+ echo "Switching interfaces [${VETH0}, ${VETH1}] to XDP Generic mode"
+fi
vethXDPgeneric ${VETH0} ${VETH1} ${NS1}
retval=$?
if [ $retval -eq 0 ]; then
- echo "Switching interfaces [${VETH0}, ${VETH1}] to XDP Native mode"
+ if [[ $verbose -eq 1 ]]; then
+ echo "Switching interfaces [${VETH0}, ${VETH1}] to XDP Native mode"
+ fi
vethXDPnative ${VETH0} ${VETH1} ${NS1}
fi