From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: alexei.starovoitov@gmail.com, daniel@iogearbox.net
Cc: oss-drivers@netronome.com, netdev@vger.kernel.org,
Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH bpf-next v2 1/3] selftests: bpf: prepare for break up of verifier tests
Date: Fri, 25 Jan 2019 15:24:42 -0800 [thread overview]
Message-ID: <20190125232444.30172-2-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20190125232444.30172-1-jakub.kicinski@netronome.com>
test_verifier.c has grown to be very long (almost 16 kLoC),
and it is very conflict prone since we always add tests at
the end.
Try to break it apart a little bit. Allow test snippets
to be defined in separate files and include them automatically
into the huge test array.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiong Wang <jiong.wang@netronome.com>
---
tools/testing/selftests/bpf/Makefile | 13 +++++++++++++
tools/testing/selftests/bpf/test_verifier.c | 3 +++
tools/testing/selftests/bpf/verifier/.gitignore | 1 +
3 files changed, 17 insertions(+)
create mode 100644 tools/testing/selftests/bpf/verifier/.gitignore
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index ab1b4e0ecc63..791b4c9bf796 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -217,4 +217,17 @@ ifeq ($(DWARF2BTF),y)
$(BTF_PAHOLE) -J $@
endif
+$(OUTPUT)/test_verifier: $(OUTPUT)/verifier/tests.h
+$(OUTPUT)/test_verifier: CFLAGS += -I$(OUTPUT)
+
+VERIFIER_TEST_FILES := $(wildcard verifier/*.c)
+$(OUTPUT)/verifier/tests.h: $(VERIFIER_TEST_FILES)
+ $(shell ( cd verifier/
+ echo '/* Generated header, do not edit */'; \
+ echo '#ifdef FILL_ARRAY'; \
+ ls *.c 2> /dev/null | \
+ sed -e 's@\(.*\)@#include \"\1\"@'; \
+ echo '#endif' \
+ ) > $(OUTPUT)/verifier/tests.h)
+
EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR)
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index 1df757645a9a..0a1847c3d1a3 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -248,6 +248,9 @@ static void bpf_fill_rand_ld_dw(struct bpf_test *self)
BPF_ALU64_IMM(BPF_ARSH, BPF_REG_7, 32)
static struct bpf_test tests[] = {
+#define FILL_ARRAY
+#include <verifier/tests.h>
+#undef FILL_ARRAY
{
"add+sub+mul",
.insns = {
diff --git a/tools/testing/selftests/bpf/verifier/.gitignore b/tools/testing/selftests/bpf/verifier/.gitignore
new file mode 100644
index 000000000000..45984a364647
--- /dev/null
+++ b/tools/testing/selftests/bpf/verifier/.gitignore
@@ -0,0 +1 @@
+tests.h
--
2.19.2
next prev parent reply other threads:[~2019-01-25 23:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 23:24 [PATCH bpf-next v2 0/3] selftests: bpf: break up test_verifier Jakub Kicinski
2019-01-25 23:24 ` Jakub Kicinski [this message]
2019-01-25 23:24 ` [PATCH bpf-next v2 3/3] selftests: bpf: break up the rest of test_verifier Jakub Kicinski
2019-01-26 5:55 ` [PATCH bpf-next v2 0/3] selftests: bpf: break up test_verifier Alexei Starovoitov
2019-01-26 6:17 ` Jakub Kicinski
2019-01-26 6:21 ` Alexei Starovoitov
2019-01-27 18:33 ` Jakub Kicinski
2019-01-27 20:56 ` Alexei Starovoitov
[not found] ` <20190127205413.231fcc05@cakuba.hsd1.ca.comcast.net>
2019-01-28 5:57 ` Alexei Starovoitov
2019-01-28 16:45 ` 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=20190125232444.30172-2-jakub.kicinski@netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/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