aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2022-06-20 12:45:31 +1000
committerAnastasia Klimchuk <aklm@chromium.org>2022-06-28 22:05:08 +0000
commiteb63685e19ae073e88d209cec0bda2ee42628e4d (patch)
tree4a52c1bdf468698c8f9b0a5e1c5a7d60d8cac0b9
parentb554cdc91e7c30f6fa55316ecae902f1e11b3ab1 (diff)
downloadflashrom-eb63685e19ae073e88d209cec0bda2ee42628e4d.tar.gz
flashrom-eb63685e19ae073e88d209cec0bda2ee42628e4d.tar.bz2
flashrom-eb63685e19ae073e88d209cec0bda2ee42628e4d.zip
tests: Add dummyflasher unit tests for opaque programmer
In commit a721181a08 dummyflasher became an opaque master too, and now registers prog bus by default. This patch upgrades a dummy unit test which uses all buses as programmer param, and adds a unit test which covers specific use case for opaque programmer. BUG=b:233816068 TEST=ninja test Change-Id: I61a5333b61ea84fb91c7f8310d52b64213c62f83 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/65236 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Joursoir <chat@joursoir.net> Reviewed-by: Thomas Heijligen <src@posteo.de>
-rw-r--r--tests/lifecycle.c16
-rw-r--r--tests/tests.c1
-rw-r--r--tests/tests.h1
3 files changed, 17 insertions, 1 deletions
diff --git a/tests/lifecycle.c b/tests/lifecycle.c
index 4e191edd..614e4bf1 100644
--- a/tests/lifecycle.c
+++ b/tests/lifecycle.c
@@ -95,7 +95,7 @@ void dummy_basic_lifecycle_test_success(void **state)
.fallback_open_state = &dummy_fallback_open_state,
};
- run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=parallel+lpc+fwh+spi");
+ run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=parallel+lpc+fwh+spi+prog");
}
void dummy_probe_lifecycle_test_success(void **state)
@@ -111,9 +111,23 @@ void dummy_probe_lifecycle_test_success(void **state)
run_probe_lifecycle(state, &dummy_io, &programmer_dummy, "bus=spi,emulate=W25Q128FV", "W25Q128.V");
}
+void dummy_probe_variable_size_test_success(void **state)
+{
+ static struct io_mock_fallback_open_state dummy_fallback_open_state = {
+ .noc = 0,
+ .paths = { NULL },
+ };
+ const struct io_mock dummy_io = {
+ .fallback_open_state = &dummy_fallback_open_state,
+ };
+
+ run_probe_lifecycle(state, &dummy_io, &programmer_dummy, "size=8388608,emulate=VARIABLE_SIZE", "Opaque flash chip");
+}
+
#else
SKIP_TEST(dummy_basic_lifecycle_test_success)
SKIP_TEST(dummy_probe_lifecycle_test_success)
+ SKIP_TEST(dummy_probe_variable_size_test_success)
#endif /* CONFIG_DUMMY */
#if CONFIG_NICREALTEK == 1
diff --git a/tests/tests.c b/tests/tests.c
index ed833b73..c747488b 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -406,6 +406,7 @@ int main(void)
const struct CMUnitTest lifecycle_tests[] = {
cmocka_unit_test(dummy_basic_lifecycle_test_success),
cmocka_unit_test(dummy_probe_lifecycle_test_success),
+ cmocka_unit_test(dummy_probe_variable_size_test_success),
cmocka_unit_test(nicrealtek_basic_lifecycle_test_success),
cmocka_unit_test(raiden_debug_basic_lifecycle_test_success),
cmocka_unit_test(dediprog_basic_lifecycle_test_success),
diff --git a/tests/tests.h b/tests/tests.h
index 5ffc1456..aa5a0d1e 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -51,6 +51,7 @@ void run_probe_lifecycle(void **state, const struct io_mock *io,
void dummy_basic_lifecycle_test_success(void **state);
void dummy_probe_lifecycle_test_success(void **state);
+void dummy_probe_variable_size_test_success(void **state);
void nicrealtek_basic_lifecycle_test_success(void **state);
void raiden_debug_basic_lifecycle_test_success(void **state);
void dediprog_basic_lifecycle_test_success(void **state);