linux-stable/tools/testing/selftests/net/run_afpackettests
Po-Hsu Lin ff95bf28c2 selftests/net: skip psock_tpacket test if KALLSYMS was not enabled
The psock_tpacket test will need to access /proc/kallsyms, this would
require the kernel config CONFIG_KALLSYMS to be enabled first.

Apart from adding CONFIG_KALLSYMS to the net/config file here, check the
file existence to determine if we can run this test will be helpful to
avoid a false-positive test result when testing it directly with the
following commad against a kernel that have CONFIG_KALLSYMS disabled:
    make -C tools/testing/selftests TARGETS=net run_tests

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-02 20:17:49 -04:00

46 lines
792 B
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
if [ $(id -u) != 0 ]; then
echo $msg must be run as root >&2
exit 0
fi
ret=0
echo "--------------------"
echo "running psock_fanout test"
echo "--------------------"
./in_netns.sh ./psock_fanout
if [ $? -ne 0 ]; then
echo "[FAIL]"
ret=1
else
echo "[PASS]"
fi
echo "--------------------"
echo "running psock_tpacket test"
echo "--------------------"
if [ -f /proc/kallsyms ]; then
./in_netns.sh ./psock_tpacket
if [ $? -ne 0 ]; then
echo "[FAIL]"
ret=1
else
echo "[PASS]"
fi
else
echo "[SKIP] CONFIG_KALLSYMS not enabled"
fi
echo "--------------------"
echo "running txring_overwrite test"
echo "--------------------"
./in_netns.sh ./txring_overwrite
if [ $? -ne 0 ]; then
echo "[FAIL]"
ret=1
else
echo "[PASS]"
fi
exit $ret