]> git.baikalelectronics.ru Git - kernel.git/commit
tools/bpf: test btf bitfield with >=256 struct member offset
authorYonghong Song <yhs@fb.com>
Thu, 10 Jan 2019 19:14:01 +0000 (11:14 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 11 Jan 2019 09:40:54 +0000 (10:40 +0100)
commit93e61398087c2bfdd372624930bc8c7f3367ef92
tree33a4fd9cd763264e83a4e4079ce40bbca1def04b
parent933b634222fd8a5564dca0ea27558afdde096700
tools/bpf: test btf bitfield with >=256 struct member offset

This patch modified test_btf pretty print test to cover
the bitfield with struct member equal to or greater 256.

Without the previous kernel patch fix, the modified test will fail:

  $ test_btf -p
  ......
  BTF pretty print array(#1)......unexpected pprint output
  expected: 0: {0,0,0,0x3,0x0,0x3,{0|[0,0,0,0,0,0,0,0]},ENUM_ZERO,4,0x1}
      read: 0: {0,0,0,0x3,0x0,0x3,{0|[0,0,0,0,0,0,0,0]},ENUM_ZERO,4,0x0}

  BTF pretty print array(#2)......unexpected pprint output
  expected: 0: {0,0,0,0x3,0x0,0x3,{0|[0,0,0,0,0,0,0,0]},ENUM_ZERO,4,0x1}
      read: 0: {0,0,0,0x3,0x0,0x3,{0|[0,0,0,0,0,0,0,0]},ENUM_ZERO,4,0x0}

  PASS:6 SKIP:0 FAIL:2

With the kernel fix, the modified test will succeed:
  $ test_btf -p
  ......
  BTF pretty print array(#1)......OK
  BTF pretty print array(#2)......OK
  PASS:8 SKIP:0 FAIL:0

Fixes: 826173cd35a4 ("bpf: btf: fix struct/union/fwd types with kind_flag")
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/test_btf.c