Thread (12 messages) read the whole thread 12 messages, 4 authors, 2020-09-29

Re: [PATCH v7 bpf-next 4/8] selftests/bpf: add bpf_snprintf_btf helper tests

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2020-09-29 09:20:53
Also in: bpf, linux-kselftest, lkml

On 9/28/20 1:31 PM, Alan Maguire wrote:
Tests verifying snprintf()ing of various data structures,
flags combinations using a tp_btf program. Tests are skipped
if __builtin_btf_type_id is not available to retrieve BTF
type ids.

Signed-off-by: Alan Maguire <redacted>
[...]
+void test_snprintf_btf(void)
+{
+	struct netif_receive_skb *skel;
+	struct netif_receive_skb__bss *bss;
+	int err, duration = 0;
+
+	skel = netif_receive_skb__open();
+	if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
+		return;
+
+	err = netif_receive_skb__load(skel);
+	if (CHECK(err, "skel_load", "failed to load skeleton: %d\n", err))
+		goto cleanup;
+
+	bss = skel->bss;
+
+	err = netif_receive_skb__attach(skel);
+	if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err))
+		goto cleanup;
+
+	/* generate receive event */
+	system("ping -c 1 127.0.0.1 > /dev/null");
This generates the following new warning when compiling BPF selftests:

   [...]
   EXT-OBJ  [test_progs] cgroup_helpers.o
   EXT-OBJ  [test_progs] trace_helpers.o
   EXT-OBJ  [test_progs] network_helpers.o
   EXT-OBJ  [test_progs] testing_helpers.o
   TEST-OBJ [test_progs] snprintf_btf.test.o
/root/bpf-next/tools/testing/selftests/bpf/prog_tests/snprintf_btf.c: In function ‘test_snprintf_btf’:
/root/bpf-next/tools/testing/selftests/bpf/prog_tests/snprintf_btf.c:30:2: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
   system("ping -c 1 127.0.0.1 > /dev/null");
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   [...]

Please fix, thx!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help