SIGN IN SIGN UP

tests: Tests for invalid input for parse_voltage()

The voltage unit suffix was matched with strncmp() against a fixed
prefix length, so any string beginning with a valid unit was accepted
and the trailing characters silently ignored. Inputs such as "village",
"2300village" or "milliv1950" were parsed as valid voltages instead of
being rejected.

Match the remaining string exactly with strcmp() so only "", "v", "mv"
or "milliv" are accepted and anything else is reported as garbage, and
add the failing inputs to parse_voltage_invalid().

Change-Id: Id4da32321dbc93642b885dd8dc33597efb67e1ec
Co-developed-by: Anastasia Klimchuk <aklm@flashrom.org>
Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org>
Co-developed-by: Abdelkader Boudih <coreboot@seuros.com>
Signed-off-by: Abdelkader Boudih <coreboot@seuros.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/93567
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
A
Anastasia Klimchuk committed
4b132df4ea03b39cfcd8a19279e5c2dcb768a33e
Parent: 54ed672
Committed by Anastasia Klimchuk <aklm@chromium.org> on 7/6/2026, 2:04:41 AM