1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright (c) 2019 Facebook */ 3 4 #include <test_progs.h> 5 #include "test_static_linked.skel.h" 6 7 void test_static_linked(void) 8 { 9 int err; 10 struct test_static_linked* skel; 11 12 skel = test_static_linked__open(); 13 if (!ASSERT_OK_PTR(skel, "skel_open")) 14 return; 15 16 skel->rodata->rovar1 = 1; 17 skel->rodata->rovar2 = 4; 18 19 err = test_static_linked__load(skel); 20 if (!ASSERT_OK(err, "skel_load")) 21 goto cleanup; 22 23 err = test_static_linked__attach(skel); 24 if (!ASSERT_OK(err, "skel_attach")) 25 goto cleanup; 26 27 /* trigger */ 28 usleep(1); 29 30 ASSERT_EQ(skel->data->var1, 1 * 2 + 2 + 3, "var1"); 31 ASSERT_EQ(skel->data->var2, 4 * 3 + 5 + 6, "var2"); 32 33 cleanup: 34 test_static_linked__destroy(skel); 35 } 36