1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-10-14 06:20:25 +02:00
Files
flashrom/tests/mediatek_i2c_spi.c
Anastasia Klimchuk 7d6a243779 tests: Use SPDX in headers
Change-Id: I3a8a8e59cbed871e0ecf953e547de56c0656e112
Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/89361
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-by: Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-10-11 06:02:44 +00:00

45 lines
1.2 KiB
C

/*
* This file is part of the flashrom project.
*
* SPDX-License-Identifier: GPL-2.0-only
* SPDX-FileCopyrightText: 2022 Google LLC
*/
#include "lifecycle.h"
#if CONFIG_MEDIATEK_I2C_SPI == 1
void mediatek_i2c_spi_basic_lifecycle_test_success(void **state)
{
struct io_mock_fallback_open_state mediatek_i2c_spi_fallback_open_state = {
.noc = 0,
.paths = { "/dev/i2c-254", NULL },
.flags = { O_RDWR },
};
const struct io_mock mediatek_i2c_spi_io = {
.fallback_open_state = &mediatek_i2c_spi_fallback_open_state,
};
run_basic_lifecycle(state, &mediatek_i2c_spi_io, &programmer_mediatek_i2c_spi, "bus=254,allow_brick=yes");
}
void mediatek_i2c_no_allow_brick_test_success(void **state)
{
struct io_mock_fallback_open_state mediatek_i2c_spi_fallback_open_state = {
.noc = 0,
.paths = { "/dev/i2c-254", NULL },
.flags = { O_RDWR },
};
const struct io_mock mediatek_i2c_spi_io = {
.fallback_open_state = &mediatek_i2c_spi_fallback_open_state,
};
run_init_error_path(state, &mediatek_i2c_spi_io, &programmer_mediatek_i2c_spi,
"bus=254", SPI_GENERIC_ERROR);
}
#else
SKIP_TEST(mediatek_i2c_spi_basic_lifecycle_test_success)
SKIP_TEST(mediatek_i2c_no_allow_brick_test_success)
#endif /* CONFIG_MEDIATEK_I2C_SPI */