From: Alexei Starovoitov <ast@kernel.org>
To: "David S . Miller" <davem@davemloft.net>
Cc: <daniel@iogearbox.net>, <ecree@solarflare.com>,
<jakub.kicinski@netronome.com>, <jiong.wang@netronome.com>,
<netdev@vger.kernel.org>, <kernel-team@fb.com>
Subject: [PATCH bpf-next 2/4] selftests/bpf: check insn processed in test_verifier
Date: Tue, 11 Dec 2018 21:28:52 -0800 [thread overview]
Message-ID: <20181212052854.4105971-3-ast@kernel.org> (raw)
In-Reply-To: <20181212052854.4105971-1-ast@kernel.org>
teach test_verifier to parse verifier output for insn processed
and compare with expected number
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
tools/testing/selftests/bpf/test_verifier.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index a08c67c8767e..82359cdbc805 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -76,7 +76,7 @@ struct bpf_test {
int fixup_percpu_cgroup_storage[MAX_FIXUPS];
const char *errstr;
const char *errstr_unpriv;
- uint32_t retval, retval_unpriv;
+ uint32_t retval, retval_unpriv, insn_processed;
enum {
UNDEF,
ACCEPT,
@@ -14444,6 +14444,19 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
}
}
+ if (test->insn_processed) {
+ uint32_t insn_processed;
+ char *proc;
+
+ proc = strstr(bpf_vlog, "processed ");
+ insn_processed = atoi(proc + 10);
+ if (test->insn_processed != insn_processed) {
+ printf("FAIL\nUnexpected insn_processed %u vs %u\n",
+ insn_processed, test->insn_processed);
+ goto fail_log;
+ }
+ }
+
if (fd_prog >= 0) {
__u8 tmp[TEST_DATA_LEN << 2];
__u32 size_tmp = sizeof(tmp);
--
2.17.1
next prev parent reply other threads:[~2018-12-12 5:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 5:28 [PATCH bpf-next 0/4] bpf: improve verifier state analysis Alexei Starovoitov
2018-12-12 5:28 ` [PATCH bpf-next 1/4] bpf: speed up stacksafe check Alexei Starovoitov
2018-12-12 5:28 ` Alexei Starovoitov [this message]
2018-12-12 5:28 ` [PATCH bpf-next 3/4] bpf: improve stacksafe state comparison Alexei Starovoitov
2018-12-12 5:28 ` [PATCH bpf-next 4/4] bpf: add self-check logic to liveness analysis Alexei Starovoitov
2018-12-12 20:58 ` Edward Cree
2018-12-12 22:00 ` Alexei Starovoitov
2018-12-12 22:26 ` Edward Cree
2018-12-13 0:00 ` Alexei Starovoitov
2018-12-13 20:02 ` Edward Cree
2018-12-13 1:21 ` Jakub Kicinski
2018-12-13 4:37 ` Alexei Starovoitov
2018-12-13 1:22 ` [PATCH bpf-next 0/4] bpf: improve verifier state analysis Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181212052854.4105971-3-ast@kernel.org \
--to=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ecree@solarflare.com \
--cc=jakub.kicinski@netronome.com \
--cc=jiong.wang@netronome.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).