Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
strategy:
fail-fast: false
matrix:
# NOTE: Full testsuite on Windows is disabled because the test script
# requires Linux kernel source tree. However, headless mode tests
# are now enabled for Windows.
# NOTE: Windows runs only headless + menuconfig import tests (no kernel
# tree, no Unix shell). Linux/macOS run selftests, compatibility
# tests, and example scripts.
target:
# Python 3.12
- python: '3.12'
Expand Down Expand Up @@ -57,14 +57,12 @@ jobs:

- name: Install Python dependencies
run: |
pip install --user setuptools wheel
python -m pip install --user setuptools wheel pytest

- name: Check out Linux source code
# Skip for Windows (headless-only mode)
if: ${{ matrix.target.headless-only != true }}
uses: actions/checkout@v6
# On Windows, checkout of 'aux.c' is expected to fail because ... Windows.
continue-on-error: true
with:
repository: torvalds/linux
ref: v5.4
Expand All @@ -76,18 +74,31 @@ jobs:
# Linux/macOS (full test): checkout to Kconfiglib subdirectory
path: ${{ matrix.target.headless-only && '.' || 'Kconfiglib' }}

- name: Run pytest selftests
# Skip on Windows: several tests depend on Unix shell ($(shell,...)),
# gcc, and forward-slash paths that are unavailable on Windows CI.
if: ${{ matrix.target.headless-only != true }}
working-directory: ${{ matrix.target.headless-only && '.' || 'Kconfiglib' }}
run: |
python -m pytest tests/ -v --tb=short --ignore=tests/test_compat.py

- name: Apply Linux Kconfig Makefile patch
# Skip for Windows (headless-only mode)
if: ${{ matrix.target.headless-only != true }}
run: |
git apply Kconfiglib/makefile.patch

- name: Run testsuite
- name: Run compatibility tests and example scripts
# Skip for Windows (headless-only mode)
if: ${{ matrix.target.headless-only != true }}
run: |
Kconfiglib/tests/reltest python

- name: Install windows-curses (Windows only)
if: matrix.target.os == 'Windows'
run: |
python -m pip install windows-curses

- name: Test headless mode
# Use root dir for Windows, Kconfiglib subdir for Linux/macOS
working-directory: ${{ matrix.target.headless-only && '.' || 'Kconfiglib' }}
Expand All @@ -101,11 +112,6 @@ jobs:
print('Headless mode test passed')
EOF

- name: Install windows-curses (Windows only)
if: matrix.target.os == 'Windows'
run: |
pip install windows-curses

- name: Test menuconfig import (Windows Python 3.12)
if: matrix.target.os == 'Windows'
# Use root dir for Windows (headless-only mode)
Expand Down
63 changes: 63 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Changelog

## Integrated from Zephyr Upstream

| Zephyr Commit | Description | This Project |
|---------------|-------------|--------------|
| `9b1ae78` | Fix file leaks (try/finally) | Implemented at lines 1140-1151, 3115-3118 |
| `0380400` | Menu visibility fix when leaving | Implemented at lines 1328-1333 (try/except) |
| `1e6f644` | Fix crash from unsupported locales | `23b7e61` |
| `407b92b` | NULL character input handling | `d546545` |
| `c3f7865` | Macro expansion empty string check | `a8c4929` |
| `82fdbda` | Modules property support | `bdfe32c` |
| `f58717e` | Symbol value origin tracking | `9938058` |
| `601f63d`, `6eae2bf` | Symbol.ranges 4-tuple unpacking | `a5b6ecd` |
| `ffb5459` | Dark mode support | `1dc26ef` (more comprehensive) |

## Features Unique to This Project

### guiconfig Enhancements
- Dark/light theme toggle with keyboard shortcut (Ctrl+T)
- Blue gear icon (replacing green X)
- Interactive search in jump-to dialog (`54aa1c9`)
- Enhanced UI experience (`b228109`)
- Select/imply origin display in menu (`b69b31e`)
- Missing `import re` fixed (ulfalizer#105, ulfalizer#136 resolved)

### menuconfig Enhancements
- Scrollbar support (`029e3d1`)
- Enhanced UI layout

### Testing
- Replaced testsuite.py with pytest: 120 tests across 10 modules under tests/.
Added `pytest.ini`, `tests/conftest.py`, and `tests/test_*.py` modules.
Compatibility tests (kernel C tool comparison) in `tests/test_compat.py`.
CI runs pytest on all platforms including Windows.
- Added tests for previously-untested public APIs: `expr_value()`,
`Symbol.config_string`, `Symbol.rev_dep`, `Symbol.weak_rev_dep`,
`Kconfig.missing_syms`, and `Symbol.user_loc`.

### API Cleanup
- Removed deprecated `KconfigSyntaxError` alias (use `KconfigError`).
- Removed `InternalError` exception (was never raised).
- Removed 10 `enable_*/disable_*` warning methods on `Kconfig`
(use the `warn`, `warn_to_stderr`, `warn_assign_undef`,
`warn_assign_override`, `warn_assign_redun` attributes directly).
- Removed deprecated module-level `load_allconfig()` function
(use `Kconfig.load_allconfig()` method).

### Core Features
- Kbuild toolchain test functions (`ced27d6`)
- Headless mode support (`27a8a0d`)
- Windows Python 3.12 compatibility (`15d3d98`)
- `transitional` keyword parsing (zephyr#25 parser support; full behavior parity tracked in TODO P1)
- `modules` keyword support (both `option modules` and bare `modules` forms)

## Version History

| Date | Action | Commits |
|------|--------|---------|
| 2025-10 | Symbol.ranges fix | `a5b6ecd` |
| 2025-10 | Kbuild toolchain support | `ced27d6` |
| 2025-10 | Dark/light theme | `1dc26ef` |
| 2025-10 | Interactive search | `54aa1c9` |
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ This warning can also be toggled by setting `Kconfig.warn_assign_undef` to `True

- Robust and highly compatible with the C Kconfig tools

The [test suite](testsuite.py) automatically compares output from Kconfiglib and
The [test suite](tests/) automatically compares output from Kconfiglib and
the C tools by diffing the generated `.config` files for the real kernel Kconfig and defconfig files across all ARCHes.
Currently, this involves comparing output for 36 ARCHes and 498 defconfig files (or over 18,000 ARCH/defconfig combinations in
"obsessive" test suite mode). All tests are expected to pass.
Expand Down Expand Up @@ -462,32 +462,33 @@ Some examples include:

## Test suite

The test suite is run with:
The self-tests can be run from the project root with [pytest](https://docs.pytest.org/):
```shell
python Kconfiglib/testsuite.py
python -m pytest tests/ -v
```

[pypy](https://pypy.org/) also works and is much faster for most tasks,
except for `allnoconfig.py`, `allnoconfig_simpler.py`, and `allyesconfig.py`,
where it has no time to warm up because those scripts are invoked via `make scriptconfig`.

The test suite must be run from the top-level kernel directory.
It requires that the Kconfiglib Git repository has been cloned into it and that the Makefile patch has been applied.
To run the full suite -- self-tests, compatibility tests against the C Kconfig tools, and example scripts -- use
[tests/reltest](tests/reltest) from the top-level kernel directory (requires the Makefile patch):
```shell
Kconfiglib/tests/reltest python
```

To suppress warnings generated for the kernel `Kconfig` files, redirect `stderr` to `/dev/null`:
```
python Kconfiglib/testsuite.py 2>/dev/null
Kconfiglib/tests/reltest python 2>/dev/null
```

Note: Forgetting to apply the Makefile patch will cause some tests that compare generated configurations to fail.
[pypy](https://pypy.org/) also works and is much faster for most tasks,
except for `allnoconfig.py`, `allnoconfig_simpler.py`, and `allyesconfig.py`,
where it has no time to warm up because those scripts are invoked via `make scriptconfig`.

Note: The test suite overwrites `.config` in the kernel root, so make sure to back it up.
Note: Forgetting to apply the Makefile patch will cause some compatibility tests that compare generated configurations to fail.

The test suite consists of a set of self-tests and a set of compatibility tests that compare configurations
generated by Kconfiglib with those generated by the C tools across various scenarios.
See [testsuite.py](testsuite.py) for available options.
Note: The compatibility tests overwrite `.config` in the kernel root, so make sure to back it up.

The [tests/reltest](tests/reltest) script runs the test suite and all example scripts to verify that everything works as expected.
The test suite consists of self-tests (under [tests/](tests/)) and compatibility tests
([tests/test_compat.py](tests/test_compat.py)) that compare configurations generated by Kconfiglib
with those generated by the C tools across various scenarios.

Occasionally, the C tools' output may change slightly (for example, due to a [recent change](https://www.spinics.net/lists/linux-kbuild/msg17074.html)).
If the test suite reports failures, try running it again against the [linux-next tree](https://www.kernel.org/doc/man-pages/linux-next.html),
Expand Down
Loading