8 Commits
Author SHA1 Message Date
Igor Opaniuk 84e8e387e5 tests: compare partition digests case-insensitively
The verify step extracts the device digest with a case-insensitive
grep but compares it case-sensitively against the local sha256sum
output. The firehose response carries uppercase hex while sha256sum
prints lowercase, so the comparison only worked as long as the
extraction happened to pick a lowercase rendering of the digest from
qdl's output. With QDL_HIL_DEBUG enabled the first match in the
output is the device's raw uppercase digest, and the step failed on
identical values - caught by the first debug-enabled CI run.

Lowercase both sides before comparing.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-08-25 09:32:07 +02:00
Igor Opaniuk c5e29f11df tests: add QDL_HIL_DEBUG to run qdl with debug logging
A failing HIL step reports qdl's normal output, which is often not
enough to diagnose a device-side problem after the fact - and the
failure may not reproduce once the board state changes, so enabling
debug logging for a rerun loses the moment.

Add a QDL_HIL_DEBUG environment knob that puts --debug on every qdl
invocation in both suites. Rigs set it in their board configuration;
the full protocol log then lands in the meson testlog for every run,
so a failure ships its own post-mortem and green runs provide a
known-good log to diff against. The flag is placed before subcommand
verbs, which is safe for flag-type options - only value-taking
options confuse the verb dispatcher.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-08-25 09:32:07 +02:00
Igor Opaniuk fda91d7c0e tests: pass the serial after the chipinfo verb
qdl's verb dispatcher scans argv for a known verb but stops at the
first argument without a leading dash. With a serial configured the
chipinfo step ran 'qdl -S <serial> chipinfo': the scan stops at the
serial value, never sees the verb, and falls through to the flash
parser, which rejects the command line with a usage message. The
suite's Linux runs never caught this because they run without
QDL_HIL_SERIAL.

Pass the serial after the verb, where the chipinfo subcommand parses
-S itself. The dispatcher's inability to step over value-taking
options deserves a fix in qdl proper; this keeps the suite working
against released binaries either way.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-08-25 09:32:07 +02:00
Igor Opaniuk b3b3a2e633 tests: make the list step honor QDL_HIL_SERIAL
The list step passes as soon as any EDL device enumerates. On a rig
with several boards attached to one host - the setup QDL_HIL_SERIAL
exists for - another board sitting in EDL mode satisfies the check
and masks the selected board never appearing; the suite then proceeds
and fails later, in a less obvious place.

When QDL_HIL_SERIAL is set, require the qdl list output to contain
that serial before declaring the device present, and name the serial
in the timeout diagnostic.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-08-25 09:32:07 +02:00
Igor Opaniuk 38881a66e1 tests: add enter-EDL hook for unattended HIL runs
The HIL suite assumes a human has already put the board into EDL mode
before the suite starts, which rules out unattended execution on a CI
runner.

Add an optional QDL_HIL_ENTER_EDL_CMD environment hook, run in the
suite's first step (after all skip gating, so runs without a
configured board still skip cleanly). The environment supplies
whatever mechanism the rig uses - 'adb reboot edl' on a booted board,
a USB relay toggle, or a lab power controller - keeping the suite
board-agnostic. The command only needs to trigger the mode switch:
the flash steps already wait for the device, and the list step now
polls for enumeration for up to QDL_HIL_SETTLE seconds (default 30),
since a power-cycled board takes several seconds to come back as an
EDL device. The suite's final reset step boots the board back into
its OS, where the next run's hook can reach it again.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-08-25 09:32:07 +02:00
Igor Opaniuk 93dec5529c tests: anchor HIL fail-fast reset to the suite's first step
The abort sentinel that implements fail-fast across the serialized HIL
steps is cleared at the start of flash_full, which was the suite's
first step when the mechanism was introduced. The list and chipinfo
steps have since been added with higher priorities, so they run before
flash_full - and a failure in either sets the sentinel only for
flash_full to wipe it (it is also exempted from the fail-fast check)
and carry on flashing a board that just failed a sanity step.

Introduce a FIRST_STEP anchor: the sentinel reset runs there and
nowhere else, and no step is exempt from the fail-fast check - the
first step clears the sentinel before checking, so a set sentinel
always means a failure in this run. Keep FIRST_STEP in sync with the
priorities in tests/meson.build.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-08-25 09:32:07 +02:00
Igor Opaniuk 4ef8df7db2 tests: extend HIL test suite
Extend the hardware-in-the-loop suite with self-contained steps that
fit the existing round-trip model:

- list devices: enumerate the attached EDL device with the list verb
  and require a vid:pid line in the output, covering device discovery
  over real USB.

- chipinfo via Sahara: read the chip identity (serial number, HW ID
  and OEM PK hash) with the chipinfo verb. The step runs before the
  programmer upload because chip identity is only available while the
  device still speaks Sahara; the verb switches the device back to
  image-transfer mode on exit, so the subsequent flash still gets its
  Sahara HELLO. SKIPs when a programmer is already running.

- create-zip and flash: package a build from a contents.xml with the
  create-zip verb, then flash the produced zip, covering the zip
  writer and the zip flashing path end to end. Gated on
  QDL_HIL_CONTENTS.

- flash sparse build: flash a bundle that uses Android sparse images,
  covering the sparse decoding path against real storage. Gated on
  QDL_HIL_SPARSE.

- NAK on bad partition: a read of a nonexistent physical partition
  must fail, verifying that a device NAK is reported as an error
  instead of silently succeeding.

- sha256 by partition name: digest a partition addressed by its GPT
  name rather than by partition and sector numbers, covering GPT name
  resolution against the device.

- write chunked: rewrite the partition image with an overridden
  --out-chunk-size=16384, covering the chunked transfer path.

- verify write integrity: compare the device-computed partition
  digest against a local sha256 of the previously read-back and
  rewritten image, proving the read/write round trip is bit-exact.

- reset board: switch the final step to the new reset verb, covering
  the explicit device-reset path instead of relying on the implicit
  reset after a dummy 1-sector read.

The two gated steps SKIP when their environment variable is unset,
and every step SKIPs without hardware, so a plain meson test stays
green.

Example invocation against an attached EDL device:

  D=<path_to_build>
  QDL_HIL_BUILD=$D QDL_HIL_CONTENTS=$D/contents.xml \
    QDL_HIL_STORAGE=ufs meson test -C build --suite=hil

   1/18 hil - qdl:HIL list devices             OK          0.05s
   2/18 hil - qdl:HIL chipinfo via Sahara      OK          0.4s
   3/18 hil - qdl:HIL flash whole build        OK         29.03s
   4/18 hil - qdl:HIL create-zip and flash     OK         79.62s
   5/18 hil - qdl:HIL flash sparse build       SKIP        0.02s
  ...
  18/18 hil - qdl:HIL reset board              OK          3.68s

  Ok:                17
  Fail:              0
  Skipped:           1

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-07-16 17:15:34 -05:00
Igor Opaniuk 533d176269 tests: add a hardware-in-the-loop (HIL) test suite
Before tagging a release we want to exercise qdl against real
hardware - flashing a full build, reading partitions, skipblock,
sha256, erase and write - but there is no automated way to do that
today. Add a "hil" meson suite that drives the built qdl binary
against an attached EDL device, so a release can be validated with a
single command. It is a stop-gap that simplifies testing until we have
proper CI HIL coverage via LAVA.

Each step is its own test in the "hil" suite. The steps are stateful,
so they run serially and in order (is_parallel:false plus a descending
priority): flash the build, read the EFI partition / GPT / address
forms, re-flash with --skipblock=sha256, run the sha256 command, erase
and write the EFI partition back, and finally reboot. Every step runs
with --skip-reset except the reboot. The erase/write pair round-trips
the partition's own readback, so nothing is left wiped, and once one
step fails the rest of the suite stops.

The suite is opt-in: the build and storage type are passed via the
environment, and when unset every step exits 77 (SKIP), so a plain
"meson test" / CI run stays green without hardware.

Usage:

  $ QDL_HIL_BUILD=/path/to/build QDL_HIL_STORAGE=ufs \
        meson test -C build --suite hil -v

   1/10 hil - qdl:HIL flash whole build       OK   21.63s
   2/10 hil - qdl:HIL read EFI partition      OK   10.50s
   3/10 hil - qdl:HIL read GPT table          OK    2.47s
   4/10 hil - qdl:HIL read address P/S+L      OK    2.46s
   5/10 hil - qdl:HIL read address P/name     OK   11.17s
   6/10 hil - qdl:HIL flash skipblock sha256  OK   22.12s
   7/10 hil - qdl:HIL sha256 command          OK    2.47s
   8/10 hil - qdl:HIL erase EFI partition     OK    4.97s
   9/10 hil - qdl:HIL write EFI partition     OK   10.18s
  10/10 hil - qdl:HIL reboot board            OK    3.64s

  Ok: 10   Fail: 0

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-06-21 17:43:25 +02:00