Skip to content
  • Yonghong Song's avatar
    tools/bpf: test btf bitfield with >=256 struct member offset · e43207fa
    Yonghong Song authored
    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: 9d5f9f70
    
     ("bpf: btf: fix struct/union/fwd types with kind_flag")
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    e43207fa