Skip to content

[smart] rename the Group name to 'lwProcess' and optimize the error h… #10436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2025

Conversation

BernardXiong
Copy link
Member

…andling for vDSO building.

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

[

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

smart的Group Name稍显凌乱,统一调整成lwProcess,以反映“轻量级进程”

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

对SConscript脚本进行调整。

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

  • BSP: qemu-virt64-aarch64/riscv
  • .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/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@github-actions github-actions bot added RT-Smart RT-Thread Smart related PR or issues component: lwp Component labels Jun 25, 2025
@BernardXiong BernardXiong requested review from Copilot and unicornx June 25, 2025 16:06
Copy link
Contributor

@Copilot 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 PR standardizes the SConscript group name to lwProcess, refactors error handling for the vDSO build step, and removes two legacy architecture-specific scripts.

  • Refactor vDSO build: consolidate clean logic into one command, wrap subprocess.run in a try/except, and report failures.
  • Rename all DefineGroup calls from vDSO/lwP to lwProcess.
  • Delete components/lwp/arch/x86/i386/SConscript and components/lwp/arch/risc-v/rv64/SConscript.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
components/lwp/vdso/SConscript Refactored clean command logic, added try/except, renamed group.
components/lwp/arch/x86/i386/SConscript Removed legacy i386 SConscript file.
components/lwp/arch/risc-v/rv64/SConscript Removed legacy rv64 SConscript file.
components/lwp/SConscript Renamed top-level group from lwP to lwProcess.
Comments suppressed due to low confidence (3)

components/lwp/vdso/SConscript:54

  • [nitpick] Renaming the vDSO group to lwProcess may conflict with the main LWP group and obscure the vDSO target. Consider using a distinct name like lwProcess-vdso for clarity.
group = DefineGroup('lwProcess', src, depend = ['RT_USING_SMART','RT_USING_VDSO'], CPPPATH = CPPPATH)

Comment on lines 43 to 46
# generic error handle
except :
print('exec command: "%s" failed.' % ' '.join(command))
exit(1)
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

Avoid using a bare except: which also catches system-exiting exceptions. Catch specific errors (e.g., except subprocess.CalledProcessError as e:) to prevent unintended behavior.

Suggested change
# generic error handle
except :
print('exec command: "%s" failed.' % ' '.join(command))
exit(1)
except subprocess.CalledProcessError as e:
print(f'Command "{e.cmd}" failed with return code {e.returncode}.')
exit(1)
except FileNotFoundError as e:
print(f'Command not found: {e}. Please ensure "scons" is installed and in your PATH.')
exit(1)

Copilot uses AI. Check for mistakes.

Comment on lines 48 to 52
if result.returncode == 0:
print("Command executed successfully")
else:
print("Command failed with exit code:", result.returncode)
exit(1)
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

When using check=True, subprocess.run will raise on non-zero exits, so this manual returncode check is redundant. Consider removing it or use check=False if you need to handle exit codes explicitly.

Suggested change
if result.returncode == 0:
print("Command executed successfully")
else:
print("Command failed with exit code:", result.returncode)
exit(1)
print("Command executed successfully")

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@unicornx unicornx left a comment

Choose a reason for hiding this comment

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

建议 rebase 到最新的 master 后再 review,因为最近 master 上又合入了多个 和 vdso 相关的 pr。
另外请考虑改进一下 copilot 的意见。

@BernardXiong
Copy link
Member Author

建议 rebase 到最新的 master 后再 review,因为最近 master 上又合入了多个 和 vdso 相关的 pr。 另外请考虑改进一下 copilot 的意见。

这个PR只涉及到SConscript的修改,主要是把Group的名称做了修改,从lwP更改成lwProcess,更能反映意义。目前主干代码中的Group Name挺乱了,在逐步进行调整。

vdso部分的修改是参考了copilot的意见。

@BernardXiong
Copy link
Member Author

@Rbb666 来帮忙合并下

@Rbb666 Rbb666 merged commit e001439 into RT-Thread:master Jul 7, 2025
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: lwp Component RT-Smart RT-Thread Smart related PR or issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants