All of lore.kernel.org
 help / color / mirror / Atom feed
* [wic][PATCH 0/2] tests/unit/test_ksparser_parse: parse the .wks file, fix a diskid crash
@ 2026-07-17 18:35 Trevor Woerner
  2026-07-17 18:35 ` [wic][PATCH 1/2] ksparser: fix crash on an invalid msdos --diskid Trevor Woerner
  2026-07-17 18:35 ` [wic][PATCH 2/2] tests/unit/test_ksparser_parse: cover the .wks KickStart parser Trevor Woerner
  0 siblings, 2 replies; 3+ messages in thread
From: Trevor Woerner @ 2026-07-17 18:35 UTC (permalink / raw)
  To: yocto-patches

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

-- 
2.50.0.173.g8b6f19ccfc3a


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-17 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 18:35 [wic][PATCH 0/2] tests/unit/test_ksparser_parse: parse the .wks file, fix a diskid crash Trevor Woerner
2026-07-17 18:35 ` [wic][PATCH 1/2] ksparser: fix crash on an invalid msdos --diskid Trevor Woerner
2026-07-17 18:35 ` [wic][PATCH 2/2] tests/unit/test_ksparser_parse: cover the .wks KickStart parser Trevor Woerner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.