1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
3 #include <test_progs.h>
5 #include "test_subprogs.skel.h"
6 #include "test_subprogs_unused.skel.h"
10 void test_subprogs(void)
12 struct test_subprogs
*skel
;
13 struct test_subprogs_unused
*skel2
;
16 skel
= test_subprogs__open_and_load();
17 if (CHECK(!skel
, "skel_open", "failed to open skeleton\n"))
20 err
= test_subprogs__attach(skel
);
21 if (CHECK(err
, "skel_attach", "failed to attach skeleton: %d\n", err
))
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
);
36 test_subprogs__destroy(skel
);