xuxin930 opened a new pull request, #17874:
URL: https://github.com/apache/nuttx/pull/17874
## Summary
**Add config change impact simulation tool (checkkconfig) using kconfig-lib**
This commit introduces a new utility tool checkkconfig.py that leverages the
kconfiglib library to simulate the effects of modifying NuttX configuration
options. The tool helps developers understand the cascading impacts of
configuration changes before committing them.
**Problem Solved:**
When modifying NuttX configuration options in defconfig files, developers
cannot easily predict which other configuration options will be automatically
enabled, disabled, or unset due to Kconfig dependencies and constraints. This
can lead to unintended configuration changes that break builds or functionality
for board-specific or application-specific configurations.
**Solution:**
The checkkconfig tool simulates configuration changes against the actual
NuttX Kconfig tree and reports all affected options:
- Analyzes single configuration option changes: `.checkkconfig.py -f
defconfig -s CONFIG_NAME y/m/n`
- Analyzes batch changes from unified diff files: `.checkkconfig.py -f
defconfig -d changes.diff`
- Reports before/after values in a clear tabular format
- Shows which unrelated options change due to dependencies
- Automatically prepares the Kconfig environment (sets APPSDIR, runs
configure.sh if needed)
**Example Output:**
```
Change report for ELF=n
Config Option Old New
----------------------------------------------------------------------
BINFMT_LOADABLE y n
ELF y n
ELF_STACKSIZE 8192 <unset>
LIBC_ARCH_ELF y n
MODLIB_ALIGN_LOG2 2 <unset>
```
**CLI Interface:**
```
checkkconfig.py [-h] -f FILE (-s CONFIG VALUE | -d DIFF)
Options:
-f, --file FILE Path to defconfig file (required)
-s, --single CONFIG VALUE Analyze single change: CONFIG_NAME y/m/n
-d, --diff DIFF Analyze changes from unified diff file
```
## Impact
- **Developers**: Can now safely experiment with configuration changes and
understand their full impact before committing. Significantly reduces risk of
introducing breaking configuration changes, particularly for board-specific and
application-specific defconfigs.
- **Board Configurations**: Enables verification that board-specific
defconfig changes don't cause unintended cascading effects across related
configuration options. Helps maintain consistent behavior across different
board variants.
- **Workflow Integration**: Tool can be integrated as a pre-commit
validation step to ensure configuration changes are intentional and complete.
Improves confidence in configuration-only PRs.
- **Dependency Analysis**: Developers gain visibility into which
configuration options depend on others, improving understanding of the NuttX
Kconfig hierarchy and making configuration maintenance easier.
--
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]