summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/system.c2
-rw-r--r--zephyr/test/drivers/include/test_mocks.h3
-rw-r--r--zephyr/test/drivers/src/test_mocks.c4
3 files changed, 8 insertions, 1 deletions
diff --git a/common/system.c b/common/system.c
index 1e8bfe15a5..446b41dc8e 100644
--- a/common/system.c
+++ b/common/system.c
@@ -351,7 +351,7 @@ int system_jumped_to_this_image(void)
return jumped_to_image;
}
-int system_jumped_late(void)
+test_mockable int system_jumped_late(void)
{
return !(reset_flags & EC_RESET_FLAG_EFS) && jumped_to_image;
}
diff --git a/zephyr/test/drivers/include/test_mocks.h b/zephyr/test/drivers/include/test_mocks.h
index 3630df083f..f29cce97cc 100644
--- a/zephyr/test/drivers/include/test_mocks.h
+++ b/zephyr/test/drivers/include/test_mocks.h
@@ -102,3 +102,6 @@
DECLARE_FAKE_VALUE_FUNC(const void *, init_rom_map, const void *, int);
DECLARE_FAKE_VOID_FUNC(init_rom_unmap, const void *, int);
DECLARE_FAKE_VALUE_FUNC(int, init_rom_copy, int, int, int);
+
+/* Mocks for common/system.c */
+DECLARE_FAKE_VALUE_FUNC(int, system_jumped_late);
diff --git a/zephyr/test/drivers/src/test_mocks.c b/zephyr/test/drivers/src/test_mocks.c
index 126246f417..99629374dd 100644
--- a/zephyr/test/drivers/src/test_mocks.c
+++ b/zephyr/test/drivers/src/test_mocks.c
@@ -14,6 +14,9 @@ DEFINE_FAKE_VALUE_FUNC(const void *, init_rom_map, const void *, int);
DEFINE_FAKE_VOID_FUNC(init_rom_unmap, const void *, int);
DEFINE_FAKE_VALUE_FUNC(int, init_rom_copy, int, int, int);
+/* Mocks for common/system.c */
+DEFINE_FAKE_VALUE_FUNC(int, system_jumped_late);
+
/**
* @brief Reset all the fakes before each test.
*/
@@ -26,6 +29,7 @@ static void fff_reset_rule_before(const struct ztest_unit_test *test,
RESET_FAKE(init_rom_map);
RESET_FAKE(init_rom_unmap);
RESET_FAKE(init_rom_copy);
+ RESET_FAKE(system_jumped_late);
}
ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);