Re: [PATCH bpf-next v2 5/5] selftests/bpf: Add test for "bpftool feature" command

From: Michal Rostecki
Date: Tue Feb 25 2020 - 08:25:37 EST


On 2/21/20 12:28 PM, Quentin Monnet wrote:>> +ÂÂÂ def
test_feature_macros(self):
>> +ÂÂÂÂÂÂÂ expected_patterns = [
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"/\*\*\* System call availability \*\*\*/",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"#define HAVE_BPF_SYSCALL",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"/\*\*\* eBPF program types \*\*\*/",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"#define HAVE.*PROG_TYPE",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"/\*\*\* eBPF map types \*\*\*/",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"#define HAVE.*MAP_TYPE",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"/\*\*\* eBPF helper functions \*\*\*/",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"#define HAVE.*HELPER",
>> +ÂÂÂÂÂÂÂÂÂÂÂ b"/\*\*\* eBPF misc features \*\*\*/",
>> +ÂÂÂÂÂÂÂ ]
>> +
>> +ÂÂÂÂÂÂÂ res = bpftool(["feature", "probe", "macros"])
>> +ÂÂÂÂÂÂÂ for pattern in expected_patterns:
>> +ÂÂÂÂÂÂÂÂÂÂÂ self.assertRegex(res, pattern)
>
> Could we have (or did I miss it?) a test that compares the output of
> probes _with_ "full" and _without_ it, to make sure that the only lines
> that differ are about "bpf_trace_prink" or "bpf_probe_write_user"? Could
> help determine if we filter out too many elements by mistake.
>
> Thanks,
> Quentin

Good idea, I will add that test in v3.