1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2021 Facebook */
3 
4 #include <test_progs.h>
5 #include <sys/syscall.h>
6 #include "linked_maps.skel.h"
7 
8 void test_linked_maps(void)
9 {
10 	int err;
11 	struct linked_maps *skel;
12 
13 	skel = linked_maps__open_and_load();
14 	if (!ASSERT_OK_PTR(skel, "skel_open"))
15 		return;
16 
17 	err = linked_maps__attach(skel);
18 	if (!ASSERT_OK(err, "skel_attach"))
19 		goto cleanup;
20 
21 	/* trigger */
22 	syscall(SYS_getpgid);
23 
24 	ASSERT_EQ(skel->bss->output_first1, 2000, "output_first1");
25 	ASSERT_EQ(skel->bss->output_second1, 2, "output_second1");
26 	ASSERT_EQ(skel->bss->output_weak1, 2, "output_weak1");
27 
28 cleanup:
29 	linked_maps__destroy(skel);
30 }
31