XueSongTap opened a new pull request, #2985:
URL: https://github.com/apache/brpc/pull/2985

   ### What problem does this PR solve?
   
   Part: #2904
   
   Problem Summary:
   - BUILD.bazel 只编译了极少数 brpc 单元测试;
   - 直接 glob(["brpc_*_unittest.cpp"]) 会把多个含 int main() 的源文件链接进同一可执行文件,引发 
duplicate symbol: main,导致其余测试无法构建。
   - CMake 已覆盖全部 UT。为了让两套构建结果一致,需要在 Bazel 侧同样编译(并可执行)全部 brpc 单测文件。
   - 其中 `test/brpc_http_rpc_protocol_unittest.cpp`的修改是为了兼容bazel指定的 更高的proto版本 
https://github.com/apache/brpc/issues/2904#issuecomment-2935095655
   ### What is changed and the side effects?
   
   Changed:
   位置 | 变更 | 说明
   -- | -- | --
   test/brpc_unit_test.bzl | 新增 | 提供 generate_brpc_unit_tests() 宏:- 输入 任意 .cpp 
列表 → 输出 “一文件一 cc_test” + 聚合 test_suite。
   test/BUILD.bazel | 新增brpc_test UT 部分 | 一次宏调用即可把 全部 brpc_*_unittest.cpp 生成 多个 
cc_test;逻辑与 test/CMakeLists.txt的 
https://github.com/apache/brpc/blob/c24e641009fa0305f0efebce694d0dad886c85ca/test/CMakeLists.txt#L253
 一致
   
   
   Side effects:
   - Performance effects:无
   
   - Breaking backward compatibility: 无
   
   ---
   ### Check List:
   - Please make sure your changes are compilable.
   - When providing us with a new feature, it is best to add related tests.
   - Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to