1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-29 16:03:47 +02:00

tests/linux_spi: Validate params file path and flags

Add path and flags validation for '/dev/null' to open operation.

BUG=b:217629892,b:215255210
TEST=`ninja test`.

Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Co-Author: Daniel Campello <campello@chromium.org>
Signed-off-by: Daniel Campello <campello@chromium.org>
Change-Id: If5d24c65f291c53a35509fea5d2f5b3fdb51c306
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62319
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Edward O'Callaghan 2022-02-24 13:59:05 +11:00 committed by Edward O'Callaghan
parent 32aa9059bc
commit 950037a724

View File

@ -355,9 +355,15 @@ void linux_spi_probe_lifecycle_test_success(void **state)
* Specifically, it is reading the buffer size from sysfs. * Specifically, it is reading the buffer size from sysfs.
*/ */
#if CONFIG_LINUX_SPI == 1 #if CONFIG_LINUX_SPI == 1
static struct io_mock_fallback_open_state linux_spi_fallback_open_state = {
.noc = 0,
.paths = { "/dev/null", NULL },
.flags = { O_RDWR },
};
const struct io_mock linux_spi_io = { const struct io_mock linux_spi_io = {
.fgets = linux_spi_fgets, .fgets = linux_spi_fgets,
.ioctl = linux_spi_ioctl, .ioctl = linux_spi_ioctl,
.fallback_open_state = &linux_spi_fallback_open_state,
}; };
io_mock_register(&linux_spi_io); io_mock_register(&linux_spi_io);