Skip to content

test: add builtin coverage for peek-fd and add autoload field to bpf_program - #124

Open
yuKing123-king wants to merge 1 commit into
DKapture:mainfrom
yuKing123-king:test/peek-fd
Open

test: add builtin coverage for peek-fd and add autoload field to bpf_program#124
yuKing123-king wants to merge 1 commit into
DKapture:mainfrom
yuKing123-king:test/peek-fd

Conversation

@yuKing123-king

@yuKing123-king yuKing123-king commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

本次修改集中在 test 目录,修改内容如下

1.添加了 peek-fd 的 BUILTIN 单测。测试内容围绕工具实际功能补充了较完整的回归验证,覆盖了以下几类行为:

  • 简单测试输出
  • 测试-r能否正确过滤
  • 测试-p pid能否正确过滤
  • 测试-f fd能否正确过滤
  • 测试-r -p pid能否组合 正确过滤
  • 测试-r -f fd能否组合 正确过滤
  • 测试-p pid -f fd能否组合 正确过滤
  • 测试 -o 是否能将输出重定向到指定文件
  • 测试未指定 -s 时,socket 读事件不会被输出
  • 测试指定 -s 时,socket 读事件能够被输出
  • 测试指定 -s 时,socket 写事件能够被输出
  • 测试未指定 -s 时,socket 写事件不会被输出
  • 测试 -p 传入负数时返回错误并输出提示
  • 测试 -p 传入 0 时返回错误并输出提示
  • 测试 -p 传入字母时返回错误并输出提示
  • 测试 -p 传入带脏字符的数字时返回错误并输出提示
  • 测试 -f 传入负数时返回错误并输出提示
  • 测试 -f 传入字母时返回错误并输出提示
  • 测试 -f 传入带脏字符的数字时返回错误并输出提示
  • 测试缺少 -p 参数时返回错误并输出提示
  • 测试缺少 -f 参数时返回错误并输出提示
  • 测试未指定 -r/-w 时返回错误并输出提示

2.在test/Makefile 中补齐测试目标的链接依赖;

3.在test/mock.cpp 中修正 skeleton 对象在全局容器中的分配、指针回填和销毁逻辑,避免因扩容和错索引导致的崩溃;

4.在test/mock.cpp 中为program_obj添加autoload字段

… bpf_program

Signed-off-by: Wang Yu <wangyu6@uniontech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant