Skip to content

tests/unit/test_ksparser_parse: parse the .wks file, fix a diskid crash

Trevor Woerner yocto-patches 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ksparser: fix crash on an invalid msdos --diskidsrc/wic/ksparser.py+2 -20 replies
2/2tests/unit/test_ksparser_parse: cover the .wks KickStart parsertests/unit/test_ksparser_parse.py+217 -00 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.

PatchPaul Barker
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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