bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors
@ 2019-05-14 21:12 Stanislav Fomichev
  2019-05-14 21:12 ` [PATCH bpf 2/2] selftests/bpf: add prog detach to flow_dissector test Stanislav Fomichev
  2019-05-15 23:42 ` [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Stanislav Fomichev @ 2019-05-14 21:12 UTC (permalink / raw)
  To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev

Otherwise, in case of an error, everything gets mushed together.

Fixes: a5cb33464e53 ("selftests/bpf: make flow dissector tests more extensible")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/testing/selftests/bpf/prog_tests/flow_dissector.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
index 8b54adfd6264..d40cee07a224 100644
--- a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
+++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
@@ -242,12 +242,12 @@ void test_flow_dissector(void)
 	 */
 
 	err = bpf_prog_attach(prog_fd, 0, BPF_FLOW_DISSECTOR, 0);
-	CHECK(err, "bpf_prog_attach", "err %d errno %d", err, errno);
+	CHECK(err, "bpf_prog_attach", "err %d errno %d\n", err, errno);
 
 	tap_fd = create_tap("tap0");
-	CHECK(tap_fd < 0, "create_tap", "tap_fd %d errno %d", tap_fd, errno);
+	CHECK(tap_fd < 0, "create_tap", "tap_fd %d errno %d\n", tap_fd, errno);
 	err = ifup("tap0");
-	CHECK(err, "ifup", "err %d errno %d", err, errno);
+	CHECK(err, "ifup", "err %d errno %d\n", err, errno);
 
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		struct bpf_flow_keys flow_keys = {};
@@ -255,7 +255,7 @@ void test_flow_dissector(void)
 		__u32 key = 0;
 
 		err = tx_tap(tap_fd, &tests[i].pkt, sizeof(tests[i].pkt));
-		CHECK(err < 0, "tx_tap", "err %d errno %d", err, errno);
+		CHECK(err < 0, "tx_tap", "err %d errno %d\n", err, errno);
 
 		err = bpf_map_lookup_elem(keys_fd, &key, &flow_keys);
 		CHECK_ATTR(err, tests[i].name, "bpf_map_lookup_elem %d\n", err);
-- 
2.21.0.1020.gf2820cf01a-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH bpf 2/2] selftests/bpf: add prog detach to flow_dissector test
  2019-05-14 21:12 [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors Stanislav Fomichev
@ 2019-05-14 21:12 ` Stanislav Fomichev
  2019-05-15 23:42 ` [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Stanislav Fomichev @ 2019-05-14 21:12 UTC (permalink / raw)
  To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev

In case we are not running in a namespace (which we don't do by default),
let's try to detach the bpf program that we use for eth_get_headlen tests.

Fixes: 0905beec9f52 ("selftests/bpf: run flow dissector tests in skb-less mode")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/testing/selftests/bpf/prog_tests/flow_dissector.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
index d40cee07a224..fbd1d88a6095 100644
--- a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
+++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
@@ -264,5 +264,6 @@ void test_flow_dissector(void)
 		CHECK_FLOW_KEYS(tests[i].name, flow_keys, tests[i].keys);
 	}
 
+	bpf_prog_detach(prog_fd, BPF_FLOW_DISSECTOR);
 	bpf_object__close(obj);
 }
-- 
2.21.0.1020.gf2820cf01a-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors
  2019-05-14 21:12 [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors Stanislav Fomichev
  2019-05-14 21:12 ` [PATCH bpf 2/2] selftests/bpf: add prog detach to flow_dissector test Stanislav Fomichev
@ 2019-05-15 23:42 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-05-15 23:42 UTC (permalink / raw)
  To: Stanislav Fomichev, netdev, bpf; +Cc: davem, ast

On 05/14/2019 11:12 PM, Stanislav Fomichev wrote:
> Otherwise, in case of an error, everything gets mushed together.
> 
> Fixes: a5cb33464e53 ("selftests/bpf: make flow dissector tests more extensible")
> Signed-off-by: Stanislav Fomichev <sdf@google.com>

Both applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-16  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 21:12 [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors Stanislav Fomichev
2019-05-14 21:12 ` [PATCH bpf 2/2] selftests/bpf: add prog detach to flow_dissector test Stanislav Fomichev
2019-05-15 23:42 ` [PATCH bpf 1/2] selftests/bpf: add missing \n to flow_dissector CHECK errors Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).