Re: [PATCH bpf-next v2 3/3] tools/bpf: add a selftest for bpf_send_signal() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 5/22/19 11:48 AM, Andrii Nakryiko wrote:
> On Tue, May 21, 2019 at 10:40 PM Yonghong Song <yhs@xxxxxx> wrote:
>>
>> The test covered both nmi and tracepoint perf events.
>>    $ ./test_send_signal_user
>>    test_send_signal (tracepoint): OK
>>    test_send_signal (perf_event): OK
>>
>> Signed-off-by: Yonghong Song <yhs@xxxxxx>
>> ---
>>   tools/testing/selftests/bpf/Makefile          |   3 +-
>>   tools/testing/selftests/bpf/bpf_helpers.h     |   1 +
>>   .../bpf/progs/test_send_signal_kern.c         |  51 +++++
>>   .../selftests/bpf/test_send_signal_user.c     | 212 ++++++++++++++++++
>>   4 files changed, 266 insertions(+), 1 deletion(-)
>>   create mode 100644 tools/testing/selftests/bpf/progs/test_send_signal_kern.c
>>   create mode 100644 tools/testing/selftests/bpf/test_send_signal_user.c
>>
>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>> index 66f2dca1dee1..5eb6368a96a2 100644
>> --- a/tools/testing/selftests/bpf/Makefile
>> +++ b/tools/testing/selftests/bpf/Makefile
>> @@ -23,7 +23,8 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
>>          test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \
>>          test_sock test_btf test_sockmap test_lirc_mode2_user get_cgroup_id_user \
>>          test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
>> -       test_netcnt test_tcpnotify_user test_sock_fields test_sysctl
>> +       test_netcnt test_tcpnotify_user test_sock_fields test_sysctl \
>> +       test_send_signal_user
>>
>>   BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
>>   TEST_GEN_FILES = $(BPF_OBJ_FILES)
>> diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
>> index 5f6f9e7aba2a..cb02521b8e58 100644
>> --- a/tools/testing/selftests/bpf/bpf_helpers.h
>> +++ b/tools/testing/selftests/bpf/bpf_helpers.h
[...]
>> +
>> +int main(void)
>> +{
>> +       test_tracepoint();
>> +       test_nmi_perf_event();
> 
> Tests should probably propagate failure up to main() and return exit
> code != 0, if any of the tests failed.

Good catch! Will fix it in the next revision.

> 
>> +       return 0;
>> +}
>> --
>> 2.17.1
>>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux