[PATCH bpf-next v5 2/3] selftests/bpf: Factor out many args tests from tracing_struct
Pu Lehui
pulehui at huawei.com
Tue Jul 2 04:57:21 PDT 2024
On 2024/7/2 19:06, Jiri Olsa wrote:
> On Tue, Jul 02, 2024 at 01:37:29AM +0000, Pu Lehui wrote:
>
> SNIP
>
>> +
>> +static void test_struct_many_args(void)
>> +{
>> + struct tracing_struct_many_args *skel;
>> + int err;
>> +
>> + skel = tracing_struct_many_args__open_and_load();
>> + if (!ASSERT_OK_PTR(skel, "tracing_struct_many_args__open_and_load"))
>> + return;
>> +
>> + err = tracing_struct_many_args__attach(skel);
>> + if (!ASSERT_OK(err, "tracing_struct_many_args__attach"))
>> + goto destroy_skel;
>> +
>> + ASSERT_OK(trigger_module_test_read(256), "trigger_read");
>> +
>> ASSERT_EQ(skel->bss->t7_a, 16, "t7:a");
>> ASSERT_EQ(skel->bss->t7_b, 17, "t7:b");
>> ASSERT_EQ(skel->bss->t7_c, 18, "t7:c");
>> @@ -74,12 +95,15 @@ static void test_fentry(void)
>> ASSERT_EQ(skel->bss->t8_g, 23, "t8:g");
>> ASSERT_EQ(skel->bss->t8_ret, 156, "t8 ret");
>>
>> - tracing_struct__detach(skel);
>> + tracing_struct_many_args__detach(skel);
>
> nit, I know it's in the current code, but tracing_struct_many_args__destroy
> will take care of the detach, so no need to call it explicitly
Alright, will resend a new version. Thanks
>
> jirka
>
>
>> destroy_skel:
>> - tracing_struct__destroy(skel);
>> + tracing_struct_many_args__destroy(skel);
>> }
>>
>
> SNIP
More information about the linux-riscv
mailing list