fix: prevent lmcore tests from polluting lmnet's CTest registry#4
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/lmshao/lmnet/sessions/1fbe8968-5a65-4e8c-8910-a0d651cab8c7 Co-authored-by: lmshao <3686112+lmshao@users.noreply.github.com>
…RCE) Agent-Logs-Url: https://github.com/lmshao/lmnet/sessions/1fbe8968-5a65-4e8c-8910-a0d651cab8c7 Co-authored-by: lmshao <3686112+lmshao@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
lmshao
May 10, 2026 02:49
View session
There was a problem hiding this comment.
Pull request overview
This PR prevents lmcore’s test suite from being registered and executed as part of lmnet’s CTest runs when lmcore is pulled in via add_subdirectory, addressing flaky CI failures caused by lmcore timing-sensitive tests on macOS.
Changes:
- Temporarily shadows
BUILD_TESTSas a non-cache variable set toOFFbefore adding thelmcoresubdirectory. - Unsets the shadowing variable immediately after
add_subdirectorysolmnet’s ownBUILD_TESTScache setting continues to controllmnettests normally.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
CI 中
macos-kqueue任务持续因test_time_utils(TimeUtils.SleepMs)失败:该测试来自依赖库
lmcore,不属于lmnet本身。问题根源:lmnet通过add_subdirectory(../lmcore lmcore_build)引入 lmcore 时,BUILD_TESTS=ON已在 CMake 缓存中,导致 lmcore 的测试套件(包括这个在 macOS CI runner 高负载时不稳定的时序测试)也被注册到 lmnet 的 CTest 中并一并运行。修复
在
add_subdirectory(../lmcore lmcore_build)前,用普通变量(non-cache)将BUILD_TESTS遮蔽为OFF。由于add_subdirectory创建的子作用域会继承父作用域的普通变量,lmcore 的option(BUILD_TESTS ...)发现变量已定义便不再修改,从而跳过 lmcore 自己的测试。add_subdirectory返回后用unset(BUILD_TESTS)移除普通变量,缓存中的ON值重新生效,lmnet 自身的测试照常构建。此方案不使用
CACHE FORCE,不会覆盖用户的 cmake 配置。