summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/pkt_md_access.c
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2019-03-01 19:42:14 -0800
committerAlexei Starovoitov <ast@kernel.org>2019-03-02 11:10:40 -0800
commit7395724b404db76fc093fb99b5c957baa409d8ae (patch)
tree31f3ade3794186ea1cb799647c18bf38951bf31e /tools/testing/selftests/bpf/prog_tests/pkt_md_access.c
parent3f30658830f3a133ba2136237ea9c8e589344a3b (diff)
downloadlinux-7395724b404db76fc093fb99b5c957baa409d8ae.tar.bz2
selftests: bpf: break up test_progs - pkt access
Move pkt access prog tests into separate files. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/pkt_md_access.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/pkt_md_access.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/pkt_md_access.c b/tools/testing/selftests/bpf/prog_tests/pkt_md_access.c
new file mode 100644
index 000000000000..ac0d43435806
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/pkt_md_access.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <test_progs.h>
+
+void test_pkt_md_access(void)
+{
+ const char *file = "./test_pkt_md_access.o";
+ struct bpf_object *obj;
+ __u32 duration, retval;
+ int err, prog_fd;
+
+ err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd);
+ if (err) {
+ error_cnt++;
+ return;
+ }
+
+ err = bpf_prog_test_run(prog_fd, 10, &pkt_v4, sizeof(pkt_v4),
+ NULL, NULL, &retval, &duration);
+ CHECK(err || retval, "",
+ "err %d errno %d retval %d duration %d\n",
+ err, errno, retval, duration);
+
+ bpf_object__close(obj);
+}