tests/unit/test_ksparser_parse: parse the .wks file, fix a diskid crash
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | ksparser: fix crash on an invalid msdos --diskidsrc/ | +2 | 0 replies | |
| 2/2 | tests/unit/test_ksparser_parse: cover the .wks KickStart parsertests/ | +217 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Paul Barker |
|---|---|
| Series | R-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [wic][PATCH 0/2] tests/unit/test_ksparser_parse: parse the .wks file, fix a diskid crash
This continues the standalone unit-test work, moving up from ksparser's argparse types to the KickStart parser that drives a whole .wks file. It keeps the shape the suite settled on: the source fix is its own standalone commit, and the green test module lands last, so the suite passes at every commit.
The fix: a bootloader line with --ptable msdos and a non-integer --diskid builds its error message with "... % self.ptable". self is the KickStart instance, which has no ptable attribute, so the interpolation raises AttributeError before the intended KickStartError. The user gets an opaque traceback instead of a described error. Interpolate the offending value instead (matching the gpt branch just below), and fix the "--ptbale" typo in the same message.
The test module adds end-to-end coverage for KickStart(): happy-path part/bootloader lines, degenerate files (empty, comment-only, CRLF, unknown directive), mutually-exclusive and invalid option combinations, multiple-bootloader rejection, diskid parsing for both ptables, and include handling. get_bitbake_var() is neutralised so the parser runs with no BitBake and no host tools. Backing the fix out turns the two msdos --diskid cases red.
Trevor Woerner (2):
ksparser: fix crash on an invalid msdos --diskid tests/unit/test_ksparser_parse: cover the .wks KickStart parser
src/wic/ksparser.py | 4 +- tests/unit/test_ksparser_parse.py | 217 ++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 tests/unit/test_ksparser_parse.py
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a