]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/net: skip psock_tpacket test if KALLSYMS was not enabled
authorPo-Hsu Lin <po-hsu.lin@canonical.com>
Mon, 1 Jul 2019 04:40:31 +0000 (12:40 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Jul 2019 00:17:49 +0000 (20:17 -0400)
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>
tools/testing/selftests/net/config
tools/testing/selftests/net/run_afpackettests

index 47404044860189010c12e6e2cfeecbf3d0e7dcef..3dea2cba232527d5fd0164ce3e9761a740130440 100644 (file)
@@ -25,3 +25,4 @@ CONFIG_NF_TABLES_IPV6=y
 CONFIG_NF_TABLES_IPV4=y
 CONFIG_NFT_CHAIN_NAT_IPV6=m
 CONFIG_NFT_CHAIN_NAT_IPV4=m
+CONFIG_KALLSYMS=y
index ea5938ec009a5eb9e28cb1778e081a568e66fd65..8b42e8b04e0f719ac9823685dabf137f55d005a3 100755 (executable)
@@ -21,12 +21,16 @@ fi
 echo "--------------------"
 echo "running psock_tpacket test"
 echo "--------------------"
-./in_netns.sh ./psock_tpacket
-if [ $? -ne 0 ]; then
-       echo "[FAIL]"
-       ret=1
+if [ -f /proc/kallsyms ]; then
+       ./in_netns.sh ./psock_tpacket
+       if [ $? -ne 0 ]; then
+               echo "[FAIL]"
+               ret=1
+       else
+               echo "[PASS]"
+       fi
 else
-       echo "[PASS]"
+       echo "[SKIP] CONFIG_KALLSYMS not enabled"
 fi
 
 echo "--------------------"