1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-03 15:03:22 +02:00

libflashrom: Add API to get the list of supported programmers

There were no options available to obtain the list of programmers.
The implementation is based on flashrom_supported_flash_chips.
Arrays of constant strings are returned, and the array must be
freed using flashrom_data_free.

Testing: Both unit tests and CLI tools serve as libflashrom clients.
    All unit tests run successfully.

Change-Id: Ib5275b742b849183b1fe701900040fee369a1d78
Signed-off-by: Dmitry Zhadinets <dzhadinets@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/86921
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
Dmitry Zhadinets
2025-03-19 01:58:32 -04:00
committed by Anastasia Klimchuk
parent 6ff43de0e0
commit bc029c2f45
6 changed files with 42 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/*
* This file is part of the flashrom project.
*
* Copyright 2025 Dmitry Zhadinets (dzhadinets@gmail.com)
* Copyright 2025 Dmitry Zhadinets <dzhadinets@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -96,4 +96,21 @@ void flashrom_set_log_level_test_success(void **state)
/* check that callback is called after the change*/
assert_int_equal(print(FLASHROM_MSG_INFO, "1%s", "\n"), 0x666 + (int)FLASHROM_MSG_INFO);
flashrom_set_log_callback(NULL);
}
}
void flashrom_supported_programmers_test_success(void **state)
{
(void) state; /* unused */
const char **array = flashrom_supported_programmers();
const char **ptr = array;
assert_non_null(array);
do {
assert_non_null(*ptr);
}while (*(++ptr));
flashrom_data_free(array);
assert_int_not_equal(ptr - array, 0);
}