WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / prog_tests / subprogs.c
blob3f3d2ac4dd57e821d3df9f18773085953047b574
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
3 #include <test_progs.h>
4 #include <time.h>
5 #include "test_subprogs.skel.h"
6 #include "test_subprogs_unused.skel.h"
8 static int duration;
10 void test_subprogs(void)
12 struct test_subprogs *skel;
13 struct test_subprogs_unused *skel2;
14 int err;
16 skel = test_subprogs__open_and_load();
17 if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
18 return;
20 err = test_subprogs__attach(skel);
21 if (CHECK(err, "skel_attach", "failed to attach skeleton: %d\n", err))
22 goto cleanup;
24 usleep(1);
26 CHECK(skel->bss->res1 != 12, "res1", "got %d, exp %d\n", skel->bss->res1, 12);
27 CHECK(skel->bss->res2 != 17, "res2", "got %d, exp %d\n", skel->bss->res2, 17);
28 CHECK(skel->bss->res3 != 19, "res3", "got %d, exp %d\n", skel->bss->res3, 19);
29 CHECK(skel->bss->res4 != 36, "res4", "got %d, exp %d\n", skel->bss->res4, 36);
31 skel2 = test_subprogs_unused__open_and_load();
32 ASSERT_OK_PTR(skel2, "unused_progs_skel");
33 test_subprogs_unused__destroy(skel2);
35 cleanup:
36 test_subprogs__destroy(skel);