diff mbox series

selftests/net: skip psock_tpacket test if KALLSYMS was not enabled

Message ID 20190612064752.6701-1-po-hsu.lin@canonical.com (mailing list archive)
State New
Headers show
Series selftests/net: skip psock_tpacket test if KALLSYMS was not enabled | expand

Commit Message

Po-Hsu Lin June 12, 2019, 6:47 a.m. UTC
The psock_tpacket test will need to access /proc/kallsyms, this would
require the kernel config CONFIG_KALLSYMS to be enabled first.

Check the file existence to determine if we can run this test.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
 tools/testing/selftests/net/run_afpackettests | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

David Miller June 12, 2019, 4:27 p.m. UTC | #1
From: Po-Hsu Lin <po-hsu.lin@canonical.com>
Date: Wed, 12 Jun 2019 14:47:52 +0800

> The psock_tpacket test will need to access /proc/kallsyms, this would
> require the kernel config CONFIG_KALLSYMS to be enabled first.
> 
> Check the file existence to determine if we can run this test.
> 
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>

Please just add CONFIG_KALLSYMS to "config".
Po-Hsu Lin June 13, 2019, 10:28 a.m. UTC | #2
Hello,

This issue was spotted on Ubuntu linux-kvm kernel, on which the
CONFIG_KALLSYMS was disabled intentionally.
I think this extra check could be helpful when running the net test directly.
$ make -C tools/testing/selftests TARGETS=net run_tests

Also, there is an identical check implemented in the ftrace
kprobe_args_symbol test.

I can send V2 along with CONFIG_KALLSYMS appended to the "config" file
if you agree with this.

Thanks

On Thu, Jun 13, 2019 at 12:27 AM David Miller <davem@davemloft.net> wrote:
>
> From: Po-Hsu Lin <po-hsu.lin@canonical.com>
> Date: Wed, 12 Jun 2019 14:47:52 +0800
>
> > The psock_tpacket test will need to access /proc/kallsyms, this would
> > require the kernel config CONFIG_KALLSYMS to be enabled first.
> >
> > Check the file existence to determine if we can run this test.
> >
> > Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
>
> Please just add CONFIG_KALLSYMS to "config".
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/run_afpackettests b/tools/testing/selftests/net/run_afpackettests
index ea5938e..8b42e8b 100755
--- a/tools/testing/selftests/net/run_afpackettests
+++ b/tools/testing/selftests/net/run_afpackettests
@@ -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 "--------------------"