You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test[utest]: cover signal delivery to a thread blocked in mdelay - #11964
core.signal has no case covering "a signal sent to a thread that is blocked in a timer
delay". That is the path behind PR #7663 ("被动挂起的线程,无法处理信号") and the behaviour
described in the discussion there:
On current master this scenario does work (verified manually: the woken thread continued after
~10 ticks instead of 100, and its handler ran), but nothing in the utest suite keeps it
working. This adds a regression case so that a future change in _signal_deliver() or in the
scheduler cannot silently break it again.
你的解决方案是什么 (what is your solution)
A new utest case rt_signal_delay_thread_test() (case 10) in src/utest/signal_tc.c:
sig_t2 installs SIGUSR1, unmasks it, then blocks in rt_thread_mdelay(1000) (1 s);
the testcase thread sends SIGUSR1 to it and waits on a semaphore for at most 500 ms;
assertions: rt_thread_kill() returns RT_EOK, the semaphore is released within 500 ms (so the
thread was woken before its 1 s delay expired), and receive_sig == SIGUSR1 (so the handler
really ran in that thread).
Only src/utest/signal_tc.c is touched (+35/-0). No kernel code is changed, and the existing
cases 1-9 are left as they are.
请提供验证的bsp和config (provide the config and bsp)
BSP: bsp/qemu-vexpress-a9
.config: CONFIG_RT_USING_UTESTCASES=y, CONFIG_RT_UTEST_SIGNAL=y (enabled temporarily to run
this case; the BSP configuration itself is not part of this PR)
msh />utest_run core.signal
[==========] utest unit name: (rt_signal_install_test)
...
[==========] utest unit name: (rt_signal_delay_thread_test)
[ PASSED ] [ result ] testcase (core.signal)
[ PASSED ] [ result ] 1 tests.
scons -j4 passes and tools/ci/clang_format_check.py reports "clang-format check success"
for the changed file.
Not covered: RT_USING_SMART (LWP) and RT_USING_SMP, which take different branches inside _signal_deliver(); only the single-core non-SMART path is exercised.
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
已经仔细查看过代码改动的对比 Already check the difference between PR and old code
代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!
为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).
Use workflow from 保持默认分支(通常为 master)
Keep the default branch (usually master) in Use workflow from
在 branch 输入框填写 PR 分支 test/issue-7654-signal-blocked-thread
Enter PR branch test/issue-7654-signal-blocked-thread in the branch field
设置需排除的文件/目录(目录请以"/"结尾)
Set files/directories to exclude (directories should end with "/")
等待工作流完成 | Wait for the workflow to complete
格式化后的代码将作为独立提交推送至你的分支。
The formatting changes will be pushed to your branch as a separate commit.
完成后,提交将自动更新至 test/issue-7654-signal-blocked-thread 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the test/issue-7654-signal-blocked-thread branch automatically, and the related Pull Request will be updated.
如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!
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
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.
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
core.signalhas no case covering "a signal sent to a thread that is blocked in a timerdelay". That is the path behind PR #7663 ("被动挂起的线程,无法处理信号") and the behaviour
described in the discussion there:
On current master this scenario does work (verified manually: the woken thread continued after
~10 ticks instead of 100, and its handler ran), but nothing in the utest suite keeps it
working. This adds a regression case so that a future change in
_signal_deliver()or in thescheduler cannot silently break it again.
你的解决方案是什么 (what is your solution)
A new utest case
rt_signal_delay_thread_test()(case 10) insrc/utest/signal_tc.c:sig_t2installs SIGUSR1, unmasks it, then blocks inrt_thread_mdelay(1000)(1 s);rt_thread_kill()returns RT_EOK, the semaphore is released within 500 ms (so thethread was woken before its 1 s delay expired), and
receive_sig == SIGUSR1(so the handlerreally ran in that thread).
Only
src/utest/signal_tc.cis touched (+35/-0). No kernel code is changed, and the existingcases 1-9 are left as they are.
请提供验证的bsp和config (provide the config and bsp)
CONFIG_RT_USING_UTESTCASES=y,CONFIG_RT_UTEST_SIGNAL=y(enabled temporarily to runthis case; the BSP configuration itself is not part of this PR)
Verification:
scons -j4passes andtools/ci/clang_format_check.pyreports "clang-format check success"for the changed file.
Not covered:
RT_USING_SMART(LWP) andRT_USING_SMP, which take different branches inside_signal_deliver(); only the single-core non-SMART path is exercised.]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up