Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Po-Hsu Lin and committed by
David S. Miller
ff95bf28 99f0eae6

+10 -5
+1
tools/testing/selftests/net/config
··· 25 25 CONFIG_NF_TABLES_IPV4=y 26 26 CONFIG_NFT_CHAIN_NAT_IPV6=m 27 27 CONFIG_NFT_CHAIN_NAT_IPV4=m 28 + CONFIG_KALLSYMS=y
+9 -5
tools/testing/selftests/net/run_afpackettests
··· 21 21 echo "--------------------" 22 22 echo "running psock_tpacket test" 23 23 echo "--------------------" 24 - ./in_netns.sh ./psock_tpacket 25 - if [ $? -ne 0 ]; then 26 - echo "[FAIL]" 27 - ret=1 24 + if [ -f /proc/kallsyms ]; then 25 + ./in_netns.sh ./psock_tpacket 26 + if [ $? -ne 0 ]; then 27 + echo "[FAIL]" 28 + ret=1 29 + else 30 + echo "[PASS]" 31 + fi 28 32 else 29 - echo "[PASS]" 33 + echo "[SKIP] CONFIG_KALLSYMS not enabled" 30 34 fi 31 35 32 36 echo "--------------------"