summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2022-02-24 13:59:05 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-04-10 11:17:38 +0000
commit950037a7243e3fd8e75d4f956e0a4a57717a1cff (patch)
tree564a082a44dcda4c83482c0550efea82e9241d89 /tests
parent32aa9059bc6b5da05b7bb0288758e22fd9d18901 (diff)
downloadflashrom-950037a7243e3fd8e75d4f956e0a4a57717a1cff.tar.gz
flashrom-950037a7243e3fd8e75d4f956e0a4a57717a1cff.tar.bz2
flashrom-950037a7243e3fd8e75d4f956e0a4a57717a1cff.zip
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/lifecycle.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/lifecycle.c b/tests/lifecycle.c
index 5566b3bcf..1a8f21895 100644
--- a/tests/lifecycle.c
+++ b/tests/lifecycle.c
@@ -355,9 +355,15 @@ void linux_spi_probe_lifecycle_test_success(void **state)
* Specifically, it is reading the buffer size from sysfs.
*/
#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 = {
.fgets = linux_spi_fgets,
.ioctl = linux_spi_ioctl,
+ .fallback_open_state = &linux_spi_fallback_open_state,
};
io_mock_register(&linux_spi_io);