On Fri, Apr 20, 2018 at 03:18:42PM -0700, Yonghong Song wrote:
> The test_stacktrace_map and test_stacktrace_build_id are
> enhanced to call bpf_get_stack in the helper to get the
> stack trace as well.  The stack traces from bpf_get_stack
> and bpf_get_stackid are compared to ensure that for the
> same stack as represented as the same hash, their ip addresses
> or build id's must be the same.
> 
> Signed-off-by: Yonghong Song <y...@fb.com>
> ---
>  tools/testing/selftests/bpf/test_progs.c           | 63 
> +++++++++++++++++++---
>  .../selftests/bpf/test_stacktrace_build_id.c       | 20 ++++++-
>  tools/testing/selftests/bpf/test_stacktrace_map.c  | 20 +++++--
>  3 files changed, 92 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_progs.c 
> b/tools/testing/selftests/bpf/test_progs.c
> index dad4c3f..06b922a 100644
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -897,11 +897,40 @@ static int compare_map_keys(int map1_fd, int map2_fd)
>       return 0;
>  }
>  
> +static int compare_stack_ips(int smap_fd, int amap_fd, int stack_trace_len)
> +{
> +     __u32 key, next_key, *cur_key_p, *next_key_p;
> +     char val_buf1[stack_trace_len], val_buf2[stack_trace_len];

the kernel is trying to get rid of VLAs.
test_progs.c already uses them, but if possible let's not
add more uses of them.
Other than that looks great.

Reply via email to