1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright (c) 2021 Facebook */ 3 4 #include <test_progs.h> 5 #include <bpf/libbpf.h> 6 #include <bpf/btf.h> 7 #include "test_ksyms_module.lskel.h" 8 9 static int duration; 10 11 void test_ksyms_module(void) 12 { 13 struct test_ksyms_module* skel; 14 int err; 15 16 skel = test_ksyms_module__open_and_load(); 17 if (CHECK(!skel, "skel_open", "failed to open skeleton\n")) 18 return; 19 20 err = test_ksyms_module__attach(skel); 21 if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err)) 22 goto cleanup; 23 24 usleep(1); 25 26 ASSERT_EQ(skel->bss->triggered, true, "triggered"); 27 ASSERT_EQ(skel->bss->out_mod_ksym_global, 123, "global_ksym_val"); 28 29 cleanup: 30 test_ksyms_module__destroy(skel); 31 } 32