3 Commits
Author SHA1 Message Date
Igor Opaniuk 65711e63a1 ux: own the program name used in diagnostics
The error prefix comes from __progname, a BSD-ism that glibc and the
Apple libc export but Windows lacks, so qdl.c and every unit test that
links util.c define their own copy. The nbdkit plugin links neither.

Keep the name in ux.c with a "qdl" default and set it through
ux_set_progname(): from argv[0] in main() and from the plugin's load
hook. Move print_version() into qdl.c, its only caller, so util.c and
the tests no longer need the symbol.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-10-01 10:21:20 +02:00
Bjorn Andersson e01b33b214 flashmap: support selecting layouts
Flashmap packages can contain more than one layout, but qdl previously
rejected anything other than a single layout. Add flashmap-specific
specifier parsing so callers can select a layout by name while
preserving the existing storage-only selector form.

The supported forms are now:

  qdl flash flashmap.json::layout-name

  qdl flash flashmap.json::layout-name/storage1,storage2

  qdl flash flashmap.json::storage1,storage2

When a multi-layout flashmap is used without a layout selector, report
the valid layout names instead of failing with the old single-layout
limitation. Extend the cmocka flashmap tests to cover required layout
selection, layout-only selection, and layout plus storage filtering.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2026-06-27 00:04:10 +00:00
Bjorn Andersson a219b66dac tests: convert flashmap dry-run to cmocka
The flashmap coverage was implemented as a shell integration test that
generated a flat build tree, created a zip archive, and invoked the qdl
binary in dry-run mode. That made the test slower and tied it to the
CLI, filesystem layout, and generated fixture data.

Replace it with a cmocka unit test around flashmap_load(). The new test
provides mock flashmap JSON, XML files, zip/file access, programmer
loading, and Firehose operation collection in-process. It preserves the
existing coverage for loading flashmap.json, loading a zip containing
flashmap.json, and applying a storage selector.

Register the test with the existing cmocka test group and remove the
shell TAP test.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2026-06-27 00:04:08 +00:00