Skip to content

Conversation

@Tm-C-mT
Copy link
Contributor

@Tm-C-mT Tm-C-mT commented Nov 10, 2025

Added comments to the utest for the signal module, including: test purpose, usage scenarios, dependency configurations, expected outcomes, and expected behaviors.

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

Add more detailed descriptions to the unit test (utest) files for the signal module.

你的解决方案是什么 (what is your solution)

Read and understand the source code, then add explanations.

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 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
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@github-actions
Copy link

👋 感谢您对 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).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:AddDescription-Signal
  • 设置PR number为 \ Set the PR number to:10914
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 AddDescription-Signal 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the AddDescription-Signal 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!

@github-actions github-actions bot added the Kernel PR has src relate code label Nov 10, 2025
@github-actions
Copy link

github-actions bot commented Nov 10, 2025

📌 Code Review Assignment

🏷️ Tag: kernel

Reviewers: GorrayLi ReviewSun hamburger-os lianux-mm wdfk-prog xu18838022837

Changed Files (Click to expand)
  • src/utest/signal_tc.c

📊 Current Review Status (Last Updated: 2025-11-10 19:31 CST)

  • GorrayLi Pending Review
  • ReviewSun Pending Review
  • hamburger-os Pending Review
  • lianux-mm Pending Review
  • wdfk-prog Pending Review
  • xu18838022837 Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

Added comments to the utest for the signal module, including: test purpose,
usage scenarios, dependency configurations, expected outcomes, and expected
behaviors.

Signed-off-by: Mengchen Teng <[email protected]>
@Tm-C-mT Tm-C-mT force-pushed the AddDescription-Signal branch from 772bd03 to 13a57ca Compare November 10, 2025 02:58
@Rbb666 Rbb666 requested a review from Copilot November 10, 2025 08:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds comprehensive documentation to the signal test case file (signal_tc.c), providing detailed explanations of test objectives, scenarios, verification metrics, dependencies, and expected results for RT-Thread's signal functionality testing.

Key Changes

  • Added extensive documentation header (lines 21-128) describing test objectives, scenarios, verification metrics, dependencies, and expected results for all signal test functions
  • Documentation covers 6 test functions: rt_signal_install_test, rt_signal_mask_test, rt_signal_unmask_test, rt_signal_kill_test, rt_signal_wait_test, and rt_signal_wait_test2

* - "sig_t1" is waiting for the signal, and then sends the SIGUSR1 signal to "sig_t1" using
* - rt_thread_kill. The main thread then waits on the _received_signal semaphore, which will be
* - released by "sig_t1" upon receiving the signal. Finally, the test case verifies that the
* - recive_sig variable is set to SIGUSR1, confirming that the signal was successfully
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "recive_sig" is misspelled. It should be "receive_sig" (missing the second 'e').

中文:单词 "recive_sig" 拼写错误,应为 "receive_sig"(缺少第二个 'e')。

Copilot uses AI. Check for mistakes.
* - [rt_signal_kill_test]: In Case7, every signo shall correctly trigger the signal handler,
* - such that recive_sig equals signo. In Case9, rt_signal_kill shall return -RT_EINVAL.
*
* - [rt_signal_wait_test]: In Case5, recive_sig shall equal SIGUSR1, indicating that the waiting
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "recive_sig" is misspelled. It should be "receive_sig" (missing the second 'e').

中文:单词 "recive_sig" 拼写错误,应为 "receive_sig"(缺少第二个 'e')。

Copilot uses AI. Check for mistakes.
* - functionality. The registration of the signal handler should be completed correctly.
* - Include Case1 and Case2.
*
* - [rt_signal_mask_test]: Verify the correctness of the rt_signal_unmask functions's
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation Issue / 文档问题

English: Line 28 states this test verifies "rt_signal_unmask" but it should be "rt_signal_mask". The function name "rt_signal_mask_test" tests the unmask functionality (when signals are unmasked and should be received), not the mask functionality.

中文:第 28 行说明该测试验证 "rt_signal_unmask" 函数,但应该是 "rt_signal_mask"。函数名 "rt_signal_mask_test" 测试的是 unmask 功能(信号取消屏蔽后应该被接收),而非 mask 功能。

Suggested change
* - [rt_signal_mask_test]: Verify the correctness of the rt_signal_unmask functions's
* - [rt_signal_mask_test]: Verify the correctness of the rt_signal_mask function's

Copilot uses AI. Check for mistakes.
* - value of recive_sig does not equal the value of signo.
*
* - [rt_signal_kill_test]: Case7(the for Loop) is the same as the loop in [rt_signal_mask_test].
* - Case9 Verifies that when an invalid signal is sent using rt_signal_kill, the function returns
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "Verifieds" is grammatically incorrect. It should be "Verifies" (third person singular present tense).

中文:单词 "Verifieds" 语法错误,应为 "Verifies"(第三人称单数现在时)。

Suggested change
* - Case9 Verifies that when an invalid signal is sent using rt_signal_kill, the function returns
* - Case9 verifies that when an invalid signal is sent using rt_signal_kill, the function returns

Copilot uses AI. Check for mistakes.
* - signal signo. After successful registration, the specified signal mask is unmasked using
* - rt_signal_unmask, then masked again using rt_signal_mask. A signal is then sent to rt_thread_self
* - via rt_thread_kill. After a 1ms delay, the signal callback function is not triggered, and the
* - value of recive_sig does not equal the value of signo.
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "recive_sig" is misspelled. It should be "receive_sig" (missing the second 'e').

中文:单词 "recive_sig" 拼写错误,应为 "receive_sig"(缺少第二个 'e')。

Copilot uses AI. Check for mistakes.
* - that recive_sig equals signo.
*
* - [rt_signal_unmask_test]: Every signo shall not trigger the signal handler after masking,
* - such that recive_sig does not equal signo.
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "recive_sig" is misspelled. It should be "receive_sig" (missing the second 'e').

中文:单词 "recive_sig" 拼写错误,应为 "receive_sig"(缺少第二个 'e')。

Copilot uses AI. Check for mistakes.
* - such that recive_sig does not equal signo.
*
* - [rt_signal_kill_test]: In Case7, every signo shall correctly trigger the signal handler,
* - such that recive_sig equals signo. In Case9, rt_signal_kill shall return -RT_EINVAL.
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "recive_sig" is misspelled. It should be "receive_sig" (missing the second 'e').

中文:单词 "recive_sig" 拼写错误,应为 "receive_sig"(缺少第二个 'e')。

Copilot uses AI. Check for mistakes.
* - [rt_signal_wait_test]: In Case5, recive_sig shall equal SIGUSR1, indicating that the waiting
* - thread successfully received the signal. And main thread can take the semaphore.
*
* - [rt_signal_wait_test2]: In Case6, recive_sig shall not equal SIGUSR1, indicating that the waiting
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "recive_sig" is misspelled. It should be "receive_sig" (missing the second 'e').

中文:单词 "recive_sig" 拼写错误,应为 "receive_sig"(缺少第二个 'e')。

Copilot uses AI. Check for mistakes.
* - functionality. The signal handler will only be triggered when the signal is unmasked.
* - Include Case3.
*
* - [rt_signal_unmask_test]: Verify the correctness of the rt_signal_mask functions's
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation Issue / 文档问题

English: Line 32 states this test verifies "rt_signal_mask" but it should be "rt_signal_unmask". The function name "rt_signal_unmask_test" tests the mask functionality (when signals are masked and should NOT be received), not the unmask functionality.

中文:第 32 行说明该测试验证 "rt_signal_mask" 函数,但应该是 "rt_signal_unmask"。函数名 "rt_signal_unmask_test" 测试的是 mask 功能(信号被屏蔽后不应该被接收),而非 unmask 功能。

Suggested change
* - [rt_signal_unmask_test]: Verify the correctness of the rt_signal_mask functions's
* - [rt_signal_unmask_test]: Verify the correctness of the rt_signal_mask function's

Copilot uses AI. Check for mistakes.
* - registered via rt_signal_install, where receive_sig is assigned the value of the triggered
* - signal signo. After successful registration, the specified signal mask is unmasked using
* - rt_signal_unmask, and a signal is sent to rt_thread_self via rt_thread_kill. After a 1ms
* - delay, the signal callback function is triggered successfully, and the value of recive_sig
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Error / 拼写错误

English: The word "recive_sig" is misspelled. It should be "receive_sig" (missing the second 'e').

中文:单词 "recive_sig" 拼写错误,应为 "receive_sig"(缺少第二个 'e')。

Copilot uses AI. Check for mistakes.
…ng mistakes, and ambiguities in function names.

Fixed the issue of grammatical errors in words; changed the variable 'recive_sig' to 'receive_sig'.
Originally, rt_signal_unmask_test was testing the masking function of rt_signal_mask, while
rt_signal_mask_test was verifying whether signals could be sent correctly during unmasking——the
function names were exactly opposite to their functions. Now the two function names have been swapped,
and the corresponding comments have also been updated accordingly.After modification, it has been
verified that the signal-related utests can be executed correctly.

Signed-off-by: Mengchen Teng <[email protected]>
@Tm-C-mT
Copy link
Contributor Author

Tm-C-mT commented Nov 10, 2025

Pull Request Overview

This pull request adds comprehensive documentation to the signal test case file (signal_tc.c), providing detailed explanations of test objectives, scenarios, verification metrics, dependencies, and expected results for RT-Thread's signal functionality testing.

Key Changes

  • Added extensive documentation header (lines 21-128) describing test objectives, scenarios, verification metrics, dependencies, and expected results for all signal test functions
  • Documentation covers 6 test functions: rt_signal_install_test, rt_signal_mask_test, rt_signal_unmask_test, rt_signal_kill_test, rt_signal_wait_test, and rt_signal_wait_test2

已修改,见commit 394df75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kernel PR has src relate code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant