On Tue, 2024-03-05 at 11:48 -0800, Andrii Nakryiko wrote: [...] > > +/* Swap test_mod1->test_1 program from 'bar' to 'foo' using shadow vars. > > + * test_mod1 load should enable autoload for 'foo'. > > + */ > > +static void autoload_and_shadow_vars(void) > > +{ > > + struct struct_ops_autocreate2 *skel = NULL; > > + struct bpf_link *link = NULL; > > + int err; > > + > > + skel = struct_ops_autocreate2__open(); > > + if (!ASSERT_OK_PTR(skel, "struct_ops_autocreate__open_opts")) > > + return; > > + > > + ASSERT_FALSE(bpf_program__autoload(skel->progs.foo), "foo default autoload"); > > + ASSERT_FALSE(bpf_program__autoload(skel->progs.bar), "bar default autoload"); > > + > > + /* loading map testmod_1 would switch foo's autoload to true */ > > + skel->struct_ops.testmod_1->test_1 = skel->progs.foo; > > + > > + err = struct_ops_autocreate2__load(skel); > > + if (ASSERT_OK(err, "struct_ops_autocreate__load")) > > + goto cleanup; > > + > > + > > let's assert autoload state here as well? Good idea! Did not occur to me to check this after load for some reason. [...]